CellData Class Reference

#include <celldata.h>

Detailed Description

CellData struct is a datacontainer that represents a single Voronoi Cell.

Public Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (CellData)
 
 CellData ()=default
 
 CellData (CellData &&src)=default
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (CellData)
 
 ~CellData ()=default
 
Result< void > CopyFrom (const CellData &src, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE)
 
void Reset ()
 
void Flush ()
 
Result< BoolScaleCell (Float scaleValue)
 
Result< BoolFixGeometry ()
 
BaseArray< Vector > & GetVertices ()
 
BaseArray< CellEdge > & GetEdges ()
 
BaseArray< Int > & GetFaces ()
 
BaseArray< Int32 > & GetAdjacentCells ()
 
const BaseArray< Vector > & GetVertices () const
 
const BaseArray< CellEdge > & GetEdges () const
 
const BaseArray< Int > & GetFaces () const
 
const BaseArray< Int32 > & GetAdjacentCells () const
 
Bool IsComplex () const
 
Bool TestPointWithCell (const Vector &point) const
 
Result< void > MergeCells (const BaseArray< Int > &thisCellFaces, const CellData &neighbourCell, const BaseArray< Int > &otherCellFaces)
 
Result< void > FuseCells (Int thisCellIndex, CellData &neighbourCell, Int otherCellIndex)
 
Vector CreateCellFaceNormal (Int faceIndex) const
 
Result< void > AddCellData (const CellData &otherCell)
 
Range< VectorGetBoundingBox () const
 

Private Member Functions

void MarkAllUsedPoints (BaseArray< Char > &pointUseless, Char mark=NOTOK)
 
void MarkAllUsedPoints (BaseArray< Int32 > &pointUseless, Int32 mark=NOTOK)
 
Bool MarkAllDoublePoints (BaseArray< Int32 > &pointUseless, Float epsilonOverride=0.0)
 
Result< BoolMarkAllColinearPoints (BaseArray< Int32 > &pointUseless, Float epsilonOverride=0.0)
 
Result< BoolMarkAllUselessPoints (BaseArray< Char > &pointUseless)
 
Result< BoolReCreateCellWithOnlyUsefulPoints (BaseArray< Char > &pointUseless)
 
Result< BoolReCreateCellWithOnlyUsefulPoints (BaseArray< Int32 > &pointUseless)
 
Bool CalcAllFaceNormals (BaseArray< Vector > &faceNormals, Float scaleValue)
 
Bool SetupReverseEdges ()
 
Result< void > CleanupUnusedPoints ()
 
Bool TestCurrentDataStructure (BaseArray< Char > &faceRemoved)
 
Result< void > ExpandCellByValue (const BaseArray< Vector > &planeNormals, const BaseArray< Int32 > &edgeToFaceBelonging, Float offset, BaseArray< Vector > &pointDisplacements)
 
Result< BoolShrinkCellByValue (const BaseArray< Vector > &planeNormals, Float offset)
 
Result< BoolCutCellOnPlane (const Pair< Vector, Vector > &plane, Int32 planeNeighborIndex=NOTOK)
 
Result< BoolCutFaceOnPlane (Int faceIndex, const Pair< Vector, Vector > &plane, const BaseArray< Float > &pointToCutPlaneDistance, const BaseArray< Int > &edgeIntesection, const BaseArray< Int > &pointTranslateMap, BaseArray< CellEdge > &newEdges, BaseArray< CellEdge > &newFaceEdges)
 
Result< BoolProcessInsideFaceAndAddToEdges (const BaseArray< CellEdge > &newFaceEdges, Int pointCount, BaseArray< CellEdge > &newEdges)
 
Result< IntIntersectEdgeOnPlane (const Pair< Vector, Vector > &planeBaseArray, Int edgeIndex, BaseArray< Vector > &newPoints)
 
Result< void > MergePointsInCutData (BaseArray< Vector > &newPoints, BaseArray< CellEdge > &newEdges, BaseArray< Int > &newFaces, BaseArray< CellEdge > &newFaceEdges)
 
Result< void > RemoveIsolatedPoints ()
 
Result< void > FusePoints (BaseArray< Int > &affectedPoints)
 
Result< void > RemoveFace (Int faceIndex, BaseArray< Int > &affectedPoints)
 

Private Attributes

BaseArray< Int_verticesPreIndex
 
BaseArray< Vector_vertices
 
BaseArray< CellEdge_edges
 
BaseArray< Int_faces
 
BaseArray< Int32_adjacentCell
 
Bool _isComplex
 

Friends

class Voronoi3DImpl
 

Constructor & Destructor Documentation

◆ CellData() [1/2]

CellData ( )
default

◆ CellData() [2/2]

CellData ( CellData &&  src)
default

◆ ~CellData()

~CellData ( )
default

Member Function Documentation

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( CellData  )

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( CellData  )

◆ CopyFrom()

Result<void> CopyFrom ( const CellData src,
COLLECTION_RESIZE_FLAGS  resizeFlags = COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE 
)

Copies the contents of src into this object.

Parameters
[in]srcThe object to copy from.
[in]resizeFlagsResize flag for collections.
Returns
OK on success.

◆ Reset()

void Reset ( )

Resets this cell to an empty cell.

◆ Flush()

void Flush ( )

Resets this cell to an empty cell (keeps memory).

◆ ScaleCell()

Result<Bool> ScaleCell ( Float  scaleValue)

Scales the current cell by a specific value.

Parameters
[in]scaleValuethe amout the cell will be scaled by.
Returns
if the scaling succeded.

◆ FixGeometry()

Result<Bool> FixGeometry ( )

This cell checks the current cell data structure and optimizes it.

Returns
true if everything worked out, otherwise false.

◆ GetVertices() [1/2]

BaseArray<Vector>& GetVertices ( )

Gets the vertex list of this cell (writable).

Returns
Reference to vertex array.

◆ GetEdges() [1/2]

BaseArray<CellEdge>& GetEdges ( )

Gets the edge list of this cell (writable).

Returns
Reference to edge array.

◆ GetFaces() [1/2]

BaseArray<Int>& GetFaces ( )

Gets the face list of this cell (writable).

Returns
Reference to face array.

◆ GetAdjacentCells() [1/2]

BaseArray<Int32>& GetAdjacentCells ( )

Gets the adjacent cell list of this cell (writable).

Returns
Reference to the adjacent cell array.

◆ GetVertices() [2/2]

const BaseArray<Vector>& GetVertices ( ) const

Gets the vertex list of this cell (not writable).

Returns
Constant reference to vertex array.

◆ GetEdges() [2/2]

const BaseArray<CellEdge>& GetEdges ( ) const

Gets the edge list of this cell (not writable).

Returns
Constant reference to edge array.

◆ GetFaces() [2/2]

const BaseArray<Int>& GetFaces ( ) const

Gets the face list of this cell (not writable).

Returns
Constant reference to face array.

◆ GetAdjacentCells() [2/2]

const BaseArray<Int32>& GetAdjacentCells ( ) const

Gets the adjacent cell list of this cell (not writable).

Returns
Constant reference to adjacent cell array.

◆ IsComplex()

Bool IsComplex ( ) const

Returns if this cell is complex (most likely not convex)

Returns
Reference to face array.

◆ TestPointWithCell()

Bool TestPointWithCell ( const Vector point) const

Tests if a passed point is inside of the cell.

Parameters
[in]pointPoint to test if it is inside.
Returns
True if point is inside cell, otherwise false.

◆ MergeCells()

Result<void> MergeCells ( const BaseArray< Int > &  thisCellFaces,
const CellData neighbourCell,
const BaseArray< Int > &  otherCellFaces 
)

Merges another cell into this one.

Parameters
[in]thisCellFacesThe faces of this cell that should be removed.
[in]neighbourCellThe other cell to fuse into this one.
[in]otherCellFacesThe faces of the other cell to remove.
Returns
OK on success.

◆ FuseCells()

Result<void> FuseCells ( Int  thisCellIndex,
CellData neighbourCell,
Int  otherCellIndex 
)

Fuses another cell into this one. The wall between the cells is removed if they are neighbors.

Parameters
[in]thisCellIndexThe external index of this cell.
[in]neighbourCellThe neighbor cell that should be fused.
[in]otherCellIndexThe external index of the neighbor cell.
Returns
OK on success.

◆ CreateCellFaceNormal()

Vector CreateCellFaceNormal ( Int  faceIndex) const

Calculates the Normal of a pointloop face of the cell.

Parameters
[in]faceIndexThe index of the cell to calculate the normal for.
Returns
The normal of the face.

◆ AddCellData()

Result<void> AddCellData ( const CellData otherCell)

Adds the data of a different cell to this one. Indices are translated.

Parameters
[in]otherCellThe other cell whose data should be added
Returns
OK on success.

◆ GetBoundingBox()

Range<Vector> GetBoundingBox ( ) const

Calculates and returns the Axis Aligned Bounding Box of the cell.

Returns
The Bounding Box of the cell

◆ MarkAllUsedPoints() [1/2]

void MarkAllUsedPoints ( BaseArray< Char > &  pointUseless,
Char  mark = NOTOK 
)
private

◆ MarkAllUsedPoints() [2/2]

void MarkAllUsedPoints ( BaseArray< Int32 > &  pointUseless,
Int32  mark = NOTOK 
)
private

◆ MarkAllDoublePoints()

Bool MarkAllDoublePoints ( BaseArray< Int32 > &  pointUseless,
Float  epsilonOverride = 0.0 
)
private

◆ MarkAllColinearPoints()

Result<Bool> MarkAllColinearPoints ( BaseArray< Int32 > &  pointUseless,
Float  epsilonOverride = 0.0 
)
private

◆ MarkAllUselessPoints()

Result<Bool> MarkAllUselessPoints ( BaseArray< Char > &  pointUseless)
private

◆ ReCreateCellWithOnlyUsefulPoints() [1/2]

Result<Bool> ReCreateCellWithOnlyUsefulPoints ( BaseArray< Char > &  pointUseless)
private

◆ ReCreateCellWithOnlyUsefulPoints() [2/2]

Result<Bool> ReCreateCellWithOnlyUsefulPoints ( BaseArray< Int32 > &  pointUseless)
private

◆ CalcAllFaceNormals()

Bool CalcAllFaceNormals ( BaseArray< Vector > &  faceNormals,
Float  scaleValue 
)
private

◆ SetupReverseEdges()

Bool SetupReverseEdges ( )
private

◆ CleanupUnusedPoints()

Result<void> CleanupUnusedPoints ( )
private

◆ TestCurrentDataStructure()

Bool TestCurrentDataStructure ( BaseArray< Char > &  faceRemoved)
private

◆ ExpandCellByValue()

Result<void> ExpandCellByValue ( const BaseArray< Vector > &  planeNormals,
const BaseArray< Int32 > &  edgeToFaceBelonging,
Float  offset,
BaseArray< Vector > &  pointDisplacements 
)
private

◆ ShrinkCellByValue()

Result<Bool> ShrinkCellByValue ( const BaseArray< Vector > &  planeNormals,
Float  offset 
)
private

◆ CutCellOnPlane()

Result<Bool> CutCellOnPlane ( const Pair< Vector, Vector > &  plane,
Int32  planeNeighborIndex = NOTOK 
)
private

◆ CutFaceOnPlane()

Result<Bool> CutFaceOnPlane ( Int  faceIndex,
const Pair< Vector, Vector > &  plane,
const BaseArray< Float > &  pointToCutPlaneDistance,
const BaseArray< Int > &  edgeIntesection,
const BaseArray< Int > &  pointTranslateMap,
BaseArray< CellEdge > &  newEdges,
BaseArray< CellEdge > &  newFaceEdges 
)
private

◆ ProcessInsideFaceAndAddToEdges()

Result<Bool> ProcessInsideFaceAndAddToEdges ( const BaseArray< CellEdge > &  newFaceEdges,
Int  pointCount,
BaseArray< CellEdge > &  newEdges 
)
private

◆ IntersectEdgeOnPlane()

Result<Int> IntersectEdgeOnPlane ( const Pair< Vector, Vector > &  planeBaseArray,
Int  edgeIndex,
BaseArray< Vector > &  newPoints 
)
private

◆ MergePointsInCutData()

Result<void> MergePointsInCutData ( BaseArray< Vector > &  newPoints,
BaseArray< CellEdge > &  newEdges,
BaseArray< Int > &  newFaces,
BaseArray< CellEdge > &  newFaceEdges 
)
private

◆ RemoveIsolatedPoints()

Result<void> RemoveIsolatedPoints ( )
private

◆ FusePoints()

Result<void> FusePoints ( BaseArray< Int > &  affectedPoints)
private

◆ RemoveFace()

Result<void> RemoveFace ( Int  faceIndex,
BaseArray< Int > &  affectedPoints 
)
private

Friends And Related Function Documentation

◆ Voronoi3DImpl

friend class Voronoi3DImpl
friend

Member Data Documentation

◆ _verticesPreIndex

BaseArray<Int> _verticesPreIndex
private

◆ _vertices

BaseArray<Vector> _vertices
private

◆ _edges

BaseArray<CellEdge> _edges
private

◆ _faces

BaseArray<Int> _faces
private

◆ _adjacentCell

BaseArray<Int32> _adjacentCell
private

◆ _isComplex

Bool _isComplex
private