54 minMargin = PX_MAX_REAL;
55 sweepMargin = PX_MAX_REAL;
69 const FloatV num = FLoad(0.333333f);
70 center = V3Scale(V3Add(V3Add(p0, p1), p2), num);
75 minMargin = PX_MAX_REAL;
76 sweepMargin = PX_MAX_REAL;
82 const Vec3V p0 = V3LoadU(pts[0]);
83 const Vec3V p1 = V3LoadU(pts[1]);
84 const Vec3V p2 = V3LoadU(pts[2]);
85 const FloatV num = FLoad(0.333333f);
86 center = V3Scale(V3Add(V3Add(p0, p1), p2), num);
91 minMargin = PX_MAX_REAL;
92 sweepMargin = PX_MAX_REAL;
107 center = triangle.center;
109 minMargin = PX_MAX_REAL;
110 sweepMargin = PX_MAX_REAL;
123 for(PxU32 i=0; i<numInds; ++i)
125 vertexs[i] = V3LoadU(originalVerts[inds[i]]);
137 Vec3V offset = V3Sub(_center, center);
154 const Vec3V n = V3Cross(ab, ac);
155 return V3Normalize(n);
168 _normal = V3Cross(ab, ac);
174 const FloatV half = FLoad(0.5f);
177 const Vec3V v = V3Cross(ba, ca);
178 return FMul(V3Length(v), half);
188 const FloatV d0 = V3Dot(v0, dir);
189 const FloatV d1 = V3Dot(v1, dir);
190 const FloatV d2 = V3Dot(v2, dir);
192 const BoolV con0 = BAnd(FIsGrtr(d0, d1), FIsGrtr(d0, d2));
193 const BoolV con1 = FIsGrtr(d1, d2);
194 return V3Sel(con0, v0, V3Sel(con1, v1, v2));
197 PX_FORCE_INLINE void supportLocal(
const aos::Vec3VArg dir, aos::FloatV& min, aos::FloatV& max)
const
200 const Vec3V v0 =
verts[0];
201 const Vec3V v1 =
verts[1];
202 const Vec3V v2 =
verts[2];
203 FloatV d0 = V3Dot(v0, dir);
204 FloatV d1 = V3Dot(v1, dir);
205 FloatV d2 = V3Dot(v2, dir);
207 max = FMax(d0, FMax(d1, d2));
208 min = FMin(d0, FMin(d1, d2));
212 PX_FORCE_INLINE aos::Vec3V supportRelative(
const aos::Vec3VArg dir,
const aos::PxMatTransformV& aToB,
const aos::PxMatTransformV& aTobT)
const
217 const Vec3V _dir = aTobT.rotate(dir);
218 const Vec3V maxPoint = supportLocal(_dir);
219 return aToB.transform(maxPoint);
222 PX_FORCE_INLINE aos::Vec3V supportLocal(
const aos::Vec3VArg dir, PxI32& index)
const
226 const VecI32V vZero = VecI32V_Zero();
227 const VecI32V vOne = VecI32V_One();
228 const VecI32V vTwo = VecI32V_Two();
229 const Vec3V v0 =
verts[0];
230 const Vec3V v1 =
verts[1];
231 const Vec3V v2 =
verts[2];
232 const FloatV d0 = V3Dot(v0, dir);
233 const FloatV d1 = V3Dot(v1, dir);
234 const FloatV d2 = V3Dot(v2, dir);
235 const BoolV con0 = BAnd(FIsGrtr(d0, d1), FIsGrtr(d0, d2));
236 const BoolV con1 = FIsGrtr(d1, d2);
237 const VecI32V vIndex = VecI32V_Sel(con0, vZero, VecI32V_Sel(con1, vOne, vTwo));
238 PxI32_From_VecI32V(vIndex, &index);
239 return V3Sel(con0, v0, V3Sel(con1, v1, v2));
242 PX_FORCE_INLINE aos::Vec3V supportRelative(
const aos::Vec3VArg dir,
const aos::PxMatTransformV& aToB,
243 const aos::PxMatTransformV& aTobT, PxI32& index)
const
249 const Vec3V _dir = aTobT.rotate(dir);
250 return aToB.transform(supportLocal(_dir, index));