Public Member Functions | Static Public Member Functions
DXFSolid Class Reference

MyDXFFile solid class. More...

#include <dxf_solid.hpp>

Inheritance diagram for DXFSolid:
Solid

List of all members.

Public Member Functions

 DXFSolid (MyDXFFile *dxffile, const std::string &layername)
 Constructor for making a solid from a DXF-file layer.
 DXFSolid (std::istream &is)
 Constructor for loading solid data from stream is.
virtual ~DXFSolid ()
 Destructor.
virtual bool inside (const Vec3D &x) const
 Return if 3D point x in simulation space is inside solid.
void debug_print (std::ostream &os) const
 Print debugging information to stream os.
void define_2x3_mapping (Vec3D(*func)(const Vec3D &))
 Define mapping from 3D space to 2D space.
void reset_transformation (void)
 Set transformation to unity.
void set_transformation (const Transformation &T)
 Set transformation.
void translate (const Vec3D &dx)
 Translate solid.
void scale (const Vec3D &sx)
 Scale solid.
void rotate_x (double a)
 Rotate solid around x-axis.
void rotate_y (double a)
 Rotate solid around y-axis.
void rotate_z (double a)
 Rotate solid around z-axis.
virtual void save (std::ostream &os) const
 Saves solid data to stream os.

Static Public Member Functions

static Vec3D unity (const Vec3D &x)
 Unity transformation.
static Vec3D rotx (const Vec3D &x)
 Solid of revolution around x-axis.
static Vec3D roty (const Vec3D &x)
 Solid of revolution around y-axis.
static Vec3D rotz (const Vec3D &x)
 Solid of revolution around z-axis.

Detailed Description

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 $ (x,y,z) \Rightarrow (x,y) $.


Constructor & Destructor Documentation

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 DXFSolid::~DXFSolid ( ) [virtual]

Destructor.


Member Function Documentation

void DXFSolid::debug_print ( std::ostream &  os) const [virtual]

Print debugging information to stream os.

Implements Solid.

void DXFSolid::define_2x3_mapping ( Vec3D(*)(const Vec3D &)  func)

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 bool DXFSolid::inside ( const Vec3D x) const [virtual]

Return if 3D point x in simulation space is inside solid.

Implements Solid.

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.

static Vec3D DXFSolid::rotx ( const Vec3D x) [static]

Solid of revolution around x-axis.

Tranformation: $ (x,y,z) \Rightarrow (x,\sqrt(y^2+z^2)) $.

static Vec3D DXFSolid::roty ( const Vec3D x) [static]

Solid of revolution around y-axis.

Tranformation: $ (x,y,z) \Rightarrow (y,\sqrt(x^2+z^2)) $.

static Vec3D DXFSolid::rotz ( const Vec3D x) [static]

Solid of revolution around z-axis.

Tranformation: $ (x,y,z) \Rightarrow (z,\sqrt(x^2+y^2)) $.

virtual void DXFSolid::save ( std::ostream &  os) const [virtual]

Saves solid data to stream os.

Implements Solid.

void DXFSolid::scale ( const Vec3D sx)

Scale solid.

Set transformation.

Sets the primary 3D to 3D transformation as a copy of transformation of T.

void DXFSolid::translate ( const Vec3D dx)

Translate solid.

static Vec3D DXFSolid::unity ( const Vec3D x) [static]

Unity transformation.

Default tranformation: $ (x,y,z) \Rightarrow (x,y) $.


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