Static Public Member Functions | List of all members
PxGeometryQuery Class Reference

Collection of geometry object queries (sweeps, raycasts, overlaps, ...). More...

#include <PxGeometryQuery.h>

Static Public Member Functions

static PX_PHYSX_COMMON_API bool sweep (const PxVec3 &unitDir, const PxReal maxDist, const PxGeometry &geom0, const PxTransform &pose0, const PxGeometry &geom1, const PxTransform &pose1, PxSweepHit &sweepHit, PxHitFlags hitFlags=PxHitFlag::eDEFAULT, const PxReal inflation=0.f)
 Sweep a specified geometry object in space and test for collision with a given object. More...
 
static PX_PHYSX_COMMON_API bool overlap (const PxGeometry &geom0, const PxTransform &pose0, const PxGeometry &geom1, const PxTransform &pose1)
 Overlap test for two geometry objects. More...
 
static PX_PHYSX_COMMON_API PxU32 raycast (const PxVec3 &origin, const PxVec3 &unitDir, const PxGeometry &geom, const PxTransform &pose, PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxRaycastHit *PX_RESTRICT rayHits, bool anyHit=false)
 Raycast test against a geometry object. More...
 
static PX_PHYSX_COMMON_API bool computePenetration (PxVec3 &direction, PxF32 &depth, const PxGeometry &geom0, const PxTransform &pose0, const PxGeometry &geom1, const PxTransform &pose1)
 Compute minimum translational distance (MTD) between two geometry objects. More...
 
static PX_PHYSX_COMMON_API PxReal pointDistance (const PxVec3 &point, const PxGeometry &geom, const PxTransform &pose, PxVec3 *closestPoint=NULL)
 Computes distance between a point and a geometry object. More...
 
static PX_PHYSX_COMMON_API
PxBounds3 
getWorldBounds (const PxGeometry &geom, const PxTransform &pose, float inflation=1.01f)
 get the bounds for a geometry object More...
 

Detailed Description

Collection of geometry object queries (sweeps, raycasts, overlaps, ...).

Member Function Documentation

static PX_PHYSX_COMMON_API bool PxGeometryQuery::computePenetration ( PxVec3 direction,
PxF32 depth,
const PxGeometry geom0,
const PxTransform pose0,
const PxGeometry geom1,
const PxTransform pose1 
)
static

Compute minimum translational distance (MTD) between two geometry objects.

All combinations of geom objects are supported except:

  • plane/plane
  • plane/mesh
  • plane/heightfield
  • mesh/mesh
  • mesh/heightfield
  • heightfield/heightfield

The function returns a unit vector ('direction') and a penetration depth ('depth').

The depenetration vector D = direction * depth should be applied to the first object, to get out of the second object.

Returned depth should always be positive or null.

If objects do not overlap, the function can not compute the MTD and returns false.

Parameters
[out]directionComputed MTD unit direction
[out]depthPenetration depth. Always positive or null.
[in]geom0The first geometry object
[in]pose0Pose of the first geometry object
[in]geom1The second geometry object
[in]pose1Pose of the second geometry object
Returns
True if the MTD has successfully been computed, i.e. if objects do overlap.
See Also
PxGeometry PxTransform
static PX_PHYSX_COMMON_API PxBounds3 PxGeometryQuery::getWorldBounds ( const PxGeometry geom,
const PxTransform pose,
float  inflation = 1.01f 
)
static

get the bounds for a geometry object

Parameters
[in]geomThe geometry object
[in]posePose of the geometry object
[in]inflationScale factor for computed world bounds. Box extents are multiplied by this value.
Returns
The bounds of the object
See Also
PxGeometry PxTransform

Referenced by PxShapeExt::getWorldBounds().

static PX_PHYSX_COMMON_API bool PxGeometryQuery::overlap ( const PxGeometry geom0,
const PxTransform pose0,
const PxGeometry geom1,
const PxTransform pose1 
)
static

Overlap test for two geometry objects.

All combinations are supported except:

Parameters
[in]geom0The first geometry object
[in]pose0Pose of the first geometry object
[in]geom1The second geometry object
[in]pose1Pose of the second geometry object
Returns
True if the two geometry objects overlap
See Also
PxGeometry PxTransform

Referenced by PxShapeExt::overlap().

static PX_PHYSX_COMMON_API PxReal PxGeometryQuery::pointDistance ( const PxVec3 point,
const PxGeometry geom,
const PxTransform pose,
PxVec3 closestPoint = NULL 
)
static

Computes distance between a point and a geometry object.

Currently supported geometry objects: box, sphere, capsule, convex.

Parameters
[in]pointThe point P
[in]geomThe geometry object
[in]posePose of the geometry object
[out]closestPointOptionally returned closest point to P on the geom object. Only valid when returned distance is strictly positive.
Returns
Square distance between the point and the geom object, or 0.0 if the point is inside the object, or -1.0 if the geometry type is not supported.
See Also
PxGeometry PxTransform
static PX_PHYSX_COMMON_API PxU32 PxGeometryQuery::raycast ( const PxVec3 origin,
const PxVec3 unitDir,
const PxGeometry geom,
const PxTransform pose,
PxReal  maxDist,
PxHitFlags  hitFlags,
PxU32  maxHits,
PxRaycastHit *PX_RESTRICT  rayHits,
bool  anyHit = false 
)
static

Raycast test against a geometry object.

Parameters
[in]originThe origin of the ray to test the geometry object against
[in]unitDirNormalized direction of the ray to test the geometry object against
[in]geomThe geometry object to test the ray against
[in]posePose of the geometry object
[in]maxDistMaximum ray length, has to be in the [0, inf) range
[in]hitFlagsSpecification of the kind of information to retrieve on hit. Combination of PxHitFlag flags
[in]maxHitsmax number of returned hits = size of 'rayHits' buffer
[out]rayHitsRaycast hits information
[in]anyHitSet to false if the closest hit point should be computed, else the query aborts as soon as any hit point along the ray is found.
Returns
Number of hits between the ray and the geometry object
Note
PX_DEPRECATED: The 'anyHit' parameter is deprecated. Please use PxHitFlag::eMESH_ANY instead.
See Also
PxRaycastHit PxGeometry PxTransform

Referenced by PxShapeExt::raycast().

static PX_PHYSX_COMMON_API bool PxGeometryQuery::sweep ( const PxVec3 unitDir,
const PxReal  maxDist,
const PxGeometry geom0,
const PxTransform pose0,
const PxGeometry geom1,
const PxTransform pose1,
PxSweepHit sweepHit,
PxHitFlags  hitFlags = PxHitFlag::eDEFAULT,
const PxReal  inflation = 0.f 
)
static

Sweep a specified geometry object in space and test for collision with a given object.

The following combinations are supported.

Parameters
[in]unitDirNormalized direction along which object geom0 should be swept
[in]maxDistMaximum sweep distance, has to be in the [0, inf) range
[in]geom0The geometry object to sweep. Supported geometries are PxSphereGeometry, PxCapsuleGeometry, PxBoxGeometry and PxConvexMeshGeometry
[in]pose0Pose of the geometry object to sweep
[in]geom1The geometry object to test the sweep against
[in]pose1Pose of the geometry object to sweep against
[out]sweepHitThe sweep hit information. Only valid if this method returns true.
[in]hitFlagsSpecify which properties per hit should be computed and written to result hit array. Combination of PxHitFlag flags
[in]inflationSurface of the swept shape is additively extruded in the normal direction, rounding corners and edges.
Returns
True if the swept geometry object geom0 hits the object geom1
See Also
PxSweepHit PxGeometry PxTransform

Referenced by PxShapeExt::sweep().


The documentation for this class was generated from the following file:


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com