Blender V4.3
ViewMap.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include <map>
13
14#include "Interface0D.h"
15#include "Interface1D.h"
16#include "Silhouette.h" // defines the embedding
17
19
22
23#ifdef WITH_CXX_GUARDEDALLOC
24# include "MEM_guardedalloc.h"
25#endif
26
27namespace Freestyle {
28
29/**********************************/
30/* */
31/* */
32/* ViewMap */
33/* */
34/* */
35/**********************************/
36
37class ViewVertex;
38class ViewEdge;
39class ViewShape;
40class TVertex;
41
47class ViewMap {
48 public:
49 typedef vector<ViewEdge *> viewedges_container;
50 typedef vector<ViewVertex *> viewvertices_container;
51 typedef vector<ViewShape *> viewshapes_container;
52 typedef vector<SVertex *> svertices_container;
53 typedef vector<FEdge *> fedges_container;
54 typedef map<int, int> id_to_index_map;
55
56 private:
57 static ViewMap *_pInstance;
58 viewshapes_container _VShapes; // view shapes
59 viewedges_container _VEdges; // view edges
60 viewvertices_container _VVertices; // view vertices
61 fedges_container _FEdges; // feature edges (embedded edges)
62 svertices_container _SVertices; // embedded vertices
63 BBox<Vec3r> _scene3DBBox;
64 // Mapping between the WShape or VShape id to the VShape index in the _VShapes vector. Used in
65 // the method viewShape(int id) to access a shape from its id.
66 id_to_index_map _shapeIdToIndex;
67
68 public:
72 void *userdata;
73
76 {
77 _pInstance = this;
78 userdata = nullptr;
79 }
80
82 virtual ~ViewMap();
83
85 const ViewEdge *getClosestViewEdge(real x, real y) const;
86
88 const FEdge *getClosestFEdge(real x, real y) const;
89
90 /* accessors */
92 static inline ViewMap *getInstance()
93 {
94 return _pInstance;
95 }
96
97 /* Returns the list of ViewShapes of the scene. */
99 {
100 return _VShapes;
101 }
102
103 /* Returns the list of ViewEdges of the scene. */
105 {
106 return _VEdges;
107 }
108
109 /* Returns the list of ViewVertices of the scene. */
111 {
112 return _VVertices;
113 }
114
115 /* Returns the list of FEdges of the scene. */
117 {
118 return _FEdges;
119 }
120
121 /* Returns the list of SVertices of the scene. */
123 {
124 return _SVertices;
125 }
126
127 /* Returns an iterator pointing onto the first ViewEdge of the list. */
128 inline viewedges_container::iterator viewedges_begin()
129 {
130 return _VEdges.begin();
131 }
132
133 inline viewedges_container::iterator viewedges_end()
134 {
135 return _VEdges.end();
136 }
137
138 inline int viewedges_size()
139 {
140 return _VEdges.size();
141 }
142
144
146 {
147 return _shapeIdToIndex;
148 }
149
152 {
153 return _scene3DBBox;
154 }
155
156 /* modifiers */
157 void AddViewShape(ViewShape *iVShape);
158
159 inline void AddViewEdge(ViewEdge *iVEdge)
160 {
161 _VEdges.push_back(iVEdge);
162 }
163
164 inline void AddViewVertex(ViewVertex *iVVertex)
165 {
166 _VVertices.push_back(iVVertex);
167 }
168
169 inline void AddFEdge(FEdge *iFEdge)
170 {
171 _FEdges.push_back(iFEdge);
172 }
173
174 inline void AddSVertex(SVertex *iSVertex)
175 {
176 _SVertices.push_back(iSVertex);
177 }
178
180 inline void setScene3dBBox(const BBox<Vec3r> &bbox)
181 {
182 _scene3DBBox = bbox;
183 }
184
185 /* Creates a T vertex in the view map.
186 * A T vertex is the intersection between 2 FEdges (before these ones are splitted).
187 * The TVertex is a 2D intersection but it corresponds to a 3D point on each of the 2 FEdges.
188 * iA3D
189 * The 3D coordinates of the point corresponding to the intersection on the first edge.
190 * iA2D
191 * The x,y,z 2D coordinates of the projection of iA3D
192 * iFEdgeA
193 * The first FEdge
194 * iB3D
195 * The 3D coordinates of the point corresponding to the intersection on the second edge.
196 * iB2D
197 * The x,y,z 2D coordinates of the projection of iB3D
198 * iFEdgeB
199 * The second FEdge
200 * id
201 * The id that must be given to that TVertex
202 */
203 TVertex *CreateTVertex(const Vec3r &iA3D,
204 const Vec3r &iA2D,
205 FEdge *iFEdgeA,
206 const Vec3r &iB3D,
207 const Vec3r &iB2D,
208 FEdge *iFEdgeB,
209 const Id &id);
210
211 /* Updates the structures to take into account the fact that a SVertex must now be considered as
212 * a ViewVertex iVertex The SVertex on top of which the ViewVertex is built (it is necessarily a
213 * NonTVertex because it is a SVertex) newViewEdges The new ViewEdges that must be add to the
214 * ViewMap
215 */
216 ViewVertex *InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newViewEdges);
217
218 /* connects a FEdge to the graph through a SVertex */
219 // FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex);
220
221 /* Clean temporary FEdges created by chaining */
222 virtual void Clean();
223
224#ifdef WITH_CXX_GUARDEDALLOC
225 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewMap")
226#endif
227};
228
229/**********************************/
230/* */
231/* */
232/* ViewVertex */
233/* */
234/* */
235/**********************************/
236
237class ViewEdge;
238class SShape;
239
240namespace ViewVertexInternal {
241
244template<class Traits> class edge_iterator_base;
246
247} // namespace ViewVertexInternal
248
257class ViewVertex : public Interface0D {
258 public: // Implementation of Interface0D
260 virtual string getExactTypeName() const
261 {
262 return "ViewVertex";
263 }
264
265 public:
266 friend class ViewShape;
267 typedef pair<ViewEdge *, bool> directedViewEdge; // if bool = true, the ViewEdge is incoming
268
269 typedef vector<directedViewEdge> edges_container;
270
275
276 private:
277 Nature::VertexNature _Nature;
278
279 public:
283 void *userdata;
284
286 inline ViewVertex()
287 {
288 userdata = nullptr;
289 _Nature = Nature::VIEW_VERTEX;
290 }
291
293 {
294 userdata = nullptr;
295 _Nature = Nature::VIEW_VERTEX | nature;
296 }
297
298 protected:
300 inline ViewVertex(ViewVertex &iBrother)
301 {
302 _Nature = iBrother._Nature;
303 iBrother.userdata = this;
304 userdata = nullptr;
305 }
306
308 virtual ViewVertex *duplicate() = 0;
309
310 public:
312 virtual ~ViewVertex() {}
313
314 /* accessors */
317 {
318 return _Nature;
319 }
320
321 /* modifiers */
323 inline void setNature(Nature::VertexNature iNature)
324 {
325 _Nature = iNature;
326 }
327
328 /* Replaces old edge by new edge */
329 virtual void Replace(ViewEdge *, ViewEdge *) {}
330
331 public:
332 /* iterators access */
333 // allows iteration on the edges that comes from/goes to this vertex in CCW order (order defined
334 // in 2D in the image plan)
336 virtual const_edge_iterator edges_begin() const = 0;
338 virtual const_edge_iterator edges_end() const = 0;
340 virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const = 0;
341
342 // Iterator access
348
353
356
357#ifdef WITH_CXX_GUARDEDALLOC
358 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewVertex")
359#endif
360};
361
362/**********************************/
363/* */
364/* */
365/* TVertex */
366/* */
367/* */
368/**********************************/
369
376class TVertex : public ViewVertex {
377 public:
378 typedef vector<directedViewEdge *> edge_pointers_container;
379
380 public: // Implementation of Interface0D
382 virtual string getExactTypeName() const
383 {
384 return "TVertex";
385 }
386
387 // Data access methods
388 /* Returns the 3D x coordinate of the vertex. Ambiguous in this case. */
389 virtual real getX() const
390 {
391 cerr << "Warning: getX() undefined for this point" << endl;
392 return _FrontSVertex->point3D().x();
393 }
394
395 virtual real getY() const
396 {
397 cerr << "Warning: getX() undefined for this point" << endl;
398 return _FrontSVertex->point3D().y();
399 }
400
401 virtual real getZ() const
402 {
403 cerr << "Warning: getX() undefined for this point" << endl;
404 return _FrontSVertex->point3D().z();
405 }
406
408 virtual Vec3r getPoint3D() const
409 {
410 cerr << "Warning: getPoint3D() undefined for this point" << endl;
411 return _FrontSVertex->getPoint3D();
412 }
413
415 virtual real getProjectedX() const
416 {
417 return _FrontSVertex->point2D().x();
418 }
419
421 virtual real getProjectedY() const
422 {
423 return _FrontSVertex->point2D().y();
424 }
425
426 virtual real getProjectedZ() const
427 {
428 return _FrontSVertex->point2D().z();
429 }
430
432 virtual Vec2r getPoint2D() const
433 {
434 return _FrontSVertex->getPoint2D();
435 }
436
438 virtual Id getId() const
439 {
440 return _Id;
441 }
442
444 // it can't
446 {
447 return this;
448 }
449
452 {
453 return this;
454 }
455
456 private:
457 SVertex *_FrontSVertex;
458 SVertex *_BackSVertex;
459 directedViewEdge _FrontEdgeA;
460 directedViewEdge _FrontEdgeB;
461 directedViewEdge _BackEdgeA;
462 directedViewEdge _BackEdgeB;
463
468 Id _Id;
470 edge_pointers_container _sortedEdges;
471
472 public:
474 inline TVertex() : ViewVertex(Nature::T_VERTEX)
475 {
476 _FrontSVertex = nullptr;
477 _BackSVertex = nullptr;
478 _FrontEdgeA.first = 0;
479 _FrontEdgeB.first = 0;
480 _BackEdgeA.first = 0;
481 _BackEdgeB.first = 0;
482 }
483
484 inline TVertex(SVertex *svFront, SVertex *svBack) : ViewVertex(Nature::T_VERTEX)
485 {
486 _FrontSVertex = svFront;
487 _BackSVertex = svBack;
488 _FrontEdgeA.first = 0;
489 _FrontEdgeB.first = 0;
490 _BackEdgeA.first = 0;
491 _BackEdgeB.first = 0;
492 svFront->setViewVertex(this);
493 svBack->setViewVertex(this);
494 }
495
496 protected:
498 inline TVertex(TVertex &iBrother) : ViewVertex(iBrother)
499 {
500 _FrontSVertex = iBrother._FrontSVertex;
501 _BackSVertex = iBrother._BackSVertex;
502 _FrontEdgeA = iBrother._FrontEdgeA;
503 _FrontEdgeB = iBrother._FrontEdgeB;
504 _BackEdgeA = iBrother._BackEdgeA;
505 _BackEdgeB = iBrother._BackEdgeB;
506 _sortedEdges = iBrother._sortedEdges;
507 }
508
511 {
512 TVertex *clone = new TVertex(*this);
513 return clone;
514 }
515
516 public:
517 /* accessors */
520 {
521 return _FrontSVertex;
522 }
523
526 {
527 return _BackSVertex;
528 }
529
531 {
532 return _FrontEdgeA;
533 }
534
536 {
537 return _FrontEdgeB;
538 }
539
541 {
542 return _BackEdgeA;
543 }
544
546 {
547 return _BackEdgeB;
548 }
549
550 /* modifiers */
552 inline void setFrontSVertex(SVertex *iFrontSVertex)
553 {
554 _FrontSVertex = iFrontSVertex;
555 _FrontSVertex->setViewVertex(this);
556 }
557
559 inline void setBackSVertex(SVertex *iBackSVertex)
560 {
561 _BackSVertex = iBackSVertex;
562 _BackSVertex->setViewVertex(this);
563 }
564
565 void setFrontEdgeA(ViewEdge *iFrontEdgeA, bool incoming = true);
566 void setFrontEdgeB(ViewEdge *iFrontEdgeB, bool incoming = true);
567 void setBackEdgeA(ViewEdge *iBackEdgeA, bool incoming = true);
568 void setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming = true);
569
571 inline void setId(const Id &iId)
572 {
573 _Id = iId;
574 }
575
577 inline SVertex *getSVertex(FEdge *iFEdge)
578 {
579 const vector<FEdge *> &vfEdges = _FrontSVertex->fedges();
580 vector<FEdge *>::const_iterator fe, fend;
581 for (fe = vfEdges.begin(), fend = vfEdges.end(); fe != fend; fe++) {
582 if ((*fe) == iFEdge) {
583 return _FrontSVertex;
584 }
585 }
586
587 const vector<FEdge *> &vbEdges = _BackSVertex->fedges();
588 for (fe = vbEdges.begin(), fend = vbEdges.end(); fe != fend; fe++) {
589 if ((*fe) == iFEdge) {
590 return _BackSVertex;
591 }
592 }
593 return nullptr;
594 }
595
596 virtual void Replace(ViewEdge *iOld, ViewEdge *iNew);
597
602 virtual ViewEdge *mate(ViewEdge *iEdgeA)
603 {
604 if (iEdgeA == _FrontEdgeA.first) {
605 return _FrontEdgeB.first;
606 }
607 if (iEdgeA == _FrontEdgeB.first) {
608 return _FrontEdgeA.first;
609 }
610 if (iEdgeA == _BackEdgeA.first) {
611 return _BackEdgeB.first;
612 }
613 if (iEdgeA == _BackEdgeB.first) {
614 return _BackEdgeA.first;
615 }
616 return nullptr;
617 }
618
619 /* iterators access */
620 virtual edge_iterator edges_begin();
621 virtual const_edge_iterator edges_begin() const;
622 virtual edge_iterator edges_end();
623 virtual const_edge_iterator edges_end() const;
624 virtual edge_iterator edges_iterator(ViewEdge *iEdge);
625 virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const;
626
632
637
640
641#ifdef WITH_CXX_GUARDEDALLOC
642 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TVertex")
643#endif
644};
645
646/**********************************/
647/* */
648/* */
649/* NonTVertex */
650/* */
651/* */
652/**********************************/
653
654// (non T vertex)
659class NonTVertex : public ViewVertex {
660 public:
661 typedef vector<directedViewEdge> edges_container;
662
663 public: // Implementation of Interface0D
665 virtual string getExactTypeName() const
666 {
667 return "NonTVertex";
668 }
669
670 // Data access methods
672 virtual real getX() const
673 {
674 return _SVertex->point3D().x();
675 }
676
678 virtual real getY() const
679 {
680 return _SVertex->point3D().y();
681 }
682
684 virtual real getZ() const
685 {
686 return _SVertex->point3D().z();
687 }
688
690 virtual Vec3r getPoint3D() const
691 {
692 return _SVertex->getPoint3D();
693 }
694
696 virtual real getProjectedX() const
697 {
698 return _SVertex->point2D().x();
699 }
700
702 virtual real getProjectedY() const
703 {
704 return _SVertex->point2D().y();
705 }
706
708 virtual real getProjectedZ() const
709 {
710 return _SVertex->point2D().z();
711 }
712
714 virtual Vec2r getPoint2D() const
715 {
716 return _SVertex->getPoint2D();
717 }
718
720 virtual Id getId() const
721 {
722 return _SVertex->getId();
723 }
724
727 {
728 return _SVertex;
729 }
730
733 {
734 return this;
735 }
736
739 {
740 return this;
741 }
742
743 private:
744 SVertex *_SVertex;
745 edges_container _ViewEdges;
746
747 public:
749 inline NonTVertex() : ViewVertex(Nature::NON_T_VERTEX)
750 {
751 _SVertex = nullptr;
752 }
753
755 inline NonTVertex(SVertex *iSVertex) : ViewVertex(Nature::NON_T_VERTEX)
756 {
757 _SVertex = iSVertex;
758 _SVertex->setViewVertex(this);
759 }
760
761 protected:
763 inline NonTVertex(NonTVertex &iBrother) : ViewVertex(iBrother)
764 {
765 _SVertex = iBrother._SVertex;
766 _SVertex->setViewVertex(this);
767 _ViewEdges = iBrother._ViewEdges;
768 }
769
772 {
773 NonTVertex *clone = new NonTVertex(*this);
774 return clone;
775 }
776
777 public:
779 virtual ~NonTVertex() {}
780
781 /* accessors */
783 inline SVertex *svertex()
784 {
785 return _SVertex;
786 }
787
789 {
790 return _ViewEdges;
791 }
792
793 /* modifiers */
795 inline void setSVertex(SVertex *iSVertex)
796 {
797 _SVertex = iSVertex;
798 _SVertex->setViewVertex(this);
799 }
800
801 inline void setViewEdges(const vector<directedViewEdge> &iViewEdges)
802 {
803 _ViewEdges = iViewEdges;
804 }
805
806 void AddIncomingViewEdge(ViewEdge *iVEdge);
807 void AddOutgoingViewEdge(ViewEdge *iVEdge);
808
809 inline void AddViewEdge(ViewEdge *iVEdge, bool incoming = true)
810 {
811 if (incoming) {
812 AddIncomingViewEdge(iVEdge);
813 }
814 else {
815 AddOutgoingViewEdge(iVEdge);
816 }
817 }
818
819 /* Replaces old edge by new edge */
820 virtual void Replace(ViewEdge *iOld, ViewEdge *iNew)
821 {
822 edges_container::iterator insertedve;
823 for (edges_container::iterator ve = _ViewEdges.begin(), vend = _ViewEdges.end(); ve != vend;
824 ve++)
825 {
826 if ((ve)->first == iOld) {
827 insertedve = _ViewEdges.insert(
828 ve, directedViewEdge(iNew, ve->second)); // inserts e2 before ve.
829 // returns an iterator pointing toward e2. ve is invalidated.
830 // we want to remove e1, but we can't use ve anymore:
831 insertedve++; // insertedve points now to e1
832 _ViewEdges.erase(insertedve);
833 return;
834 }
835 }
836 }
837
838 /* iterators access */
839 virtual edge_iterator edges_begin();
840 virtual const_edge_iterator edges_begin() const;
841 virtual edge_iterator edges_end();
842 virtual const_edge_iterator edges_end() const;
843 virtual edge_iterator edges_iterator(ViewEdge *iEdge);
844 virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const;
845
851
856
859
860#ifdef WITH_CXX_GUARDEDALLOC
861 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NonTVertex")
862#endif
863};
864
865/**********************************/
866/* */
867/* */
868/* ViewEdge */
869/* */
870/* */
871/**********************************/
872
873/* Geometry(normals...)
874 * Nature of edges
875 * 2D spaces (1or2, material, z...)
876 * Parent Shape
877 * 3D Shading, material
878 * Importance
879 * Occluders
880 */
881class ViewShape;
882
883namespace ViewEdgeInternal {
884
885template<class Traits> class edge_iterator_base;
886template<class Traits> class fedge_iterator_base;
887template<class Traits> class vertex_iterator_base;
888
889} // end of namespace ViewEdgeInternal
890
894class ViewEdge : public Interface1D {
895 public: // Implementation of Interface0D
897 virtual string getExactTypeName() const
898 {
899 return "ViewEdge";
900 }
901
902 // Data access methods
904 virtual Id getId() const
905 {
906 return _Id;
907 }
908
911 {
912 return _Nature;
913 }
914
915 public:
917 friend class ViewShape;
918 // for ViewEdge iterator
921 // for fedge iterator
924 // for svertex iterator
927
928 private:
929 ViewVertex *__A; // edge starting vertex
930 ViewVertex *__B; // edge ending vertex
931 Nature::EdgeNature _Nature; // nature of view edge
932 ViewShape *_Shape; // shape to which the view edge belongs
933 FEdge *_FEdgeA; // first edge of the embedded fedges chain
934 FEdge *_FEdgeB; // last edge of the embedded fedges chain
935 Id _Id;
936 uint _ChainingTimeStamp;
937 // The silhouette view edge separates two 2D spaces. The one on the left is necessarily the Shape
938 // _Shape (the one to which this edge belongs to) and _aShape is the one on its right NOT HANDLED
939 // BY THE COPY CONSTRUCTOR
940 ViewShape *_aShape;
941 int _qi;
942 vector<ViewShape *> _Occluders;
943 bool _isInImage;
944
945 // tmp
946 Id *_splittingId;
947
948 public:
952 void *userdata;
953
955 inline ViewEdge()
956 {
957 __A = nullptr;
958 __B = nullptr;
959 _FEdgeA = nullptr;
960 _FEdgeB = nullptr;
961 _ChainingTimeStamp = 0;
962 _qi = 0;
963 _aShape = nullptr;
964 userdata = nullptr;
965 _splittingId = nullptr;
966 _isInImage = true;
967 }
968
970 {
971 __A = iA;
972 __B = iB;
973 _FEdgeA = nullptr;
974 _FEdgeB = nullptr;
975 _Shape = 0;
976 _ChainingTimeStamp = 0;
977 _qi = 0;
978 _aShape = nullptr;
979 userdata = nullptr;
980 _splittingId = nullptr;
981 _isInImage = true;
982 }
983
984 inline ViewEdge(ViewVertex *iA, ViewVertex *iB, FEdge *iFEdgeA)
985 {
986 __A = iA;
987 __B = iB;
988 _FEdgeA = iFEdgeA;
989 _FEdgeB = nullptr;
990 _Shape = nullptr;
991 _ChainingTimeStamp = 0;
992 _qi = 0;
993 _aShape = nullptr;
994 userdata = nullptr;
995 _splittingId = nullptr;
996 _isInImage = true;
997 }
998
999 inline ViewEdge(
1000 ViewVertex *iA, ViewVertex *iB, FEdge *iFEdgeA, FEdge *iFEdgeB, ViewShape *iShape)
1001 {
1002 __A = iA;
1003 __B = iB;
1004 _FEdgeA = iFEdgeA;
1005 _FEdgeB = iFEdgeB;
1006 _Shape = iShape;
1007 _ChainingTimeStamp = 0;
1008 _qi = 0;
1009 _aShape = nullptr;
1010 userdata = nullptr;
1011 _splittingId = nullptr;
1012 _isInImage = true;
1013 UpdateFEdges(); // tells every FEdge between iFEdgeA and iFEdgeB that this is theit ViewEdge
1014 }
1015
1016 // soc protected:
1018 inline ViewEdge(ViewEdge &iBrother)
1019 {
1020 __A = iBrother.__A;
1021 __B = iBrother.__B;
1022 _FEdgeA = iBrother._FEdgeA;
1023 _FEdgeB = iBrother._FEdgeB;
1024 _Nature = iBrother._Nature;
1025 _Shape = nullptr;
1026 _Id = iBrother._Id;
1027 _ChainingTimeStamp = iBrother._ChainingTimeStamp;
1028 _aShape = iBrother._aShape;
1029 _qi = iBrother._qi;
1030 _splittingId = nullptr;
1031 _isInImage = iBrother._isInImage;
1032 iBrother.userdata = this;
1033 userdata = nullptr;
1034 }
1035
1038 {
1039 ViewEdge *clone = new ViewEdge(*this);
1040 return clone;
1041 }
1042
1043 public:
1045 virtual ~ViewEdge()
1046 {
1047#if 0
1048 if (_aFace) {
1049 delete _aFace;
1050 _aFace = nullptr;
1051 }
1052#endif
1053 // only the last splitted deletes this id
1054 if (_splittingId) {
1055 if (*_splittingId == _Id) {
1056 delete _splittingId;
1057 }
1058 }
1059 }
1060
1061 /* accessors */
1063 inline ViewVertex *A()
1064 {
1065 return __A;
1066 }
1067
1069 inline ViewVertex *B()
1070 {
1071 return __B;
1072 }
1073
1075 inline FEdge *fedgeA()
1076 {
1077 return _FEdgeA;
1078 }
1079
1081 inline FEdge *fedgeB()
1082 {
1083 return _FEdgeB;
1084 }
1085
1088 {
1089 return _Shape;
1090 }
1091
1096 {
1097 return _aShape;
1098 }
1099
1101 inline bool isClosed()
1102 {
1103 if (!__B) {
1104 return true;
1105 }
1106 return false;
1107 }
1108
1111 {
1112 return _ChainingTimeStamp;
1113 }
1114
1115 inline const ViewShape *aShape() const
1116 {
1117 return _aShape;
1118 }
1119
1120 inline const ViewShape *bShape() const
1121 {
1122 return _Shape;
1123 }
1124
1125 inline vector<ViewShape *> &occluders()
1126 {
1127 return _Occluders;
1128 }
1129
1130 inline Id *splittingId()
1131 {
1132 return _splittingId;
1133 }
1134
1135 inline bool isInImage() const
1136 {
1137 return _isInImage;
1138 }
1139
1140 /* modifiers */
1142 inline void setA(ViewVertex *iA)
1143 {
1144 __A = iA;
1145 }
1146
1148 inline void setB(ViewVertex *iB)
1149 {
1150 __B = iB;
1151 }
1152
1154 inline void setNature(Nature::EdgeNature iNature)
1155 {
1156 _Nature = iNature;
1157 }
1158
1160 inline void setFEdgeA(FEdge *iFEdge)
1161 {
1162 _FEdgeA = iFEdge;
1163 }
1164
1166 inline void setFEdgeB(FEdge *iFEdge)
1167 {
1168 _FEdgeB = iFEdge;
1169 }
1170
1172 inline void setShape(ViewShape *iVShape)
1173 {
1174 _Shape = iVShape;
1175 }
1176
1178 inline void setId(const Id &id)
1179 {
1180 _Id = id;
1181 }
1182
1184 void UpdateFEdges();
1185
1187 inline void setaShape(ViewShape *iShape)
1188 {
1189 _aShape = iShape;
1190 }
1191
1193 inline void setQI(int qi)
1194 {
1195 _qi = qi;
1196 }
1197
1200 {
1201 _ChainingTimeStamp = ts;
1202 }
1203
1204 inline void AddOccluder(ViewShape *iShape)
1205 {
1206 _Occluders.push_back(iShape);
1207 }
1208
1209 inline void setSplittingId(Id *id)
1210 {
1211 _splittingId = id;
1212 }
1213
1214 inline void setIsInImage(bool iFlag)
1215 {
1216 _isInImage = iFlag;
1217 }
1218
1219 /* stroke interface definition */
1220 inline bool intersect_2d_area(const Vec2r &iMin, const Vec2r &iMax) const
1221 {
1222 // parse edges to check if one of them is intersection the region:
1223 FEdge *current = _FEdgeA;
1224 do {
1226 iMin,
1227 iMax,
1228 Vec2r(current->vertexA()->point2D()[0], current->vertexA()->point2D()[1]),
1229 Vec2r(current->vertexB()->point2D()[0], current->vertexB()->point2D()[1])))
1230 {
1231 return true;
1232 }
1233 current = current->nextEdge();
1234 } while ((current != 0) && (current != _FEdgeA));
1235
1236 return false;
1237 }
1238
1239 inline bool include_in_2d_area(const Vec2r &iMin, const Vec2r &iMax) const
1240 {
1241 // parse edges to check if all of them are intersection the region:
1242 FEdge *current = _FEdgeA;
1243
1244 do {
1246 iMin,
1247 iMax,
1248 Vec2r(current->vertexA()->point2D()[0], current->vertexA()->point2D()[1]),
1249 Vec2r(current->vertexB()->point2D()[0], current->vertexB()->point2D()[1])))
1250 {
1251 return false;
1252 }
1253 current = current->nextEdge();
1254 } while ((current != 0) && (current != _FEdgeA));
1255
1256 return true;
1257 }
1258
1259 /* Information access interface */
1260
1261#if 0
1262 inline Nature::EdgeNature viewedge_nature() const
1263 {
1264 return getNature();
1265 }
1266
1267 float viewedge_length() const;
1268#endif
1269
1271 real getLength2D() const;
1272
1273#if 0
1274 inline Material material() const
1275 {
1276 return _FEdgeA->vertexA()->shape()->material();
1277 }
1278#endif
1279
1280 inline int qi() const
1281 {
1282 return _qi;
1283 }
1284
1285 inline occluder_container::const_iterator occluders_begin() const
1286 {
1287 return _Occluders.begin();
1288 }
1289
1290 inline occluder_container::const_iterator occluders_end() const
1291 {
1292 return _Occluders.end();
1293 }
1294
1295 inline int occluders_size() const
1296 {
1297 return _Occluders.size();
1298 }
1299
1300 inline bool occluders_empty() const
1301 {
1302 return _Occluders.empty();
1303 }
1304
1305 inline const Polygon3r &occludee() const
1306 {
1307 return (_FEdgeA->aFace());
1308 }
1309
1310 inline const SShape *occluded_shape() const;
1311
1312 inline const bool occludee_empty() const
1313 {
1314 if (_aShape == 0) {
1315 return true;
1316 }
1317 return false;
1318 }
1319
1320 // inline real z_discontinuity(int iCombination = 0) const;
1321
1322 inline Id shape_id() const
1323 {
1324 return _FEdgeA->vertexA()->shape()->getId();
1325 }
1326
1327 inline const SShape *shape() const
1328 {
1329 return _FEdgeA->vertexA()->shape();
1330 }
1331
1332 inline float shape_importance() const
1333 {
1334 return _FEdgeA->shape_importance();
1335 }
1336
1337 /* iterators access */
1338 // view edge iterator
1341 // feature edge iterator
1348 // embedding vertex iterator
1355
1356 // Iterator access (Interface1D)
1361
1366
1372 virtual Interface0DIterator pointsBegin(float t = 0.0f);
1373
1379 virtual Interface0DIterator pointsEnd(float t = 0.0f);
1380
1381#ifdef WITH_CXX_GUARDEDALLOC
1382 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewEdge")
1383#endif
1384};
1385
1386/**********************************/
1387/* */
1388/* */
1389/* ViewShape */
1390/* */
1391/* */
1392/**********************************/
1393
1397 private:
1398 vector<ViewVertex *> _Vertices;
1399 vector<ViewEdge *> _Edges;
1400 SShape *_SShape;
1401
1402 public:
1407
1409 inline ViewShape()
1410 {
1411 userdata = nullptr;
1412 _SShape = nullptr;
1413 }
1414
1416 inline ViewShape(SShape *iSShape)
1417 {
1418 userdata = nullptr;
1419 _SShape = iSShape;
1420 //_SShape->setViewShape(this);
1421 }
1422
1424 inline ViewShape(ViewShape &iBrother)
1425 {
1426 userdata = nullptr;
1427 vector<ViewVertex *>::iterator vv, vvend;
1428 vector<ViewEdge *>::iterator ve, veend;
1429
1430 _SShape = iBrother._SShape;
1431
1432 vector<ViewVertex *> &vvertices = iBrother.vertices();
1433 // duplicate vertices
1434 for (vv = vvertices.begin(), vvend = vvertices.end(); vv != vvend; vv++) {
1435 ViewVertex *newVertex = (*vv)->duplicate();
1436 AddVertex(newVertex);
1437 }
1438
1439 vector<ViewEdge *> &vvedges = iBrother.edges();
1440 // duplicate edges
1441 for (ve = vvedges.begin(), veend = vvedges.end(); ve != veend; ve++) {
1442 ViewEdge *newEdge = (*ve)->duplicate();
1443 AddEdge(newEdge); // here the shape is set as the edge's shape
1444 }
1445
1446 //-------------------------
1447 // remap edges in vertices:
1448 //-------------------------
1449 for (vv = _Vertices.begin(), vvend = _Vertices.end(); vv != vvend; vv++) {
1450 switch ((*vv)->getNature()) {
1451 case Nature::T_VERTEX: {
1452 TVertex *v = (TVertex *)(*vv);
1453 ViewEdge *veFrontA = (ViewEdge *)(v)->frontEdgeA().first->userdata;
1454 ViewEdge *veFrontB = (ViewEdge *)(v)->frontEdgeB().first->userdata;
1455 ViewEdge *veBackA = (ViewEdge *)(v)->backEdgeA().first->userdata;
1456 ViewEdge *veBackB = (ViewEdge *)(v)->backEdgeB().first->userdata;
1457
1458 v->setFrontEdgeA(veFrontA, v->frontEdgeA().second);
1459 v->setFrontEdgeB(veFrontB, v->frontEdgeB().second);
1460 v->setBackEdgeA(veBackA, v->backEdgeA().second);
1461 v->setBackEdgeB(veBackB, v->backEdgeB().second);
1462 break;
1463 }
1464 case Nature::NON_T_VERTEX: {
1465 NonTVertex *v = (NonTVertex *)(*vv);
1466 vector<ViewVertex::directedViewEdge> &vedges = (v)->viewedges();
1467 vector<ViewVertex::directedViewEdge> newEdges;
1468 for (vector<ViewVertex::directedViewEdge>::iterator ve = vedges.begin(),
1469 veend = vedges.end();
1470 ve != veend;
1471 ve++)
1472 {
1473 ViewEdge *current = (ViewEdge *)((ve)->first)->userdata;
1474 newEdges.push_back(ViewVertex::directedViewEdge(current, ve->second));
1475 }
1476 (v)->setViewEdges(newEdges);
1477 } break;
1478 default:
1479 break;
1480 }
1481 }
1482
1483 //-------------------------------------
1484 // remap vertices in edges:
1485 //-------------------------------------
1486 for (ve = _Edges.begin(), veend = _Edges.end(); ve != veend; ve++) {
1487 (*ve)->setA((ViewVertex *)((*ve)->A()->userdata));
1488 (*ve)->setB((ViewVertex *)((*ve)->B()->userdata));
1489 //---------------------------------------
1490 // Update all embedded FEdges
1491 //---------------------------------------
1492 (*ve)->UpdateFEdges();
1493 }
1494
1495 // reset all brothers userdata to nullptr:
1496 //-------------------------------------
1497 //---------
1498 // vertices
1499 //---------
1500 for (vv = vvertices.begin(), vvend = vvertices.end(); vv != vvend; vv++) {
1501 (*vv)->userdata = nullptr;
1502 }
1503
1504 //------
1505 // edges
1506 //------
1507 for (ve = vvedges.begin(), veend = vvedges.end(); ve != veend; ve++) {
1508 (*ve)->userdata = nullptr;
1509 }
1510 }
1511
1514 {
1515 ViewShape *clone = new ViewShape(*this);
1516 return clone;
1517 }
1518
1520 virtual ~ViewShape();
1521
1522 /* splits a view edge into several view edges.
1523 * fe
1524 * The FEdge that gets splitted
1525 * iViewVertices
1526 * The view vertices corresponding to the different intersections for the edge fe.
1527 * This list need to be sorted such as the first view vertex is the farther away from
1528 * fe->vertexA. ioNewEdges The feature edges that are newly created (the initial edges are not
1529 * included) are added to this list. ioNewViewEdges The view edges that are newly created (the
1530 * initial edges are not included) are added to this list.
1531 */
1532 inline void SplitEdge(FEdge *fe,
1533 const vector<TVertex *> &iViewVertices,
1534 vector<FEdge *> &ioNewEdges,
1535 vector<ViewEdge *> &ioNewViewEdges);
1536
1537 /* accessors */
1539 inline SShape *sshape()
1540 {
1541 return _SShape;
1542 }
1543
1545 inline const SShape *sshape() const
1546 {
1547 return _SShape;
1548 }
1549
1551 inline vector<ViewVertex *> &vertices()
1552 {
1553 return _Vertices;
1554 }
1555
1557 inline vector<ViewEdge *> &edges()
1558 {
1559 return _Edges;
1560 }
1561
1563 inline Id getId() const
1564 {
1565 return _SShape->getId();
1566 }
1567
1569 inline const string &getName() const
1570 {
1571 return _SShape->getName();
1572 }
1573
1575 inline const string &getLibraryPath() const
1576 {
1577 return _SShape->getLibraryPath();
1578 }
1579
1580 /* modifiers */
1582 inline void setSShape(SShape *iSShape)
1583 {
1584 _SShape = iSShape;
1585 }
1586
1588 inline void setVertices(const vector<ViewVertex *> &iVertices)
1589 {
1590 _Vertices = iVertices;
1591 }
1592
1594 inline void setEdges(const vector<ViewEdge *> &iEdges)
1595 {
1596 _Edges = iEdges;
1597 }
1598
1600 inline void AddVertex(ViewVertex *iVertex)
1601 {
1602 _Vertices.push_back(iVertex);
1603 //_SShape->AddNewVertex(iVertex->svertex());
1604 }
1605
1607 inline void AddEdge(ViewEdge *iEdge)
1608 {
1609 _Edges.push_back(iEdge);
1610 iEdge->setShape(this);
1611 //_SShape->AddNewEdge(iEdge->fedge());
1612 }
1613
1614 /* removes the view edge iViewEdge in the View Shape and the associated FEdge chain entry in the
1615 * underlying SShape
1616 */
1617 void RemoveEdge(ViewEdge *iViewEdge);
1618
1619 /* removes the view vertex iViewVertex in the View Shape. */
1620 void RemoveVertex(ViewVertex *iViewVertex);
1621
1622#ifdef WITH_CXX_GUARDEDALLOC
1623 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewShape")
1624#endif
1625};
1626
1627/*
1628 * #############################################
1629 * #############################################
1630 * #############################################
1631 * ###### ######
1632 * ###### I M P L E M E N T A T I O N ######
1633 * ###### ######
1634 * #############################################
1635 * #############################################
1636 * #############################################
1637 */
1638/* for inline functions */
1639
1641 const vector<TVertex *> &iViewVertices,
1642 vector<FEdge *> &ioNewEdges,
1643 vector<ViewEdge *> &ioNewViewEdges)
1644{
1645 ViewEdge *vEdge = fe->viewedge();
1646
1647 // We first need to sort the view vertices from farther to closer to fe->vertexA
1648 SVertex *sv, *sv2;
1649 ViewVertex *vva, *vvb;
1650 vector<TVertex *>::const_iterator vv, vvend;
1651 for (vv = iViewVertices.begin(), vvend = iViewVertices.end(); vv != vvend; vv++) {
1652 // Add the viewvertices to the ViewShape
1653 AddVertex((*vv));
1654
1655 // retrieve the correct SVertex from the view vertex
1656 //--------------------------------------------------
1657 sv = (*vv)->frontSVertex();
1658 sv2 = (*vv)->backSVertex();
1659
1660 if (sv->shape() != sv2->shape()) {
1661 if (sv->shape() != _SShape) {
1662 sv = sv2;
1663 }
1664 }
1665 else {
1666 // if the shape is the same we can safely differ the two vertices using their ids:
1667 if (sv->getId() != fe->vertexA()->getId()) {
1668 sv = sv2;
1669 }
1670 }
1671
1672 vva = vEdge->A();
1673 vvb = vEdge->B();
1674
1675 // We split Fedge AB into AA' and A'B. A' and A'B are created.
1676 // AB becomes (address speaking) AA'. B is updated.
1677 //--------------------------------------------------
1678 SShape *shape = fe->shape();
1679
1680 // a new edge, A'B is created.
1681 FEdge *newEdge = shape->SplitEdgeIn2(fe, sv);
1682 /* One of the two FEdges (fe and newEdge) may have a 2D length less than M_EPSILON.
1683 * (22 Feb 2011, T.K.)
1684 */
1685
1686 ioNewEdges.push_back(newEdge);
1687 ViewEdge *newVEdge;
1688
1689 if ((vva == 0) || (vvb == 0)) { // that means we're dealing with a closed viewedge (loop)
1690 // remove the chain that was starting by the fedge A of vEdge (which is different from fe
1691 // !!!!)
1692 shape->RemoveEdgeFromChain(vEdge->fedgeA());
1693 // we set
1694 vEdge->setA(*vv);
1695 vEdge->setB(*vv);
1696 vEdge->setFEdgeA(newEdge);
1697 // FEdge *previousEdge = newEdge->previousEdge();
1698 vEdge->setFEdgeB(fe);
1699 newVEdge = vEdge;
1700 vEdge->fedgeA()->setViewEdge(newVEdge);
1701 }
1702 else {
1703 // while we create the view edge, it updates the "ViewEdge" pointer of every underlying
1704 // FEdges to this.
1705 newVEdge = new ViewEdge((*vv), vvb); //, newEdge, vEdge->fedgeB());
1706 newVEdge->setNature((fe)->getNature());
1707 newVEdge->setFEdgeA(newEdge);
1708 // newVEdge->setFEdgeB(fe);
1709 // If our original viewedge is made of one FEdge, then
1710 if ((vEdge->fedgeA() == vEdge->fedgeB()) || (fe == vEdge->fedgeB())) {
1711 newVEdge->setFEdgeB(newEdge);
1712 }
1713 else {
1714 newVEdge->setFEdgeB(vEdge->fedgeB()); // MODIF
1715 }
1716
1717 Id *newId = vEdge->splittingId();
1718 if (newId == 0) {
1719 newId = new Id(vEdge->getId());
1720 vEdge->setSplittingId(newId);
1721 }
1722 newId->setSecond(newId->getSecond() + 1);
1723 newVEdge->setId(*newId);
1724 newVEdge->setSplittingId(newId);
1725#if 0
1726 Id id(vEdge->getId().getFirst(), vEdge->getId().getSecond() + 1);
1727 newVEdge->setId(vEdge->getId());
1728 vEdge->setId(id);
1729#endif
1730
1731 AddEdge(newVEdge); // here this shape is set as the edge's shape
1732
1733 // add new edge to the list of new edges passed as argument:
1734 ioNewViewEdges.push_back(newVEdge);
1735
1736 if (0 != vvb) {
1737 vvb->Replace((vEdge), newVEdge);
1738 }
1739
1740 // we split the view edge:
1741 vEdge->setB((*vv));
1742 vEdge->setFEdgeB(fe); // MODIF
1743
1744 // Update fedges so that they point to the new viewedge:
1745 newVEdge->UpdateFEdges();
1746 }
1747 // check whether this vertex is a front vertex or a back one
1748 if (sv == (*vv)->frontSVertex()) {
1749 // -- View Vertex A' --
1750 (*vv)->setFrontEdgeA(vEdge, true);
1751 (*vv)->setFrontEdgeB(newVEdge, false);
1752 }
1753 else {
1754 // -- View Vertex A' --
1755 (*vv)->setBackEdgeA(vEdge, true);
1756 (*vv)->setBackEdgeB(newVEdge, false);
1757 }
1758 }
1759}
1760
1761/**********************************/
1762/* */
1763/* */
1764/* ViewEdge */
1765/* */
1766/* */
1767/**********************************/
1768
1769#if 0
1770inline Vec3r ViewEdge::orientation2d(int iCombination) const
1771{
1772 return edge_orientation2d_function<ViewEdge>(*this, iCombination);
1773}
1774
1775inline Vec3r ViewEdge::orientation3d(int iCombination) const
1776{
1777 return edge_orientation3d_function<ViewEdge>(*this, iCombination);
1778}
1779
1780inline real ViewEdge::z_discontinuity(int iCombination) const
1781{
1782 return z_discontinuity_edge_function<ViewEdge>(*this, iCombination);
1783}
1784
1785inline float ViewEdge::local_average_depth(int iCombination) const
1786{
1787 return local_average_depth_edge_function<ViewEdge>(*this, iCombination);
1788}
1789
1790inline float ViewEdge::local_depth_variance(int iCombination) const
1791{
1792 return local_depth_variance_edge_function<ViewEdge>(*this, iCombination);
1793}
1794
1795inline real ViewEdge::local_average_density(float sigma, int iCombination) const
1796{
1797 return density_edge_function<ViewEdge>(*this, iCombination);
1798}
1799#endif
1800
1802{
1803 if (0 == _aShape) {
1804 return 0;
1805 }
1806 return _aShape->sshape();
1807}
1808
1809#if 0
1810inline Vec3r ViewEdge::curvature2d_as_vector(int iCombination) const
1811{
1812 return curvature2d_as_vector_edge_function<ViewEdge>(*this, iCombination);
1813}
1814
1815inline real ViewEdge::curvature2d_as_angle(int iCombination) const
1816{
1817 return curvature2d_as_angle_edge_function<ViewEdge>(*this, iCombination);
1818}
1819#endif
1820
1821} /* namespace Freestyle */
unsigned int uint
Classes defining the basic "Iterator" design pattern.
Configuration definitions.
Various tools for geometry.
Interface to 0D elements.
Interface 1D and related tools definitions.
Read Guarded memory(de)allocation.
Classes to define a silhouette structure.
ATTR_WARN_UNUSED_RESULT const BMVert * v
ViewEdge * viewedge() const
Definition Silhouette.h:658
SShape * shape()
Definition Silhouette.h:636
FEdge * nextEdge()
Definition Silhouette.h:623
SVertex * vertexA()
Definition Silhouette.h:597
void setViewEdge(ViewEdge *iViewEdge)
Definition Silhouette.h:766
const Polygon3r & aFace() const
Definition Silhouette.h:690
float shape_importance() const
id_type getFirst() const
Definition Id.h:64
id_type getSecond() const
Definition Id.h:70
void setSecond(id_type second)
Definition Id.h:82
virtual void Replace(ViewEdge *iOld, ViewEdge *iNew)
Definition ViewMap.h:820
void AddIncomingViewEdge(ViewEdge *iVEdge)
Definition ViewMap.cpp:571
virtual ViewVertex * duplicate()
Definition ViewMap.h:771
virtual Vec3r getPoint3D() const
Definition ViewMap.h:690
virtual real getProjectedX() const
Definition ViewMap.h:696
edges_container & viewedges()
Definition ViewMap.h:788
virtual string getExactTypeName() const
Definition ViewMap.h:665
vector< directedViewEdge > edges_container
Definition ViewMap.h:661
virtual ViewVertex * castToViewVertex()
Definition ViewMap.h:732
virtual ~NonTVertex()
Definition ViewMap.h:779
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin()
Definition ViewMap.cpp:633
NonTVertex(NonTVertex &iBrother)
Definition ViewMap.h:763
virtual edge_iterator edges_iterator(ViewEdge *iEdge)
Definition ViewMap.cpp:608
virtual real getZ() const
Definition ViewMap.h:684
virtual NonTVertex * castToNonTVertex()
Definition ViewMap.h:738
virtual Id getId() const
Definition ViewMap.h:720
virtual edge_iterator edges_begin()
Definition ViewMap.cpp:588
virtual real getProjectedY() const
Definition ViewMap.h:702
void AddViewEdge(ViewEdge *iVEdge, bool incoming=true)
Definition ViewMap.h:809
void AddOutgoingViewEdge(ViewEdge *iVEdge)
Definition ViewMap.cpp:555
virtual real getProjectedZ() const
Definition ViewMap.h:708
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd()
Definition ViewMap.cpp:639
void setViewEdges(const vector< directedViewEdge > &iViewEdges)
Definition ViewMap.h:801
SVertex * svertex()
Definition ViewMap.h:783
virtual Vec2r getPoint2D() const
Definition ViewMap.h:714
void setSVertex(SVertex *iSVertex)
Definition ViewMap.h:795
virtual real getY() const
Definition ViewMap.h:678
virtual real getX() const
Definition ViewMap.h:672
virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge)
Definition ViewMap.cpp:645
virtual edge_iterator edges_end()
Definition ViewMap.cpp:598
NonTVertex(SVertex *iSVertex)
Definition ViewMap.h:755
virtual SVertex * castToSVertex()
Definition ViewMap.h:726
const string & getLibraryPath() const
const string & getName() const
void setViewVertex(ViewVertex *iViewVertex)
Definition Silhouette.h:355
virtual Vec3r getPoint3D() const
Definition Silhouette.h:86
virtual Vec2r getPoint2D() const
Definition Silhouette.h:110
virtual Id getId() const
Definition Silhouette.h:119
const Vec3r & point2D() const
Definition Silhouette.h:230
const vector< FEdge * > & fedges()
Definition Silhouette.h:250
const Vec3r & point3D() const
Definition Silhouette.h:225
virtual real getProjectedY() const
Definition ViewMap.h:421
void setId(const Id &iId)
Definition ViewMap.h:571
SVertex * backSVertex()
Definition ViewMap.h:525
void setBackEdgeA(ViewEdge *iBackEdgeA, bool incoming=true)
Definition ViewMap.cpp:372
virtual edge_iterator edges_iterator(ViewEdge *iEdge)
Definition ViewMap.cpp:459
virtual string getExactTypeName() const
Definition ViewMap.h:382
virtual Vec2r getPoint2D() const
Definition ViewMap.h:432
virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge)
Definition ViewMap.cpp:532
virtual edge_iterator edges_begin()
Definition ViewMap.cpp:433
virtual ViewVertex * castToViewVertex()
Definition ViewMap.h:445
SVertex * getSVertex(FEdge *iFEdge)
Definition ViewMap.h:577
virtual ViewVertex * duplicate()
Definition ViewMap.h:510
SVertex * frontSVertex()
Definition ViewMap.h:519
directedViewEdge & backEdgeB()
Definition ViewMap.h:545
void setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming=true)
Definition ViewMap.cpp:391
virtual Vec3r getPoint3D() const
Definition ViewMap.h:408
virtual real getProjectedZ() const
Definition ViewMap.h:426
void setBackSVertex(SVertex *iBackSVertex)
Definition ViewMap.h:559
virtual real getX() const
Definition ViewMap.h:389
virtual edge_iterator edges_end()
Definition ViewMap.cpp:445
void setFrontEdgeB(ViewEdge *iFrontEdgeB, bool incoming=true)
Definition ViewMap.cpp:353
directedViewEdge & frontEdgeB()
Definition ViewMap.h:535
virtual TVertex * castToTVertex()
Definition ViewMap.h:451
virtual ViewEdge * mate(ViewEdge *iEdgeA)
Definition ViewMap.h:602
virtual real getProjectedX() const
Definition ViewMap.h:415
TVertex(TVertex &iBrother)
Definition ViewMap.h:498
directedViewEdge & frontEdgeA()
Definition ViewMap.h:530
directedViewEdge & backEdgeA()
Definition ViewMap.h:540
virtual void Replace(ViewEdge *iOld, ViewEdge *iNew)
Definition ViewMap.cpp:410
virtual real getZ() const
Definition ViewMap.h:401
void setFrontSVertex(SVertex *iFrontSVertex)
Definition ViewMap.h:552
void setFrontEdgeA(ViewEdge *iFrontEdgeA, bool incoming=true)
Definition ViewMap.cpp:334
TVertex(SVertex *svFront, SVertex *svBack)
Definition ViewMap.h:484
virtual Id getId() const
Definition ViewMap.h:438
virtual real getY() const
Definition ViewMap.h:395
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin()
Definition ViewMap.cpp:520
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd()
Definition ViewMap.cpp:526
vector< directedViewEdge * > edge_pointers_container
Definition ViewMap.h:378
value_type x() const
Definition VecMat.h:493
value_type z() const
Definition VecMat.h:513
value_type y() const
Definition VecMat.h:503
const_vertex_iterator vertices_end() const
Definition ViewMap.cpp:744
int qi() const
Definition ViewMap.h:1280
ViewShape * aShape()
Definition ViewMap.h:1095
virtual string getExactTypeName() const
Definition ViewMap.h:897
bool isInImage() const
Definition ViewMap.h:1135
void setId(const Id &id)
Definition ViewMap.h:1178
uint getChainingTimeStamp()
Definition ViewMap.h:1110
void setaShape(ViewShape *iShape)
Definition ViewMap.h:1187
virtual Nature::EdgeNature getNature() const
Definition ViewMap.h:910
ViewEdge(ViewVertex *iA, ViewVertex *iB, FEdge *iFEdgeA, FEdge *iFEdgeB, ViewShape *iShape)
Definition ViewMap.h:999
ViewEdge(ViewVertex *iA, ViewVertex *iB)
Definition ViewMap.h:969
ViewEdge(ViewVertex *iA, ViewVertex *iB, FEdge *iFEdgeA)
Definition ViewMap.h:984
void setFEdgeB(FEdge *iFEdge)
Definition ViewMap.h:1166
Id shape_id() const
Definition ViewMap.h:1322
fedge_iterator fedge_iterator_last()
Definition ViewMap.cpp:703
fedge_iterator fedge_iterator_end()
Definition ViewMap.cpp:713
ViewEdgeInternal::edge_iterator_base< Const_traits< ViewEdge * > > const_edge_iterator
Definition ViewMap.h:920
void setA(ViewVertex *iA)
Definition ViewMap.h:1142
occluder_container::const_iterator occluders_begin() const
Definition ViewMap.h:1285
const ViewShape * bShape() const
Definition ViewMap.h:1120
virtual Id getId() const
Definition ViewMap.h:904
bool include_in_2d_area(const Vec2r &iMin, const Vec2r &iMax) const
Definition ViewMap.h:1239
edge_iterator ViewEdge_iterator()
view edge iterator
Definition ViewMap.cpp:682
float shape_importance() const
Definition ViewMap.h:1332
bool intersect_2d_area(const Vec2r &iMin, const Vec2r &iMax) const
Definition ViewMap.h:1220
ViewEdgeInternal::fedge_iterator_base< Const_traits< FEdge * > > const_fedge_iterator
Definition ViewMap.h:923
ViewShape * viewShape()
Definition ViewMap.h:1087
void setFEdgeA(FEdge *iFEdge)
Definition ViewMap.h:1160
const_vertex_iterator vertices_last() const
Definition ViewMap.cpp:734
void setShape(ViewShape *iVShape)
Definition ViewMap.h:1172
const SShape * shape() const
Definition ViewMap.h:1327
virtual Interface0DIterator pointsBegin(float t=0.0f)
Definition ViewMap.cpp:768
const bool occludee_empty() const
Definition ViewMap.h:1312
virtual ViewEdge * duplicate()
Definition ViewMap.h:1037
ViewEdgeInternal::vertex_iterator_base< Nonconst_traits< SVertex * > > vertex_iterator
Definition ViewMap.h:925
const Polygon3r & occludee() const
Definition ViewMap.h:1305
virtual Interface0DIterator pointsEnd(float t=0.0f)
Definition ViewMap.cpp:773
bool occluders_empty() const
Definition ViewMap.h:1300
int occluders_size() const
Definition ViewMap.h:1295
ViewVertex * B()
Definition ViewMap.h:1069
const ViewShape * aShape() const
Definition ViewMap.h:1115
SVertex vertex_type
Definition ViewMap.h:916
vector< ViewShape * > & occluders()
Definition ViewMap.h:1125
ViewEdgeInternal::edge_iterator_base< Nonconst_traits< ViewEdge * > > edge_iterator
Definition ViewMap.h:919
const_vertex_iterator vertices_begin() const
embedding vertex iterator
Definition ViewMap.cpp:724
fedge_iterator fedge_iterator_begin()
feature edge iterator
Definition ViewMap.cpp:693
void setSplittingId(Id *id)
Definition ViewMap.h:1209
real getLength2D() const
Definition ViewMap.cpp:667
virtual Interface0DIterator verticesBegin()
Definition ViewMap.cpp:754
void AddOccluder(ViewShape *iShape)
Definition ViewMap.h:1204
void setChainingTimeStamp(uint ts)
Definition ViewMap.h:1199
ViewEdgeInternal::vertex_iterator_base< Const_traits< SVertex * > > const_vertex_iterator
Definition ViewMap.h:926
void setIsInImage(bool iFlag)
Definition ViewMap.h:1214
virtual Interface0DIterator verticesEnd()
Definition ViewMap.cpp:761
void setNature(Nature::EdgeNature iNature)
Definition ViewMap.h:1154
ViewVertex * A()
Definition ViewMap.h:1063
const SShape * occluded_shape() const
Definition ViewMap.h:1801
void setQI(int qi)
Definition ViewMap.h:1193
occluder_container::const_iterator occluders_end() const
Definition ViewMap.h:1290
ViewEdgeInternal::fedge_iterator_base< Nonconst_traits< FEdge * > > fedge_iterator
Definition ViewMap.h:922
ViewEdge(ViewEdge &iBrother)
Definition ViewMap.h:1018
void setB(ViewVertex *iB)
Definition ViewMap.h:1148
virtual ~ViewEdge()
Definition ViewMap.h:1045
vector< FEdge * > fedges_container
Definition ViewMap.h:53
vector< SVertex * > svertices_container
Definition ViewMap.h:52
const FEdge * getClosestFEdge(real x, real y) const
Definition ViewMap.cpp:96
ViewShape * viewShape(uint id)
Definition ViewMap.cpp:84
void AddViewShape(ViewShape *iVShape)
Definition ViewMap.cpp:90
viewshapes_container & ViewShapes()
Definition ViewMap.h:98
vector< ViewVertex * > viewvertices_container
Definition ViewMap.h:50
viewedges_container::iterator viewedges_begin()
Definition ViewMap.h:128
vector< ViewShape * > viewshapes_container
Definition ViewMap.h:51
const ViewEdge * getClosestViewEdge(real x, real y) const
Definition ViewMap.cpp:116
void AddSVertex(SVertex *iSVertex)
Definition ViewMap.h:174
BBox< Vec3r > getScene3dBBox() const
Definition ViewMap.h:151
vector< ViewEdge * > viewedges_container
Definition ViewMap.h:49
id_to_index_map & shapeIdToIndexMap()
Definition ViewMap.h:145
virtual void Clean()
Definition ViewMap.cpp:55
static ViewMap * getInstance()
Definition ViewMap.h:92
TVertex * CreateTVertex(const Vec3r &iA3D, const Vec3r &iA2D, FEdge *iFEdgeA, const Vec3r &iB3D, const Vec3r &iB2D, FEdge *iFEdgeB, const Id &id)
Definition ViewMap.cpp:139
viewedges_container::iterator viewedges_end()
Definition ViewMap.h:133
viewvertices_container & ViewVertices()
Definition ViewMap.h:110
void setScene3dBBox(const BBox< Vec3r > &bbox)
Definition ViewMap.h:180
svertices_container & SVertices()
Definition ViewMap.h:122
void AddFEdge(FEdge *iFEdge)
Definition ViewMap.h:169
virtual ~ViewMap()
Definition ViewMap.cpp:32
ViewVertex * InsertViewVertex(SVertex *iVertex, vector< ViewEdge * > &newViewEdges)
Definition ViewMap.cpp:182
void AddViewVertex(ViewVertex *iVVertex)
Definition ViewMap.h:164
void AddViewEdge(ViewEdge *iVEdge)
Definition ViewMap.h:159
map< int, int > id_to_index_map
Definition ViewMap.h:54
viewedges_container & ViewEdges()
Definition ViewMap.h:104
fedges_container & FEdges()
Definition ViewMap.h:116
const string & getName() const
Definition ViewMap.h:1569
void setVertices(const vector< ViewVertex * > &iVertices)
Definition ViewMap.h:1588
ViewShape(SShape *iSShape)
Definition ViewMap.h:1416
const SShape * sshape() const
Definition ViewMap.h:1545
void AddVertex(ViewVertex *iVertex)
Definition ViewMap.h:1600
void SplitEdge(FEdge *fe, const vector< TVertex * > &iViewVertices, vector< FEdge * > &ioNewEdges, vector< ViewEdge * > &ioNewViewEdges)
Definition ViewMap.h:1640
vector< ViewEdge * > & edges()
Definition ViewMap.h:1557
void setSShape(SShape *iSShape)
Definition ViewMap.h:1582
vector< ViewVertex * > & vertices()
Definition ViewMap.h:1551
virtual ViewShape * duplicate()
Definition ViewMap.h:1513
void RemoveVertex(ViewVertex *iViewVertex)
Definition ViewMap.cpp:815
void setEdges(const vector< ViewEdge * > &iEdges)
Definition ViewMap.h:1594
void RemoveEdge(ViewEdge *iViewEdge)
Definition ViewMap.cpp:803
void AddEdge(ViewEdge *iEdge)
Definition ViewMap.h:1607
ViewShape(ViewShape &iBrother)
Definition ViewMap.h:1424
SShape * sshape()
Definition ViewMap.h:1539
const string & getLibraryPath() const
Definition ViewMap.h:1575
ViewVertexInternal::edge_iterator_base< ViewVertexInternal::edge_const_traits > const_edge_iterator
Definition ViewMap.h:274
virtual ~ViewVertex()
Definition ViewMap.h:312
pair< ViewEdge *, bool > directedViewEdge
Definition ViewMap.h:267
virtual Nature::VertexNature getNature() const
Definition ViewMap.h:316
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin()=0
virtual const_edge_iterator edges_begin() const =0
virtual const_edge_iterator edges_end() const =0
virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const =0
ViewVertex(ViewVertex &iBrother)
Definition ViewMap.h:300
virtual edge_iterator edges_end()=0
virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge)=0
virtual string getExactTypeName() const
Definition ViewMap.h:260
ViewVertex(Nature::VertexNature nature)
Definition ViewMap.h:292
virtual edge_iterator edges_begin()=0
virtual edge_iterator edges_iterator(ViewEdge *iEdge)=0
vector< directedViewEdge > edges_container
Definition ViewMap.h:269
virtual ViewVertex * duplicate()=0
virtual void Replace(ViewEdge *, ViewEdge *)
Definition ViewMap.h:329
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd()=0
ViewVertexInternal::edge_iterator_base< ViewVertexInternal::edge_nonconst_traits > edge_iterator
Definition ViewMap.h:272
void setNature(Nature::VertexNature iNature)
Definition ViewMap.h:323
Material material
bool intersect2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B)
Definition GeomUtils.cpp:19
bool include2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B)
Definition GeomUtils.cpp:40
VecMat::Vec2< real > Vec2r
Definition Geom.h:24
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
ushort VertexNature
Definition Nature.h:22
static const VertexNature VIEW_VERTEX
Definition Nature.h:28
static const VertexNature T_VERTEX
Definition Nature.h:32
static const VertexNature NON_T_VERTEX
Definition Nature.h:30
ushort EdgeNature
Definition Nature.h:36
inherits from class Rep
Definition AppCanvas.cpp:20
double real
Definition Precision.h:14