DGtal 2.1.0
Loading...
Searching...
No Matches
Display3D.h
1
16#pragma once
17
29#include <vector>
30#include <map>
31
32#include "DGtal/dec/DiscreteExteriorCalculus.h"
33
34#include "Eigen/Geometry"
35
36#include "DGtal/helpers/StdDefs.h"
37
38#include "DGtal/io/Color.h"
39#include "DGtal/kernel/CanonicEmbedder.h"
40
41#include "DGtal/topology/KhalimskySpaceND.h"
42#include "DGtal/topology/CanonicCellEmbedder.h"
43#include "DGtal/topology/CanonicSCellEmbedder.h"
44
45// Objects to draw
46#include "DGtal/base/ConstRangeAdapter.h"
47
48#include "DGtal/shapes/Mesh.h"
49
50#include "DGtal/dec/DiscreteExteriorCalculus.h"
51
52#include "DGtal/topology/Object.h"
53
54#include "DGtal/images/ImageAdapter.h"
55#include "DGtal/images/ConstImageAdapter.h"
56#include "DGtal/images/ImageContainerBySTLVector.h"
57
58#include "DGtal/geometry/tools/SphericalAccumulator.h"
59#include "DGtal/geometry/curves/StandardDSS6Computer.h"
60#include "DGtal/geometry/curves/Naive3DDSSComputer.h"
61#include "DGtal/geometry/curves/GridCurve.h"
62
63namespace DGtal {
64 namespace drawutils { // Namespace for some utilities
71 template<size_t I>
72 std::vector<std::array<size_t, I>> makeIndices(size_t N);
73
83 template<typename T>
84 std::array<T, 8> getCubeVertices(T center, double size);
85
98 template<typename T, typename U>
99 void insertCubeVertices(U& dest, T center, double scale);
100
112 template <typename T>
113 std::array<T, 4> getAASquareVertices(T center, int orientation, double size);
114
128 template<typename U, typename T>
129 void insertAASquare(U& dest, T center, int orientation, double size);
130
147 template<typename T>
148 std::array<T, 8> getPrism(
149 T center, int orientation,
150 double size1, double size2, double shift1, double shift2
151 );
152
169 template<typename T, typename U>
170 void insertPrism(U& dest, T center, int orientation,
171 double size1, double size2, double shift1, double shift2);
172 } // drawutils
173
178 // Color of an object
179 Color color = Color(200, 200, 200, 255);
180 // When set, color is ignored and the viewer is free to choose
181 bool useDefaultColors = true;
182 // Maintains uniform scale of the object independently for easy access
183 double width = 1.0;
184
192 enum DrawMode : size_t {
193 DEFAULT = (1 << 0), //< Default mode
194 PAVING = (1 << 1), //< For voxels, render them as cubes
195 BALLS = (1 << 2), //< For voxels, render them as balls
196 ADJACENCIES = (1 << 3), //< For objects, draws adjacencies
197 GRID = (1 << 4), //< For domains, draws a grid
198 SIMPLIFIED = (1 << 5) //< For KCell, draws quads instead of prisms
199 };
200
201 size_t mode = static_cast<size_t>(DrawMode::DEFAULT);
202 };
203
207 enum class QuantityScale {
208 VERTEX = 0,
209 EDGE = 1,
210 FACE = 2,
211 CELL = 3,
212 UNKNOWN = 4 // Also used as a default to decide later
213 };
214
222 template<typename T>
223 struct Quantity {
224 using QType = std::map<std::string, std::vector<T>>;
225
226 QType& operator[](int idx) { return data[idx]; }
227
228 const QType& operator[](int idx) const { return data[idx]; }
229
231 return data[static_cast<size_t>(scale)];
232 };
233
234 const QType& operator[](const QuantityScale& scale) const {
235 return data[static_cast<size_t>(scale)];
236 };
237
238 std::array<QType, static_cast<size_t>(QuantityScale::UNKNOWN)> data;
239 };
240
246 template<typename RealPoint>
247 struct DisplayData {
258 std::size_t elementSize;
259
260 // Return the default quantity level associated with
261 // a given element size.
262 static constexpr auto getDefaultQuantityLevel = [](size_t eSize) {
263 switch(eSize) {
264 case 1: return QuantityScale::VERTEX;
265 case 2: return QuantityScale::EDGE;
266 case 0: // Polygonal meshes
267 case 3: // Triangle meshes
268 case 4: // Quad meshes
269 return QuantityScale::FACE;
270 case 8: return QuantityScale::CELL;
271 default:
273 };
274 };
275
276 // Indices for elements when elementSize is 0
277 std::vector<std::vector<uint32_t>> indices;
278
279 // List of vertices
280 std::vector<RealPoint> vertices;
281
282 // Transform of the object
283 Eigen::Affine3d transform = Eigen::Affine3d::Identity();
284
285 // Draw style of the object (color, scale)
287
288 // Color to apply to each element
290 // Vector to attach to each element
292 // Values to attach to each element (may serve for coloring)
294 };
295
300 ClippingPlane(double _a, double _b, double _c, double _d) :
301 a(_a), b(_b), c(_c), d(_d)
302 { }
303
304 double a, b, c; //< Normal components
305 double d; //< Offset
306
307 // Some style for rendering (colors)
309 };
310
330 template<typename T, typename Type>
332 WithQuantity(const T& _object, const std::string& _name, const Type& value, QuantityScale s = QuantityScale::UNKNOWN) :
333 scale(s), object(_object), name(_name)
334 {
335 values.push_back(value);
336 }
337
338 WithQuantity(const T& _object, const std::string& _name, const std::vector<Type>& _values, QuantityScale s = QuantityScale::UNKNOWN) :
339 scale(s), object(_object), name(_name)
340 {
341 this->values = _values;
342 }
343
344 // Scale to apply the quantity at
346
347 // Copy of the object
349 // Copy of the values to attach
350 std::vector<Type> values;
351 // Name of the property
352 std::string name;
353 };
354
380 template < typename Space = Z3i::Space, typename KSpace = Z3i::KSpace>
381 class Display3D {
382 public:
383 Display3D(const KSpace& space) :
384 myKSpace(space),
387 { }
388
390
391 virtual ~Display3D() {};
392
393 // Usefull definitions
394 using Point = typename Space::Point;
395 using KCell = typename KSpace::Cell;
396 using SCell = typename KSpace::SCell;
397 using RealPoint = typename Space::RealPoint ;
398
402
408 struct Callback{
420 virtual void OnAttach(void* _viewer) { ((void) _viewer); };
426 virtual void OnUI(void* viewerData) { ((void) viewerData); };
437 virtual void OnClick(const std::string& name, size_t index, const DisplayData<RealPoint>& data, void* viewerData) {((void) name); ((void) index); ((void) data); ((void) viewerData); };
438
439 // Pointer to the Display3D instance the callback is attached to
441 };
442 public: // General commands
448 virtual void show() = 0;
452 virtual void renderNewData() = 0;
453
459 virtual void renderAll() {
460 myToRender.clear();
461 myToRender.reserve(data.size());
462
463 for (const auto& m : data)
464 myToRender.push_back(m.first);
465
467 }
471 virtual void clearView() = 0;
475 virtual void clear();
479 virtual void setCallback(Callback* callback);
480
481 public: // Group/Lists managements
499 std::string newList(const std::string& name, size_t eSize = 0);
500
506 bool setCurrentList(const std::string& name);
507
513 bool canCreateNewList(size_t elementSize) const;
514
523 std::string createOrReuseList(const std::string& name, size_t elementSize);
524
532
533 // Some shortcuts for clearer code
534
535 std::string newCubeList(const std::string& name) { return newList(name, 8); }
536 std::string newBallList(const std::string& name) { return newList(name, 1); }
537 std::string newLineList(const std::string& name) { return newList(name, 2); }
538 std::string newQuadList(const std::string& name) { return newList(name, 4); }
539 std::string newPolygonList(const std::string& name) { return newList(name, 0); }
540 std::string newTriangleList(const std::string& name) { return newList(name, 3); }
541 std::string newVolumetricList(const std::string& name) { return newList(name, 8); }
542
543 std::string createOrReuseCubeList(const std::string& name) { return createOrReuseList(name, 8); }
544 std::string createOrReuseBallList(const std::string& name) { return createOrReuseList(name, 1); }
545 std::string createOrReuseLineList(const std::string& name) { return createOrReuseList(name, 2); }
546 std::string createOrReuseQuadList(const std::string& name) { return createOrReuseList(name, 4); }
547 std::string createOrReusePolygonList(const std::string& name) { return createOrReuseList(name, 0); }
548 std::string createOrReuseTriangleList(const std::string& name) { return createOrReuseList(name, 3); }
549 std::string createOrReuseVolumetricList(const std::string& name) { return createOrReuseList(name, 8); }
550
551 public: // Draw commands
552
558 template<typename Obj>
559 Display3D& operator<<(const Obj& obj);
560
561 // @brief Draws a Point with integer coodinates
562 std::string draw(const Point& p, const std::string& uname = "Point_{i}");
563
564 // @brief Draws a RealPoint with real coodinates
565 std::string draw(const RealPoint& rp, const std::string& uname = "Point_{i}");
566
567 // @brief Draws a vector of objects
568 template<typename T>
569 std::string draw(const std::vector<T>& vec, const std::string& uname = "");
570
571 // @brief Draws a range of any object
572 template<typename A, typename B, typename C>
573 std::string draw(const ConstRangeAdapter<A, B, C> range, const std::string& uname = "");
574
575 // @brief Draws any object provided through a ConstIteratorAdapter
576 template<typename A, typename B, typename C>
577 std::string draw(const ConstIteratorAdapter<A, B, C>& adapter, const std::string& uname = "");
578
579 // @brief Draws a grid curve
580 std::string draw(const GridCurve<KSpace>& curve, const std::string& uname = "GridCurve_{i}");
581
582 // @brief Draws a grid curve as mid points
583 std::string draw(const typename GridCurve<KSpace>::MidPointsRange& range, const std::string& uname = "MidPoints_{i}");
584
585 // @brief Draws a grid curve as arrows
586 std::string draw(const typename GridCurve<KSpace>::ArrowsRange& range, const std::string& uname = "Arrows_{i}");
587
588 // @brief Draws a DiscreteExteriorCalculus
589 template<DGtal::Dimension emb, DGtal::Dimension amb, typename Algebra, typename Int>
590 std::string draw(const DiscreteExteriorCalculus<emb, amb, Algebra, Int>& calc, const std::string& uname = "Calculus_{i}");
591
592 // @brief Draws a KForm
593 template<typename Calculus, DGtal::Order order, DGtal::Duality duality>
594 std::string draw(const KForm<Calculus, order, duality>& kform, const std::string& uname = "KForm_{i}");
595
596 // @brief Draws a VectorField
597 template<typename Calculus, DGtal::Duality dual>
598 std::string draw(const VectorField<Calculus, dual>& field, const std::string& uname = "Field_{i}");
599
600 // @brief Draws an unsigned KCell
601 std::string draw(const KCell& cell, const std::string& name = "KCell_{i}_{d}d");
602
603 // @brief Draws a singed KCell
604 std::string draw(const SCell& cell, const std::string& name = "SCell_{i}_{d}d");
605
606 // @brief Draws a Domain
607 //
608 // Note: the default name has a special hex code in the begining
609 // so that string based view-order draws domain in the background
610 std::string draw(const HyperRectDomain<Space>& domain, const std::string& uname = "\xff Domain_{i}");
611
617 template<typename Vec>
618 std::string drawPolygon(const std::vector<Vec>& vertices, const std::string& uname = "Polygon_{i}");
619
620 // @brief Draws a ball
621 std::string drawBall(const RealPoint& c, const std::string& uname = "Ball_{i}");
622
623 // @brief Draws a line
624 std::string drawLine(const RealPoint& a, const RealPoint& b, const std::string& uname = "Line_{i}");
625
626 // @brief Draws a quad
627 std::string drawQuad(const RealPoint& a, const RealPoint& b, const RealPoint& c, const RealPoint& d, const std::string& uname = "Quad_{i}");
628
629 // @brief Draws a DigitalSet
630 template<typename Obj, typename Cont>
631 std::string draw(const DigitalSetByAssociativeContainer<Obj, Cont>& set, const std::string& name = "Set_{i}");
632
633 // @brief Draws an Object
634 template<typename Adj, typename Set>
635 std::string draw(const DGtal::Object<Adj, Set>& obj, const std::string& uname = "Object_{i}");
636
637 // @brief Draws an Image
638 template<typename D, typename T>
639 std::string draw(const ImageContainerBySTLVector<D, T>& image, const std::string& name = "Image_{i}");
640
641 // @brief Draws an Image
642 template <typename TImageContainer,
643 typename TNewDomain,
644 typename TFunctorD,
645 typename TNewValue,
646 typename TFunctorV,
647 typename TFunctorVm1>
648 std::string draw(const ImageAdapter<TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1>& adapter, const std::string& name = "Image_{i}");
649
650 // @brief Draws an Image
651 template <typename TImageContainer,
652 typename TNewDomain,
653 typename TFunctorD,
654 typename TNewValue,
655 typename TFunctorV>
656 std::string draw(const ConstImageAdapter<TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV>& adapter, const std::string& name = "Image_{i}");
657
658 // @brief Draws a mesh
659 template <typename Pt>
660 std::string draw(const Mesh<Pt>& mesh, const std::string& uname = "Mesh_{i}");
661
662 // @brief Draws a DSS6Computer
663 template<typename It, typename Int, int Con>
664 std::string draw(const StandardDSS6Computer<It, Int, Con>& computer, const std::string& uname = "Computer_{i}");
665
666 template<typename It, typename Int, int Con>
667 std::string draw(const Naive3DDSSComputer<It, Int, Con>& computer, const std::string& uname = "Computer_{i}");
668
669 // @brief Draws any object with a property
670 template<typename T, typename Type>
671 std::string draw(const WithQuantity<T, Type>& props, const std::string& uname = "");
672
673 template<typename Type>
674 void addQuantity(const std::string& oName, const std::string& qName, const Type& value, QuantityScale scale = QuantityScale::UNKNOWN);
675
676 template<typename Type>
677 void addQuantity(const std::string& oName, const std::string& qName, const std::vector<Type>& value, QuantityScale scale = QuantityScale::UNKNOWN);
678
679
680 // @brief Adds a clipping plane
681 std::string draw(const ClippingPlane& plane, const std::string& name = "");
682
683 // @brief Draws a Spherical Accumulator
684 template<typename T>
685 std::string draw(const SphericalAccumulator<T> accumulator, const std::string& uname = "SphericalAccumulator_{i}");
686
687 // @brief Set the current draw color
688 std::string draw(const DGtal::Color& color, const std::string& name = "");
689
690 // @brief Set the current draw color
691 void drawColor(const DGtal::Color& color);
692
693 // @brief Use default colors
695
696 // @brief Draws adjacencies of further Object
697 void drawAdjacencies(bool toggle = true);
698
699 // @brief Draws 2D KCell as simplifed mode
700 void drawAsSimplified(bool toggle = true);
701
702 // @brief Draws grid of further domains
703 void drawAsGrid(bool toggle = true);
704
705 // @brief Reset style
707
708 // @brief Draws voxels of further object, domains and points
710
711 // @brief Draws balls of further object, domains and points
713 private: // Draw commands
714 // To avoid confusion, keep this function as private:
715
716 // @brief Draws an /!\ arrow (NOT A LINE)
717 std::string draw(const std::pair<RealPoint, RealPoint>& arrow, const std::string& uname = "Arrow_{i}");
718
722 template<typename Range>
723 std::string drawGenericRange(const Range& range, const std::string& uname);
724
725 // @brief Draws an image through an iterator
726 template<typename T>
727 std::string drawImage(const std::string& uname, const T& image);
728
729 // @brief Draws an image through an iterator and replacing from its original domain
730 template<typename T>
731 std::string drawImageAdaptDom(const std::string& uname, const T& image);
732
733 // @brief Draws a KCell (signed or not)
734 std::string drawKCell(std::string uname, const RealPoint& rp, bool xodd, bool yodd, bool zodd, bool hasSign, bool sign);
735
736 public:
737 // The user is responsible for using these wrong..
738 //
740 bool allowReuseList = false;
741
742 std::vector<ClippingPlane> planes;
743 // Leave access to the user for thin modifications
744 std::map<std::string, DisplayData<RealPoint>> data;
745
746 protected:
751
753 std::vector<std::string> myToRender;
754
755 std::string myCurrentName = "";
757 }; // Display3D
758} // DGtal
759
760#include "Display3D.ih"
761
Structure representing an RGB triple with alpha component.
Definition Color.h:77
Aim: implements a const image adapter with a given domain (i.e. a subdomain) and 2 functors : g for d...
This class adapts any iterator so that operator* returns another element than the one pointed to by t...
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: DiscreteExteriorCalculus represents a calculus in the dec package. This is the main structure in...
Base class for viewing DGtal objects.
Definition Display3D.h:381
void drawAdjacencies(bool toggle=true)
std::string newTriangleList(const std::string &name)
Definition Display3D.h:540
void drawAsSimplified(bool toggle=true)
std::string myCurrentName
Definition Display3D.h:755
std::string createOrReuseLineList(const std::string &name)
Definition Display3D.h:545
void setDefaultColors()
bool canCreateNewList(size_t elementSize) const
Tells if a list of a given elementSize can be reused.
std::string draw(const DiscreteExteriorCalculus< emb, amb, Algebra, Int > &calc, const std::string &uname="Calculus_{i}")
typename KSpace::Cell KCell
Definition Display3D.h:395
void drawAsGrid(bool toggle=true)
std::string draw(const DGtal::Color &color, const std::string &name="")
std::string drawPolygon(const std::vector< Vec > &vertices, const std::string &uname="Polygon_{i}")
Draws a polygon.
std::string createOrReuseQuadList(const std::string &name)
Definition Display3D.h:546
void drawColor(const DGtal::Color &color)
std::string draw(const DigitalSetByAssociativeContainer< Obj, Cont > &set, const std::string &name="Set_{i}")
std::string draw(const ConstIteratorAdapter< A, B, C > &adapter, const std::string &uname="")
std::string drawGenericRange(const Range &range, const std::string &uname)
Draws a range of object to the screen.
std::string draw(const Point &p, const std::string &uname="Point_{i}")
bool setCurrentList(const std::string &name)
Set the current group for further updates.
std::string createOrReuseList(const std::string &name, size_t elementSize)
Reuse a list if possible, otherwise create a new one.
std::string draw(const WithQuantity< T, Type > &props, const std::string &uname="")
typename KSpace::SCell SCell
Definition Display3D.h:396
std::string draw(const ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 > &adapter, const std::string &name="Image_{i}")
virtual void renderAll()
(Re)Render all data
Definition Display3D.h:459
std::string newList(const std::string &name, size_t eSize=0)
Create a new group.
std::string createOrReusePolygonList(const std::string &name)
Definition Display3D.h:547
std::string draw(const Naive3DDSSComputer< It, Int, Con > &computer, const std::string &uname="Computer_{i}")
std::string createOrReuseCubeList(const std::string &name)
Definition Display3D.h:543
virtual void setCallback(Callback *callback)
Sets callback.
std::string createOrReuseBallList(const std::string &name)
Definition Display3D.h:544
virtual void clearView()=0
Clear the screen.
std::string draw(const KForm< Calculus, order, duality > &kform, const std::string &uname="KForm_{i}")
std::string draw(const HyperRectDomain< Space > &domain, const std::string &uname="\xff Domain_{i}")
Embedder myEmbedder
Definition Display3D.h:748
std::map< std::string, DisplayData< RealPoint > > data
Definition Display3D.h:744
std::string drawImageAdaptDom(const std::string &uname, const T &image)
std::string drawKCell(std::string uname, const RealPoint &rp, bool xodd, bool yodd, bool zodd, bool hasSign, bool sign)
std::vector< std::string > myToRender
Definition Display3D.h:753
std::string draw(const Mesh< Pt > &mesh, const std::string &uname="Mesh_{i}")
std::string draw(const typename GridCurve< KSpace >::MidPointsRange &range, const std::string &uname="MidPoints_{i}")
void addQuantity(const std::string &oName, const std::string &qName, const Type &value, QuantityScale scale=QuantityScale::UNKNOWN)
std::string draw(const std::vector< T > &vec, const std::string &uname="")
std::string draw(const ConstImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV > &adapter, const std::string &name="Image_{i}")
SCellEmbedder mySCellEmbedder
Definition Display3D.h:750
std::string createOrReuseVolumetricList(const std::string &name)
Definition Display3D.h:549
std::string drawQuad(const RealPoint &a, const RealPoint &b, const RealPoint &c, const RealPoint &d, const std::string &uname="Quad_{i}")
std::string drawBall(const RealPoint &c, const std::string &uname="Ball_{i}")
std::string draw(const ConstRangeAdapter< A, B, C > range, const std::string &uname="")
virtual void show()=0
Starts the event loop and display of elements.
std::string draw(const VectorField< Calculus, dual > &field, const std::string &uname="Field_{i}")
std::string draw(const typename GridCurve< KSpace >::ArrowsRange &range, const std::string &uname="Arrows_{i}")
std::string newBallList(const std::string &name)
Definition Display3D.h:536
std::string draw(const KCell &cell, const std::string &name="KCell_{i}_{d}d")
std::string createOrReuseTriangleList(const std::string &name)
Definition Display3D.h:548
std::string draw(const SphericalAccumulator< T > accumulator, const std::string &uname="SphericalAccumulator_{i}")
std::string newQuadList(const std::string &name)
Definition Display3D.h:538
void addQuantity(const std::string &oName, const std::string &qName, const std::vector< Type > &value, QuantityScale scale=QuantityScale::UNKNOWN)
CellEmbedder myCellEmbedder
Definition Display3D.h:749
std::string draw(const DGtal::Object< Adj, Set > &obj, const std::string &uname="Object_{i}")
std::string drawLine(const RealPoint &a, const RealPoint &b, const std::string &uname="Line_{i}")
virtual ~Display3D()
Definition Display3D.h:391
DisplayStyle currentStyle
Definition Display3D.h:739
std::string draw(const GridCurve< KSpace > &curve, const std::string &uname="GridCurve_{i}")
virtual void renderNewData()=0
Renders newly added data.
std::string newVolumetricList(const std::string &name)
Definition Display3D.h:541
Display3D(const KSpace &space)
Definition Display3D.h:383
std::string draw(const SCell &cell, const std::string &name="SCell_{i}_{d}d")
std::string draw(const RealPoint &rp, const std::string &uname="Point_{i}")
void endCurrentGroup()
End current group and sets an invalid current group.
DisplayData< RealPoint > * myCurrentData
Definition Display3D.h:756
std::string draw(const StandardDSS6Computer< It, Int, Con > &computer, const std::string &uname="Computer_{i}")
std::string drawImage(const std::string &uname, const T &image)
typename Space::Point Point
Definition Display3D.h:394
std::string newLineList(const std::string &name)
Definition Display3D.h:537
typename Space::RealPoint RealPoint
Definition Display3D.h:397
std::string draw(const ClippingPlane &plane, const std::string &name="")
std::string newPolygonList(const std::string &name)
Definition Display3D.h:539
Callback * myCallback
Definition Display3D.h:752
std::string draw(const std::pair< RealPoint, RealPoint > &arrow, const std::string &uname="Arrow_{i}")
virtual void clear()
Clear the viewer, including screen and internal data.
std::string newCubeList(const std::string &name)
Definition Display3D.h:535
std::vector< ClippingPlane > planes
Definition Display3D.h:742
Display3D & operator<<(const Obj &obj)
Draw object with stream API.
std::string draw(const ImageContainerBySTLVector< D, T > &image, const std::string &name="Image_{i}")
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition GridCurve.h:173
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: implements an image adapter with a given domain (i.e. a subdomain) and 3 functors : g for domain...
Aim: KForm represents discrete kforms in the dec package.
Definition KForm.h:66
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
SignedKhalimskyCell< dim, Integer > SCell
KhalimskyCell< dim, Integer > Cell
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Definition Mesh.h:92
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Definition Object.h:120
Aim: implements an accumulator (as histograms for 1D scalars) adapted to spherical point samples.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Aim: VectorField represents a discrete vector field in the dec package. Vector field values are attac...
Definition VectorField.h:68
float scale
void insertCubeVertices(U &dest, T center, double scale)
Insert cube vertices into an array.
std::vector< std::array< size_t, I > > makeIndices(size_t N)
Create a list of indices for a vertex array with independent elements.
std::array< T, 8 > getCubeVertices(T center, double size)
Return the vertices of a cube.
void insertAASquare(U &dest, T center, int orientation, double size)
Insert vertices of a square into a container.
void insertPrism(U &dest, T center, int orientation, double size1, double size2, double shift1, double shift2)
Insert the vertices of a prism into a container.
std::array< T, 8 > getPrism(T center, int orientation, double size1, double size2, double shift1, double shift2)
Return the vertices of a prism.
std::array< T, 4 > getAASquareVertices(T center, int orientation, double size)
Return the vertices of an axis aligned square.
DGtal is the top-level namespace which contains all DGtal functions and types.
@ UNKNOWN
Definition Topology.h:52
QuantityScale
Enumerate where quantities can be applied.
Definition Display3D.h:207
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.
Clipping plane.
Definition Display3D.h:299
DisplayStyle style
Definition Display3D.h:308
ClippingPlane(double _a, double _b, double _c, double _d)
Definition Display3D.h:300
A general callback for the viewer to give control to the user.
Definition Display3D.h:408
virtual void OnAttach(void *_viewer)
Called when setCallback is performed on the viewer.
Definition Display3D.h:420
Display3D< Space, KSpace > * viewer
Definition Display3D.h:440
virtual void OnUI(void *viewerData)
Called to render or interact with some UI.
Definition Display3D.h:426
virtual void OnClick(const std::string &name, size_t index, const DisplayData< RealPoint > &data, void *viewerData)
Called when an element is clicked.
Definition Display3D.h:437
Data required to display an object.
Definition Display3D.h:247
Eigen::Affine3d transform
Definition Display3D.h:283
Quantity< Color > colorQuantities
Definition Display3D.h:289
Quantity< RealPoint > vectorQuantities
Definition Display3D.h:291
static constexpr auto getDefaultQuantityLevel
Definition Display3D.h:262
std::vector< std::vector< uint32_t > > indices
Definition Display3D.h:277
std::size_t elementSize
Definition Display3D.h:258
std::vector< RealPoint > vertices
Definition Display3D.h:280
DisplayStyle style
Definition Display3D.h:286
Quantity< double > scalarQuantities
Definition Display3D.h:293
Style of display of an element.
Definition Display3D.h:177
DrawMode
List available draw modes.
Definition Display3D.h:192
Wrapper for array of quantities.
Definition Display3D.h:223
const QType & operator[](int idx) const
Definition Display3D.h:228
QType & operator[](const QuantityScale &scale)
Definition Display3D.h:230
QType & operator[](int idx)
Definition Display3D.h:226
std::array< QType, static_cast< size_t >(QuantityScale::UNKNOWN)> data
Definition Display3D.h:238
std::map< std::string, std::vector< T > > QType
Definition Display3D.h:224
const QType & operator[](const QuantityScale &scale) const
Definition Display3D.h:234
Attach a property to an element.
Definition Display3D.h:331
WithQuantity(const T &_object, const std::string &_name, const Type &value, QuantityScale s=QuantityScale::UNKNOWN)
Definition Display3D.h:332
std::string name
Definition Display3D.h:352
std::vector< Type > values
Definition Display3D.h:350
QuantityScale scale
Definition Display3D.h:345
WithQuantity(const T &_object, const std::string &_name, const std::vector< Type > &_values, QuantityScale s=QuantityScale::UNKNOWN)
Definition Display3D.h:338
unsigned int index(DGtal::uint32_t n, unsigned int b)
Definition testBits.cpp:44
Domain domain
Image image(domain)
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer