31#if defined(Display3D_RECURSES)
32#error Recursive header files inclusion detected in Display3D.h
35#define Display3D_RECURSES
37#if !defined Display3D_h
47#include "DGtal/kernel/domains/CDomain.h"
48#include "DGtal/base/Common.h"
49#include "DGtal/base/CountedPtr.h"
50#include "DGtal/io/Color.h"
51#include "DGtal/images/CImage.h"
52#include "DGtal/images/CConstImage.h"
53#include "DGtal/shapes/Mesh.h"
56#include "DGtal/topology/CanonicCellEmbedder.h"
57#include "DGtal/topology/CanonicSCellEmbedder.h"
58#include "DGtal/kernel/CanonicEmbedder.h"
59#include "DGtal/helpers/StdDefs.h"
60#include "DGtal/io/DrawWithDisplay3DModifier.h"
61#include "DGtal/kernel/CSpace.h"
91 template <
typename Space = Z3i::Space,
typename KSpace = Z3i::KSpace>
109 typedef int (*SelectCallbackFct)(
void* viewer,
DGtal::int32_t name,
void* data );
121 :
fct( _fct ), data( _data ),
min( _min ),
max( _max ) {}
124 return (
min < other.
min );
127 {
return (
min <= name ) && ( name <=
max ); }
254 typedef std::map<DGtal::int32_t, std::vector< QuadD3D > >
QuadsMap;
257 typedef std::map<DGtal::int32_t, std::vector< CubeD3D > >
CubesMap;
444 std::string
getMode(
const std::string & objectName )
const;
545 const bool enableReorientation,
546 const bool enableDoubleFace =
false);
558 bool xSurfel,
bool ySurfel,
bool zSurfel);
586 const bool enableReorientation,
588 const bool enableDoubleFace =
false);
637 const double radius=0.5,
638 const unsigned int resolution = 30);
656 bool xSurfel,
bool ySurfel,
bool zSurfel,
double sizeShiftFactor,
657 double sizeFactor=1.0,
bool isSigned=
false,
bool aSign=
true);
670 bool xSurfel,
bool ySurfel,
bool zSurfel);
691 const double width=0.02);
721 template <
typename TDrawableWithDisplay3D>
792 typedef std::map< std::string,CountedPtr<DrawableWithDisplay3D> >
StyleMapping;
912 static void cross (
double dst[3],
double srcA[3],
double srcB[3]);
929 template <
typename Space ,
typename KSpace >
934 template <
typename Space ,
typename KSpace >
952 template <
typename Space ,
typename KSpace >
962#include "DGtal/io/Display3D.ih"
970#undef Display3D_RECURSES
Structure representing an RGB triple with alpha component.
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
virtual DGtal::Color getLineColor()
std::set< SelectCallbackFctStore > mySelectCallBackFcts
RealPoint embedKS(const typename KSpace::SCell &cell) const
SCellEmbedder * mySCellEmbedder
an embeder from a signed khalimsky space point to a real space point
Display3D< Space, KSpace > Self
std::vector< std::string > myQuadSetNameList
void createNewTriangleList(std::string s="")
void createNewLineList(std::string s="")
const CellEmbedder & cellEmbedder() const
std::vector< std::vector< PolygonD3D > > myPolygonSetList
Represents all the polygon drawn in the Display3D.
DGtal::int32_t createNewQuadList()
void addCylinder(const RealPoint &p1, const RealPoint &p2, const double width=0.02)
virtual void setLineColor(DGtal::Color aColor)
DGtal::int32_t createNewCubeList()
CanonicSCellEmbedder< KSpace > SCellEmbedder
std::vector< std::string > myLineSetNameList
std::map< std::string, std::string > ModeMapping
std::vector< ClippingPlaneD3D > myClippingPlaneList
bool deleteQuadList(const DGtal::int32_t name)
const KSpace & space() const
std::vector< std::vector< TriangleD3D > > myTriangleSetList
Represents all the triangles drawn in the Display3D.
static void normalize(double vec[3])
KSpace myKSpace
The Khalimsky space.
CanonicCellEmbedder< KSpace > CellEmbedder
Display3D & operator=(const Display3D &)=delete
Assignment operator. Deleted.
void addPrism(const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, double sizeShiftFactor, double sizeFactor=1.0, bool isSigned=false, bool aSign=true)
const SCellEmbedder & sCellEmbedder() const
void updateBoundingBox(const RealPoint &point)
virtual DGtal::Color getFillColor()
BOOST_CONCEPT_ASSERT((concepts::CSpace< Space >))
std::vector< std::vector< BallD3D > > myBallSetList
bool myBoundingPtEmptyTag
True if the bounding box is empty (no objects added)
std::map< DGtal::int32_t, std::vector< CubeD3D > > CubesMap
The type that maps identifier name -> vector of CubeD3D.
void addQuadFromSurfelCenterWithNormal(const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, const RealVector &aNormal, const bool enableReorientation, const bool sign, const bool enableDoubleFace=false)
DGtal::Color myCurrentFillColor
std::vector< QuadD3D > myPrismList
RealPoint embedK(const typename KSpace::Cell &cell) const
std::map< std::string, CountedPtr< DrawableWithDisplay3D > > StyleMapping
virtual void setFillColor(DGtal::Color aColor)
SelectCallbackFct getSelectCallback3D(DGtal::int32_t aName, void *&data) const
void addQuadFromSurfelCenter(const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel)
void exportToMesh(Mesh< RealPoint > &aMesh) const
RealPoint embed(const typename Space::Point &dp) const
std::vector< std::string > myPrismNameList
virtual void setKSpace(const KSpace &aKSpace)
std::map< DGtal::int32_t, std::vector< QuadD3D > > QuadsMap
The type that maps identifier name -> vector of QuadD3D.
void addLine(const RealPoint &p1, const RealPoint &p2, const double width=0.03)
void setSelectCallback3D(SelectCallbackFct fct, void *data, DGtal::int32_t min_name, DGtal::int32_t max_name)
void setName3d(DGtal::int32_t name=-1)
std::vector< std::string > myBallSetNameList
void addCube(const RealPoint ¢er, double width=1.0)
std::vector< std::string > myPolygonSetNameList
void addQuadWithNormal(const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4, const RealPoint &n, const bool enableReorientation, const bool enableDoubleFace=false)
double myCurrentfShiftVisuPrisms
void addPolygon(const std::vector< RealPoint > &vertices)
DGtal::int32_t name3d() const
void createNewBallList(std::string s="")
Display3D(const Display3D &)=delete
Copy constructor. Deleted.
void addBall(const RealPoint ¢er, const double radius=0.5, const unsigned int resolution=30)
std::vector< std::string > myCubeSetNameList
void addTriangle(const RealPoint &p1, const RealPoint &p2, const RealPoint &p3)
Display3D(const KSpace &KSEmb)
Embedder * myEmbedder
an embeder from a dgtal space point to a real space point
double myBoundingPtUp[3]
upper point of the bounding box
CellEmbedder * myCellEmbedder
an embeder from a unsigned khalimsky space point to a real space point
void addClippingPlane(double a, double b, double c, double d, bool drawPlane)
Space::RealPoint RealPoint
RealPoint type.
bool myBoundingPtChangedTag
const Embedder & embedder() const
std::vector< std::string > myTriangleSetNameList
void addQuad(const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4)
DGtal::Color myCurrentLineColor
CanonicEmbedder< Space > Embedder
std::string getMode(const std::string &objectName) const
bool deleteCubeList(const DGtal::int32_t name)
double myBoundingPtLow[3]
lower point of the bouding box
std::vector< std::string > myClippingPlaneNameList
void createNewPolygonList(std::string s="")
Display3D & operator<<(const TDrawableWithDisplay3D &object)
void selfDisplay(std::ostream &out) const
Display3D(Display3D &&)=delete
Move constructor. Deleted.
RealPoint embedKS(const DGtal::TransformedPrism &aTrans) const
void addCone(const RealPoint &p1, const RealPoint &p2, double width=0.08)
void addBasicSurfel(const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel)
virtual void setFillTransparency(unsigned char alpha)
Space::RealVector RealVector
RealVector type.
static void cross(double dst[3], double srcA[3], double srcB[3])
std::vector< std::vector< LineD3D > > myLineSetList
SignedKhalimskyCell< dim, Integer > SCell
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Aim: Implements basic operations that will be used in Point and Vector classes.
DGtal::Dimension Dimension
Copy of the dimension type.
static const Dimension dimension
Copy of the static dimension of the Point/Vector.
PointVector< dim, double > RealPoint
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
void operator>>(const Display3D< Space, KSpace > &aDisplay3D, DGtal::Mesh< typename Display3D< Space, KSpace >::RealPoint > &aMesh)
boost::int32_t int32_t
signed 32-bit integer.
Aim: A trivial embedder for signed and unsigned cell, which corresponds to the canonic injection of c...
Aim: A trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn.
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
const double & operator[](unsigned int i) const
double & operator[](unsigned int i)
static const RealPoint::Dimension dimension
DGtal::int32_t name
The "OpenGL name" associated with the graphical structure, used for selecting it (-1 is none).
~CommonD3D()=default
Protected destructor to disallow polymorphism.
DGtal::Color color
Color used for displaying the graphical structure.
RealPoint center
The center coordinate of the cube.
double width
The width of a cube face.
std::vector< RealPoint > vertices
bool operator<(const SelectCallbackFctStore &other) const
bool isSelected(DGtal::int32_t name) const
SelectCallbackFctStore(SelectCallbackFct _fct, void *_data, DGtal::int32_t _min, DGtal::int32_t _max)
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.