29#ifndef GU_VEC_SPHERE_H
30#define GU_VEC_SPHERE_H
35#include "geometry/PxSphereGeometry.h"
36#include "GuVecConvex.h"
37#include "GuConvexSupportTable.h"
55 bMarginIsRadius =
true;
63 FStore(
radius, &minMargin);
64 FStore(
radius, &sweepMargin);
65 bMarginIsRadius =
true;
75 margin = sphere.margin;
76 minMargin = sphere.minMargin;
77 sweepMargin = sphere.sweepMargin;
78 bMarginIsRadius =
true;
87 margin = sphereGeom.
radius;
88 minMargin = sphereGeom.
radius;
89 sweepMargin = sphereGeom.
radius;
90 bMarginIsRadius =
true;
100 PX_INLINE void setV(
const aos::Vec3VArg _center,
const aos::FloatVArg _radius)
115 return BAllEqTTTT(FIsGrtrOrEq(
radius, FZero())) != 0;
128 const FloatV cc = V3LengthSq(V3Sub(center, p));
129 return FAllGrtrOrEq(rr, cc) != 0;
142 const Vec3V centerDif= V3Sub(center, sphere.center);
144 const FloatV cc = V3Dot(centerDif, centerDif);
145 const FloatV rr = FMul(radiusDif, radiusDif);
147 const BoolV con0 = FIsGrtrOrEq(radiusDif, FZero());
148 const BoolV con1 = FIsGrtr(rr, cc);
149 return BAllEqTTTT(BAnd(con0, con1))==1;
164 const FloatV zero = FZero();
165 const FloatV half = FHalf();
167 const Vec3V boxSphereCenter = V3Scale(V3Add(maximum, minimum), half);
168 const Vec3V v = V3Scale(V3Sub(maximum, minimum), half);
169 const FloatV boxSphereR = V3Length(v);
171 const Vec3V w = V3Sub(center, boxSphereCenter);
172 const FloatV wLength = V3Length(w);
173 const FloatV dif = FSub(FSub(
radius, wLength), boxSphereR);
175 return FAllGrtrOrEq(dif, zero) != 0;
187 const Vec3V centerDif = V3Sub(center, sphere.center);
188 const FloatV cc = V3Dot(centerDif, centerDif);
190 const FloatV rr = FMul(r, r);
191 return FAllGrtrOrEq(rr, cc) != 0;
197 return aos::V3Zero();
204 const Vec3V _dir = V3Normalize(dir);
205 return V3ScaleAdd(_dir,
radius, center);
215 PX_FORCE_INLINE aos::Vec3V supportMargin(
const aos::Vec3VArg dir,
const aos::FloatVArg _margin, aos::Vec3V& support)
const
Definition GuVecConvex.h:58
Definition GuVecSphere.h:47
A geometry object.
Definition PxGeometry.h:79
A class representing the geometry of a sphere.
Definition PxSphereGeometry.h:48
PxReal radius
The radius of the sphere.
Definition PxSphereGeometry.h:88
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
aos::FloatV radius
Sphere's center, w component is radius.
Definition GuVecSphere.h:235
PX_INLINE bool isValid() const
Checks the sphere is valid.
Definition GuVecSphere.h:111
PX_INLINE bool contains(const SphereV &sphere) const
Tests if a sphere is contained within the sphere.
Definition GuVecSphere.h:138
PX_INLINE SphereV()
Constructor.
Definition GuVecSphere.h:52
PX_INLINE bool contains(const aos::Vec3VArg p) const
Tests if a point is contained within the sphere.
Definition GuVecSphere.h:124
PX_INLINE SphereV(const SphereV &sphere)
Copy constructor.
Definition GuVecSphere.h:72
PX_INLINE bool intersect(const SphereV &sphere) const
Tests if the sphere intersects another sphere.
Definition GuVecSphere.h:184
PX_INLINE ~SphereV()
Destructor.
Definition GuVecSphere.h:96
PX_INLINE bool contains(const aos::Vec3VArg minimum, const aos::Vec3VArg maximum) const
Tests if a box is contained within the sphere.
Definition GuVecSphere.h:159
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition GuVecConvex.h:43
Definition PxVecMathAoSScalar.h:90
Definition PxVecMathAoSScalar.h:52
Definition PxVecMathAoSScalar.h:77