diff options
| author | Ales Borovicka <[email protected]> | 2017-03-15 15:20:53 +0100 |
|---|---|---|
| committer | Ales Borovicka <[email protected]> | 2017-03-15 15:20:53 +0100 |
| commit | 2398860b2b9bd6d9ec55a4b1cfddbcf1f6e4ebf6 (patch) | |
| tree | 31a4af0fa12e07fc3a90477a1e3cadaba91cfe05 /PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp | |
| parent | PhysX 3.4, APEX 1.4 final release @21757769 (diff) | |
| download | physx-3.4-2398860b2b9bd6d9ec55a4b1cfddbcf1f6e4ebf6.tar.xz physx-3.4-2398860b2b9bd6d9ec55a4b1cfddbcf1f6e4ebf6.zip | |
PhysX 3.4, APEX 1.4 patch release @21821222
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp')
| -rw-r--r-- | PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp b/PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp index 39c24c2c..b0a98c50 100644 --- a/PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp +++ b/PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp @@ -297,9 +297,13 @@ bool physx::Gu::computeCapsule_TriangleMeshMTD( const PxTriangleMeshGeometry& tr } } - normal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + normal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); + if(foundInitial) { FStore(distV, &hit.distance); @@ -409,8 +413,12 @@ bool physx::Gu::computeCapsule_HeightFieldMTD(const PxHeightFieldGeometry& heigh } } - normal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + normal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); + if(foundInitial) { FStore(distV, &hit.distance); @@ -580,8 +588,12 @@ bool physx::Gu::computeBox_TriangleMeshMTD(const PxTriangleMeshGeometry& triMesh } } - worldNormal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + worldNormal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); + if(foundInitial) { //transform closestA to world space @@ -722,8 +734,12 @@ bool physx::Gu::computeBox_HeightFieldMTD( const PxHeightFieldGeometry& heightFi } } - worldNormal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + worldNormal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); if(foundInitial) { @@ -881,8 +897,13 @@ bool physx::Gu::computeConvex_TriangleMeshMTD( const PxTriangleMeshGeometry& tri } } - worldNormal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + worldNormal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); + if(foundInitial) { //transform closestA to world space @@ -1041,8 +1062,13 @@ bool physx::Gu::computeConvex_HeightFieldMTD( const PxHeightFieldGeometry& heigh } } - worldNormal = V3Normalize(translation); - distV = FNeg(V3Length(translation)); + + const FloatV translationF = V3Length(translation); + distV = FNeg(translationF); + + const BoolV con = FIsGrtr(translationF, FZero()); + worldNormal = V3Sel(con, V3ScaleInv(translation, translationF), zeroV); + if(foundInitial) { //transform closestA to world space |