Goal: Check if a ray intersects a capsule.
- Ray is defined by a point and a unit vector (Origin, Direction)
- Capsule is defined by two points and a radius (A, B, r)
- If there is an intersection, we must calculate the actual points of impact as well as the normals at those points
Goal: Calculate the sin/cos of an arbitrary angle.
- Should be faster than CRT’s sin/cos and faster than FPU’s fsin/fcos
- The error should be kept to a minimum compared to the above functions
- Double precision is required
- Function should be in the form: double func(double), ie. no xmm regs passed to the function, result should be returned on the FPU stack and it should calculate only 1 angle at a time
For the rest of the post we’ll be talking about sin(). Calculating cos(), or even sincos() should be easily derived from the code below. The required changes will be described at the end of the post.
Goal: Classify whether a batch of AABBs are completely inside, completely outside or intersecting a frustum (6 planes).
- AABBs are defined as (Center, Extent) pairs.
- All vectors are Vector3f’s
Goal: Calculate the Axis Aligned Bounding Box of a point list.
- Vertices as Vector3f’s
- (Optional) Vertex list should be 16-byte aligned
Goal: Multiply a batch of Vector3f’s with the same 4×4 matrix.
- ‘src’ and ‘dst’ arrays shouldn’t point to the same memory location
- All pointers should be 16-byte aligned (see below for details on array sizes)
- Treat Vector3f’s as positions (w = 1.0)
- Matrix is column major