30 _ptr->NxSetFPUExceptions(b);
39 _ptr->NxSetFPUPrecision24();
48 _ptr->NxSetFPUPrecision53();
57 _ptr->NxSetFPUPrecision64();
66 _ptr->NxSetFPURoundingChop();
75 _ptr->NxSetFPURoundingDown();
84 _ptr->NxSetFPURoundingNear();
93 _ptr->NxSetFPURoundingUp();
102 return _ptr->NxIntCeil(f);
111 return _ptr->NxIntChop(f);
120 return _ptr->NxIntFloor(f);
159 nassertr(edge_index < 12, LVector3f::zero());
161 _ptr->NxComputeBoxWorldEdgeNormal(box._box, edge_index, nNormal);
174 _ptr->NxComputeCapsuleAroundBox(box._box, capsule._capsule);
187 return _ptr->NxIsBoxAInsideBoxB(a._box, b._box);
199 _ptr->NxComputeBoxAroundCapsule(capsule._capsule, box._box);
236 _ptr->NxMergeSpheres(merged._sphere, sphere0._sphere, sphere1._sphere);
285 return _ptr->NxComputeSphereMass(radius, density);
296 return _ptr->NxComputeSphereDensity(radius, mass);
351 return _ptr->NxComputeCylinderMass(radius, length, density);
362 return _ptr->NxComputeCylinderDensity(radius, length, mass);
373 return _ptr->NxComputeConeMass(radius, length, density);
384 return _ptr->NxComputeConeDensity(radius, length, mass);
397 _ptr->NxComputeBoxInertiaTensor(tensor, mass, xlength, ylength, zlength);
410 _ptr->NxComputeSphereInertiaTensor(tensor, mass, radius, hollow);
422box_box_intersect(
const LVector3f &extents0,
const LPoint3f ¢er0,
const LMatrix3f &rotation0,
const LVector3f &extents1,
const LPoint3f ¢er1,
const LMatrix3f &rotation1,
bool full_test) {
424 nassertr_always(!extents0.is_nan(),
false);
425 nassertr_always(!center0.is_nan(),
false);
426 nassertr_always(!rotation0.is_nan(),
false);
427 nassertr_always(!extents1.is_nan(),
false);
428 nassertr_always(!center1.is_nan(),
false);
429 nassertr_always(!rotation1.is_nan(),
false);
431 return _ptr->NxBoxBoxIntersect(
447tri_box_intersect(
const LPoint3f &vertex0,
const LPoint3f &vertex1,
const LPoint3f &vertex2,
const LPoint3f ¢er,
const LVector3f &extents) {
449 nassertr_always(!vertex0.is_nan(),
false);
450 nassertr_always(!vertex1.is_nan(),
false);
451 nassertr_always(!vertex2.is_nan(),
false);
452 nassertr_always(!center.is_nan(),
false);
453 nassertr_always(!extents.is_nan(),
false);
455 return _ptr->NxTriBoxIntersect(
472 NxVec3 nPointOnPlane;
474 bool result = _ptr->NxRayPlaneIntersect(ray._ray, plane._plane, dist, nPointOnPlane);
476 PhysxManager::update_point3_from_nxVec3(point_on_plane, nPointOnPlane);
488ray_sphere_intersect(
const LPoint3f &origin,
const LVector3f &dir,
float length,
const LPoint3f ¢er,
float radius, LPoint3f &hit_pos) {
490 nassertr_always(!origin.is_nan(),
false);
491 nassertr_always(!dir.is_nan(),
false);
492 nassertr_always(!center.is_nan(),
false);
495 NxVec3 nPointOnPlane;
497 bool result = _ptr->NxRaySphereIntersect(
506 PhysxManager::update_point3_from_nxVec3(hit_pos, nPointOnPlane);
517segment_box_intersect(
const LPoint3f &p1,
const LPoint3f &p2,
const LPoint3f &bbox_min,
const LPoint3f &bbox_max, LPoint3f &intercept) {
519 nassertr_always(!p1.is_nan(),
false);
520 nassertr_always(!p2.is_nan(),
false);
521 nassertr_always(!bbox_min.is_nan(),
false);
522 nassertr_always(!bbox_max.is_nan(),
false);
526 bool result =_ptr->NxSegmentBoxIntersect(
533 PhysxManager::update_point3_from_nxVec3(intercept, nIntercept);
544ray_aabb_intersect(
const LPoint3f &min,
const LPoint3f &max,
const LPoint3f &origin,
const LVector3f &dir, LPoint3f &coord) {
546 nassertr_always(!min.is_nan(),
false);
547 nassertr_always(!max.is_nan(),
false);
548 nassertr_always(!origin.is_nan(),
false);
549 nassertr_always(!dir.is_nan(),
false);
553 bool result = _ptr->NxRayAABBIntersect(
560 PhysxManager::update_point3_from_nxVec3(coord, nCoord);
571segment_obb_intersect(
const LPoint3f &p0,
const LPoint3f &p1,
const LPoint3f ¢er,
const LVector3f &extents,
const LMatrix3f &rot) {
573 nassertr_always(!p0.is_nan(),
false);
574 nassertr_always(!p1.is_nan(),
false);
575 nassertr_always(!center.is_nan(),
false);
576 nassertr_always(!extents.is_nan(),
false);
577 nassertr_always(!rot.is_nan(),
false);
579 return _ptr->NxSegmentOBBIntersect(
595 nassertr_always(!p0.is_nan(),
false);
596 nassertr_always(!p1.is_nan(),
false);
597 nassertr_always(!min.is_nan(),
false);
598 nassertr_always(!max.is_nan(),
false);
600 return _ptr->NxSegmentAABBIntersect(
615 nassertr_always(!center.is_nan(),
false);
616 nassertr_always(!extents.is_nan(),
false);
617 nassertr_always(!rot.is_nan(),
false);
619 return _ptr->NxRayOBBIntersect(
635 nassertr_always(!origin.is_nan(), -1);
636 nassertr_always(!dir.is_nan(), -1);
638 NxReal t[2] = { 0.0f, 0.0f };
640 return _ptr->NxRayCapsuleIntersect(
643 capsule._capsule, t);
656 nassertr_always(!velocity0.is_nan(),
false);
657 nassertr_always(!velocity1.is_nan(),
false);
659 return _ptr->NxSweptSpheresIntersect(
675ray_tri_intersect(
const LPoint3f &orig,
const LVector3f &dir,
const LPoint3f &vert0,
const LPoint3f &vert1,
const LPoint3f &vert2, LVector3f &hit,
bool cull) {
677 nassertr_always(!orig.is_nan(),
false);
678 nassertr_always(!dir.is_nan(),
false);
679 nassertr_always(!vert0.is_nan(),
false);
680 nassertr_always(!vert1.is_nan(),
false);
681 nassertr_always(!vert2.is_nan(),
false);
685 bool result = _ptr->NxRayTriIntersect(
711 nassertr_always(!dir.is_nan(),
false);
716 bool result = _ptr->NxSweepBoxCapsule(
717 box._box, lss._capsule,
719 length, min_dist, nNormal);
721 PhysxManager::update_vec3_from_nxVec3(normal, nNormal);
736 nassertr_always(!dir.is_nan(),
false);
741 bool result = _ptr->NxSweepBoxSphere(
742 box._box, sphere._sphere,
744 length, min_dist, nNormal);
746 PhysxManager::update_vec3_from_nxVec3(normal, nNormal);
761 nassertr_always(!dir.is_nan(),
false);
767 bool result = _ptr->NxSweepCapsuleCapsule(
768 lss0._capsule, lss1._capsule,
770 length, min_dist, nIp, nNormal);
772 PhysxManager::update_point3_from_nxVec3(ip, nIp);
773 PhysxManager::update_vec3_from_nxVec3(normal, nNormal);
788 nassertr_always(!dir.is_nan(),
false);
794 bool result = _ptr->NxSweepSphereCapsule(
795 sphere._sphere, lss._capsule,
797 length, min_dist, nIp, nNormal);
799 PhysxManager::update_point3_from_nxVec3(ip, nIp);
800 PhysxManager::update_vec3_from_nxVec3(normal, nNormal);
815 nassertr_always(!dir.is_nan(),
false);
821 bool result = _ptr->NxSweepBoxBox(
822 box0._box, box1._box,
824 length, nIp, nNormal, min_dist);
826 PhysxManager::update_point3_from_nxVec3(ip, nIp);
827 PhysxManager::update_vec3_from_nxVec3(normal, nNormal);
840point_obb_sqr_dist(
const LPoint3f &point,
const LPoint3f ¢er,
const LVector3f &extents,
const LMatrix3f &rot, LPoint3f ¶ms) {
842 nassertr_always(!point.is_nan(), 0.0f);
843 nassertr_always(!center.is_nan(), 0.0f);
844 nassertr_always(!extents.is_nan(), 0.0f);
845 nassertr_always(!rot.is_nan(), 0.0f);
849 float result = _ptr->NxPointOBBSqrDist(
856 PhysxManager::update_point3_from_nxVec3(params, nParams);
Represention of a axis aligned bounding box.
Represents an oriented bounding box, as a center point, extents(radii) and a rotation.
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
static LMatrix3f nxMat33_to_mat3(const NxMat33 &m)
Converts from NxMat33 to LMatrix3f.
static NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Represents an ray as an origin and direction.
Represents a line segment.
Represents a sphere defined by its center point and radius.
float compute_square_distance(const PhysxSegment &seg, const LPoint3f &point)
Compute the distance squared from a point to a line segment.
LVector3f compute_box_world_edge_normal(const PhysxBox &box, unsigned int edge_index)
Compute and edge normals for an oriented box.
void set_fpu_rounding_chop()
Set FPU precision.
bool sweep_box_sphere(const PhysxBox &box, const PhysxSphere &sphere, const LVector3f &dir, float length, LVector3f &normal)
Box-vs-sphere sweep test.
PhysxBox compute_box_around_capsule(const PhysxCapsule &capsule)
Compute a box which encloses a capsule.
float compute_sphere_density(float radius, float mass)
Computes density of a homogeneous sphere according to sphere mass.
void set_fpu_rounding_near()
Set FPU rounding mode.
bool ray_aabb_intersect(const LPoint3f &min, const LPoint3f &max, const LPoint3f &origin, const LVector3f &dir, LPoint3f &coord)
Ray-AABB intersection test.
bool sweep_box_capsule(const PhysxBox &box, const PhysxCapsule &lss, const LVector3f &dir, float length, LVector3f &normal)
Box-vs-capsule sweep test.
float compute_cylinder_density(float radius, float length, float mass)
Computes density of a homogeneous cylinder according to cylinder mass.
void set_fpu_precision24()
Set FPU precision.
PhysxBox create_box(const PhysxBounds3 &aabb, const LMatrix4f &mat)
Create an oriented box from an axis aligned box and a transformation.
int int_floor(const float &f)
Convert a floating point number to an integer.
float compute_ellipsoid_mass(const LVector3f &extents, float density)
Computes mass of a homogeneous ellipsoid according to ellipsoid density.
bool sweep_sphere_capsule(const PhysxSphere &sphere, const PhysxCapsule &lss, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal)
Sphere-vs-capsule sweep test.
float compute_cone_mass(float radius, float length, float density)
Computes mass of a homogeneous cone according to cone density.
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.
void set_fpu_precision53()
Set FPU precision.
float compute_sphere_mass(float radius, float density)
Computes mass of a homogeneous sphere according to sphere density.
void set_fpu_rounding_up()
Set FPU rounding mode.
float compute_distance_squared(const PhysxRay &ray, const LPoint3f &point)
Compute the distance squared from a point to a ray.
unsigned int ray_capsule_intersect(const LPoint3f &origin, const LVector3f &dir, const PhysxCapsule &capsule)
Ray-capsule intersection test.
bool is_box_a_inside_box_b(const PhysxBox &a, const PhysxBox &b)
Test if box A is inside another box B.
bool segment_aabb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &min, const LPoint3f &max)
Boolean segment-AABB intersection test.
PhysxSphere merge_spheres(const PhysxSphere &sphere0, const PhysxSphere &sphere1)
Compute an overall bounding sphere for a pair of spheres.
bool segment_box_intersect(const LPoint3f &p1, const LPoint3f &p2, const LPoint3f &bbox_min, const LPoint3f &bbox_max, LPoint3f &intercept)
Segment-AABB intersection test.
LVector3f compute_box_inertia_tensor(float mass, float xlength, float ylength, float zlength)
Computes diagonalized inertia tensor for a box.
bool box_contains_point(const PhysxBox &box, const LPoint3f &p)
Test if an oriented box contains a point.
PhysxCapsule compute_capsule_around_box(const PhysxBox &box)
Compute a capsule which encloses a box.
LVector3f compute_sphere_inertia_tensor(float mass, float radius, bool hollow)
Computes diagonalized inertia tensor for a sphere.
void set_fpu_exceptions(bool b)
Set FPU precision.
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.
float compute_ellipsoid_density(const LVector3f &extents, float mass)
Computes density of a homogeneous ellipsoid according to ellipsoid mass.
int int_ceil(const float &f)
Convert a floating point number to an integer.
float compute_cone_density(float radius, float length, float mass)
Computes density of a homogeneous cone according to cone mass.
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).
float point_obb_sqr_dist(const LPoint3f &point, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot, LPoint3f ¶ms)
Point-vs-OBB distance computation.
bool ray_plane_intersect(const PhysxRay &ray, const PhysxPlane &plane, LPoint3f &point_on_plane)
Ray-plane intersection test.
int int_chop(const float &f)
Convert a floating point number to an integer.
bool ray_sphere_intersect(const LPoint3f &origin, const LVector3f &dir, float length, const LPoint3f ¢er, float radius, LPoint3f &hit_pos)
Ray-sphere intersection test.
float compute_box_density(const LVector3f &extents, float mass)
Computes density of a homogeneous box according to box mass.
float compute_cylinder_mass(float radius, float length, float density)
Computes mass of a homogeneous cylinder according to cylinder density.
bool swept_spheres_intersect(const PhysxSphere &sphere0, const LVector3f &velocity0, const PhysxSphere &sphere1, const LVector3f &velocity1)
Sphere-sphere sweep test.
void set_fpu_precision64()
Set FPU precision.
bool sweep_capsule_capsule(const PhysxCapsule &lss0, const PhysxCapsule &lss1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal)
Capsule-vs-capsule sweep test.
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.
float compute_box_mass(const LVector3f &extents, float density)
Computes mass of a homogeneous box according to box density.
bool ray_obb_intersect(const PhysxRay &ray, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot)
Boolean ray-OBB intersection test.
void set_fpu_rounding_down()
Set FPU rounding mode.
bool sweep_box_box(const PhysxBox &box0, const PhysxBox &box1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal)
Box-vs-box sweep test.
bool segment_obb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot)
Boolean segment-OBB intersection test.
void normal_to_tangents(const LVector3f &n, LVector3f &t1, LVector3f &t2)
Get the tangent vectors associated with a normal.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.