Table of Contents

Class Pointcloud

Namespace
MathAssertions.Geometry3D
Assembly
MathAssertions.dll

Aggregate predicates over a ReadOnlySpan<T> of Vector3: boundedness, centroid, and "approximately on a known surface" checks. Each helper is an extension method for natural call-site syntax (cloud.IsBoundedBy(box), cloud.HasCentroidAt(expected, tolerance)).

public static class Pointcloud
Inheritance
Pointcloud
Inherited Members

Methods

HasCentroidAt(ReadOnlySpan<Vector3>, Vector3, double)

Returns true when the arithmetic centroid of cloud is within tolerance of expected component-wise. The empty cloud has no centroid and returns false.

public static bool HasCentroidAt(this ReadOnlySpan<Vector3> cloud, Vector3 expected, double tolerance)

Parameters

cloud ReadOnlySpan<Vector3>

Point cloud.

expected Vector3

Expected centroid.

tolerance double

Maximum allowed absolute difference per component. Must be non-negative and not NaN.

Returns

bool

true if the centroid matches within tolerance.

Exceptions

ArgumentOutOfRangeException

tolerance is NaN or negative.

IsApproximatelyOnPlane(ReadOnlySpan<Vector3>, Plane, double)

Returns true when every point in cloud lies within maxResidual perpendicular distance of plane. The empty cloud is vacuously on the plane.

public static bool IsApproximatelyOnPlane(this ReadOnlySpan<Vector3> cloud, Plane plane, double maxResidual)

Parameters

cloud ReadOnlySpan<Vector3>

Point cloud.

plane Plane

Reference plane (assumes unit-length normal, the standard CreateFromVertices(Vector3, Vector3, Vector3) convention).

maxResidual double

Maximum allowed perpendicular distance from the plane. Must be non-negative and not NaN.

Returns

bool

true if every point is within the residual.

Exceptions

ArgumentOutOfRangeException

maxResidual is NaN or negative.

IsApproximatelyOnSphere(ReadOnlySpan<Vector3>, Vector3, float, double)

Returns true when every point in cloud lies within maxResidual radial distance of the sphere defined by center and radius: the absolute difference between point-to-center distance and the radius is bounded by the residual. The empty cloud is vacuously on the sphere.

public static bool IsApproximatelyOnSphere(this ReadOnlySpan<Vector3> cloud, Vector3 center, float radius, double maxResidual)

Parameters

cloud ReadOnlySpan<Vector3>

Point cloud.

center Vector3

Sphere center.

radius float

Sphere radius.

maxResidual double

Maximum allowed radial deviation. Must be non-negative and not NaN.

Returns

bool

true if every point is within the residual band.

Exceptions

ArgumentOutOfRangeException

maxResidual is NaN or negative.

IsBoundedBy(ReadOnlySpan<Vector3>, AxisAlignedBox)

Returns true when every point in cloud lies inside (or on the boundary of) box. The empty cloud is vacuously bounded.

public static bool IsBoundedBy(this ReadOnlySpan<Vector3> cloud, AxisAlignedBox box)

Parameters

cloud ReadOnlySpan<Vector3>
box AxisAlignedBox

Returns

bool

IsBoundedBy(ReadOnlySpan<Vector3>, Sphere)

Returns true when every point in cloud lies inside (or on the boundary of) sphere. The empty cloud is vacuously bounded.

public static bool IsBoundedBy(this ReadOnlySpan<Vector3> cloud, Sphere sphere)

Parameters

cloud ReadOnlySpan<Vector3>
sphere Sphere

Returns

bool