C# Class MIConvexHull.MathHelper

A helper class mostly for normal computation. If convex hulls are computed in higher dimensions, it might be a good idea to add a specific FindNormalVectorND function.
Mostrar archivo Open project: gusmanb/MIConvexHull Class Usage Examples

Public Methods

Method Description
CalculateFacePlane ( ConvexFaceInternal face, double center ) : bool

Calculates the normal and offset of the hyper-plane given by the face's vertices.

FindNormalVector ( int vertices, double normalData ) : void

Finds normal vector of a hyper-plane given by vertices. Stores the results to normalData.

GetSimplexVolume ( ConvexFaceInternal cell, IList vertices, SimplexVolumeBuffer buffer ) : double

Computes the volume of an n-dimensional simplex. Buffer needs to be array of shape Dimension x Dimension.

GetVertexDistance ( int v, ConvexFaceInternal f ) : double

Check if the vertex is "visible" from the face. The vertex is "over face" if the return value is > Constants.PlaneDistanceTolerance.

LengthSquared ( double x ) : double

Squared length of the vector.

MathHelper ( int dimension, double positions ) : System
SubtractFast ( int x, int y, double target ) : void

Subtracts vectors x and y and stores the result to target.

Private Methods

Method Description
DeterminantDestructive ( SimplexVolumeBuffer buff ) : double
FindNormal ( int vertices, double normal ) : void
FindNormalVector2D ( int vertices, double normal ) : void

Finds 2D normal vector.

FindNormalVector3D ( int vertices, double normal ) : void

Finds 3D normal vector.

FindNormalVector4D ( int vertices, double normal ) : void

Finds 4D normal vector.

FindNormalVectorND ( int vertices, double normal ) : void
LUFactor ( double data, int order, int ipiv, double vecLUcolj ) : void

Method Details

CalculateFacePlane() public method

Calculates the normal and offset of the hyper-plane given by the face's vertices.
public CalculateFacePlane ( ConvexFaceInternal face, double center ) : bool
face ConvexFaceInternal
center double
return bool

FindNormalVector() public method

Finds normal vector of a hyper-plane given by vertices. Stores the results to normalData.
public FindNormalVector ( int vertices, double normalData ) : void
vertices int
normalData double
return void

GetSimplexVolume() public static method

Computes the volume of an n-dimensional simplex. Buffer needs to be array of shape Dimension x Dimension.
public static GetSimplexVolume ( ConvexFaceInternal cell, IList vertices, SimplexVolumeBuffer buffer ) : double
cell ConvexFaceInternal
vertices IList
buffer SimplexVolumeBuffer Helper for the calculation to avoid unnecessary allocations.
return double

GetVertexDistance() public method

Check if the vertex is "visible" from the face. The vertex is "over face" if the return value is > Constants.PlaneDistanceTolerance.
public GetVertexDistance ( int v, ConvexFaceInternal f ) : double
v int
f ConvexFaceInternal
return double

LengthSquared() public static method

Squared length of the vector.
public static LengthSquared ( double x ) : double
x double
return double

MathHelper() public method

public MathHelper ( int dimension, double positions ) : System
dimension int
positions double
return System

SubtractFast() public method

Subtracts vectors x and y and stores the result to target.
public SubtractFast ( int x, int y, double target ) : void
x int
y int
target double
return void