Public Member Functions | |
bool | box_box_intersect (const LVector3f &extents0, const LPoint3f ¢er0, const LMatrix3f &rotation0, const LVector3f &extents1, const LPoint3f ¢er1, const LMatrix3f &rotation1, bool full_test) |
Boolean intersection test between two OBBs. More... | |
bool | box_contains_point (const PhysxBox &box, const LPoint3f &p) |
Test if an oriented box contains a point. More... | |
PhysxBox | compute_box_around_capsule (const PhysxCapsule &capsule) |
Compute a box which encloses a capsule. More... | |
float | compute_box_density (const LVector3f &extents, float mass) |
Computes density of a homogeneous box according to box mass. More... | |
LVector3f | compute_box_inertia_tensor (float mass, float xlength, float ylength, float zlength) |
Computes diagonalized inertia tensor for a box. More... | |
float | compute_box_mass (const LVector3f &extents, float density) |
Computes mass of a homogeneous box according to box density. More... | |
LVector3f | compute_box_world_edge_normal (const PhysxBox &box, unsigned int edge_index) |
Compute and edge normals for an oriented box. More... | |
PhysxCapsule | compute_capsule_around_box (const PhysxBox &box) |
Compute a capsule which encloses a box. More... | |
float | compute_cone_density (float radius, float length, float mass) |
Computes density of a homogeneous cone according to cone mass. More... | |
float | compute_cone_mass (float radius, float length, float density) |
Computes mass of a homogeneous cone according to cone density. More... | |
float | compute_cylinder_density (float radius, float length, float mass) |
Computes density of a homogeneous cylinder according to cylinder mass. More... | |
float | compute_cylinder_mass (float radius, float length, float density) |
Computes mass of a homogeneous cylinder according to cylinder density. More... | |
float | compute_distance_squared (const PhysxRay &ray, const LPoint3f &point) |
Compute the distance squared from a point to a ray. More... | |
float | compute_ellipsoid_density (const LVector3f &extents, float mass) |
Computes density of a homogeneous ellipsoid according to ellipsoid mass. More... | |
float | compute_ellipsoid_mass (const LVector3f &extents, float density) |
Computes mass of a homogeneous ellipsoid according to ellipsoid density. More... | |
float | compute_sphere_density (float radius, float mass) |
Computes density of a homogeneous sphere according to sphere mass. More... | |
LVector3f | compute_sphere_inertia_tensor (float mass, float radius, bool hollow) |
Computes diagonalized inertia tensor for a sphere. More... | |
float | compute_sphere_mass (float radius, float density) |
Computes mass of a homogeneous sphere according to sphere density. More... | |
float | compute_square_distance (const PhysxSegment &seg, const LPoint3f &point) |
Compute the distance squared from a point to a line segment. More... | |
PhysxBox | create_box (const PhysxBounds3 &aabb, const LMatrix4f &mat) |
Create an oriented box from an axis aligned box and a transformation. More... | |
LMatrix3f | find_rotation_matrix (const LVector3f &x, const LVector3f &b) |
Computes a rotation matrix M so that: M * x = b (x and b are unit vectors). More... | |
int | int_ceil (const float &f) |
Convert a floating point number to an integer. More... | |
int | int_chop (const float &f) |
Convert a floating point number to an integer. More... | |
int | int_floor (const float &f) |
Convert a floating point number to an integer. More... | |
bool | is_box_a_inside_box_b (const PhysxBox &a, const PhysxBox &b) |
Test if box A is inside another box B. More... | |
PhysxSphere | merge_spheres (const PhysxSphere &sphere0, const PhysxSphere &sphere1) |
Compute an overall bounding sphere for a pair of spheres. More... | |
void | normal_to_tangents (const LVector3f &n, LVector3f &t1, LVector3f &t2) |
Get the tangent vectors associated with a normal. More... | |
float | point_obb_sqr_dist (const LPoint3f &point, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot, LPoint3f ¶ms) |
Point-vs-OBB distance computation. More... | |
bool | ray_aabb_intersect (const LPoint3f &min, const LPoint3f &max, const LPoint3f &origin, const LVector3f &dir, LPoint3f &coord) |
Ray-AABB intersection test. More... | |
unsigned int | ray_capsule_intersect (const LPoint3f &origin, const LVector3f &dir, const PhysxCapsule &capsule) |
Ray-capsule intersection test. More... | |
bool | ray_obb_intersect (const PhysxRay &ray, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot) |
Boolean ray-OBB intersection test. More... | |
bool | ray_plane_intersect (const PhysxRay &ray, const PhysxPlane &plane, LPoint3f &point_on_plane) |
Ray-plane intersection test. More... | |
bool | ray_sphere_intersect (const LPoint3f &origin, const LVector3f &dir, float length, const LPoint3f ¢er, float radius, LPoint3f &hit_pos) |
Ray-sphere intersection test. More... | |
bool | ray_tri_intersect (const LPoint3f &orig, const LVector3f &dir, const LPoint3f &vert0, const LPoint3f &vert1, const LPoint3f &vert2, LVector3f &hit, bool cull) |
Ray-triangle intersection test. More... | |
bool | segment_aabb_intersect (const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &min, const LPoint3f &max) |
Boolean segment-AABB intersection test. More... | |
bool | segment_box_intersect (const LPoint3f &p1, const LPoint3f &p2, const LPoint3f &bbox_min, const LPoint3f &bbox_max, LPoint3f &intercept) |
Segment-AABB intersection test. More... | |
bool | segment_obb_intersect (const LPoint3f &p0, const LPoint3f &p1, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot) |
Boolean segment-OBB intersection test. More... | |
void | set_fpu_exceptions (bool b) |
Set FPU precision. More... | |
void | set_fpu_precision24 () |
Set FPU precision. More... | |
void | set_fpu_precision53 () |
Set FPU precision. More... | |
void | set_fpu_precision64 () |
Set FPU precision. More... | |
void | set_fpu_rounding_chop () |
Set FPU precision. More... | |
void | set_fpu_rounding_down () |
Set FPU rounding mode. More... | |
void | set_fpu_rounding_near () |
Set FPU rounding mode. More... | |
void | set_fpu_rounding_up () |
Set FPU rounding mode. More... | |
bool | sweep_box_box (const PhysxBox &box0, const PhysxBox &box1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) |
Box-vs-box sweep test. More... | |
bool | sweep_box_capsule (const PhysxBox &box, const PhysxCapsule &lss, const LVector3f &dir, float length, LVector3f &normal) |
Box-vs-capsule sweep test. More... | |
bool | sweep_box_sphere (const PhysxBox &box, const PhysxSphere &sphere, const LVector3f &dir, float length, LVector3f &normal) |
Box-vs-sphere sweep test. More... | |
bool | sweep_capsule_capsule (const PhysxCapsule &lss0, const PhysxCapsule &lss1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) |
Capsule-vs-capsule sweep test. More... | |
bool | sweep_sphere_capsule (const PhysxSphere &sphere, const PhysxCapsule &lss, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) |
Sphere-vs-capsule sweep test. More... | |
bool | swept_spheres_intersect (const PhysxSphere &sphere0, const LVector3f &velocity0, const PhysxSphere &sphere1, const LVector3f &velocity1) |
Sphere-sphere sweep test. More... | |
bool | tri_box_intersect (const LPoint3f &vertex0, const LPoint3f &vertex1, const LPoint3f &vertex2, const LPoint3f ¢er, const LVector3f &extents) |
Boolean intersection test between a triangle and a box. More... | |
Public Attributes | |
NxUtilLib * | _ptr |
Definition at line 33 of file physxUtilLib.h.
bool PhysxUtilLib::box_box_intersect | ( | const LVector3f & | extents0, |
const LPoint3f & | center0, | ||
const LMatrix3f & | rotation0, | ||
const LVector3f & | extents1, | ||
const LPoint3f & | center1, | ||
const LMatrix3f & | rotation1, | ||
bool | full_test | ||
) |
Boolean intersection test between two OBBs.
Uses the separating axis theorem. Disabling 'full_test' only performs 6 axis tests out of 15.
[in] | extents0 |
Definition at line 422 of file physxUtilLib.cxx.
bool PhysxUtilLib::box_contains_point | ( | const PhysxBox & | box, |
const LPoint3f & | p | ||
) |
Test if an oriented box contains a point.
[in] | box |
Definition at line 129 of file physxUtilLib.cxx.
References PhysxManager::point3_to_nxVec3().
PhysxBox PhysxUtilLib::compute_box_around_capsule | ( | const PhysxCapsule & | capsule | ) |
Compute a box which encloses a capsule.
[in] | capsule |
Definition at line 196 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_box_density | ( | const LVector3f & | extents, |
float | mass | ||
) |
Computes density of a homogeneous box according to box mass.
[in] | radius |
Definition at line 316 of file physxUtilLib.cxx.
References PhysxManager::vec3_to_nxVec3().
LVector3f PhysxUtilLib::compute_box_inertia_tensor | ( | float | mass, |
float | xlength, | ||
float | ylength, | ||
float | zlength | ||
) |
Computes diagonalized inertia tensor for a box.
[in] | mass |
Definition at line 394 of file physxUtilLib.cxx.
References PhysxManager::nxVec3_to_vec3().
float PhysxUtilLib::compute_box_mass | ( | const LVector3f & | extents, |
float | density | ||
) |
Computes mass of a homogeneous box according to box density.
[in] | radius |
Definition at line 305 of file physxUtilLib.cxx.
References PhysxManager::vec3_to_nxVec3().
LVector3f PhysxUtilLib::compute_box_world_edge_normal | ( | const PhysxBox & | box, |
unsigned int | edge_index | ||
) |
Compute and edge normals for an oriented box.
This is an averaged normal, from the two faces sharing the edge. The edge index should be from 0 to 11 (i.e. a box has 12 edges).
[in] | box |
Definition at line 155 of file physxUtilLib.cxx.
PhysxCapsule PhysxUtilLib::compute_capsule_around_box | ( | const PhysxBox & | box | ) |
Compute a capsule which encloses a box.
[in] | box |
Definition at line 171 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_cone_density | ( | float | radius, |
float | length, | ||
float | mass | ||
) |
Computes density of a homogeneous cone according to cone mass.
[in] | radius |
Definition at line 382 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_cone_mass | ( | float | radius, |
float | length, | ||
float | density | ||
) |
Computes mass of a homogeneous cone according to cone density.
[in] | radius |
Definition at line 371 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_cylinder_density | ( | float | radius, |
float | length, | ||
float | mass | ||
) |
Computes density of a homogeneous cylinder according to cylinder mass.
[in] | radius |
Definition at line 360 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_cylinder_mass | ( | float | radius, |
float | length, | ||
float | density | ||
) |
Computes mass of a homogeneous cylinder according to cylinder density.
[in] | radius |
Definition at line 349 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_distance_squared | ( | const PhysxRay & | ray, |
const LPoint3f & | point | ||
) |
Compute the distance squared from a point to a ray.
[in] | ray |
Definition at line 209 of file physxUtilLib.cxx.
References PhysxManager::point3_to_nxVec3().
float PhysxUtilLib::compute_ellipsoid_density | ( | const LVector3f & | extents, |
float | mass | ||
) |
Computes density of a homogeneous ellipsoid according to ellipsoid mass.
[in] | radius |
Definition at line 338 of file physxUtilLib.cxx.
References PhysxManager::vec3_to_nxVec3().
float PhysxUtilLib::compute_ellipsoid_mass | ( | const LVector3f & | extents, |
float | density | ||
) |
Computes mass of a homogeneous ellipsoid according to ellipsoid density.
[in] | radius |
Definition at line 327 of file physxUtilLib.cxx.
References PhysxManager::vec3_to_nxVec3().
float PhysxUtilLib::compute_sphere_density | ( | float | radius, |
float | mass | ||
) |
Computes density of a homogeneous sphere according to sphere mass.
[in] | radius |
Definition at line 294 of file physxUtilLib.cxx.
LVector3f PhysxUtilLib::compute_sphere_inertia_tensor | ( | float | mass, |
float | radius, | ||
bool | hollow | ||
) |
Computes diagonalized inertia tensor for a sphere.
[in] | mass |
Definition at line 407 of file physxUtilLib.cxx.
References PhysxManager::nxVec3_to_vec3().
float PhysxUtilLib::compute_sphere_mass | ( | float | radius, |
float | density | ||
) |
Computes mass of a homogeneous sphere according to sphere density.
[in] | radius |
Definition at line 283 of file physxUtilLib.cxx.
float PhysxUtilLib::compute_square_distance | ( | const PhysxSegment & | seg, |
const LPoint3f & | point | ||
) |
Compute the distance squared from a point to a line segment.
[in] | seg |
Definition at line 221 of file physxUtilLib.cxx.
References PhysxManager::point3_to_nxVec3().
PhysxBox PhysxUtilLib::create_box | ( | const PhysxBounds3 & | aabb, |
const LMatrix4f & | mat | ||
) |
Create an oriented box from an axis aligned box and a transformation.
[in] | aabb |
Definition at line 140 of file physxUtilLib.cxx.
LMatrix3f PhysxUtilLib::find_rotation_matrix | ( | const LVector3f & | x, |
const LVector3f & | b | ||
) |
Computes a rotation matrix M so that: M * x = b (x and b are unit vectors).
[in] | x |
Definition at line 268 of file physxUtilLib.cxx.
References PhysxManager::nxMat33_to_mat3(), and PhysxManager::vec3_to_nxVec3().
int PhysxUtilLib::int_ceil | ( | const float & | f | ) |
Convert a floating point number to an integer.
Definition at line 100 of file physxUtilLib.cxx.
int PhysxUtilLib::int_chop | ( | const float & | f | ) |
Convert a floating point number to an integer.
Definition at line 109 of file physxUtilLib.cxx.
int PhysxUtilLib::int_floor | ( | const float & | f | ) |
Convert a floating point number to an integer.
Definition at line 118 of file physxUtilLib.cxx.
Test if box A is inside another box B.
Returns TRUE if box A is inside box B.
[in] | a |
Definition at line 185 of file physxUtilLib.cxx.
PhysxSphere PhysxUtilLib::merge_spheres | ( | const PhysxSphere & | sphere0, |
const PhysxSphere & | sphere1 | ||
) |
Compute an overall bounding sphere for a pair of spheres.
[in] | sphere0 |
Definition at line 233 of file physxUtilLib.cxx.
void PhysxUtilLib::normal_to_tangents | ( | const LVector3f & | n, |
LVector3f & | t1, | ||
LVector3f & | t2 | ||
) |
Get the tangent vectors associated with a normal.
[in] | n |
Definition at line 246 of file physxUtilLib.cxx.
References PhysxManager::vec3_to_nxVec3().
float PhysxUtilLib::point_obb_sqr_dist | ( | const LPoint3f & | point, |
const LPoint3f & | center, | ||
const LVector3f & | extents, | ||
const LMatrix3f & | rot, | ||
LPoint3f & | params | ||
) |
Point-vs-OBB distance computation.
Returns distance between a point and an OBB.
[in] | point | The point |
[in] | center | OBB center |
[in] | extents | OBB extents |
[in] | rot | OBB rotation |
[out] | params | Closest point on the box, in box space |
Definition at line 840 of file physxUtilLib.cxx.
bool PhysxUtilLib::ray_aabb_intersect | ( | const LPoint3f & | min, |
const LPoint3f & | max, | ||
const LPoint3f & | origin, | ||
const LVector3f & | dir, | ||
LPoint3f & | coord | ||
) |
Ray-AABB intersection test.
Also computes intersection point.
[in] | min |
Definition at line 544 of file physxUtilLib.cxx.
unsigned int PhysxUtilLib::ray_capsule_intersect | ( | const LPoint3f & | origin, |
const LVector3f & | dir, | ||
const PhysxCapsule & | capsule | ||
) |
Ray-capsule intersection test.
Returns number of intersection points (0,1 or 2) along the ray.
[in] | origin |
Definition at line 633 of file physxUtilLib.cxx.
bool PhysxUtilLib::ray_obb_intersect | ( | const PhysxRay & | ray, |
const LPoint3f & | center, | ||
const LVector3f & | extents, | ||
const LMatrix3f & | rot | ||
) |
Boolean ray-OBB intersection test.
Based on separating axis theorem.
[in] | ray |
Definition at line 613 of file physxUtilLib.cxx.
bool PhysxUtilLib::ray_plane_intersect | ( | const PhysxRay & | ray, |
const PhysxPlane & | plane, | ||
LPoint3f & | point_on_plane | ||
) |
bool PhysxUtilLib::ray_sphere_intersect | ( | const LPoint3f & | origin, |
const LVector3f & | dir, | ||
float | length, | ||
const LPoint3f & | center, | ||
float | radius, | ||
LPoint3f & | hit_pos | ||
) |
Ray-sphere intersection test.
Returns true if the ray intersects the sphere, and the impact point if needed.
[in] | origin |
Definition at line 488 of file physxUtilLib.cxx.
bool PhysxUtilLib::ray_tri_intersect | ( | const LPoint3f & | orig, |
const LVector3f & | dir, | ||
const LPoint3f & | vert0, | ||
const LPoint3f & | vert1, | ||
const LPoint3f & | vert2, | ||
LVector3f & | hit, | ||
bool | cull | ||
) |
Ray-triangle intersection test.
Returns impact distance (t) as well as barycentric coordinates (u,v) of impact point. The test performs back face culling or not according to 'cull'.
[in] | orig |
Definition at line 675 of file physxUtilLib.cxx.
bool PhysxUtilLib::segment_aabb_intersect | ( | const LPoint3f & | p0, |
const LPoint3f & | p1, | ||
const LPoint3f & | min, | ||
const LPoint3f & | max | ||
) |
Boolean segment-AABB intersection test.
Based on separating axis theorem.
[in] | p0 |
Definition at line 593 of file physxUtilLib.cxx.
bool PhysxUtilLib::segment_box_intersect | ( | const LPoint3f & | p1, |
const LPoint3f & | p2, | ||
const LPoint3f & | bbox_min, | ||
const LPoint3f & | bbox_max, | ||
LPoint3f & | intercept | ||
) |
Segment-AABB intersection test.
Also computes intersection point.
[in] | p1 |
Definition at line 517 of file physxUtilLib.cxx.
bool PhysxUtilLib::segment_obb_intersect | ( | const LPoint3f & | p0, |
const LPoint3f & | p1, | ||
const LPoint3f & | center, | ||
const LVector3f & | extents, | ||
const LMatrix3f & | rot | ||
) |
Boolean segment-OBB intersection test.
Based on separating axis theorem.
[in] | p0 |
Definition at line 571 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_exceptions | ( | bool | b | ) |
Set FPU precision.
Definition at line 28 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_precision24 | ( | ) |
Set FPU precision.
Definition at line 37 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_precision53 | ( | ) |
Set FPU precision.
Definition at line 46 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_precision64 | ( | ) |
Set FPU precision.
Definition at line 55 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_rounding_chop | ( | ) |
Set FPU precision.
Definition at line 64 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_rounding_down | ( | ) |
Set FPU rounding mode.
Definition at line 73 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_rounding_near | ( | ) |
Set FPU rounding mode.
Definition at line 82 of file physxUtilLib.cxx.
void PhysxUtilLib::set_fpu_rounding_up | ( | ) |
Set FPU rounding mode.
Definition at line 91 of file physxUtilLib.cxx.
bool PhysxUtilLib::sweep_box_box | ( | const PhysxBox & | box0, |
const PhysxBox & | box1, | ||
const LVector3f & | dir, | ||
float | length, | ||
LPoint3f & | ip, | ||
LVector3f & | normal | ||
) |
Box-vs-box sweep test.
Sweeps a box against a box, returns true if box hit the other box. Also returns contact information.
[in] | box0 |
Definition at line 813 of file physxUtilLib.cxx.
bool PhysxUtilLib::sweep_box_capsule | ( | const PhysxBox & | box, |
const PhysxCapsule & | lss, | ||
const LVector3f & | dir, | ||
float | length, | ||
LVector3f & | normal | ||
) |
Box-vs-capsule sweep test.
Sweeps a box against a capsule, returns true if box hit the capsule. Also returns contact information.
[in] | box | Box |
[in] | lss | Capsule |
[in] | dir | Unit-length sweep direction |
[in] | length | Length of sweep |
[out] | normal | Normal at impact point |
Definition at line 709 of file physxUtilLib.cxx.
bool PhysxUtilLib::sweep_box_sphere | ( | const PhysxBox & | box, |
const PhysxSphere & | sphere, | ||
const LVector3f & | dir, | ||
float | length, | ||
LVector3f & | normal | ||
) |
Box-vs-sphere sweep test.
Sweeps a box against a sphere, returns true if box hit the sphere. Also returns contact information.
[in] | box | Box |
[in] | sphere | Sphere |
[in] | dir | Unit-length sweep direction |
[in] | length | Length of sweep |
[out] | normal | Normal at impact point |
Definition at line 734 of file physxUtilLib.cxx.
bool PhysxUtilLib::sweep_capsule_capsule | ( | const PhysxCapsule & | lss0, |
const PhysxCapsule & | lss1, | ||
const LVector3f & | dir, | ||
float | length, | ||
LPoint3f & | ip, | ||
LVector3f & | normal | ||
) |
Capsule-vs-capsule sweep test.
Sweeps a capsule against a capsule, returns true if capsule hit the other capsule. Also returns contact information.
[in] | lss0 |
Definition at line 759 of file physxUtilLib.cxx.
bool PhysxUtilLib::sweep_sphere_capsule | ( | const PhysxSphere & | sphere, |
const PhysxCapsule & | lss, | ||
const LVector3f & | dir, | ||
float | length, | ||
LPoint3f & | ip, | ||
LVector3f & | normal | ||
) |
Sphere-vs-capsule sweep test.
Sweeps a sphere against a capsule, returns true if sphere hit the capsule. Also returns contact information.
[in] | sphere |
Definition at line 786 of file physxUtilLib.cxx.
bool PhysxUtilLib::swept_spheres_intersect | ( | const PhysxSphere & | sphere0, |
const LVector3f & | velocity0, | ||
const PhysxSphere & | sphere1, | ||
const LVector3f & | velocity1 | ||
) |
Sphere-sphere sweep test.
Returns true if spheres intersect during their linear motion along provided velocity vectors.
[in] | sphere0 |
Definition at line 654 of file physxUtilLib.cxx.
bool PhysxUtilLib::tri_box_intersect | ( | const LPoint3f & | vertex0, |
const LPoint3f & | vertex1, | ||
const LPoint3f & | vertex2, | ||
const LPoint3f & | center, | ||
const LVector3f & | extents | ||
) |
Boolean intersection test between a triangle and a box.
[in] | vertex0 |
Definition at line 447 of file physxUtilLib.cxx.