MeshCore::MeshBuilder Class Reference

Class for creating the mesh structure by adding facets. More...

#include <Builder.h>

Helper class

class MeshKernel
 
 MeshBuilder (MeshKernel &rclM)
 
 ~MeshBuilder ()
 
void SetTolerance (float)
 Set the tolerance for the comparison of points. More...
 
void Initialize (size_t ctFacets, bool deletion=true)
 Initializes the class. More...
 
void AddFacet (const MeshGeomFacet &facet, bool takeFlag=false, bool takeProperty=false)
 adding facets More...
 
void AddFacet (const Base::Vector3f &pt1, const Base::Vector3f &pt2, const Base::Vector3f &pt3, const Base::Vector3f &normal, unsigned char flag=0, unsigned long prop=0)
 Add new facet. More...
 
void AddFacet (Base::Vector3f *facetPoints, unsigned char flag=0, unsigned long prop=0)
 Add new facet. More...
 
void Finish (bool freeMemory=false)
 Finishes building up the mesh structure. More...
 

Detailed Description

Class for creating the mesh structure by adding facets.

Building the structure needs 3 steps:

  1. initializing
  2. adding the facets
  3. finishing
    // Sample Code for building a mesh structure
    MeshBuilder builder(someMeshReference);
    builder.Initialize(numberOfFacets);
    ...
    for (...)
    builder.AddFacet(...);
    ...
    builder.Finish();
    Author
    Berthold Grupp

Constructor & Destructor Documentation

◆ MeshBuilder()

MeshBuilder::MeshBuilder ( MeshKernel rclM)

◆ ~MeshBuilder()

MeshBuilder::~MeshBuilder ( )

Member Function Documentation

◆ AddFacet() [1/3]

void MeshBuilder::AddFacet ( Base::Vector3f facetPoints,
unsigned char  flag = 0,
unsigned long  prop = 0 
)

Add new facet.

Parameters
facetPointsArray of vectors (size 4) in order of vec1, vec2, vec3, normal
flag
prop

◆ AddFacet() [2/3]

void MeshBuilder::AddFacet ( const Base::Vector3f pt1,
const Base::Vector3f pt2,
const Base::Vector3f pt3,
const Base::Vector3f normal,
unsigned char  flag = 0,
unsigned long  prop = 0 
)

Add new facet.

References AddFacet().

◆ AddFacet() [3/3]

void MeshBuilder::AddFacet ( const MeshGeomFacet facet,
bool  takeFlag = false,
bool  takeProperty = false 
)

adding facets

Add new facet

Parameters
facetthe facet
takeFlagif true the flag from the MeshGeomFacet will be taken
takeProperty

References AddFacet(), and MeshCore::MeshGeomFacet::GetNormal().

Referenced by AddFacet(), MeshCore::MeshInput::LoadAsciiSTL(), MeshCore::MeshInput::LoadBinarySTL(), and MeshCore::MeshKernel::operator=().

◆ Finish()

void MeshBuilder::Finish ( bool  freeMemory = false)

Finishes building up the mesh structure.

Must be done after adding facets.

Parameters
freeMemoryif false (default) only the memory of internal structures gets freed, otherwise additional unneeded memory in the mesh structure is tried to be freed.
Remarks
If you have called AddFacet() as many times as specified in Initialize() then absolutely no memory is wasted and you can leave the default value.

Referenced by MeshCore::MeshInput::LoadAsciiSTL(), MeshCore::MeshInput::LoadBinarySTL(), and MeshCore::MeshKernel::operator=().

◆ Initialize()

void MeshBuilder::Initialize ( size_t  ctFacets,
bool  deletion = true 
)

Initializes the class.

Must be done before adding facets

Parameters
ctFacetscount of facets.
deletionif true (default) the mesh-kernel will be cleared otherwise you can add new facets on an existing mesh-kernel
Remarks
To be efficient you should add exactly ctFacets with AddFacet(), otherwise you'll possibly run into wastage of memory and performance problems.

Referenced by MeshCore::MeshInput::LoadAsciiSTL(), MeshCore::MeshInput::LoadBinarySTL(), and MeshCore::MeshKernel::operator=().

◆ SetTolerance()

void MeshBuilder::SetTolerance ( float  fTol)

Set the tolerance for the comparison of points.

Normally you don't need to set the tolerance.

Friends And Related Function Documentation

◆ MeshKernel

friend class MeshKernel
friend

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