MyDXFFile solid class. More...
#include <dxf_solid.hpp>
Public Member Functions | |
DXFSolid (MyDXFFile *dxffile, const std::string &layername) | |
Constructor for making a solid from a DXF-file layer. More... | |
DXFSolid (std::istream &is) | |
Constructor for loading solid data from stream is. More... | |
virtual | ~DXFSolid () |
Destructor. More... | |
virtual bool | inside (const Vec3D &x) const |
Return if 3D point x in simulation space is inside solid. More... | |
void | debug_print (std::ostream &os) const |
Print debugging information to stream os. More... | |
void | define_2x3_mapping (Vec3D(*func)(const Vec3D &)) |
Define mapping from 3D space to 2D space. More... | |
void | reset_transformation (void) |
Set transformation to unity. More... | |
void | set_transformation (const Transformation &T) |
Set transformation. More... | |
void | translate (const Vec3D &dx) |
Translate solid. More... | |
void | scale (const Vec3D &sx) |
Scale solid. More... | |
void | rotate_x (double a) |
Rotate solid around x-axis. More... | |
void | rotate_y (double a) |
Rotate solid around y-axis. More... | |
void | rotate_z (double a) |
Rotate solid around z-axis. More... | |
virtual void | save (std::ostream &os) const |
Saves solid data to stream os. More... | |
![]() | |
virtual | ~Solid () |
Virtual destructor. More... | |
Static Public Member Functions | |
static Vec3D | unity (const Vec3D &x) |
Unity transformation. More... | |
static Vec3D | rotx (const Vec3D &x) |
Solid of revolution around x-axis. More... | |
static Vec3D | roty (const Vec3D &x) |
Solid of revolution around y-axis. More... | |
static Vec3D | rotz (const Vec3D &x) |
Solid of revolution around z-axis. More... | |
MyDXFFile solid class.
DXFSolid is an implementation of Solid using MyDXFFile entities. The solid is built from a two dimensional area defined by enclosing the area with dxf path objects in one layer. The solid volume in (three dimensional) simulation space is defined using a combination of two transformations. The first transformation is from simulation space to intermediate 3D space and it is made using the Transformation class. These intermediate 3D space points are then mapped to two dimensional dxf space using an optional user defined function. The Transformation defaults to unity matrix and if the user defined function is left undefined it defaults to .
DXFSolid::DXFSolid | ( | MyDXFFile * | dxffile, |
const std::string & | layername | ||
) |
Constructor for making a solid from a DXF-file layer.
The entities from the DXF-file layer layername are copied to DXFSolid object. No dependency stays between dxffile and the object constructed. The transformations are initialized to unity.
DXFSolid::DXFSolid | ( | std::istream & | is | ) |
Constructor for loading solid data from stream is.
|
virtual |
Destructor.
|
virtual |
Print debugging information to stream os.
Implements Solid.
Define mapping from 3D space to 2D space.
The mapping function can be user defined or one of the predefined functions: unity(), rotx(), roty() or rotz(). The mapping function can return a vector with NaN components for guaranteed inside solid result. Similarly infinity is guaranteed to give free space result.
|
virtual |
Return if 3D point x in simulation space is inside solid.
Implements Solid.
void DXFSolid::reset_transformation | ( | void | ) |
Set transformation to unity.
Resets the primary 3D to 3D transformation to unity.
void DXFSolid::rotate_x | ( | double | a | ) |
Rotate solid around x-axis.
Rotate around x-axis for a radians.
void DXFSolid::rotate_y | ( | double | a | ) |
Rotate solid around y-axis.
Rotate around y-axis for a radians.
void DXFSolid::rotate_z | ( | double | a | ) |
Rotate solid around z-axis.
Rotate around z-axis for a radians.
Solid of revolution around x-axis.
Tranformation: .
Solid of revolution around y-axis.
Tranformation: .
Solid of revolution around z-axis.
Tranformation: .
|
virtual |
Saves solid data to stream os.
Implements Solid.
void DXFSolid::scale | ( | const Vec3D & | sx | ) |
Scale solid.
void DXFSolid::set_transformation | ( | const Transformation & | T | ) |
Set transformation.
Sets the primary 3D to 3D transformation as a copy of transformation of T.
void DXFSolid::translate | ( | const Vec3D & | dx | ) |
Translate solid.
Unity transformation.
Default tranformation: .