Conversation
IQuick143
left a comment
There was a problem hiding this comment.
Overall the code is good, although I haven't looked through the ellipse code and the tests yet.
Co-Authored-By: IQuick 143 <IQuick143cz@gmail.com>
| let y = signum.y * b * b / (b * b + m * m * a * a).sqrt(); | ||
| let x = signum.x * a * (1. - y * y / b / b).sqrt(); | ||
| rotation * Vec3::new(x, y, 0.) |
There was a problem hiding this comment.
Possible division by zero if ellipse is degenerate?
NthTensor
left a comment
There was a problem hiding this comment.
Very cool! Everything looks as I would expect. Finding the Ellipse code a little hard to follow without comments, but think I get the gist.
Haven't visually inspected yet, will try to later. Approving.
| } | ||
| } | ||
|
|
||
| fn bounding_sphere<T: Primitive2d + Bounded2d>( |
There was a problem hiding this comment.
I think this should probably be renamed to something more descriptive which doesn't share a name with the Bounded3d method. Maybe bounding_sphere_from_base or similar?
| fn aabb_3d(&self, translation: Vec3, rotation: Quat) -> Aabb3d { | ||
| let Vec2 { x: a, y: b } = self.base_shape.half_size; | ||
| let normal = rotation * Vec3::Z; | ||
| let conjugate_rot = rotation.conjugate(); |
There was a problem hiding this comment.
I think this is a little more readable:
| let conjugate_rot = rotation.conjugate(); | |
| let inverse_rot = rotation.conjugate(); |
Objective
Bounded3dfor someExtrusion<T>Aabb3ds andBoundingSpheres for any extrusion with aBounded2dbase shapeSolution
Bounded3dfor all 2Dbevy_mathprimitives with the exception ofPlane2d. As far as I can see,Plane2dis pretty much a line? and I think it is very unintuitive to extrude a plane and get a plane as a result.extrusion_bounding_boxandextrusion_bounding_sphere. These are not always used internally since there are faster methods for specific extrusions. Both of them produce the optimal result within precision limits though.Testing