Class EllipsoidGeometry
Defined in File pf_obstacle_geometry.hpp
Inheritance Relationships
Base Type
public pfield::ObstacleGeometry(Class ObstacleGeometry)
Class Documentation
-
class EllipsoidGeometry : public pfield::ObstacleGeometry
Geometry for an ellipsoid obstacle.
Defined by three semi-axes (a, b, c) along the principal axes. Supports PCA-rotated ellipsoids fitted to mesh geometry:
axesholds the rotation from the obstacle frame to the principal-axis frame, andcentroidOffsetholds the mesh centroid displacement.SDF: first-order approximation d ≈ f(p) / ||∇f(p)|| where f(p) = (px/a)² + (py/b)² + (pz/c)² - 1.
Public Functions
-
EllipsoidGeometry(double semiX, double semiY, double semiZ)
Constructs an axis-aligned EllipsoidGeometry centered at the origin.
- Parameters:
semiX – Semi-axis along X (must be > 0).
semiY – Semi-axis along Y (must be > 0).
semiZ – Semi-axis along Z (must be > 0).
-
EllipsoidGeometry(double semiX, double semiY, double semiZ, const Eigen::Matrix3d &axes, const Eigen::Vector3d ¢roidOffset)
Constructs a PCA-rotated EllipsoidGeometry.
- Parameters:
semiX – Semi-axis along the PCA X principal axis.
semiY – Semi-axis along the PCA Y principal axis.
semiZ – Semi-axis along the PCA Z principal axis.
axes – Rotation from obstacle frame to PCA frame (columns are principal axes).
centroidOffset – Offset from the collision-origin to the ellipsoid center, expressed in the obstacle’s local frame.
-
virtual ObstacleType getType() const override
Returns the ObstacleType discriminator for this geometry.
-
virtual std::vector<double> asVector() const override
Returns a vector of the geometry’s defining parameters.
The vector layout is type-specific: Sphere → {radius} Box → {length, width, height} Cylinder → {radius, height} Ellipsoid → {semi_x, semi_y, semi_z} Capsule → {radius, height} Mesh → {length, width, height} (bounding-box dims or zeros)
-
virtual Eigen::Vector3d halfDimensions(const Eigen::Vector3d &meshScale) const override
Returns the half-dimensions of the obstacle’s axis-aligned bounding box.
Used for broad-phase influence-zone checks.
- Parameters:
meshScale – Scale of the mesh resource (used only by MeshGeometry; ignored by all other types).
-
virtual void computeSignedDistanceAndNormal(const Eigen::Vector3d &localPoint, const Eigen::Quaterniond &obstacleOrientation, double &signedDistance, Eigen::Vector3d &normal) const override
Computes the signed distance and outward surface normal from a point expressed in the obstacle’s local frame.
The caller is responsible for transforming the world-frame query point into the obstacle’s local frame before calling this method.
- Parameters:
localPoint – [in] Query point in the obstacle’s local frame.
obstacleOrientation – [in] World-frame orientation of the obstacle (quaternion), used to rotate the computed normal back to world coordinates.
signedDistance – [out] Signed distance to the obstacle surface (negative if inside, positive if outside).
normal – [out] Outward unit normal in world coordinates at the closest surface point.
-
virtual std::shared_ptr<coal::CollisionGeometry> buildCoalGeometry(const Eigen::Vector3d &obstaclePosition, const Eigen::Quaterniond &obstacleOrientation, coal::Transform3s &coalTransform) const override
Builds the Coal collision geometry for this obstacle.
The returned shared_ptr is used to construct a coal::CollisionObject. The caller is responsible for supplying the correct world-frame transform.
- Parameters:
obstaclePosition – World-frame position of the obstacle origin.
obstacleOrientation – World-frame orientation of the obstacle.
coalTransform – [out] The Coal transform that should be passed to coal::CollisionObject together with the returned geometry. For most types this equals the obstacle pose, but OBB-fitted shapes (Box, Capsule) may shift and rotate it to the OBB center.
- Returns:
Shared pointer to the Coal collision geometry.
-
virtual coal::Transform3s computeUpdatedCoalTransform(const Eigen::Vector3d &obstaclePosition, const Eigen::Quaterniond &obstacleOrientation) const override
Computes the world-frame Coal transform to use when updating a cached collision object’s pose.
For most types this simply encodes (obstaclePosition, obstacleOrientation). OBB-fitted types (Box, Capsule) adjust for the centroid offset and PCA rotation baked into the Coal object at construction time.
- Parameters:
obstaclePosition – New world-frame position of the obstacle.
obstacleOrientation – New world-frame orientation of the obstacle.
- Returns:
The Coal transform to apply to the cached collision object.
-
virtual bool operator==(const ObstacleGeometry &other) const override
Equality comparison — only types with the same concrete class and parameters are equal.
-
virtual std::unique_ptr<ObstacleGeometry> clone() const override
Deep-copy factory, so PotentialFieldObstacle can clone its geometry.
Public Members
-
double semiX
Semi-axis along principal X.
-
double semiY
Semi-axis along principal Y.
-
double semiZ
Semi-axis along principal Z.
-
Eigen::Matrix3d axes
PCA rotation (identity if axis-aligned).
-
Eigen::Vector3d centroidOffset
Centroid offset (zero if centered).
-
std::string sourceMeshResource
Mesh URI from which this ellipsoid was fitted (empty if not mesh-derived).
-
Eigen::Vector3d sourceMeshScale = Eigen::Vector3d::Ones()
Mesh scale corresponding to
sourceMeshResource.
-
EllipsoidGeometry(double semiX, double semiY, double semiZ)