Table of Contents

Class PointCloudShape

Namespace
Jitter2.Collision.Shapes
Assembly
Jitter2.dll

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

supportMap VertexSupportMap

Exceptions

InvalidOperationException

Thrown when supportMap does not define a non-degenerate volume.

PointCloudShape(IEnumerable<JVector>)

Initializes a new instance of the PointCloudShape class.

public PointCloudShape(IEnumerable<JVector> vertices)

Parameters

vertices IEnumerable<JVector>

All vertices that define the convex hull.

Exceptions

ArgumentException

Thrown when vertices is empty.

InvalidOperationException

Thrown when vertices does not define a non-degenerate volume.

PointCloudShape(ReadOnlySpan<JVector>)

Initializes a new instance of the PointCloudShape class.

public PointCloudShape(ReadOnlySpan<JVector> vertices)

Parameters

vertices ReadOnlySpan<JVector>

All vertices that define the convex hull.

Exceptions

ArgumentException

Thrown when vertices is empty.

InvalidOperationException

Thrown when vertices does 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

JVector

Methods

CalculateBoundingBox(in JQuaternion, in JVector, out JBoundingBox)

public override void CalculateBoundingBox(in JQuaternion orientation, in JVector position, out JBoundingBox box)

Parameters

orientation JQuaternion
position JVector
box JBoundingBox

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

inertia JSymmetricMatrix
com JVector
mass float

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

PointCloudShape

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

point JVector

An 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

direction JVector

The search direction in local space. Does not need to be normalized.

result JVector

The 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.