Class PointCloudShape
Represents the convex hull of a set of points, which may include interior points.
public class PointCloudShape : RigidBodyShape, IDynamicTreeProxy, IPartitionedSetIndex, IUpdatableBoundingBox, ISupportFeature, ISupportMappable, IRayCastable, IAngularSweepTestable, ISweepTestable, IDistanceTestable, IDebugDrawable, ICloneableShape<PointCloudShape>
- Inheritance
-
PointCloudShape
- Implements
- Inherited Members
Remarks
Best suited to small point sets (roughly 300 points or fewer). For larger hulls, consider ConvexHullShape.
Constructors
PointCloudShape(VertexSupportMap)
Initializes a new instance of the PointCloudShape class.
public PointCloudShape(VertexSupportMap supportMap)
Parameters
supportMapVertexSupportMap
Exceptions
- InvalidOperationException
Thrown when
supportMapdoes not define a non-degenerate volume.
PointCloudShape(IEnumerable<JVector>)
Initializes a new instance of the PointCloudShape class.
public PointCloudShape(IEnumerable<JVector> vertices)
Parameters
verticesIEnumerable<JVector>All vertices that define the convex hull.
Exceptions
- ArgumentException
Thrown when
verticesis empty.- InvalidOperationException
Thrown when
verticesdoes not define a non-degenerate volume.
PointCloudShape(ReadOnlySpan<JVector>)
Initializes a new instance of the PointCloudShape class.
public PointCloudShape(ReadOnlySpan<JVector> vertices)
Parameters
verticesReadOnlySpan<JVector>All vertices that define the convex hull.
Exceptions
- ArgumentException
Thrown when
verticesis empty.- InvalidOperationException
Thrown when
verticesdoes not define a non-degenerate volume.
Properties
Shift
Gets or sets the offset added to the vertices in local coordinates.
public JVector Shift { get; set; }
Property Value
Methods
CalculateBoundingBox(in JQuaternion, in JVector, out JBoundingBox)
public override void CalculateBoundingBox(in JQuaternion orientation, in JVector position, out JBoundingBox box)
Parameters
orientationJQuaternionpositionJVectorboxJBoundingBox
CalculateMassInertia()
Recalculates the mass, center of mass, and inertia tensor.
public void CalculateMassInertia()
Exceptions
- InvalidOperationException
Thrown when the point cloud does not define a non-degenerate volume.
CalculateMassInertia(out JSymmetricMatrix, out JVector, out float)
Calculates the shape's mass, center of mass, and inertia at unit density. The default implementation approximates the surface; overrides can provide exact mass properties.
public override void CalculateMassInertia(out JSymmetricMatrix inertia, out JVector com, out float mass)
Parameters
inertiaJSymmetricMatrixcomJVectormassfloat
Remarks
The inertia tensor is computed relative to the coordinate system origin (0,0,0), not the center of mass.
Clone()
Creates a copy that shares the original vertex data.
public PointCloudShape Clone()
Returns
GetCenter(out JVector)
Returns a point inside the shape. It does not need to be the center of mass.
public override void GetCenter(out JVector point)
Parameters
pointJVectorAn interior point in local space.
SupportMap(in JVector, out JVector)
Computes the point on the shape that is furthest in the specified direction.
public override void SupportMap(in JVector direction, out JVector result)
Parameters
directionJVectorThe search direction in local space. Does not need to be normalized.
resultJVectorThe point on the shape's surface furthest along
direction.
UpdateShape()
Updates the shape's cached mass, inertia, and bounding box.
public void UpdateShape()
Exceptions
- InvalidOperationException
Thrown when the point cloud does not define a non-degenerate volume.