DGtal 1.4.0
|
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection. More...
#include <DGtal/io/boards/Board3DTo2D.h>
Public Types | |
enum | CairoType { CairoPDF , CairoPNG , CairoPS , CairoEPS , CairoSVG } |
Public Types inherited from DGtal::Display3D< Z3i::Space, Z3i::KSpace > | |
enum | StreamKey |
typedef Display3D< Space, KSpace > | Self |
typedef Space::RealPoint | RealPoint |
RealPoint type. | |
typedef Space::RealVector | RealVector |
RealVector type. | |
typedef CanonicEmbedder< Space > | Embedder |
typedef CanonicCellEmbedder< KSpace > | CellEmbedder |
typedef CanonicSCellEmbedder< KSpace > | SCellEmbedder |
typedef int(* | SelectCallbackFct) (void *viewer, DGtal::int32_t name, void *data) |
Select callback function type. | |
typedef std::map< DGtal::int32_t, std::vector< QuadD3D > > | QuadsMap |
The type that maps identifier name -> vector of QuadD3D. | |
typedef std::map< DGtal::int32_t, std::vector< CubeD3D > > | CubesMap |
The type that maps identifier name -> vector of CubeD3D. | |
typedef std::map< std::string, std::string > | ModeMapping |
typedef std::map< std::string, CountedPtr< DrawableWithDisplay3D > > | StyleMapping |
Public Member Functions | |
Board3DTo2D () | |
Board3DTo2D (KSpace KSEmb) | |
~Board3DTo2D () | |
std::string | className () const |
void | setCameraPosition (double x, double y, double z) |
void | setCameraDirection (double x, double y, double z) |
void | setCameraUpVector (double x, double y, double z) |
void | setNearFar (double _near, double _far) |
void | saveCairo (const char *filename, CairoType type, int bWidth, int bHeight) |
Board3DTo2D & | operator<< (const DGtal::Color &aColor) |
template<typename TDrawableWithDisplay3D > | |
Board3DTo2D & | operator<< (const TDrawableWithDisplay3D &object) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Public Member Functions inherited from DGtal::Display3D< Z3i::Space, Z3i::KSpace > | |
BOOST_CONCEPT_ASSERT ((concepts::CSpace< Space >)) | |
virtual | ~Display3D () |
Display3D (const KSpace &KSEmb) | |
Display3D () | |
Display3D (const Display3D &)=delete | |
Copy constructor. Deleted. | |
Display3D (Display3D &&)=delete | |
Move constructor. Deleted. | |
Display3D & | operator= (const Display3D &)=delete |
Assignment operator. Deleted. | |
Display3D & | operator= (Display3D &&)=delete |
Move operator. Deleted. | |
const Embedder & | embedder () const |
const CellEmbedder & | cellEmbedder () const |
const SCellEmbedder & | sCellEmbedder () const |
const KSpace & | space () const |
virtual void | setFillColor (DGtal::Color aColor) |
virtual void | setFillTransparency (unsigned char alpha) |
virtual void | setLineColor (DGtal::Color aColor) |
virtual DGtal::Color | getFillColor () |
virtual DGtal::Color | getLineColor () |
virtual void | setKSpace (const KSpace &aKSpace) |
void | setName3d (DGtal::int32_t name=-1) |
DGtal::int32_t | name3d () const |
void | setSelectCallback3D (SelectCallbackFct fct, void *data, DGtal::int32_t min_name, DGtal::int32_t max_name) |
SelectCallbackFct | getSelectCallback3D (DGtal::int32_t aName, void *&data) const |
void | addClippingPlane (double a, double b, double c, double d, bool drawPlane) |
std::string | getMode (const std::string &objectName) const |
void | createNewLineList (std::string s="") |
void | createNewBallList (std::string s="") |
DGtal::int32_t | createNewCubeList () |
bool | deleteCubeList (const DGtal::int32_t name) |
DGtal::int32_t | createNewQuadList () |
bool | deleteQuadList (const DGtal::int32_t name) |
void | createNewTriangleList (std::string s="") |
void | createNewPolygonList (std::string s="") |
void | addQuad (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4) |
void | addQuadWithNormal (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4, const RealPoint &n, const bool enableReorientation, const bool enableDoubleFace=false) |
void | addQuadFromSurfelCenter (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel) |
void | addQuadFromSurfelCenterWithNormal (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, const RealVector &aNormal, const bool enableReorientation, const bool sign, const bool enableDoubleFace=false) |
void | addTriangle (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3) |
void | addPolygon (const std::vector< RealPoint > &vertices) |
void | addLine (const RealPoint &p1, const RealPoint &p2, const double width=0.03) |
void | addCube (const RealPoint ¢er, double width=1.0) |
void | addBall (const RealPoint ¢er, const double radius=0.5, const unsigned int resolution=30) |
void | addPrism (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, double sizeShiftFactor, double sizeFactor=1.0, bool isSigned=false, bool aSign=true) |
void | addBasicSurfel (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel) |
void | addCone (const RealPoint &p1, const RealPoint &p2, double width=0.08) |
void | addCylinder (const RealPoint &p1, const RealPoint &p2, const double width=0.02) |
void | updateBoundingBox (const RealPoint &point) |
void | exportToMesh (Mesh< RealPoint > &aMesh) const |
Display3D & | operator<< (const TDrawableWithDisplay3D &object) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
void | clear () |
RealPoint | embed (const typename Space::Point &dp) const |
RealPoint | embedKS (const typename KSpace::SCell &cell) const |
RealPoint | embedKS (const DGtal::TransformedPrism &aTrans) const |
RealPoint | embedK (const typename KSpace::Cell &cell) const |
Data Fields | |
DGtal::Color | myDefaultColor |
default color | |
Data Fields inherited from DGtal::Display3D< Z3i::Space, Z3i::KSpace > | |
ModeMapping | myModes |
StyleMapping | myStyles |
bool | myBoundingPtEmptyTag |
True if the bounding box is empty (no objects added) | |
double | myBoundingPtUp [3] |
upper point of the bounding box | |
double | myBoundingPtLow [3] |
lower point of the bouding box | |
Protected Member Functions | |
virtual void | init () |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CSpace< Space >)) | |
void | precompute_projection_matrix () |
void | project (double x3d, double y3d, double z3d, double &x2d, double &y2d) |
Static Private Member Functions | |
static void | TransposeMt (double tmat[16], double mat[16]) |
static void | MulMt (double v[4], double mat[16], double b[4]) |
static void | LookAtMt (double mat[16], double eyex, double eyey, double eyez, double dirx, double diry, double dirz, double upx, double upy, double upz) |
Private Attributes | |
int | Viewport [4] |
2D viewport | |
double | matrix [16] |
projection matrix | |
double | camera_position [3] |
camera position | |
double | camera_direction [3] |
camera direction | |
double | camera_upVector [3] |
camera up-vector | |
double | ZNear |
znear distance | |
double | ZFar |
zfar distance | |
Additional Inherited Members | |
Static Protected Member Functions inherited from DGtal::Display3D< Z3i::Space, Z3i::KSpace > | |
static void | cross (double dst[3], double srcA[3], double srcB[3]) |
static void | normalize (double vec[3]) |
Protected Attributes inherited from DGtal::Display3D< Z3i::Space, Z3i::KSpace > | |
KSpace | myKSpace |
The Khalimsky space. | |
Embedder * | myEmbedder |
an embeder from a dgtal space point to a real space point | |
CellEmbedder * | myCellEmbedder |
an embeder from a unsigned khalimsky space point to a real space point | |
SCellEmbedder * | mySCellEmbedder |
an embeder from a signed khalimsky space point to a real space point | |
DGtal::Color | myCurrentFillColor |
DGtal::Color | myCurrentLineColor |
double | myCurrentfShiftVisuPrisms |
std::vector< std::vector< LineD3D > > | myLineSetList |
std::vector< std::vector< BallD3D > > | myBallSetList |
std::vector< ClippingPlaneD3D > | myClippingPlaneList |
std::vector< QuadD3D > | myPrismList |
QuadsMap | myQuadsMap |
std::vector< std::vector< TriangleD3D > > | myTriangleSetList |
Represents all the triangles drawn in the Display3D. | |
std::vector< std::vector< PolygonD3D > > | myPolygonSetList |
Represents all the polygon drawn in the Display3D. | |
CubesMap | myCubesMap |
std::vector< std::string > | myCubeSetNameList |
std::vector< std::string > | myLineSetNameList |
std::vector< std::string > | myBallSetNameList |
std::vector< std::string > | myClippingPlaneNameList |
std::vector< std::string > | myPrismNameList |
std::vector< std::string > | myQuadSetNameList |
std::vector< std::string > | myTriangleSetNameList |
std::vector< std::string > | myPolygonSetNameList |
DGtal::int32_t | myName3d |
std::set< SelectCallbackFctStore > | mySelectCallBackFcts |
bool | myBoundingPtChangedTag |
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Description of class 'Board3DTo2D'
Definition at line 70 of file Board3DTo2D.h.
Cairo type for save files.
Enumerator | |
---|---|
CairoPDF | |
CairoPNG | |
CairoPS | |
CairoEPS | |
CairoSVG |
Definition at line 82 of file Board3DTo2D.h.
DGtal::Board3DTo2D< Space, KSpace >::Board3DTo2D | ( | ) |
Constructor.
|
inline |
Constructor with a khalimsky space
KSEmb | the Khalimsky space |
Definition at line 93 of file Board3DTo2D.h.
References DGtal::Board3DTo2D< Space, KSpace >::init().
|
inline |
Definition at line 100 of file Board3DTo2D.h.
|
private |
|
inline |
Definition at line 106 of file Board3DTo2D.h.
|
protectedvirtual |
init function (should be in Constructor).
Referenced by DGtal::Board3DTo2D< Space, KSpace >::Board3DTo2D().
bool DGtal::Board3DTo2D< Space, KSpace >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
staticprivate |
Compute 4x4 LookAt matrix.
mat | destination matrix. |
eyex | x position of eye. |
eyey | y position of eye. |
eyez | z position of eye. |
dirx | x direction of eye. |
diry | y direction of eye. |
dirz | z director of eye. |
upx | x coordinate of up-vector. |
upy | y coordinate of up-vector. |
upz | z coordinate of up-vector. |
|
staticprivate |
Multiply a 3d vector by a 4x4 matrix.
v | destination vector. |
mat | source matrix. |
b | source vector. |
Board3DTo2D & DGtal::Board3DTo2D< Space, KSpace >::operator<< | ( | const DGtal::Color & | aColor | ) |
Set the default color for future drawing.
aColor | a DGtal::Color (allow to set a trasnparency value). |
Board3DTo2D & DGtal::Board3DTo2D< Space, KSpace >::operator<< | ( | const TDrawableWithDisplay3D & | object | ) |
Draws the drawable [object] in this board. It should satisfy the concept CDrawableWithDisplay3D, which requires for instance a method setStyle( Board3DTo2D & ).
object | any drawable object. |
|
private |
Precompute 4x4 projection matrix for 3D->2D projection.
|
private |
Project a 3d point (3D->2D).
x3d | x position of the 3d point. |
y3d | y position of the 3d point. |
z3d | z position of the 3d point. |
x2d | x destination projection position of the 2d point. |
y2d | y destination projection position of the 2d point. |
void DGtal::Board3DTo2D< Space, KSpace >::saveCairo | ( | const char * | filename, |
CairoType | type, | ||
int | bWidth, | ||
int | bHeight ) |
Save a Cairo image.
filename | filename of the image to save. |
type | type of the image to save (CairoPDF, CairoPNG, CairoPS, CairoEPS, CairoSVG). |
bWidth | width of the image to save. |
bHeight | height of the image to save. |
Referenced by main().
void DGtal::Board3DTo2D< Space, KSpace >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
inline |
Set camera direction.
x | x direction. |
y | y direction. |
z | z direction. |
Definition at line 126 of file Board3DTo2D.h.
References DGtal::Board3DTo2D< Space, KSpace >::camera_direction.
|
inline |
Set camera position.
x | x position. |
y | y position. |
z | z position. |
Definition at line 117 of file Board3DTo2D.h.
References DGtal::Board3DTo2D< Space, KSpace >::camera_position.
|
inline |
Set camera up-vector.
x | x coordinate of up-vector. |
y | y coordinate of up-vector. |
z | z coordinate of up-vector. |
Definition at line 135 of file Board3DTo2D.h.
References DGtal::Board3DTo2D< Space, KSpace >::camera_upVector.
|
inline |
Set near and far distance, too near or too far end up not visible.
_near | near distance. |
_far | far distance. |
Definition at line 143 of file Board3DTo2D.h.
References DGtal::Board3DTo2D< Space, KSpace >::ZFar, and DGtal::Board3DTo2D< Space, KSpace >::ZNear.
|
staticprivate |
Transpose a 4x4 matrix.
tmat | destination matrix. |
mat | source matrix. |
|
private |
camera direction
Definition at line 266 of file Board3DTo2D.h.
Referenced by DGtal::Board3DTo2D< Space, KSpace >::setCameraDirection().
|
private |
camera position
Definition at line 265 of file Board3DTo2D.h.
Referenced by DGtal::Board3DTo2D< Space, KSpace >::setCameraPosition().
|
private |
camera up-vector
Definition at line 267 of file Board3DTo2D.h.
Referenced by DGtal::Board3DTo2D< Space, KSpace >::setCameraUpVector().
|
private |
projection matrix
Definition at line 263 of file Board3DTo2D.h.
DGtal::Color DGtal::Board3DTo2D< Space, KSpace >::myDefaultColor |
default color
The associated map type for storing possible modes used for displaying for digital objects. The associated map type for storing the default styles of digital objects.
Definition at line 169 of file Board3DTo2D.h.
|
private |
2D viewport
Definition at line 262 of file Board3DTo2D.h.
|
private |
zfar distance
Definition at line 270 of file Board3DTo2D.h.
Referenced by DGtal::Board3DTo2D< Space, KSpace >::setNearFar().
|
private |
znear distance
Definition at line 269 of file Board3DTo2D.h.
Referenced by DGtal::Board3DTo2D< Space, KSpace >::setNearFar().