OpenLexocad  27.1
Base::Builder3D Class Reference

#include <Builder3D.h>

Public Member Functions

 Builder3D ()
 Construction. More...
 
virtual ~Builder3D ()
 Destruction. More...
 
void clear (void)
 clear the string buffer More...
 
point set handling
void startPoints (short pointSize=2, float color_r=1.0, float color_g=0.0, float color_b=0.0)
 starts a point set More...
 
void addPoint (float x, float y, float z)
 insert a point in an point set More...
 
void addPoint (const Vector3f &vec)
 add a vector to a point set More...
 
void endPoints (void)
 ends the points set operation More...
 
void addSinglePoint (float x, float y, float z, short pointSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a singular point (without startPoints() & endPoints() ) More...
 
void addSinglePoint (const Base::Vector3f &vec, short pointSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a singular point (without startPoints() & endPoints() ) More...
 
line/direction handling
void addSingleLine (Vector3f pt1, Vector3f pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a line defined by 2 Vector3D More...
 
void addSingleArrow (Vector3f pt1, Vector3f pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2. More...
 
triangle handling
void addSingleTriangle (Vector3f pt0, Vector3f pt1, Vector3f pt2, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a (filled) triangle defined by 3 vectors More...
 
Transformation
void addTransformation (const Base::Matrix4D &)
 adds a transformation More...
 
void addTransformation (const Base::Vector3f &translation, const Base::Vector3f &rotationaxis, float fAngle)
 
text handling
void addText (float pos_x, float pos_y, float pos_z, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 
void addText (const Base::Vector3f &vec, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 
write the result
void saveToLog (void)
 sends the result to the log and gui More...
 
void saveToFile (const char *FileName)
 save the result to a file (*.iv) More...
 

Detailed Description

A Builder class for 3D representations on App level On the application level nothing is known of the visual representation of data. Nevertheless it's often needed to see some 3D information, e.g. points, directions, when you program or debug an algorithm. Builder3D was made for this specific purpose. This class allows you to easily build up a 3D representation of some mathematical and algorithm internals. You can save this representation to a file and view it in an Inventor viewer, or send it to the log. In the case of using the log and a debug FreeCAD the representation will be loaded into the active viewer.

The workflow goes as follows: Create the a Builder3D object and call the methods to insert the graphical elements. After that call either saveToLog() or saveToFile().
Usage:
for ( unsigned long i=0; i<pMesh->CountPoints(); i++ )
{
log3D.addSinglePoint(pMesh->GetPoint(i));
log3D.addText(pMesh->GetPoint(i),"Point");
...
}
log3D.saveToLog();
See also
Base::ConsoleSingleton

Constructor & Destructor Documentation

◆ Builder3D()

Base::Builder3D::Builder3D ( )

Construction.

◆ ~Builder3D()

virtual Base::Builder3D::~Builder3D ( )
virtual

Destruction.

Member Function Documentation

◆ addPoint() [1/2]

void Base::Builder3D::addPoint ( float  x,
float  y,
float  z 
)

insert a point in an point set

◆ addPoint() [2/2]

void Base::Builder3D::addPoint ( const Vector3f vec)

add a vector to a point set

◆ addSingleArrow()

void Base::Builder3D::addSingleArrow ( Vector3f  pt1,
Vector3f  pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2.

◆ addSingleLine()

void Base::Builder3D::addSingleLine ( Vector3f  pt1,
Vector3f  pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a line defined by 2 Vector3D

◆ addSinglePoint() [1/2]

void Base::Builder3D::addSinglePoint ( float  x,
float  y,
float  z,
short  pointSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a singular point (without startPoints() & endPoints() )

◆ addSinglePoint() [2/2]

void Base::Builder3D::addSinglePoint ( const Base::Vector3f vec,
short  pointSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a singular point (without startPoints() & endPoints() )

◆ addSingleTriangle()

void Base::Builder3D::addSingleTriangle ( Vector3f  pt0,
Vector3f  pt1,
Vector3f  pt2,
bool  filled = true,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a (filled) triangle defined by 3 vectors

◆ addText() [1/2]

void Base::Builder3D::addText ( float  pos_x,
float  pos_y,
float  pos_z,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

◆ addText() [2/2]

void Base::Builder3D::addText ( const Base::Vector3f vec,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

◆ addTransformation() [1/2]

void Base::Builder3D::addTransformation ( const Base::Matrix4D )

adds a transformation

◆ addTransformation() [2/2]

void Base::Builder3D::addTransformation ( const Base::Vector3f translation,
const Base::Vector3f rotationaxis,
float  fAngle 
)

◆ clear()

void Base::Builder3D::clear ( void  )

clear the string buffer

◆ endPoints()

void Base::Builder3D::endPoints ( void  )

ends the points set operation

◆ saveToFile()

void Base::Builder3D::saveToFile ( const char *  FileName)

save the result to a file (*.iv)

◆ saveToLog()

void Base::Builder3D::saveToLog ( void  )

sends the result to the log and gui

◆ startPoints()

void Base::Builder3D::startPoints ( short  pointSize = 2,
float  color_r = 1.0,
float  color_g = 0.0,
float  color_b = 0.0 
)

starts a point set


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