KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FACET Class Reference

#include <wrlfacet.h>

Public Member Functions

 FACET ()
 
void Init ()
 
bool HasMinPoints ()
 
bool HasColors ()
 
void AddVertex (WRLVEC3F &aVertex, int aIndex)
 Add the vertex and its associated index to the internal list of polygon vertices. More...
 
void AddColor (const SGCOLOR &aColor)
 Add the given RGB color to the internal list. More...
 
float CalcFaceNormal ()
 Calculate the normal to the facet assuming a CCW orientation and perform the calculation of the angle weighted vertex normals. More...
 
void Renormalize (float aMaxValue)
 
void CalcVertexNormal (int aIndex, std::list< FACET * > &aFacetList, float aCreaseAngle)
 Calculate the weighted normal for the given vertex. More...
 
bool GetWeightedNormal (int aIndex, WRLVEC3F &aNorm)
 Retrieve the angle weighted normal for the given vertex index. More...
 
bool GetFaceNormal (WRLVEC3F &aNorm)
 Retrieve the normal for this facet. More...
 
bool GetData (std::vector< WRLVEC3F > &aVertexList, std::vector< WRLVEC3F > &aNormalsList, std::vector< SGCOLOR > &aColorsList, WRL1_ORDER aVertexOrder)
 Package the internal data as triangles with corresponding per-vertex normals. More...
 
int GetMaxIndex ()
 
void CollectVertices (std::vector< std::list< FACET * > > &aFacetList)
 Add a pointer to this object at each position within aFacetList referenced by the internal vertex indices. More...
 

Private Attributes

std::vector< WRLVEC3Fvertices
 
std::vector< SGCOLORcolors
 
std::vector< int > indices
 
WRLVEC3F face_normal
 
std::vector< WRLVEC3Fnorms
 
std::vector< WRLVEC3Fvnweight
 
int maxIdx
 

Detailed Description

Definition at line 42 of file wrlfacet.h.

Constructor & Destructor Documentation

◆ FACET()

FACET::FACET ( )

Definition at line 149 of file wrlfacet.cpp.

References face_normal, and maxIdx.

Member Function Documentation

◆ AddColor()

void FACET::AddColor ( const SGCOLOR aColor)

Add the given RGB color to the internal list.

For per-face coloring only a single color needs to be specified. For a per-vertex coloring the color must be specified for each vertex.

Definition at line 204 of file wrlfacet.cpp.

References colors.

Referenced by WRL2FACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().

◆ AddVertex()

void FACET::AddVertex ( WRLVEC3F aVertex,
int  aIndex 
)

Add the vertex and its associated index to the internal list of polygon vertices.

Definition at line 191 of file wrlfacet.cpp.

References indices, maxIdx, and vertices.

Referenced by WRL2FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().

◆ CalcFaceNormal()

float FACET::CalcFaceNormal ( )

Calculate the normal to the facet assuming a CCW orientation and perform the calculation of the angle weighted vertex normals.

Returns
is the max. magnitude of any component of the normal or zero if there is a fault or the normal has already been calculated.

Definition at line 212 of file wrlfacet.cpp.

References face_normal, VCalcCosAngle(), VCalcTriNorm(), vertices, and vnweight.

◆ CalcVertexNormal()

void FACET::CalcVertexNormal ( int  aIndex,
std::list< FACET * > &  aFacetList,
float  aCreaseAngle 
)

Calculate the weighted normal for the given vertex.

Parameters
aIndexis the VRML file's Vertex Index for the vertex to be processed.
aFacetListis the list of all faces which share this vertex.

Definition at line 329 of file wrlfacet.cpp.

References face_normal, indices, LOWER_LIMIT, norms, VCalcCosAngle(), vertices, and vnweight.

◆ CollectVertices()

void FACET::CollectVertices ( std::vector< std::list< FACET * > > &  aFacetList)

Add a pointer to this object at each position within aFacetList referenced by the internal vertex indices.

Definition at line 642 of file wrlfacet.cpp.

References indices, maxIdx, and vertices.

◆ GetData()

bool FACET::GetData ( std::vector< WRLVEC3F > &  aVertexList,
std::vector< WRLVEC3F > &  aNormalsList,
std::vector< SGCOLOR > &  aColorsList,
WRL1_ORDER  aVertexOrder 
)

Package the internal data as triangles with corresponding per-vertex normals.

Parameters
aVertexListis the list of vertices to add to.
aNormalsListis the list of per-vertex normals to add to.
aColorsListis the list of per-vertex colors (if any) to add to.
aVertexOrderinforms the function of the vertex winding order.

Definition at line 462 of file wrlfacet.cpp.

References colors, norms, and vertices.

◆ GetFaceNormal()

bool FACET::GetFaceNormal ( WRLVEC3F aNorm)

Retrieve the normal for this facet.

Parameters
aNormwill hold the result.

Definition at line 445 of file wrlfacet.cpp.

References face_normal, vertices, and vnweight.

◆ GetMaxIndex()

int FACET::GetMaxIndex ( )
inline

Definition at line 109 of file wrlfacet.h.

References maxIdx.

◆ GetWeightedNormal()

bool FACET::GetWeightedNormal ( int  aIndex,
WRLVEC3F aNorm 
)

Retrieve the angle weighted normal for the given vertex index.

Parameters
aIndexis the VRML file's Vertex Index for the vertex to be processed.
aNormwill hold the result.

Definition at line 412 of file wrlfacet.cpp.

References indices, vertices, and vnweight.

◆ HasColors()

bool FACET::HasColors ( )

Definition at line 182 of file wrlfacet.cpp.

References colors.

Referenced by WRL1FACESET::TranslateToSG().

◆ HasMinPoints()

bool FACET::HasMinPoints ( )

◆ Init()

void FACET::Init ( )

◆ Renormalize()

void FACET::Renormalize ( float  aMaxValue)

Definition at line 663 of file wrlfacet.cpp.

References LOWER_LIMIT, and vnweight.

Member Data Documentation

◆ colors

std::vector< SGCOLOR > FACET::colors
private

Definition at line 122 of file wrlfacet.h.

Referenced by AddColor(), GetData(), HasColors(), and Init().

◆ face_normal

WRLVEC3F FACET::face_normal
private

Definition at line 125 of file wrlfacet.h.

Referenced by CalcFaceNormal(), CalcVertexNormal(), FACET(), GetFaceNormal(), and Init().

◆ indices

std::vector< int > FACET::indices
private

Definition at line 123 of file wrlfacet.h.

Referenced by AddVertex(), CalcVertexNormal(), CollectVertices(), GetWeightedNormal(), and Init().

◆ maxIdx

int FACET::maxIdx
private

Definition at line 129 of file wrlfacet.h.

Referenced by AddVertex(), CollectVertices(), FACET(), GetMaxIndex(), and Init().

◆ norms

std::vector< WRLVEC3F > FACET::norms
private

Definition at line 126 of file wrlfacet.h.

Referenced by CalcVertexNormal(), GetData(), and Init().

◆ vertices

std::vector< WRLVEC3F > FACET::vertices
private

◆ vnweight

std::vector< WRLVEC3F > FACET::vnweight
private

The documentation for this class was generated from the following files: