C# Class MIConvexHull.ObjectManager

A helper class for object allocation/storage. This helps the GC a lot as it prevents the creation of about 75% of new face objects (in the case of ConvexFaceInternal). In the case of FaceConnectors and DefferedFaces, the difference is even higher (in most cases O(1) vs O(number of created faces)).
Show file Open project: gusmanb/MIConvexHull Class Usage Examples

Public Methods

Method Description
DepositConnector ( FaceConnector connector ) : void

Store a face connector in the "embedded" linked list.

DepositDeferredFace ( DeferredFace face ) : void

Deposit the deferred face.

DepositFace ( int faceIndex ) : void

Return the face to the pool for later use.

DepositVertexBuffer ( IndexBuffer buffer ) : void

Deposit the index buffer.

GetConnector ( ) : FaceConnector

Get an unused face connector. If none is available, create it.

GetDeferredFace ( ) : DeferredFace

Get the deferred face.

GetFace ( ) : int

Return index of an unused face or creates a new one.

GetVertexBuffer ( ) : IndexBuffer

Get a store index buffer or create a new instance.

ObjectManager ( ConvexHullInternal hull ) : System

Create the manager.

Private Methods

Method Description
CreateFace ( ) : int

Create a new face and put it in the pool.

ReallocateFacePool ( ) : void

Reallocate the face pool, including the AffectedFaceFlags

Method Details

DepositConnector() public method

Store a face connector in the "embedded" linked list.
public DepositConnector ( FaceConnector connector ) : void
connector FaceConnector
return void

DepositDeferredFace() public method

Deposit the deferred face.
public DepositDeferredFace ( DeferredFace face ) : void
face DeferredFace
return void

DepositFace() public method

Return the face to the pool for later use.
public DepositFace ( int faceIndex ) : void
faceIndex int
return void

DepositVertexBuffer() public method

Deposit the index buffer.
public DepositVertexBuffer ( IndexBuffer buffer ) : void
buffer IndexBuffer
return void

GetConnector() public method

Get an unused face connector. If none is available, create it.
public GetConnector ( ) : FaceConnector
return FaceConnector

GetDeferredFace() public method

Get the deferred face.
public GetDeferredFace ( ) : DeferredFace
return DeferredFace

GetFace() public method

Return index of an unused face or creates a new one.
public GetFace ( ) : int
return int

GetVertexBuffer() public method

Get a store index buffer or create a new instance.
public GetVertexBuffer ( ) : IndexBuffer
return IndexBuffer

ObjectManager() public method

Create the manager.
public ObjectManager ( ConvexHullInternal hull ) : System
hull ConvexHullInternal
return System