Class SupportFeatureSampler
Finds the outermost feature of a shape in a given direction by sampling its support mapping.
public static class SupportFeatureSampler
- Inheritance
-
SupportFeatureSampler
- Inherited Members
Remarks
This is the default implementation of SupportFeature(in JVector, float, Span<JVector>). It probes the support mapping in six directions tilted around the given one in a hexagonal pattern. A flat feature returns its vertices for these probes. A curved surface would return points beside the actual contact, by the radius times the tilt; those probes are recognized by how they move when the tilt is doubled and are extrapolated to zero tilt, which puts them on the resting point or line of the curved side.
Shapes that know their features analytically should override the query instead: the sampling costs twelve to thirty support calls.
Methods
Sample<T>(T, in JVector, float, Span<JVector>)
Samples the feature of a shape that supports it in the given direction.
public static int Sample<T>(T shape, in JVector direction, float tolerance, Span<JVector> vertices) where T : ISupportMappable
Parameters
shapeTThe shape to sample.
directionJVectorThe direction in the shape's local space. Does not need to be normalized.
tolerancefloatThe sine of the tilt angle of the probes.
verticesSpan<JVector>Receives the vertices in local space: one for a point, two for a segment, more for a polygon in winding order. At least MaxVertices entries long.
Returns
- int
The number of vertices written, at least one.
Type Parameters
TThe type of the shape.