Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a format function to vector and matrix structs #1240

Open
hordurj opened this issue Aug 7, 2024 · 0 comments
Open

Add a format function to vector and matrix structs #1240

hordurj opened this issue Aug 7, 2024 · 0 comments
Labels
feedback needs-triage Issues that need triaging

Comments

@hordurj
Copy link
Contributor

hordurj commented Aug 7, 2024

It would be convenient to include a format function in Vec and Mat structs (and other similar types) for easy printing of these types (std.debug.print, allocPrint, etc).

Default for Vec2 is:
math.vec.Vec(2,f32){ .v = { 1e0, 2e0 } }

A more compact Vec2 output:
[1.0 2.1]
or
1.0, 2.1
or
1.0 2.1

Mat2x2:
[[1.0, 0.0], [0.0, 1.0]]
or
[1.0 0.0] [0.0, 1.0]

Or something along these lines.

https://ziglang.org/documentation/master/std/#std.fmt.Formatter

@hordurj hordurj added feedback needs-triage Issues that need triaging labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback needs-triage Issues that need triaging
Projects
None yet
Development

No branches or pull requests

1 participant