greggman / wgpu-matrix

Fast WebGPU 3d math library
https://wgpu-matrix.org
MIT License
298 stars 13 forks source link

open to adding vec[2|3].rotate(point, origin, rads, out) ? #23

Closed mreinstein closed 6 months ago

mreinstein commented 7 months ago

@greggman gl-matrix has a way to rotate a 2d point by another point representing the origin. Would you be open to a PR for this?

greggman commented 7 months ago

Sounds good to me. Is a similar function needed for vec3 and/or vec4?

mreinstein commented 7 months ago

vec3, most definitely.

greggman commented 7 months ago

I'd also love to see quaternions added but I have almost no experience with them 😅 so I've avoided adding them.

mreinstein commented 7 months ago

yeah I've been working exclusively in 2D land for quite some time, so I hear you there.

I might take a peek at gl-matrix and look at it's implementation because I don't think internally it uses any matrices, and it should port over without (any?) modification, save for the optional out parameter being at the end.

greggman commented 7 months ago

it should port over without (any?) modification

gl-matrix is fn(out, arg, arg, arg) wgpu-matrix is fn(arg, arg, arg, out?)

But otherwise, yea, if it's not using matrices then it should work.