DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Data Fields | Protected Attributes | Private Member Functions
DGtal::Display3D Class Reference

#include <Display3D.h>

Inheritance diagram for DGtal::Display3D:
Inheritance graph
[legend]
Collaboration diagram for DGtal::Display3D:
Collaboration graph
[legend]

Data Structures

struct  clippingPlaneD3D
struct  lineD3D
struct  pointD3D
struct  polygonD3D
struct  quadD3D
struct  triangleD3D
struct  voxelD3D

Public Types

enum  StreamKey { addNewList, updateDisplay, shiftSurfelVisu }
typedef std::map< std::string,
std::string > 
ModeMapping
typedef std::map< std::string,
CountedPtr
< DrawableWithDisplay3D > > 
StyleMapping

Public Member Functions

virtual ~Display3D ()
 Display3D ()
virtual void setFillColor (DGtal::Color aColor)
virtual void setLineColor (DGtal::Color aColor)
virtual DGtal::Color getFillColor ()
virtual DGtal::Color getLineColor ()
virtual void addClippingPlane (double a, double b, double c, double d, bool drawPlane)
virtual void setCameraUpVector (double, double, double)
virtual void setCameraPosition (double, double, double)
virtual void setNearFar (double, double)
virtual void setCameraDirection (double, double, double)
virtual std::string getMode (const std::string &objectName) const
virtual void createNewLineList ()
virtual void createNewPointList ()
virtual void createNewVoxelList (bool depthTest=true)
virtual void addQuad (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, DGtal::Color aColor)
virtual void addTriangle (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, DGtal::Color aColor)
virtual void addPolygon (std::vector< pointD3D > vectPointsPolygon, DGtal::Color aColor)
virtual void addLine (double x1, double y1, double z1, double x2, double y2, double z2, const DGtal::Color &color=DGtal::Color(20, 20, 20, 200), double width=1.5)
virtual void addVoxel (DGtal::int64_t x, DGtal::int64_t y, DGtal::int64_t z, DGtal::Color color=DGtal::Color(220, 220, 220), double width=0.5, bool withWire=false)
virtual void addPoint (double x, double y, double z, const DGtal::Color &color=DGtal::Color(200, 20, 20), double size=40)
virtual void addKSSurfel (double x, double y, double z, bool xSurfel, bool ySurfel, bool zSurfel, double sizeShiftFactor, double positionShift=0.0, double sizeFactor=1.0, bool isSigned=false, bool aSign=true, bool basicMode=false)
virtual void addKSVoxel (int x, int y, int z, double sizeFactor=0.94)
virtual void addKSPointel (double x, double y, double z, double size=0.1, bool isSigned=false, bool aSign=true)
virtual void addKSLinel (double x1, double y1, double z1, double x2, double y2, double z2, double width=0.02, bool isSigned=false, bool aSign=true)
void updateBoundingBox (double x, double y, double z)
void exportToMesh (MeshFromPoints< Display3D::pointD3D > &aMesh) const
template<typename TDrawableWithDisplay3D >
Display3Doperator<< (const TDrawableWithDisplay3D &object)
void selfDisplay (std::ostream &out) const
bool isValid () const
void setScale (float sx, float sy, float sz)

Data Fields

ModeMapping myModes
StyleMapping myStyles
bool myBoundingPtEmptyTag
double myBoundingPtUp [3]
double myBoundingPtLow [3]

Protected Attributes

float myScaleX
float myScaleY
float myScaleZ
DGtal::Color myCurrentFillColor
DGtal::Color myCurrentLineColor
double myCurrentfShiftVisuKSSurfels
std::vector< std::vector
< voxelD3D > > 
myVoxelSetList
std::vector< std::vector
< lineD3D > > 
myLineSetList
std::vector< std::vector
< pointD3D > > 
myPointSetList
std::vector< clippingPlaneD3DmyClippingPlaneList
std::vector< quadD3DmyKSSurfelList
std::vector< pointD3DmyKSPointelList
std::vector< lineD3DmyKSLinelList
std::vector< quadD3DmyQuadList
std::vector< triangleD3DmyTriangleList
std::vector< polygonD3DmyPolygonList
std::vector< bool > myListVoxelDepthTest
float myMeshDefaultLineWidth

Private Member Functions

 Display3D (const Display3D &other)
Display3Doperator= (const Display3D &other)

Detailed Description

Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like PointVector, DigitalSetBySTLSet, Object ...). The class Viewer3D and Board3DTo2D implement two different ways to display 3D objects. The first one (Viewer3D), permits an interactive visualisation (based on OpenGL ) and the second one (Board3DTo2D) provides 3D visualisation from 2D vectorial display (based on the CAIRO library)

Description of class 'Display3D'

See also:
Viewer3D, Board3DTo2D
Examples:
io/display3DToOFF.cpp.

Definition at line 74 of file Display3D.h.


Member Typedef Documentation

typedef std::map< std::string, std::string > DGtal::Display3D::ModeMapping

The associated map type for storing possible modes used for displaying for digital objects.

Definition at line 566 of file Display3D.h.

The associated map type for storing the default styles of digital objects.

Definition at line 574 of file Display3D.h.


Member Enumeration Documentation

Enumerator:
addNewList 
updateDisplay 
shiftSurfelVisu 

Definition at line 235 of file Display3D.h.


Constructor & Destructor Documentation

virtual DGtal::Display3D::~Display3D ( )
inlinevirtual

Destructor.

Definition at line 220 of file Display3D.h.

{};
DGtal::Display3D::Display3D ( )
inline

Definition at line 223 of file Display3D.h.

References myBoundingPtEmptyTag, myCurrentFillColor, myCurrentLineColor, myScaleX, myScaleY, and myScaleZ.

{
myCurrentFillColor = Color ( 220, 220, 220 );
myCurrentLineColor = Color ( 22, 22, 222, 50 );
myScaleX=1.0;
myScaleY=1.0;
myScaleZ=1.0;
};
DGtal::Display3D::Display3D ( const Display3D other)
private

Constructor. Forbidden by default (protected to avoid g++ warnings). Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

void DGtal::Display3D::addClippingPlane ( double  a,
double  b,
double  c,
double  d,
bool  drawPlane 
)
inlinevirtual

Add a new 3D Clipping plane represented by ax+by+cz+d = 0 A maximal of five clipping plane can be added.

Parameters:
a,b,c,d: plane equation.

Definition at line 649 of file Display3D.ih.

References DGtal::Display3D::clippingPlaneD3D::a, DGtal::abs(), DGtal::Display3D::clippingPlaneD3D::b, DGtal::Display3D::clippingPlaneD3D::c, and DGtal::Display3D::clippingPlaneD3D::d.

Referenced by DGtal::Display3DFactory::draw().

{
if(myClippingPlaneList.size()<5)
{
clippingPlaneD3D cp;
cp.a=a; cp.b=b; cp.c=c; cp.d=d;
myClippingPlaneList.push_back(cp);
if(drawPlane)
{
double x1,x2,x3,x4;
double y1,y2,y3,y4;
double z1,z2,z3,z4;
double norm = sqrt(a*a+b*b+c*c);
double dec=0.1;
// Z dominant projection of the upper face
if(abs(c)>=abs(b) && abs(c) >= abs(a))
{
x1= myBoundingPtUp[0]+a*dec/norm; y1= myBoundingPtUp[1]+b*dec/norm;
z1 = c*dec/norm +(-d-a*myBoundingPtUp[0]-b*myBoundingPtUp[1])/c;
x2= myBoundingPtLow[0]+a*dec/norm; y2= myBoundingPtUp[1]+b*dec/norm;
z2= c*dec/norm+(-d-a*myBoundingPtLow[0]-b*myBoundingPtUp[1])/c;
x3= myBoundingPtLow[0]+a*dec/norm; y3= myBoundingPtLow[1]+b*dec/norm;
z3= c*dec/norm+(-d-a*myBoundingPtLow[0]-b*myBoundingPtLow[1])/c;
x4= myBoundingPtUp[0]+a*dec/norm; y4= myBoundingPtLow[1]+b*dec/norm;
z4= c*dec/norm+(-d-a*myBoundingPtUp[0]-b*myBoundingPtLow[1])/c;
if(c>0)
{
addQuad(x4,y4,z4,x3,y3,z3, x2,y2,z2, x1,y1,z1, DGtal::Color(205,0,0, 30));
}else
{
addQuad( x1,y1,z1, x2,y2,z2, x3,y3,z3,x4,y4,z4 , DGtal::Color(205,0,0, 30));
}
}// Y dominant projection of the upper face
else if(abs(b)>=abs(c) && abs(b) >= abs(a))
{
x1= myBoundingPtUp[0]+a*dec/norm; z1= myBoundingPtUp[2]+c*dec/norm;
y1= b*dec/norm +(-d-a*myBoundingPtUp[0]-c*myBoundingPtUp[2])/b;
x2= myBoundingPtUp[0]+a*dec/norm; z2= myBoundingPtLow[2]+c*dec/norm;
y2= b*dec/norm +(-d-a*myBoundingPtUp[0]-c*myBoundingPtLow[2])/b;
x3= myBoundingPtLow[0]+a*dec/norm; z3= myBoundingPtLow[2]+c*dec/norm;
y3= b*dec/norm +(-d-a*myBoundingPtLow[0]-c*myBoundingPtLow[2])/b;
x4= myBoundingPtLow[0]+a*dec/norm; z4= myBoundingPtUp[2]+c*dec/norm;
y4= b*dec/norm +(-d-a*myBoundingPtLow[0]-c*myBoundingPtUp[2])/b;
if(b>0)
{
addQuad(x4,y4,z4,x3,y3,z3, x2,y2,z2, x1,y1,z1, DGtal::Color(205,0,0, 30));
}else
{
addQuad( x1,y1,z1, x2,y2,z2, x3,y3,z3,x4,y4,z4 , DGtal::Color(205,0,0, 30));
}
}// X dominant projection of the upper face
else if(abs(a)>=abs(c) && abs(a) >= abs(b))
{
y1= myBoundingPtUp[1]+b*dec/norm; z1= myBoundingPtUp[2]+c*dec/norm;
x1= a*dec/norm +(-d-b*myBoundingPtUp[1]-c*myBoundingPtUp[2])/a;
y2= myBoundingPtLow[1]+b*dec/norm; z2= myBoundingPtUp[2]+c*dec/norm;
x2= a*dec/norm +(-d-b*myBoundingPtLow[1]-c*myBoundingPtUp[2])/a;
y3= myBoundingPtLow[1]+b*dec/norm; z3= myBoundingPtLow[2]+c*dec/norm;
x3= a*dec/norm +(-d-b*myBoundingPtLow[1]-c*myBoundingPtLow[2])/a;
y4= myBoundingPtUp[1]+b*dec/norm; z4= myBoundingPtLow[2]+c*dec/norm;
x4= a*dec/norm +(-d-b*myBoundingPtUp[1]-c*myBoundingPtLow[2])/a;
if(a>0)
{
addQuad(x4,y4,z4,x3,y3,z3, x2,y2,z2, x1,y1,z1, DGtal::Color(205,0,0, 30));
}else
{
addQuad( x1,y1,z1, x2,y2,z2, x3,y3,z3,x4,y4,z4 , DGtal::Color(205,0,0, 30));
}
}
}
}else
{
std::cerr <<"Warning maximal clipping plane added" << endl;
}
}
void DGtal::Display3D::addKSLinel ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  width = 0.02,
bool  isSigned = false,
bool  aSign = true 
)
inlinevirtual

Add a KSLinel from the Kahlimsky space. If the KSlinel is signed its display will difffers acoording its sign (display as a cone) else it will be displayed as simple cylinder.

Parameters:
x1,y1,z1first point of the extremity point of the KSLinel.
x2,y2,z2second point of the extremity point of the KSLinel.
widththe width of the KSLinel representation (of its associated cylinder (default= 0.02))
isSignedto specify if we want to display an signed or unsigned Cell Linel.
aSignif isSigned is true it will add the KSLinel reprensented by a cone oriented in the direct axis orientation.

Definition at line 625 of file Display3D.ih.

References DGtal::Display3D::lineD3D::B, DGtal::Display3D::lineD3D::G, DGtal::Display3D::lineD3D::isSigned, DGtal::Display3D::lineD3D::R, DGtal::Display3D::lineD3D::signPos, DGtal::Display3D::lineD3D::T, DGtal::Display3D::lineD3D::width, DGtal::Display3D::lineD3D::x1, DGtal::Display3D::lineD3D::x2, DGtal::Display3D::lineD3D::y1, DGtal::Display3D::lineD3D::y2, DGtal::Display3D::lineD3D::z1, and DGtal::Display3D::lineD3D::z2.

Referenced by DGtal::Display3DFactory::draw().

{
updateBoundingBox(x1, y1, z1);
updateBoundingBox(x2, y2, z2);
lineD3D l;
l.x1=x1; l.y1=y1; l.z1=z1; l.x2=x2; l.y2=y2; l.z2=z2;
l.width=width;
l.isSigned=isSigned;
l.signPos=signPos;
myKSLinelList.push_back(l);
}
void DGtal::Display3D::addKSPointel ( double  x,
double  y,
double  z,
double  size = 0.1,
bool  isSigned = false,
bool  aSign = true 
)
inlinevirtual

Add a KSPoint from the Kahlimsky space.

Parameters:
x,y,zthe center of the KSVoxel.
sizethe point size (default= 0.1)
isSignedto specify if we want to display an signed or unsigned Cell point.
aSignif isSigned is true it will be used to apply a different displays according this boolean parameter (if
aSign=truedisplay a cross else, display a small cylinder.).

Definition at line 584 of file Display3D.ih.

References DGtal::Display3D::pointD3D::B, DGtal::Display3D::pointD3D::G, DGtal::Display3D::pointD3D::isSigned, DGtal::Display3D::pointD3D::R, DGtal::Display3D::pointD3D::signPos, DGtal::Display3D::pointD3D::size, DGtal::Display3D::pointD3D::T, DGtal::Display3D::pointD3D::x, DGtal::Display3D::pointD3D::y, and DGtal::Display3D::pointD3D::z.

Referenced by DGtal::Display3DFactory::draw().

{
pointD3D pt;
pt.x=x; pt.y=y; pt.z=z; pt.size=size;
pt.isSigned=isSigned;
pt.signPos=signPos;
myKSPointelList.push_back(pt);
}
void DGtal::Display3D::addKSSurfel ( double  x,
double  y,
double  z,
bool  xSurfel,
bool  ySurfel,
bool  zSurfel,
double  sizeShiftFactor,
double  positionShift = 0.0,
double  sizeFactor = 1.0,
bool  isSigned = false,
bool  aSign = true,
bool  basicMode = false 
)
inlinevirtual

Specific to display a KSSurfel from Kahlimsky space. The display can take into accounts the sign of the cell.

Parameters:
x,y,zthe surfel center.
xSurfel,ySurfel,zSurfelspecify if the surfel has its main face in the direction of the x-axis, y-axis or z-axis.
sizeShiftFactorset the distance between the display of the surfel and potential KSVoxel.
translateShifttranslate the KSsurfel from the asso
isSignedto specify if we want to display an signed or unsigned Cell.
aSignif isSigned is true it will be used to apply a different displays according this boolean parameter (if
aSign=trueoriented in the direct axis orientation).
basicModeif true, a basic mode to display KSSurfel are used (i.e just a simple surfel face).

Definition at line 386 of file Display3D.ih.

References DGtal::Display3D::quadD3D::B, DGtal::cross(), DGtal::Display3D::quadD3D::G, DGtal::normalize(), DGtal::Display3D::quadD3D::nx, DGtal::Display3D::quadD3D::ny, DGtal::Display3D::quadD3D::nz, DGtal::Display3D::quadD3D::R, DGtal::Display3D::quadD3D::T, DGtal::Display3D::quadD3D::x1, DGtal::Display3D::quadD3D::x2, DGtal::Display3D::quadD3D::x3, DGtal::Display3D::quadD3D::x4, DGtal::Display3D::quadD3D::y1, DGtal::Display3D::quadD3D::y2, DGtal::Display3D::quadD3D::y3, DGtal::Display3D::quadD3D::y4, DGtal::Display3D::quadD3D::z1, DGtal::Display3D::quadD3D::z2, DGtal::Display3D::quadD3D::z3, and DGtal::Display3D::quadD3D::z4.

Referenced by DGtal::Display3DFactory::draw().

{
double retract= 0.05*(sizeShiftFactor+myCurrentfShiftVisuKSSurfels);
double width= 0.03*(sizeShiftFactor+myCurrentfShiftVisuKSSurfels);
if(basicMode){
width=0.0;
retract=0.0;
}
double x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4;
double x5, y5, z5, x6, y6, z6, x7, y7, z7, x8, y8, z8;
double dx, dy, dz;
ASSERT( xSurfel || ySurfel || zSurfel );
if(zSurfel)
{
x1= x-(0.5*sizeFactor); y1= y-(0.5*sizeFactor); z1= z-0.5+positionShift;
x2= x+(0.5*sizeFactor); y2= y-(0.5*sizeFactor); z2= z-0.5+positionShift;
x3= x+(0.5*sizeFactor); y3= y+(0.5*sizeFactor); z3= z-0.5+positionShift;
x4= x-(0.5*sizeFactor); y4= y+(0.5*sizeFactor); z4= z-0.5+positionShift;
y1+=retract; y2+=retract; y3-=retract; y4-=retract;
x1+=retract; x2-=retract; x3-=retract; x4+=retract;
dx=0.0; dy=0.0; dz=width;
}
else if(ySurfel)
{
x1= x-(0.5*sizeFactor); y1= y-0.5+positionShift; z1= z-(0.5*sizeFactor);
x2= x-(0.5*sizeFactor); y2= y-0.5+positionShift; z2= z+(0.5*sizeFactor);
x3= x+(0.5*sizeFactor); y3= y-0.5+positionShift; z3= z+(0.5*sizeFactor);
x4= x+(0.5*sizeFactor); y4= y-0.5+positionShift; z4= z-(0.5*sizeFactor);
x1+=retract; x2+=retract; x3-=retract; x4-=retract;
z1+=retract; z2-=retract; z3-=retract; z4+=retract;
dx=0.0; dy=width; dz=0.0;
}
else
{
x1= x-0.5+positionShift; y1= y-(0.5*sizeFactor); z1= z-(0.5*sizeFactor);
x2= x-0.5+positionShift; y2= y+(0.5*sizeFactor); z2= z-(0.5*sizeFactor);
x3= x-0.5+positionShift; y3= y+(0.5*sizeFactor); z3= z+(0.5*sizeFactor);
x4= x-0.5+positionShift; y4= y-(0.5*sizeFactor); z4= z+(0.5*sizeFactor);
y1+=retract; y2-=retract; y3-=retract; y4+=retract;
z1+=retract; z2+=retract; z3-=retract; z4-=retract;
dx=width; dy=0.0; dz=0.0;
}
double xcenter= (x1+x2+x3+x4)/4.0;
double ycenter= (y1+y2+y3+y4)/4.0;
double zcenter= (z1+z2+z3+z4)/4.0;
x5=x1-dx; y5=y1-dy; z5= z1-dz;
x6=x2-dx; y6=y2-dy; z6= z2-dz;
x7=x3-dx; y7=y3-dy; z7= z3-dz;
x8=x4-dx; y8=y4-dy; z8= z4-dz;
x1=x1+dx; y1=y1+dy; z1= z1+dz;
x2=x2+dx; y2=y2+dy; z2= z2+dz;
x3=x3+dx; y3=y3+dy; z3= z3+dz;
x4=x4+dx; y4=y4+dy; z4= z4+dz;
//if cell is oriented positively we retrac the upper face:
if(isSigned && aSign && !basicMode)
{
x1= 0.6*x1+0.4*xcenter; x2= 0.6*x2+0.4*xcenter; x3= 0.6*x3+0.4*xcenter; x4= 0.6*x4+0.4*xcenter;
y1= 0.6*y1+0.4*ycenter; y2= 0.6*y2+0.4*ycenter; y3= 0.6*y3+0.4*ycenter; y4= 0.6*y4+0.4*ycenter;
z1= 0.6*z1+0.4*zcenter; z2= 0.6*z2+0.4*zcenter; z3= 0.6*z3+0.4*zcenter; z4= 0.6*z4+0.4*zcenter;
}else if (isSigned && !basicMode)
{
x5= 0.6*x5+0.4*xcenter; x6= 0.6*x6+0.4*xcenter; x7= 0.6*x7+0.4*xcenter; x8= 0.6*x8+0.4*xcenter;
y5= 0.6*y5+0.4*ycenter; y6= 0.6*y6+0.4*ycenter; y7= 0.6*y7+0.4*ycenter; y8= 0.6*y8+0.4*ycenter;
z5= 0.6*z5+0.4*zcenter; z6= 0.6*z6+0.4*zcenter; z7= 0.6*z7+0.4*zcenter; z8= 0.6*z8+0.4*zcenter;
}
if(basicMode)
{
if(! aSign)
this->addQuad(x1,y1,z1,x2,y2,z2, x3,y3,z3, x4,y4,z4,myCurrentFillColor );
else
this->addQuad(x4,y4,z4,x3,y3,z3, x2,y2,z2, x1,y1,z1,myCurrentFillColor );
}
else
{
//main up face
quadD3D qFaceUp;
double normaleUp [3];
normaleUp[0] = dx!=0.0? 1.0:0.0;
normaleUp[1] = dy!=0.0 ? 1.0:0.0;
normaleUp[2] = dz!=0.0? 1.0:0.0;
qFaceUp.nx= normaleUp[0];
qFaceUp.ny= normaleUp[1];
qFaceUp.nz= normaleUp[2];
qFaceUp.x1=x1; qFaceUp.y1=y1; qFaceUp.z1= z1;
qFaceUp.x2=x2; qFaceUp.y2=y2; qFaceUp.z2= z2;
qFaceUp.x3=x3; qFaceUp.y3=y3; qFaceUp.z3= z3;
qFaceUp.x4=x4; qFaceUp.y4=y4; qFaceUp.z4= z4;
qFaceUp.R=myCurrentFillColor.red();qFaceUp.G=myCurrentFillColor.green(); qFaceUp.B=myCurrentFillColor.blue();
myKSSurfelList.push_back(qFaceUp);
//main down face
quadD3D qFaceDown;
qFaceDown.nx= -normaleUp[0];
qFaceDown.ny= -normaleUp[1];
qFaceDown.nz= -normaleUp[2];
qFaceDown.x1=x5; qFaceDown.y1=y5; qFaceDown.z1= z5;
qFaceDown.x2=x6; qFaceDown.y2=y6; qFaceDown.z2= z6;
qFaceDown.x3=x7; qFaceDown.y3=y7; qFaceDown.z3= z7;
qFaceDown.x4=x8; qFaceDown.y4=y8; qFaceDown.z4= z8;
qFaceDown.R=myCurrentFillColor.red();qFaceDown.G=myCurrentFillColor.green(); qFaceDown.B=myCurrentFillColor.blue();
qFaceDown.T=myCurrentFillColor.alpha();
myKSSurfelList.push_back(qFaceDown);
//small face 1
quadD3D qFace1;
double vF1[3]; double v1 [3]; double n1 [3];
vF1[0] = x2-x1; vF1[1] = y2-y1; vF1[2] = z2-z1;
v1[0] = x5-x1; v1[1] = y5-y1; v1[2] = z5-z1;
cross(n1, v1,vF1);
normalize(n1);
qFace1.nx=n1[0]; qFace1.ny=n1[1]; qFace1.nz=n1[2];
qFace1.x1= x1; qFace1.y1 =y1; qFace1.z1=z1;
qFace1.x2= x2; qFace1.y2 =y2; qFace1.z2=z2;
qFace1.x3= x6; qFace1.y3 =y6; qFace1.z3=z6;
qFace1.x4= x5; qFace1.y4 =y5; qFace1.z4=z5;
myKSSurfelList.push_back(qFace1);
//small face 2
quadD3D qFace2;
double vF2[3]; double v2 [3]; double n2[3];
vF2[0]= x3-x2; vF2[1]=y3-y2; vF2[2]= z3-z2;
v2[0]= x6-x2; v2[1]= y6-y2; v2[2]=z6-z2;
cross(n2, v2, vF2);
normalize(n2);
qFace2.nx=n2[0]; qFace2.ny=n2[1]; qFace2.nz=n2[2];
qFace2.x1= x2; qFace2.y1 =y2; qFace2.z1=z2;
qFace2.x2= x3; qFace2.y2 =y3; qFace2.z2=z3;
qFace2.x3= x7; qFace2.y3 =y7; qFace2.z3=z7;
qFace2.x4= x6; qFace2.y4 =y6; qFace2.z4=z6;
myKSSurfelList.push_back(qFace2);
//small face 3
quadD3D qFace3;
double vF3[3]; double v3 [3]; double n3[3];
vF3[0]= x4-x3; vF3[1]=y4-y3; vF3[2]= z4-z3;
v3[0]= x7-x3; v3[1]= y7-y3; v3[2]=z7-z3;
cross(n3, v3, vF3);
normalize(n3);
qFace3.nx=n3[0]; qFace3.ny=n3[1]; qFace3.nz=n3[2];
qFace3.x1= x3; qFace3.y1 =y3; qFace3.z1=z3;
qFace3.x2= x4; qFace3.y2 =y4; qFace3.z2=z4;
qFace3.x3= x8; qFace3.y3 =y8; qFace3.z3=z8;
qFace3.x4= x7; qFace3.y4 =y7; qFace3.z4=z7;
myKSSurfelList.push_back(qFace3);
//small face 4
quadD3D qFace4;
double vF4[3]; double v4 [3]; double n4[3];
vF4[0]= x1-x4; vF4[1]=y1-y4; vF4[2]= z1-z4;
v4[0]= x5-x4; v4[1]= y5-y4; v4[2]=z5-z4;
cross(n4, v4, vF4);
normalize(n4);
qFace4.nx=n4[0]; qFace4.ny=n4[1]; qFace4.nz=n4[2];
qFace4.x1= x4; qFace4.y1 =y4; qFace4.z1=z4;
qFace4.x2= x1; qFace4.y2 =y1; qFace4.z2=z1;
qFace4.x3= x5; qFace4.y3 =y5; qFace4.z3=z5;
qFace4.x4= x8; qFace4.y4 =y8; qFace4.z4=z8;
myKSSurfelList.push_back(qFace4);
}
}
void DGtal::Display3D::addKSVoxel ( int  x,
int  y,
int  z,
double  sizeFactor = 0.94 
)
inlinevirtual

Add a KSVoxel from the Kahlimsky space.

Parameters:
x,y,zthe center of the KSVoxel.

Definition at line 604 of file Display3D.ih.

References DGtal::Display3D::voxelD3D::B, DGtal::Display3D::voxelD3D::G, DGtal::Display3D::voxelD3D::R, DGtal::Display3D::voxelD3D::T, DGtal::Display3D::voxelD3D::width, DGtal::Display3D::voxelD3D::x, DGtal::Display3D::voxelD3D::y, and DGtal::Display3D::voxelD3D::z.

Referenced by DGtal::Display3DFactory::draw().

{
voxelD3D v;
v.x=x;
v.y=y;
v.z=z;
v.width=0.5*sizeFactor;
(myVoxelSetList.at(0)).push_back(v);
}
void DGtal::Display3D::addLine ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
const DGtal::Color color = DGtal::Color(20,20,20,200),
double  width = 1.5 
)
inlinevirtual

Method to add a line to the current display.

Parameters:
x1,y1,z1,x2,y2,z2the two extremty line points.
colorthe line color.
withthe line width

Definition at line 218 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::lineD3D::B, DGtal::Color::blue(), DGtal::Display3D::lineD3D::G, DGtal::Color::green(), DGtal::Display3D::lineD3D::isSigned, DGtal::Display3D::lineD3D::R, DGtal::Color::red(), DGtal::Display3D::lineD3D::signPos, DGtal::Display3D::lineD3D::T, DGtal::Display3D::lineD3D::width, DGtal::Display3D::lineD3D::x1, DGtal::Display3D::lineD3D::x2, DGtal::Display3D::lineD3D::y1, DGtal::Display3D::lineD3D::y2, DGtal::Display3D::lineD3D::z1, and DGtal::Display3D::lineD3D::z2.

Referenced by DGtal::Display3DFactory::draw(), DGtal::Display3DFactory::drawAsBoundingBox(), DGtal::Display3DFactory::drawAsGrid(), and DGtal::Display3DFactory::drawAsPoints().

{
updateBoundingBox(x1, y1, z1);
updateBoundingBox(x2, y2, z2);
lineD3D l;
l.x1=x1;
l.y1=y1;
l.z1=z1;
l.x2=x2;
l.y2=y2;
l.z2=z2;
l.R=aColor.red();
l.G=aColor.green();
l.B=aColor.blue();
l.T=aColor.alpha();
l.width=width;
l.isSigned=false;
l.signPos=false;
(myLineSetList.at(myLineSetList.size()-1)).push_back(l);
}
void DGtal::Display3D::addPoint ( double  x,
double  y,
double  z,
const DGtal::Color color = DGtal::Color(200,20,20),
double  size = 40 
)
inlinevirtual

Method to add a point to the current display.

Parameters:
x,y,zthe point.
colorthe point color.
withthe point width

Definition at line 196 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::pointD3D::B, DGtal::Color::blue(), DGtal::Display3D::pointD3D::G, DGtal::Color::green(), DGtal::Display3D::pointD3D::isSigned, DGtal::Display3D::pointD3D::R, DGtal::Color::red(), DGtal::Display3D::pointD3D::signPos, DGtal::Display3D::pointD3D::size, DGtal::Display3D::pointD3D::T, DGtal::Display3D::pointD3D::x, DGtal::Display3D::pointD3D::y, and DGtal::Display3D::pointD3D::z.

Referenced by DGtal::Display3DFactory::drawAsGrid(), and DGtal::Display3DFactory::drawAsPavingPoints().

{
pointD3D p;
p.x=x;
p.y=y;
p.z=z;
p.R=aColor.red();
p.G=aColor.green();
p.B=aColor.blue();
p.T=aColor.alpha();
p.isSigned=false;
p.signPos=false;
p.size=size;
(myPointSetList.at(myPointSetList.size()-1)).push_back(p);
}
void DGtal::Display3D::addPolygon ( std::vector< pointD3D vectPointsPolygon,
DGtal::Color  aColor 
)
inlinevirtual

Method to add a specific polygon.

Parameters:
vectPointsPolygon,:a vector containing the polygon vertex.

Definition at line 336 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::polygonD3D::B, DGtal::Color::blue(), DGtal::cross(), DGtal::Trace::error(), DGtal::Display3D::polygonD3D::G, DGtal::Color::green(), DGtal::normalize(), DGtal::Display3D::polygonD3D::nx, DGtal::Display3D::polygonD3D::ny, DGtal::Display3D::polygonD3D::nz, DGtal::Display3D::polygonD3D::R, DGtal::Color::red(), DGtal::Display3D::polygonD3D::T, DGtal::trace, and DGtal::Display3D::polygonD3D::vectPoints.

Referenced by DGtal::Display3DFactory::drawAsFaces().

{
polygonD3D aPolygon;
for(unsigned int i=0; i< vectPointsPolygon.size();i++){
aPolygon.vectPoints.push_back(vectPointsPolygon.at(i));
updateBoundingBox(vectPointsPolygon.at(i).x, vectPointsPolygon.at(i).y, vectPointsPolygon.at(i).z);
}
double x1= vectPointsPolygon.at(0).x;
double y1= vectPointsPolygon.at(0).y;
double z1= vectPointsPolygon.at(0).z;
double x2= vectPointsPolygon.at(1).x;
double y2= vectPointsPolygon.at(1).y;
double z2= vectPointsPolygon.at(1).z;
double x3= vectPointsPolygon.at(2).x;
double y3= vectPointsPolygon.at(2).y;
double z3= vectPointsPolygon.at(2).z;
double u[3]; double v [3]; double n [3];
u[0]=x2-x1; u[1]=y2-y1; u[2]=z2-z1;
v[0]=x3-x1; v[1]=y3-y1; v[2]=z3-z1;
cross(n, u, v );
normalize(n);
if(u[0]==0.0 && u[1]==0.0 && u[2]==0.0){
trace.error()<< "Warning polygin not added due to identical vertex... "<<endl;
return;
}
aPolygon.nx= n[0];
aPolygon.ny= n[1];
aPolygon.nz= n[2];
aPolygon.R=aColor.red();
aPolygon.G=aColor.green();
aPolygon.B=aColor.blue();
aPolygon.T=aColor.alpha();
myPolygonList.push_back(aPolygon);
}
void DGtal::Display3D::addQuad ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  x3,
double  y3,
double  z3,
double  x4,
double  y4,
double  z4,
DGtal::Color  aColor 
)
inlinevirtual

Method to add a specific quad (used by addClippingPlane). The normal is computed from the vertex order.

Parameters:
x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4the four coordinates of the quad.
aColorthe quad color.

Definition at line 250 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::quadD3D::B, DGtal::Color::blue(), DGtal::cross(), DGtal::Trace::error(), DGtal::Display3D::quadD3D::G, DGtal::Color::green(), DGtal::normalize(), DGtal::Display3D::quadD3D::nx, DGtal::Display3D::quadD3D::ny, DGtal::Display3D::quadD3D::nz, DGtal::Display3D::quadD3D::R, DGtal::Color::red(), DGtal::Display3D::quadD3D::T, DGtal::trace, DGtal::Display3D::quadD3D::x1, DGtal::Display3D::quadD3D::x2, DGtal::Display3D::quadD3D::x3, DGtal::Display3D::quadD3D::x4, DGtal::Display3D::quadD3D::y1, DGtal::Display3D::quadD3D::y2, DGtal::Display3D::quadD3D::y3, DGtal::Display3D::quadD3D::y4, DGtal::Display3D::quadD3D::z1, DGtal::Display3D::quadD3D::z2, DGtal::Display3D::quadD3D::z3, and DGtal::Display3D::quadD3D::z4.

Referenced by DGtal::Display3DFactory::draw(), DGtal::Display3DFactory::drawAsBoundingBox(), and DGtal::Display3DFactory::drawAsFaces().

{
quadD3D aQuad;
updateBoundingBox(x1, y1, z1);
updateBoundingBox(x2, y2, z2);
updateBoundingBox(x3, y3, z3);
updateBoundingBox(x4, y4, z4);
double u[3]; double v [3]; double n [3];
u[0]=x2-x1; u[1]=y2-y1; u[2]=z2-z1;
v[0]=x3-x1; v[1]=y3-y1; v[2]=z3-z1;
cross(n, u, v );
if(u[0]==0.0 && u[1]==0.0 && u[2]==0.0){
trace.error()<< "Warning quad not added due to identical vertex... "<<endl;
return;
}
aQuad.x1=x1; aQuad.y1=y1; aQuad.z1=z1;
aQuad.x2=x2; aQuad.y2=y2; aQuad.z2=z2;
aQuad.x3=x3; aQuad.y3=y3; aQuad.z3=z3;
aQuad.x4=x4; aQuad.y4=y4; aQuad.z4=z4;
aQuad.nx= n[0];
aQuad.ny= n[1];
aQuad.nz= n[2];
aQuad.R=aColor.red();
aQuad.G=aColor.green();
aQuad.B=aColor.blue();
aQuad.T=aColor.alpha();
myQuadList.push_back(aQuad);
}
void DGtal::Display3D::addTriangle ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  x3,
double  y3,
double  z3,
DGtal::Color  aColor 
)
inlinevirtual

Method to add a specific quad (used by addClippingPlane). The normal is computed from the vertex order.

Parameters:
x1,y1,z1,x2,y2,z2,x3,y3,z3the four coordinates of the triangle.
aColorthe quad color.

Definition at line 293 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::triangleD3D::B, DGtal::Color::blue(), DGtal::cross(), DGtal::Trace::error(), DGtal::Display3D::triangleD3D::G, DGtal::Color::green(), DGtal::normalize(), DGtal::Display3D::triangleD3D::nx, DGtal::Display3D::triangleD3D::ny, DGtal::Display3D::triangleD3D::nz, DGtal::Display3D::triangleD3D::R, DGtal::Color::red(), DGtal::Display3D::triangleD3D::T, DGtal::trace, DGtal::Display3D::triangleD3D::x1, DGtal::Display3D::triangleD3D::x2, DGtal::Display3D::triangleD3D::x3, DGtal::Display3D::triangleD3D::y1, DGtal::Display3D::triangleD3D::y2, DGtal::Display3D::triangleD3D::y3, DGtal::Display3D::triangleD3D::z1, DGtal::Display3D::triangleD3D::z2, and DGtal::Display3D::triangleD3D::z3.

Referenced by DGtal::Display3DFactory::drawAsFaces().

{
updateBoundingBox(x1, y1, z1);
updateBoundingBox(x2, y2, z2);
updateBoundingBox(x3, y3, z3);
triangleD3D aTriangle;
double u[3]; double v [3]; double n [3];
u[0]=x2-x1; u[1]=y2-y1; u[2]=z2-z1;
v[0]=x3-x1; v[1]=y3-y1; v[2]=z3-z1;
cross(n, u, v );
cross(n, u, v );
if(u[0]==0.0 && u[1]==0.0 && u[2]==0.0){
trace.error()<< "Warning triangle not added due to identical vertex... "<<endl;
return;
}
aTriangle.x1=x1; aTriangle.y1=y1; aTriangle.z1=z1;
aTriangle.x2=x2; aTriangle.y2=y2; aTriangle.z2=z2;
aTriangle.x3=x3; aTriangle.y3=y3; aTriangle.z3=z3;
aTriangle.nx= n[0];
aTriangle.ny= n[1];
aTriangle.nz= n[2];
aTriangle.R=aColor.red();
aTriangle.G=aColor.green();
aTriangle.B=aColor.blue();
aTriangle.T=aColor.alpha();
myTriangleList.push_back(aTriangle);
}
void DGtal::Display3D::addVoxel ( DGtal::int64_t  x,
DGtal::int64_t  y,
DGtal::int64_t  z,
DGtal::Color  color = DGtal::Color(220, 220, 220),
double  width = 0.5,
bool  withWire = false 
)
inlinevirtual

Method to add specific voxel. It includes several modes to display the voxel with and without the wire visualisation.

Parameters:
x,y,zthe voxel center.
colorthe voxel color.
widththe voxel width.
widthWireif true add the wire representation.

Definition at line 157 of file Display3D.ih.

References DGtal::Color::alpha(), DGtal::Display3D::voxelD3D::B, DGtal::Color::blue(), DGtal::Display3D::voxelD3D::G, DGtal::Color::green(), DGtal::Display3D::voxelD3D::R, DGtal::Color::red(), DGtal::Display3D::voxelD3D::T, DGtal::Display3D::voxelD3D::width, DGtal::Display3D::voxelD3D::x, DGtal::Display3D::voxelD3D::y, and DGtal::Display3D::voxelD3D::z.

Referenced by DGtal::Display3DFactory::drawAsPaving(), DGtal::Display3DFactory::drawAsPavingTransparent(), and DGtal::Display3DFactory::drawAsPavingWired().

{
updateBoundingBox((double)x, (double)y, (double)z);
voxelD3D v;
v.x=(int)x;
v.y=(int)y;
v.z=(int)z;
v.R=aColor.red();
v.G=aColor.green();
v.B=aColor.blue();
v.T=aColor.alpha();
v.width=width;
if(withWire)
{
addLine(x-0.5, y-0.5, z-0.5, x+0.5, y-0.5, z-0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y-0.5, z-0.5, x+0.5, y+0.5, z-0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y+0.5, z-0.5, x-0.5, y+0.5, z-0.5, DGtal::Color(0,0,0), 2);
addLine(x-0.5, y+0.5, z-0.5, x-0.5, y-0.5, z-0.5, DGtal::Color(0,0,0), 2);
addLine(x-0.5, y-0.5, z+0.5, x+0.5, y-0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y-0.5, z+0.5, x+0.5, y+0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y+0.5, z+0.5, x-0.5, y+0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x-0.5, y+0.5, z+0.5, x-0.5, y-0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x-0.5, y-0.5, z-0.5, x-0.5, y-0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y-0.5, z-0.5, x+0.5, y-0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x+0.5, y+0.5, z-0.5, x+0.5, y+0.5, z+0.5, DGtal::Color(0,0,0), 2);
addLine(x-0.5, y+0.5, z-0.5, x-0.5, y+0.5, z+0.5, DGtal::Color(0,0,0), 2);
}
(myVoxelSetList.at(myVoxelSetList.size()-1)).push_back(v);
}
void DGtal::Display3D::createNewLineList ( )
inlinevirtual

Used to create a new list containing new 3D objects (useful to use transparency between different objects).

Definition at line 144 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::draw().

{
std::vector< lineD3D > v;
myLineSetList.push_back(v);
}
void DGtal::Display3D::createNewPointList ( )
inlinevirtual

Used to create a new list containing new 3D objects (useful to use transparency between different objects).

Definition at line 135 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::draw().

{
std::vector< pointD3D > v;
myPointSetList.push_back(v);
}
void DGtal::Display3D::createNewVoxelList ( bool  depthTest = true)
inlinevirtual

Used to create a new list containing new 3D objects (useful to use transparency between different objects).

Definition at line 123 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::draw(), DGtal::Display3DFactory::drawAsPaving(), and DGtal::Display3DFactory::drawAsPavingTransparent().

{
std::vector< voxelD3D > v;
myVoxelSetList.push_back(v);
myListVoxelDepthTest.push_back(depthTest);
}
void DGtal::Display3D::exportToMesh ( MeshFromPoints< Display3D::pointD3D > &  aMesh) const
inline

Export as MeshFromPoints the current displayed elements.

Parameters:
aMesh: (return) the mesh containing the elements of the display.

Definition at line 768 of file Display3D.ih.

References DGtal::MeshFromPoints< TPoint >::addQuadFace(), DGtal::MeshFromPoints< TPoint >::addTriangularFace(), DGtal::MeshFromPoints< TPoint >::addVertex(), DGtal::Display3D::voxelD3D::B, DGtal::Display3D::quadD3D::B, DGtal::Display3D::triangleD3D::B, DGtal::Display3D::voxelD3D::G, DGtal::Display3D::quadD3D::G, DGtal::Display3D::triangleD3D::G, DGtal::Display3D::voxelD3D::R, DGtal::Display3D::quadD3D::R, DGtal::Display3D::triangleD3D::R, DGtal::Display3D::voxelD3D::T, DGtal::Display3D::quadD3D::T, DGtal::Display3D::triangleD3D::T, DGtal::Display3D::voxelD3D::width, DGtal::Display3D::voxelD3D::x, DGtal::Display3D::pointD3D::x, DGtal::Display3D::quadD3D::x1, DGtal::Display3D::triangleD3D::x1, DGtal::Display3D::quadD3D::x2, DGtal::Display3D::triangleD3D::x2, DGtal::Display3D::quadD3D::x3, DGtal::Display3D::triangleD3D::x3, DGtal::Display3D::quadD3D::x4, DGtal::Display3D::voxelD3D::y, DGtal::Display3D::pointD3D::y, DGtal::Display3D::quadD3D::y1, DGtal::Display3D::triangleD3D::y1, DGtal::Display3D::quadD3D::y2, DGtal::Display3D::triangleD3D::y2, DGtal::Display3D::quadD3D::y3, DGtal::Display3D::triangleD3D::y3, DGtal::Display3D::quadD3D::y4, DGtal::Display3D::voxelD3D::z, DGtal::Display3D::pointD3D::z, DGtal::Display3D::quadD3D::z1, DGtal::Display3D::triangleD3D::z1, DGtal::Display3D::quadD3D::z2, DGtal::Display3D::triangleD3D::z2, DGtal::Display3D::quadD3D::z3, DGtal::Display3D::triangleD3D::z3, and DGtal::Display3D::quadD3D::z4.

Referenced by DGtal::operator>>().

{
unsigned int vertexIndex=0;
// Export of KSSurfel lists (generated from KhalimskyCell or SignedKhalimskyCell (through addKSSurfel))
for (unsigned int i=0; i< myKSSurfelList.size(); i++){
quadD3D quad = myKSSurfelList.at(i);
pointD3D p1, p2, p3, p4;
p1.x=quad.x1*myScaleX; p1.y=quad.y1*myScaleY ;p1.z=quad.z1*myScaleZ;
p2.x=quad.x2*myScaleX; p2.y=quad.y2*myScaleY ;p2.z=quad.z2*myScaleZ;
p3.x=quad.x3*myScaleX; p3.y=quad.y3*myScaleY ;p3.z=quad.z3*myScaleZ;
p4.x=quad.x4*myScaleX; p4.y=quad.y4*myScaleY ;p4.z=quad.z4*myScaleZ;
aMesh.addVertex(p1);
aMesh.addVertex(p2);
aMesh.addVertex(p3);
aMesh.addVertex(p4);
aMesh.addQuadFace(vertexIndex, vertexIndex+1, vertexIndex+2,vertexIndex+3,
DGtal::Color(quad.R, quad.G, quad.B, quad.T));
vertexIndex+=4;
}
// Export QuadList
for (unsigned int i=0; i<myQuadList.size(); i++){
quadD3D quad = myQuadList.at(i);
pointD3D p1, p2, p3, p4;
p1.x=quad.x1*myScaleX; p1.y=quad.y1*myScaleY ;p1.z=quad.z1*myScaleZ;
p2.x=quad.x2*myScaleX; p2.y=quad.y2*myScaleY ;p2.z=quad.z2*myScaleZ;
p3.x=quad.x3*myScaleX; p3.y=quad.y3*myScaleY ;p3.z=quad.z3*myScaleZ;
p4.x=quad.x4*myScaleX; p4.y=quad.y4*myScaleY ;p4.z=quad.z4*myScaleZ;
aMesh.addVertex(p4);
aMesh.addVertex(p3);
aMesh.addVertex(p2);
aMesh.addVertex(p1);
aMesh.addQuadFace(vertexIndex,vertexIndex+1, vertexIndex+2, vertexIndex+3,
DGtal::Color(quad.R, quad.G, quad.B, quad.T));
vertexIndex+=4;
}
// Export the mesh from TriangleList
for (unsigned int i=0; i < myTriangleList.size(); i++){
triangleD3D aTriangle = myTriangleList.at(i);
pointD3D p1, p2, p3;
p1.x = aTriangle.x1*myScaleX; p1.y = aTriangle.y1*myScaleY; p1.z = aTriangle.z1*myScaleZ;
p2.x = aTriangle.x2*myScaleX; p2.y = aTriangle.y2*myScaleY; p2.z = aTriangle.z2*myScaleZ;
p3.x = aTriangle.x3*myScaleX; p3.y = aTriangle.y3*myScaleY; p3.z = aTriangle.z3*myScaleZ;
aMesh.addVertex(p1);
aMesh.addVertex(p2);
aMesh.addVertex(p3);
aMesh.addTriangularFace(vertexIndex, vertexIndex+1, vertexIndex+2,
DGtal::Color(aTriangle.R, aTriangle.G,
aTriangle.B, aTriangle.T));
vertexIndex+=3;
}
// Export of voxelSet (generated from addVoxel)
for(unsigned int j=0; j<myVoxelSetList.size(); j++){
for (unsigned int i=0; i< myVoxelSetList.at(j).size(); i++){
voxelD3D voxel = myVoxelSetList.at(j).at(i);
pointD3D p1, p2, p3, p4, p5, p6, p7, p8;
double width= voxel.width;
p1.x = (voxel.x-width)*myScaleX; p1.y = (voxel.y+width)*myScaleY; p1.z = (voxel.z+width)*myScaleZ;
p2.x = (voxel.x+width)*myScaleX; p2.y = (voxel.y+width)*myScaleY; p2.z = (voxel.z+width)*myScaleZ;
p3.x = (voxel.x+width)*myScaleX; p3.y = (voxel.y-width)*myScaleY; p3.z = (voxel.z+width)*myScaleZ;
p4.x = (voxel.x-width)*myScaleX; p4.y = (voxel.y-width)*myScaleY; p4.z = (voxel.z+width)*myScaleZ;
p5.x = (voxel.x-width)*myScaleX; p5.y = (voxel.y+width)*myScaleY; p5.z = (voxel.z-width)*myScaleZ;
p6.x = (voxel.x+width)*myScaleX; p6.y = (voxel.y+width)*myScaleY; p6.z = (voxel.z-width)*myScaleZ;
p7.x = (voxel.x+width)*myScaleX; p7.y = (voxel.y-width)*myScaleY; p7.z = (voxel.z-width)*myScaleZ;
p8.x = (voxel.x-width)*myScaleX; p8.y = (voxel.y-width)*myScaleY; p8.z = (voxel.z-width)*myScaleZ;
aMesh.addVertex(p1);
aMesh.addVertex(p2);
aMesh.addVertex(p3);
aMesh.addVertex(p4);
aMesh.addVertex(p5);
aMesh.addVertex(p6);
aMesh.addVertex(p7);
aMesh.addVertex(p8);
//z+
aMesh.addQuadFace(vertexIndex, vertexIndex+3, vertexIndex+2, vertexIndex+1,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
//z-
aMesh.addQuadFace(vertexIndex+4, vertexIndex+5, vertexIndex+6, vertexIndex+7,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
//y+
aMesh.addQuadFace(vertexIndex+1, vertexIndex+2, vertexIndex+6, vertexIndex+5,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
//y-
aMesh.addQuadFace(vertexIndex, vertexIndex+4, vertexIndex+7, vertexIndex+3,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
//x+
aMesh.addQuadFace(vertexIndex, vertexIndex+1, vertexIndex+5, vertexIndex+4,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
//x-
aMesh.addQuadFace(vertexIndex+3, vertexIndex+7, vertexIndex+6, vertexIndex+2,
DGtal::Color(voxel.R, voxel.G, voxel.B, voxel.T));
vertexIndex+=8;
}
}
}
DGtal::Color DGtal::Display3D::getFillColor ( )
inlinevirtual
DGtal::Color DGtal::Display3D::getLineColor ( )
inlinevirtual

Used to get the line color

Returns:
the current line color.

Definition at line 98 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::drawAsGrid().

{
}
std::string DGtal::Display3D::getMode ( const std::string &  objectName) const
inlinevirtual
Parameters:
objectNamethe name of the object (generally obtained with a 'object.className()').
Returns:
the current mode for the given object name or "" if no specific mode has been set.

Definition at line 113 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::draw(), and DGtal::Display3DFactory::drawAsPoints().

{
ModeMapping::const_iterator itm = myModes.find( objectName );
return itm == myModes.end() ? "" : itm->second;
}
bool DGtal::Display3D::isValid ( ) const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Reimplemented in DGtal::Viewer3D, and DGtal::Board3DTo2D.

template<typename TDrawableWithDisplay3D >
DGtal::Display3D & DGtal::Display3D::operator<< ( const TDrawableWithDisplay3D &  object)
inline

Draws the drawable [object] in this board. It should satisfy the concept CDrawableWithViewer3D, which requires for instance a method setStyle( Viewer3D & ).

Parameters:
objectany drawable object.
Returns:
a reference on 'this'.

Reimplemented in DGtal::Viewer3D, and DGtal::Board3DTo2D.

Definition at line 892 of file Display3D.ih.

References DGtal::Display3DFactory::draw().

{
// BOOST_CONCEPT_ASSERT((CDrawableWithDisplay3D< TDrawableWithDisplay3D >));
return *this;
}
Display3D& DGtal::Display3D::operator= ( const Display3D other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
void DGtal::Display3D::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Reimplemented in DGtal::Viewer3D, and DGtal::Board3DTo2D.

virtual void DGtal::Display3D::setCameraDirection ( double  ,
double  ,
double   
)
inlinevirtual

Set camera direction.

Parameters:
xx direction.
yy direction.
zz direction.

Reimplemented in DGtal::Board3DTo2D.

Definition at line 310 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

{ };
virtual void DGtal::Display3D::setCameraPosition ( double  ,
double  ,
double   
)
inlinevirtual

Set camera position.

Parameters:
xx position.
yy position.
zz position.

Reimplemented in DGtal::Board3DTo2D.

Definition at line 293 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

{ };
virtual void DGtal::Display3D::setCameraUpVector ( double  ,
double  ,
double   
)
inlinevirtual

Set camera up-vector.

Parameters:
xx coordinate of up-vector.
yy coordinate of up-vector.
zz coordinate of up-vector.

Reimplemented in DGtal::Board3DTo2D.

Definition at line 285 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

{};
void DGtal::Display3D::setFillColor ( DGtal::Color  aColor)
inlinevirtual

Used to set the current fill color

Parameters:
aColorthe fill color.

Definition at line 82 of file Display3D.ih.

References myCurrentFillColor.

Referenced by DGtal::Display3DFactory::draw().

{
}
void DGtal::Display3D::setLineColor ( DGtal::Color  aColor)
inlinevirtual

Used to set the line fill color

Parameters:
aColorthe line color.
Examples:
io/meshFromOFF.cpp.

Definition at line 90 of file Display3D.ih.

Referenced by DGtal::Display3DFactory::draw().

{
}
virtual void DGtal::Display3D::setNearFar ( double  ,
double   
)
inlinevirtual

Set near and far distance.

Parameters:
nearnear distance.
farfar distance.

Reimplemented in DGtal::Board3DTo2D.

Definition at line 300 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

{};
void DGtal::Display3D::setScale ( float  sx,
float  sy,
float  sz 
)
inline

Use to change the main axis scale (usefull if we need to display data with variable scales, as for instance from medical imagery scanner)

Parameters:
sx,:scale factor for the x axis (scale increased if >1, decreased if <1, reflected if -1).
sy,:scale factor for the y axis (scale increased if >1, decreased if <1, reflected if -1).
sz,:scale factor for the z axis (scale increased if >1, decreased if <1, reflected if -1).

Definition at line 758 of file Display3D.ih.

{
myScaleX = sx;
myScaleY = sy;
myScaleZ = sz;
}
void DGtal::Display3D::updateBoundingBox ( double  x,
double  y,
double  z 
)
inline

Used to update the scene bounding box when objects are added.

Parameters:
x,y,zthe coordinates to be taken into accounts.

Definition at line 731 of file Display3D.ih.


Field Documentation

bool DGtal::Display3D::myBoundingPtEmptyTag

True if the bounding box is empty (no objects added)

Definition at line 599 of file Display3D.h.

Referenced by Display3D().

double DGtal::Display3D::myBoundingPtLow[3]

Definition at line 601 of file Display3D.h.

double DGtal::Display3D::myBoundingPtUp[3]

Definition at line 600 of file Display3D.h.

std::vector< clippingPlaneD3D > DGtal::Display3D::myClippingPlaneList
protected

Represent all the clipping planes added to the scene (of maxSize=5).

Definition at line 643 of file Display3D.h.

DGtal::Color DGtal::Display3D::myCurrentFillColor
protected

Definition at line 611 of file Display3D.h.

Referenced by Display3D(), and setFillColor().

double DGtal::Display3D::myCurrentfShiftVisuKSSurfels
protected

Used to specialized visualisation with KS surfels/voxels.

Definition at line 619 of file Display3D.h.

DGtal::Color DGtal::Display3D::myCurrentLineColor
protected

Definition at line 613 of file Display3D.h.

Referenced by Display3D().

std::vector< lineD3D > DGtal::Display3D::myKSLinelList
protected

For saving all linels of Khalimsky space (used to display Khalimsky Space Cell)

Definition at line 662 of file Display3D.h.

std::vector< pointD3D > DGtal::Display3D::myKSPointelList
protected

For saving all pointels of Khalimsky space (used to display Khalimsky Space Cell)

Definition at line 656 of file Display3D.h.

std::vector< quadD3D > DGtal::Display3D::myKSSurfelList
protected

For saving all surfels of Khalimsky space (used to display Khalimsky Space Cell)

Definition at line 650 of file Display3D.h.

std::vector< std::vector<lineD3D> > DGtal::Display3D::myLineSetList
protected

Used to represent all the list of line primitive

Definition at line 631 of file Display3D.h.

std::vector<bool> DGtal::Display3D::myListVoxelDepthTest
protected

Used to define if GL_TEST_DEPTH is used.

Definition at line 678 of file Display3D.h.

float DGtal::Display3D::myMeshDefaultLineWidth
protected

Definition at line 680 of file Display3D.h.

ModeMapping DGtal::Display3D::myModes

Definition at line 583 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

std::vector< std::vector<pointD3D> > DGtal::Display3D::myPointSetList
protected

Used to represent all the list of point primitive

Definition at line 637 of file Display3D.h.

std::vector<polygonD3D> DGtal::Display3D::myPolygonList
protected

Definition at line 674 of file Display3D.h.

std::vector< quadD3D > DGtal::Display3D::myQuadList
protected

Definition at line 666 of file Display3D.h.

float DGtal::Display3D::myScaleX
protected

Definition at line 85 of file Display3D.h.

Referenced by Display3D().

float DGtal::Display3D::myScaleY
protected

Definition at line 86 of file Display3D.h.

Referenced by Display3D().

float DGtal::Display3D::myScaleZ
protected

Definition at line 87 of file Display3D.h.

Referenced by Display3D().

StyleMapping DGtal::Display3D::myStyles

For instance, may associate a new style object T1 to the class "HyperRectDomain": myStyles[ "HyperRectDomain" ] = T1.

One can also store a new style T2 for a specific mode used for drawing a class: myStyles[ "HyperRectDomain/Paving" ] = T2.

Modes may only be used in objects implementing the concept CDrawableWithBoard2D.

Definition at line 594 of file Display3D.h.

Referenced by DGtal::Display3DFactory::draw().

std::vector< triangleD3D > DGtal::Display3D::myTriangleList
protected

Definition at line 670 of file Display3D.h.

std::vector< std::vector<voxelD3D> > DGtal::Display3D::myVoxelSetList
protected

Used to represent all the list used in the display.

Definition at line 625 of file Display3D.h.


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