aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp
diff options
context:
space:
mode:
authorAles Borovicka <[email protected]>2017-03-15 15:20:53 +0100
committerAles Borovicka <[email protected]>2017-03-15 15:20:53 +0100
commit2398860b2b9bd6d9ec55a4b1cfddbcf1f6e4ebf6 (patch)
tree31a4af0fa12e07fc3a90477a1e3cadaba91cfe05 /PhysX_3.4/Source/GeomUtils/src/GuSweepMTD.cpp
parentPhysX 3.4, APEX 1.4 final release @21757769 (diff)
downloadphysx-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.cpp50
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