Blender V4.3
Silhouette.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 <float.h>
13#include <iostream>
14#include <set>
15#include <string>
16#include <vector>
17
18#include "Interface0D.h"
19#include "Interface1D.h"
20
21#include "../geometry/BBox.h"
22#include "../geometry/Geom.h"
23#include "../geometry/Polygon.h"
24
26
27#include "../system/Exception.h"
29
31
32#ifdef WITH_CXX_GUARDEDALLOC
33# include "MEM_guardedalloc.h"
34#endif
35
36using namespace std;
37
38namespace Freestyle {
39
40using namespace Geometry;
41
42class ViewShape;
43typedef vector<ViewShape *> occluder_container;
44
45/**********************************/
46/* */
47/* */
48/* SVertex */
49/* */
50/* */
51/**********************************/
52
53class FEdge;
54class ViewVertex;
55class SShape;
56
58class SVertex : public Interface0D {
59 public: // Implementation of Interface0D
61 virtual string getExactTypeName() const
62 {
63 return "SVertex";
64 }
65
66 // Data access methods
68 virtual real getX() const
69 {
70 return _Point3D.x();
71 }
72
74 virtual real getY() const
75 {
76 return _Point3D.y();
77 }
78
80 virtual real getZ() const
81 {
82 return _Point3D.z();
83 }
84
86 virtual Vec3r getPoint3D() const
87 {
88 return _Point3D;
89 }
90
92 virtual real getProjectedX() const
93 {
94 return _Point2D.x();
95 }
96
98 virtual real getProjectedY() const
99 {
100 return _Point2D.y();
101 }
102
104 virtual real getProjectedZ() const
105 {
106 return _Point2D.z();
107 }
108
110 virtual Vec2r getPoint2D() const
111 {
112 return Vec2r(_Point2D.x(), _Point2D.y());
113 }
114
116 virtual FEdge *getFEdge(Interface0D &);
117
119 virtual Id getId() const
120 {
121 return _Id;
122 }
123
125 virtual Nature::VertexNature getNature() const;
126
128 virtual SVertex *castToSVertex();
129
131 virtual ViewVertex *castToViewVertex();
132
134 virtual NonTVertex *castToNonTVertex();
135
137 virtual TVertex *castToTVertex();
138
139 public:
140 typedef vector<FEdge *> fedges_container;
141
142 private:
143 Id _Id;
144 Vec3r _Point3D;
145 Vec3r _Point2D;
146 set<Vec3r> _Normals;
147 vector<FEdge *> _FEdges; // the edges containing this vertex
148 SShape *_Shape; // the shape to which belongs the vertex
149 ViewVertex *_pViewVertex; // The associated viewvertex, in case there is one.
150#if 0
151 real _curvatureFredo;
152 Vec2r _directionFredo;
153#endif
154 CurvatureInfo *_curvature_info;
155
156 public:
160 void *userdata;
161
163 inline SVertex()
164 {
165 _Id = 0;
166 userdata = nullptr;
167 _Shape = nullptr;
168 _pViewVertex = 0;
169 _curvature_info = 0;
170 }
171
173 inline SVertex(const Vec3r &iPoint3D, const Id &id)
174 {
175 _Point3D = iPoint3D;
176 _Id = id;
177 userdata = nullptr;
178 _Shape = nullptr;
179 _pViewVertex = 0;
180 _curvature_info = 0;
181 }
182
184 inline SVertex(SVertex &iBrother)
185 {
186 _Id = iBrother._Id;
187 _Point3D = iBrother.point3D();
188 _Point2D = iBrother.point2D();
189 _Normals = iBrother._Normals;
190 _FEdges = iBrother.fedges();
191 _Shape = iBrother.shape();
192 _pViewVertex = iBrother._pViewVertex;
193 if (!(iBrother._curvature_info)) {
194 _curvature_info = 0;
195 }
196 else {
197 _curvature_info = new CurvatureInfo(*(iBrother._curvature_info));
198 }
199 iBrother.userdata = this;
200 userdata = 0;
201 }
202
204 virtual ~SVertex()
205 {
206 if (_curvature_info) {
207 delete _curvature_info;
208 }
209 }
210
213 {
214 SVertex *clone = new SVertex(*this);
215 return clone;
216 }
217
219 virtual bool operator==(const SVertex &iBrother)
220 {
221 return ((_Point2D == iBrother._Point2D) && (_Point3D == iBrother._Point3D));
222 }
223
224 /* accessors */
225 inline const Vec3r &point3D() const
226 {
227 return _Point3D;
228 }
229
230 inline const Vec3r &point2D() const
231 {
232 return _Point2D;
233 }
234
239 inline set<Vec3r> normals()
240 {
241 return _Normals;
242 }
243
245 inline uint normalsSize() const
246 {
247 return _Normals.size();
248 }
249
250 inline const vector<FEdge *> &fedges()
251 {
252 return _FEdges;
253 }
254
255 inline fedges_container::iterator fedges_begin()
256 {
257 return _FEdges.begin();
258 }
259
260 inline fedges_container::iterator fedges_end()
261 {
262 return _FEdges.end();
263 }
264
265 inline SShape *shape()
266 {
267 return _Shape;
268 }
269
270 inline real z() const
271 {
272 return _Point2D[2];
273 }
274
279 {
280 return _pViewVertex;
281 }
282
285 inline void setPoint3D(const Vec3r &iPoint3D)
286 {
287 _Point3D = iPoint3D;
288 }
289
291 inline void setPoint2D(const Vec3r &iPoint2D)
292 {
293 _Point2D = iPoint2D;
294 }
295
298 inline void AddNormal(const Vec3r &iNormal)
299 {
300 _Normals.insert(iNormal); // if iNormal in the set already exists, nothing is done
301 }
302
304 {
305 if (_curvature_info) { // Q. is this an error condition? (T.K. 02-May-2011)
306 delete _curvature_info;
307 }
308 _curvature_info = ci;
309 }
310
312 {
313 return _curvature_info;
314 }
315
316#if 0
317 /* Fredo's normal and curvature. */
318 void setCurvatureFredo(real c)
319 {
320 _curvatureFredo = c;
321 }
322
323 void setDirectionFredo(Vec2r d)
324 {
325 _directionFredo = d;
326 }
327
328 real curvatureFredo()
329 {
330 return _curvatureFredo;
331 }
332
333 const Vec2r directionFredo()
334 {
335 return _directionFredo;
336 }
337#endif
338
340 inline void setId(const Id &id)
341 {
342 _Id = id;
343 }
344
345 inline void setFEdges(const vector<FEdge *> &iFEdges)
346 {
347 _FEdges = iFEdges;
348 }
349
350 inline void setShape(SShape *iShape)
351 {
352 _Shape = iShape;
353 }
354
355 inline void setViewVertex(ViewVertex *iViewVertex)
356 {
357 _pViewVertex = iViewVertex;
358 }
359
361 inline void AddFEdge(FEdge *iFEdge)
362 {
363 _FEdges.push_back(iFEdge);
364 }
365
367 inline void RemoveFEdge(FEdge *iFEdge)
368 {
369 for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) {
370 if (iFEdge == (*fe)) {
371 _FEdges.erase(fe);
372 break;
373 }
374 }
375 }
376
377 /* replaces edge 1 by edge 2 in the list of edges */
378 inline void Replace(FEdge *e1, FEdge *e2)
379 {
380 vector<FEdge *>::iterator insertedfe;
381 for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) {
382 if ((*fe) == e1) {
383 insertedfe = _FEdges.insert(fe, e2); // inserts e2 before fe.
384 // returns an iterator pointing toward e2. fe is invalidated.
385 // we want to remove e1, but we can't use fe anymore:
386 ++insertedfe; // insertedfe points now to e1
387 _FEdges.erase(insertedfe);
388 return;
389 }
390 }
391 }
392
393 public:
394 /* Information access interface */
395 FEdge *fedge(); // for non T vertex
396
397 inline const Vec3r &point2d() const
398 {
399 return point2D();
400 }
401
402 inline const Vec3r &point3d() const
403 {
404 return point3D();
405 }
406
407 inline Vec3r normal() const
408 {
409 if (_Normals.size() == 1) {
410 return (*(_Normals.begin()));
411 }
413 return *(_Normals.begin());
414 }
415
416 // Material material() const ;
417 Id shape_id() const;
418 const SShape *shape() const;
419 float shape_importance() const;
420
421 int qi() const;
422 occluder_container::const_iterator occluders_begin() const;
423 occluder_container::const_iterator occluders_end() const;
424 bool occluders_empty() const;
425 int occluders_size() const;
426 const Polygon3r &occludee() const;
427 const SShape *occluded_shape() const;
428 bool occludee_empty() const;
429 real z_discontinuity() const;
430#if 0
431 inline float local_average_depth() const;
432 inline float local_depth_variance() const;
433 inline real local_average_density(float sigma = 2.3f) const;
434 inline Vec3r shaded_color() const;
435 inline Vec3r orientation2d() const;
436 inline Vec3r orientation3d() const;
437 inline Vec3r curvature2d_as_vector() const;
439 inline real curvature2d_as_angle() const;
440#endif
441
442#ifdef WITH_CXX_GUARDEDALLOC
443 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SVertex")
444#endif
445};
446
447/**********************************/
448/* */
449/* */
450/* FEdge */
451/* */
452/* */
453/**********************************/
454
455class ViewEdge;
456
465class FEdge : public Interface1D {
466 public: // Implementation of Interface0D
468 virtual string getExactTypeName() const
469 {
470 return "FEdge";
471 }
472
473 // Data access methods
474
476 virtual real getLength2D() const
477 {
478 if (!_VertexA || !_VertexB) {
479 return 0;
480 }
481 return (_VertexB->getPoint2D() - _VertexA->getPoint2D()).norm();
482 }
483
485 virtual Id getId() const
486 {
487 return _Id;
488 }
489
490 public:
491 // An edge can only be of one kind (SILHOUETTE or BORDER, etc...)
492 // For an multi-nature edge there must be several different FEdge.
493 // DEBUG:
494 // Vec3r A;
495 // Vec3r u;
496 // vector<Polygon3r> _Occludees;
497 // Vec3r intersection;
498 // vector<Vec3i> _Cells;
499
500 protected:
505 // vector<Polygon3r> _Occluders; // visibility // NOT HANDLED BY THE COPY CONSTRUCTOR!!
506
507 FEdge *_NextEdge; // next edge on the chain
510 // Sometimes we need to deport the visibility computation onto another edge. For example the
511 // exact edges use edges of the mesh to compute their visibility
512
513 Polygon3r _aFace; // The occluded face which lies on the right of a silhouette edge
516
518
520
522
523 public:
527 void *userdata;
528
530 inline FEdge()
531 {
532 userdata = nullptr;
533 _VertexA = nullptr;
534 _VertexB = nullptr;
536 _NextEdge = nullptr;
537 _PreviousEdge = nullptr;
538 _ViewEdge = nullptr;
539 //_hasVisibilityPoint = false;
540 _occludeeEmpty = true;
541 _isSmooth = false;
542 _isInImage = true;
543 _isTemporary = false;
544 }
545
547 inline FEdge(SVertex *vA, SVertex *vB)
548 {
549 userdata = nullptr;
550 _VertexA = vA;
551 _VertexB = vB;
553 _NextEdge = nullptr;
554 _PreviousEdge = nullptr;
555 _ViewEdge = nullptr;
556 //_hasVisibilityPoint = false;
557 _occludeeEmpty = true;
558 _isSmooth = false;
559 _isInImage = true;
560 _isTemporary = false;
561 }
562
564 inline FEdge(FEdge &iBrother)
565 {
566 _VertexA = iBrother.vertexA();
567 _VertexB = iBrother.vertexB();
568 _NextEdge = iBrother.nextEdge();
569 _PreviousEdge = iBrother._PreviousEdge;
570 _Nature = iBrother.getNature();
571 _Id = iBrother._Id;
572 _ViewEdge = iBrother._ViewEdge;
573 //_hasVisibilityPoint = iBrother._hasVisibilityPoint;
574 //_VisibilityPointA = iBrother._VisibilityPointA;
575 //_VisibilityPointB = iBrother._VisibilityPointB;
576 _aFace = iBrother._aFace;
578 _isSmooth = iBrother._isSmooth;
579 _isInImage = iBrother._isInImage;
580 _isTemporary = iBrother._isTemporary;
581 iBrother.userdata = this;
582 userdata = 0;
583 }
584
586 virtual ~FEdge() {}
587
589 virtual FEdge *duplicate()
590 {
591 FEdge *clone = new FEdge(*this);
592 return clone;
593 }
594
595 /* accessors */
597 inline SVertex *vertexA()
598 {
599 return _VertexA;
600 }
601
603 inline SVertex *vertexB()
604 {
605 return _VertexB;
606 }
607
609 inline SVertex *operator[](const ushort &i) const
610 {
611 return (i % 2 == 0) ? _VertexA : _VertexB;
612 }
613
616 {
617 return _Nature;
618 }
619
623 inline FEdge *nextEdge()
624 {
625 return _NextEdge;
626 }
627
632 {
633 return _PreviousEdge;
634 }
635
636 inline SShape *shape()
637 {
638 return _VertexA->shape();
639 }
640
641#if 0
642 inline int invisibility() const
643 {
644 return _Occluders.size();
645 }
646#endif
647
648 int invisibility() const;
649
650#if 0
651 inline const vector<Polygon3r> &occluders() const
652 {
653 return _Occluders;
654 }
655#endif
656
658 inline ViewEdge *viewedge() const
659 {
660 return _ViewEdge;
661 }
662
664 {
665 return Vec3r((_VertexA->point3D() + _VertexB->point3D()) / 2.0);
666 }
667
669 {
670 return Vec3r((_VertexA->point2D() + _VertexB->point2D()) / 2.0);
671 }
672
673#if 0
674 inline bool hasVisibilityPoint() const
675 {
676 return _hasVisibilityPoint;
677 }
678
679 inline Vec3r visibilityPointA() const
680 {
681 return _VisibilityPointA;
682 }
683
684 inline Vec3r visibilityPointB() const
685 {
686 return _VisibilityPointB;
687 }
688#endif
689
690 inline const Polygon3r &aFace() const
691 {
692 return _aFace;
693 }
694
696 {
698 }
699
700 inline bool getOccludeeEmpty()
701 {
702 return _occludeeEmpty;
703 }
704
706 inline bool isSmooth() const
707 {
708 return _isSmooth;
709 }
710
711 inline bool isInImage() const
712 {
713 return _isInImage;
714 }
715
716 inline bool isTemporary() const
717 {
718 return _isTemporary;
719 }
720
721 /* modifiers */
723 inline void setVertexA(SVertex *vA)
724 {
725 _VertexA = vA;
726 }
727
729 inline void setVertexB(SVertex *vB)
730 {
731 _VertexB = vB;
732 }
733
735 inline void setId(const Id &id)
736 {
737 _Id = id;
738 }
739
741 inline void setNextEdge(FEdge *iEdge)
742 {
743 _NextEdge = iEdge;
744 }
745
747 inline void setPreviousEdge(FEdge *iEdge)
748 {
749 _PreviousEdge = iEdge;
750 }
751
753 inline void setNature(Nature::EdgeNature iNature)
754 {
755 _Nature = iNature;
756 }
757
758#if 0
759 inline void AddOccluder(Polygon3r &iPolygon)
760 {
761 _Occluders.push_back(iPolygon);
762 }
763#endif
764
766 inline void setViewEdge(ViewEdge *iViewEdge)
767 {
768 _ViewEdge = iViewEdge;
769 }
770
771#if 0
772 inline void setHasVisibilityPoint(bool iBool)
773 {
774 _hasVisibilityPoint = iBool;
775 }
776
777 inline void setVisibilityPointA(const Vec3r &iPoint)
778 {
779 _VisibilityPointA = iPoint;
780 }
781
782 inline void setVisibilityPointB(const Vec3r &iPoint)
783 {
784 _VisibilityPointB = iPoint;
785 }
786#endif
787
788 inline void setaFace(Polygon3r &iFace)
789 {
790 _aFace = iFace;
791 }
792
793 inline void setOccludeeIntersection(const Vec3r &iPoint)
794 {
795 _occludeeIntersection = iPoint;
796 }
797
798 inline void setOccludeeEmpty(bool iempty)
799 {
800 _occludeeEmpty = iempty;
801 }
802
806 inline void setSmooth(bool iFlag)
807 {
808 _isSmooth = iFlag;
809 }
810
811 inline void setIsInImage(bool iFlag)
812 {
813 _isInImage = iFlag;
814 }
815
816 inline void setTemporary(bool iFlag)
817 {
818 _isTemporary = iFlag;
819 }
820
821 /* checks whether two FEdge have a common vertex.
822 * Returns a pointer on the common vertex if it exists, nullptr otherwise.
823 */
824 static inline SVertex *CommonVertex(FEdge *iEdge1, FEdge *iEdge2)
825 {
826 if ((nullptr == iEdge1) || (nullptr == iEdge2)) {
827 return nullptr;
828 }
829
830 SVertex *sv1 = iEdge1->vertexA();
831 SVertex *sv2 = iEdge1->vertexB();
832 SVertex *sv3 = iEdge2->vertexA();
833 SVertex *sv4 = iEdge2->vertexB();
834
835 if ((sv1 == sv3) || (sv1 == sv4)) {
836 return sv1;
837 }
838 else if ((sv2 == sv3) || (sv2 == sv4)) {
839 return sv2;
840 }
841
842 return nullptr;
843 }
844
845 inline const SVertex *min2d() const
846 {
847 if (_VertexA->point2D() < _VertexB->point2D()) {
848 return _VertexA;
849 }
850 else {
851 return _VertexB;
852 }
853 }
854
855 inline const SVertex *max2d() const
856 {
857 if (_VertexA->point2D() < _VertexB->point2D()) {
858 return _VertexB;
859 }
860 else {
861 return _VertexA;
862 }
863 }
864
865 /* Information access interface */
866
867 // Material material() const;
868 Id shape_id() const;
869 const SShape *shape() const;
870 float shape_importance() const;
871
872 inline const int qi() const
873 {
874 return invisibility();
875 }
876
877 occluder_container::const_iterator occluders_begin() const;
878 occluder_container::const_iterator occluders_end() const;
879 bool occluders_empty() const;
880 int occluders_size() const;
881
882 inline const Polygon3r &occludee() const
883 {
884 return aFace();
885 }
886
887 const SShape *occluded_shape() const;
888
889#if 0
890 inline const bool occludee_empty() const
891 {
892 return _occludeeEmpty;
893 }
894#endif
895
896 bool occludee_empty() const;
897 real z_discontinuity() const;
898
899#if 0
900 inline float local_average_depth(int iCombination = 0) const;
901 inline float local_depth_variance(int iCombination = 0) const;
902 inline real local_average_density(float sigma = 2.3f, int iCombination = 0) const;
903 inline Vec3r shaded_color(int iCombination = 0) const {}
904#endif
905
906 int viewedge_nature() const;
907
908 // float viewedge_length() const;
909
910 inline Vec3r orientation2d() const
911 {
912 return Vec3r(_VertexB->point2d() - _VertexA->point2d());
913 }
914
915 inline Vec3r orientation3d() const
916 {
917 return Vec3r(_VertexB->point3d() - _VertexA->point3d());
918 }
919
920#if 0
921 inline real curvature2d() const
922 {
923 return viewedge()->curvature2d((_VertexA->point2d() + _VertexB->point2d()) / 2.0);
924 }
925
926 inline Vec3r curvature2d_as_vector(int iCombination = 0) const;
927
928 /* Angle in degrees. */
929 inline real curvature2d_as_angle(int iCombination = 0) const;
930#endif
931
932 // Iterator access (Interface1D)
934 virtual inline Interface0DIterator verticesBegin();
935
937 virtual inline Interface0DIterator verticesEnd();
938
945 virtual inline Interface0DIterator pointsBegin(float t = 0.0f);
946
953 virtual inline Interface0DIterator pointsEnd(float t = 0.0f);
954
955#ifdef WITH_CXX_GUARDEDALLOC
956 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdge")
957#endif
958};
959
960//
961// SVertexIterator
962//
964
965namespace FEdgeInternal {
966
968 public:
970 {
971 _vertex = nullptr;
972 _edge = nullptr;
973 }
974
976 {
977 _vertex = vi._vertex;
978 _edge = vi._edge;
979 }
980
982 {
983 _vertex = v;
984 _edge = edge;
985 }
986
988 {
989 _vertex = vi._vertex;
990 _edge = vi._edge;
991 return *this;
992 }
993
994 virtual string getExactTypeName() const
995 {
996 return "SVertexIterator";
997 }
998
1000 {
1001 return *_vertex;
1002 }
1003
1005 {
1006 return &(operator*());
1007 }
1008
1010 {
1011 increment();
1012 return *this;
1013 }
1014
1016 {
1017 SVertexIterator ret(*this);
1018 increment();
1019 return ret;
1020 }
1021
1023 {
1024 decrement();
1025 return *this;
1026 }
1027
1029 {
1030 SVertexIterator ret(*this);
1031 decrement();
1032 return ret;
1033 }
1034
1035 virtual int increment()
1036 {
1037 if (_vertex == _edge->vertexB()) {
1038 _vertex = 0;
1039 return 0;
1040 }
1041 _vertex = _edge->vertexB();
1042 return 0;
1043 }
1044
1045 virtual int decrement()
1046 {
1047 if (_vertex == _edge->vertexA()) {
1048 _vertex = 0;
1049 return 0;
1050 }
1051 _vertex = _edge->vertexA();
1052 return 0;
1053 }
1054
1055 virtual bool isBegin() const
1056 {
1057 return _vertex == _edge->vertexA();
1058 }
1059
1060 virtual bool isEnd() const
1061 {
1062 return _vertex == _edge->vertexB();
1063 }
1064
1065 virtual bool operator==(const Interface0DIteratorNested &it) const
1066 {
1067 const SVertexIterator *it_exact = dynamic_cast<const SVertexIterator *>(&it);
1068 if (!it_exact) {
1069 return false;
1070 }
1071 return ((_vertex == it_exact->_vertex) && (_edge == it_exact->_edge));
1072 }
1073
1074 virtual float t() const
1075 {
1076 if (_vertex == _edge->vertexA()) {
1077 return 0.0f;
1078 }
1079 return ((float)_edge->getLength2D());
1080 }
1081 virtual float u() const
1082 {
1083 if (_vertex == _edge->vertexA()) {
1084 return 0.0f;
1085 }
1086 return 1.0f;
1087 }
1088
1089 virtual SVertexIterator *copy() const
1090 {
1091 return new SVertexIterator(*this);
1092 }
1093
1094 private:
1095 SVertex *_vertex;
1096 FEdge *_edge;
1097};
1098
1099} // end of namespace FEdgeInternal
1100
1101// Iterator access (implementation)
1102
1108
1114
1116{
1117 return verticesBegin();
1118}
1119
1121{
1122 return verticesEnd();
1123}
1124
1130class FEdgeSharp : public FEdge {
1131 protected:
1132 Vec3r _aNormal; // When following the edge, normal of the right face
1133 Vec3r _bNormal; // When following the edge, normal of the left face
1138
1139 public:
1141 virtual string getExactTypeName() const
1142 {
1143 return "FEdgeSharp";
1144 }
1145
1147 inline FEdgeSharp() : FEdge()
1148 {
1150 _aFaceMark = _bFaceMark = false;
1151 }
1152
1154 inline FEdgeSharp(SVertex *vA, SVertex *vB) : FEdge(vA, vB)
1155 {
1157 _aFaceMark = _bFaceMark = false;
1158 }
1159
1161 inline FEdgeSharp(FEdgeSharp &iBrother) : FEdge(iBrother)
1162 {
1163 _aNormal = iBrother._aNormal;
1164 _bNormal = iBrother._bNormal;
1167 _aFaceMark = iBrother._aFaceMark;
1168 _bFaceMark = iBrother._bFaceMark;
1169 }
1170
1172 virtual ~FEdgeSharp() {}
1173
1175 virtual FEdge *duplicate()
1176 {
1177 FEdge *clone = new FEdgeSharp(*this);
1178 return clone;
1179 }
1180
1184 inline const Vec3r &normalA()
1185 {
1186 return _aNormal;
1187 }
1188
1190 inline const Vec3r &normalB()
1191 {
1192 return _bNormal;
1193 }
1194
1200 {
1201 return _aFrsMaterialIndex;
1202 }
1203
1207 const FrsMaterial &aFrsMaterial() const;
1208
1211 {
1212 return _bFrsMaterialIndex;
1213 }
1214
1216 const FrsMaterial &bFrsMaterial() const;
1217
1221 inline bool aFaceMark() const
1222 {
1223 return _aFaceMark;
1224 }
1225
1227 inline bool bFaceMark() const
1228 {
1229 return _bFaceMark;
1230 }
1231
1233 inline void setNormalA(const Vec3r &iNormal)
1234 {
1235 _aNormal = iNormal;
1236 }
1237
1239 inline void setNormalB(const Vec3r &iNormal)
1240 {
1241 _bNormal = iNormal;
1242 }
1243
1246 {
1248 }
1249
1252 {
1254 }
1255
1257 inline void setaFaceMark(bool iFaceMark)
1258 {
1259 _aFaceMark = iFaceMark;
1260 }
1261
1263 inline void setbFaceMark(bool iFaceMark)
1264 {
1265 _bFaceMark = iFaceMark;
1266 }
1267
1268#ifdef WITH_CXX_GUARDEDALLOC
1269 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdgeSharp")
1270#endif
1271};
1272
1276class FEdgeSmooth : public FEdge {
1277 protected:
1280#if 0
1281 bool _hasVisibilityPoint;
1282 Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented
1283 Vec3r _VisibilityPointB; // using its 2 extremity points A and B
1284#endif
1285 void *_Face; // In case of exact silhouette, Face is the WFace crossed by Fedge
1286 // NOT HANDLED BY THE COPY CONSTRUCTEUR
1288
1289 public:
1291 virtual string getExactTypeName() const
1292 {
1293 return "FEdgeSmooth";
1294 }
1295
1297 inline FEdgeSmooth() : FEdge()
1298 {
1299 _Face = nullptr;
1300 _FaceMark = false;
1302 _isSmooth = true;
1303 }
1304
1306 inline FEdgeSmooth(SVertex *vA, SVertex *vB) : FEdge(vA, vB)
1307 {
1308 _Face = nullptr;
1309 _FaceMark = false;
1311 _isSmooth = true;
1312 }
1313
1315 inline FEdgeSmooth(FEdgeSmooth &iBrother) : FEdge(iBrother)
1316 {
1317 _Normal = iBrother._Normal;
1318 _Face = iBrother._Face;
1319 _FaceMark = iBrother._FaceMark;
1321 _isSmooth = true;
1322 }
1323
1325 virtual ~FEdgeSmooth() {}
1326
1328 virtual FEdge *duplicate()
1329 {
1330 FEdge *clone = new FEdgeSmooth(*this);
1331 return clone;
1332 }
1333
1334 inline void *face() const
1335 {
1336 return _Face;
1337 }
1338
1340 inline bool faceMark() const
1341 {
1342 return _FaceMark;
1343 }
1344
1346 inline const Vec3r &normal()
1347 {
1348 return _Normal;
1349 }
1350
1353 {
1354 return _FrsMaterialIndex;
1355 }
1356
1358 const FrsMaterial &frs_material() const;
1359
1360 inline void setFace(void *iFace)
1361 {
1362 _Face = iFace;
1363 }
1364
1366 inline void setFaceMark(bool iFaceMark)
1367 {
1368 _FaceMark = iFaceMark;
1369 }
1370
1372 inline void setNormal(const Vec3r &iNormal)
1373 {
1374 _Normal = iNormal;
1375 }
1376
1379 {
1381 }
1382
1383#ifdef WITH_CXX_GUARDEDALLOC
1384 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdgeSmooth")
1385#endif
1386};
1387
1388/**********************************/
1389/* */
1390/* */
1391/* SShape */
1392/* */
1393/* */
1394/**********************************/
1395
1398class SShape {
1399 private:
1400 vector<FEdge *> _chains; // list of fedges that are chains starting points.
1401 vector<SVertex *> _verticesList; // list of all vertices
1402 vector<FEdge *> _edgesList; // list of all edges
1403 Id _Id;
1404 string _Name;
1405 string _LibraryPath;
1406 BBox<Vec3r> _BBox;
1407 vector<FrsMaterial> _FrsMaterials;
1408
1409 float _importance;
1410
1411 ViewShape *_ViewShape;
1412
1413 public:
1417 void *userdata; // added by E.T.
1418
1420 inline SShape()
1421 {
1422 userdata = nullptr;
1423 _importance = 0.0f;
1424 _ViewShape = nullptr;
1425 }
1426
1428 inline SShape(SShape &iBrother)
1429 {
1430 userdata = nullptr;
1431 _Id = iBrother._Id;
1432 _Name = iBrother._Name;
1433 _LibraryPath = iBrother._LibraryPath;
1434 _BBox = iBrother.bbox();
1435 _FrsMaterials = iBrother._FrsMaterials;
1436 _importance = iBrother._importance;
1437 _ViewShape = iBrother._ViewShape;
1438
1439 //---------
1440 // vertices
1441 //---------
1442 vector<SVertex *>::iterator sv, svend;
1443 vector<SVertex *> &verticesList = iBrother.getVertexList();
1444 for (sv = verticesList.begin(), svend = verticesList.end(); sv != svend; sv++) {
1445 SVertex *newv = new SVertex(*(*sv));
1446 newv->setShape(this);
1447 _verticesList.push_back(newv);
1448 }
1449
1450 //------
1451 // edges
1452 //------
1453 vector<FEdge *>::iterator e, eend;
1454 vector<FEdge *> &edgesList = iBrother.getEdgeList();
1455 for (e = edgesList.begin(), eend = edgesList.end(); e != eend; e++) {
1456 FEdge *newe = (*e)->duplicate();
1457 _edgesList.push_back(newe);
1458 }
1459
1460 //-------------------------
1461 // starting chain edges
1462 //-------------------------
1463 vector<FEdge *>::iterator fe, fend;
1464 vector<FEdge *> &fedges = iBrother.getChains();
1465 for (fe = fedges.begin(), fend = fedges.end(); fe != fend; fe++) {
1466 _chains.push_back((FEdge *)((*fe)->userdata));
1467 }
1468
1469 //-------------------------
1470 // remap edges in vertices:
1471 //-------------------------
1472 for (sv = _verticesList.begin(), svend = _verticesList.end(); sv != svend; sv++) {
1473 const vector<FEdge *> &fedgeList = (*sv)->fedges();
1474 vector<FEdge *> newfedgelist;
1475 for (vector<FEdge *>::const_iterator fed = fedgeList.begin(), fedend = fedgeList.end();
1476 fed != fedend;
1477 fed++)
1478 {
1479 FEdge *current = *fed;
1480 newfedgelist.push_back((FEdge *)current->userdata);
1481 }
1482 (*sv)->setFEdges(newfedgelist);
1483 }
1484
1485 //-------------------------------------
1486 // remap vertices and nextedge in edges:
1487 //-------------------------------------
1488 for (e = _edgesList.begin(), eend = _edgesList.end(); e != eend; e++) {
1489 (*e)->setVertexA((SVertex *)((*e)->vertexA()->userdata));
1490 (*e)->setVertexB((SVertex *)((*e)->vertexB()->userdata));
1491 (*e)->setNextEdge((FEdge *)((*e)->nextEdge()->userdata));
1492 (*e)->setPreviousEdge((FEdge *)((*e)->previousEdge()->userdata));
1493 }
1494
1495 // reset all brothers userdata to nullptr:
1496 //-------------------------------------
1497 //---------
1498 // vertices
1499 //---------
1500 for (sv = _verticesList.begin(), svend = _verticesList.end(); sv != svend; sv++) {
1501 (*sv)->userdata = nullptr;
1502 }
1503
1504 //------
1505 // edges
1506 //------
1507 for (e = _edgesList.begin(), eend = _edgesList.end(); e != eend; e++) {
1508 (*e)->userdata = nullptr;
1509 }
1510 }
1511
1514 {
1515 SShape *clone = new SShape(*this);
1516 return clone;
1517 }
1518
1520 virtual inline ~SShape()
1521 {
1522 vector<SVertex *>::iterator sv, svend;
1523 vector<FEdge *>::iterator e, eend;
1524 if (0 != _verticesList.size()) {
1525 for (sv = _verticesList.begin(), svend = _verticesList.end(); sv != svend; sv++) {
1526 delete (*sv);
1527 }
1528 _verticesList.clear();
1529 }
1530
1531 if (0 != _edgesList.size()) {
1532 for (e = _edgesList.begin(), eend = _edgesList.end(); e != eend; e++) {
1533 delete (*e);
1534 }
1535 _edgesList.clear();
1536 }
1537
1539 //-----------------------
1540 if (0 != _chains.size()) {
1541 _chains.clear();
1542 }
1543 }
1544
1546 inline void AddEdge(FEdge *iEdge)
1547 {
1548 _edgesList.push_back(iEdge);
1549 }
1550
1554 inline void AddNewVertex(SVertex *iv)
1555 {
1556 iv->setShape(this);
1557 _verticesList.push_back(iv);
1558 }
1559
1560 inline void AddChain(FEdge *iEdge)
1561 {
1562 _chains.push_back(iEdge);
1563 }
1564
1565 inline SVertex *CreateSVertex(const Vec3r &P3D, const Vec3r &P2D, const Id &id)
1566 {
1567 SVertex *Ia = new SVertex(P3D, id);
1568 Ia->setPoint2D(P2D);
1569 AddNewVertex(Ia);
1570 return Ia;
1571 }
1572
1591 inline void SplitEdge(FEdge *fe, const vector<Vec2r> &iParameters, vector<FEdge *> &ioNewEdges)
1592 {
1593 SVertex *ioA = fe->vertexA();
1594 SVertex *ioB = fe->vertexB();
1595 Vec3r A = ioA->point3D();
1596 Vec3r B = ioB->point3D();
1597 Vec3r a = ioA->point2D();
1598 Vec3r b = ioB->point2D();
1599
1600 Vec3r newpoint3d, newpoint2d;
1601 vector<SVertex *> intersections;
1602 real t, T;
1603 for (vector<Vec2r>::const_iterator p = iParameters.begin(), pend = iParameters.end();
1604 p != pend;
1605 p++)
1606 {
1607 T = (*p)[0];
1608 t = (*p)[1];
1609
1610 if ((t < 0) || (t > 1)) {
1611 cerr << "Warning: Intersection out of range for edge " << ioA->getId() << " - "
1612 << ioB->getId() << endl;
1613 }
1614
1615 // compute the 3D and 2D coordinates for the intersections points:
1616 newpoint3d = Vec3r(A + T * (B - A));
1617 newpoint2d = Vec3r(a + t * (b - a));
1618
1619 // create new SVertex:
1620 // (we keep B's id)
1621 SVertex *newVertex = new SVertex(newpoint3d, ioB->getId());
1622 newVertex->setPoint2D(newpoint2d);
1623
1624 // Add this vertex to the intersections list:
1625 intersections.push_back(newVertex);
1626
1627 // Add this vertex to this sshape:
1628 AddNewVertex(newVertex);
1629 }
1630
1631 for (vector<SVertex *>::iterator sv = intersections.begin(), svend = intersections.end();
1632 sv != svend;
1633 sv++)
1634 {
1635 // SVertex *svA = fe->vertexA();
1636 SVertex *svB = fe->vertexB();
1637
1638 // We split edge AB into AA' and A'B. A' and A'B are created.
1639 // AB becomes (address speaking) AA'. B is updated.
1640 //--------------------------------------------------
1641 // The edge AB becomes edge AA'.
1642 (fe)->setVertexB((*sv));
1643 // a new edge, A'B is created.
1644 FEdge *newEdge;
1645 if (fe->isSmooth()) {
1646 newEdge = new FEdgeSmooth((*sv), svB);
1647 FEdgeSmooth *se = dynamic_cast<FEdgeSmooth *>(newEdge);
1648 FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe);
1650 }
1651 else {
1652 newEdge = new FEdgeSharp((*sv), svB);
1653 FEdgeSharp *se = dynamic_cast<FEdgeSharp *>(newEdge);
1654 FEdgeSharp *fes = dynamic_cast<FEdgeSharp *>(fe);
1657 }
1658
1659 newEdge->setNature((fe)->getNature());
1660
1661 // to build a new chain:
1662 AddChain(newEdge);
1663 // add the new edge to the sshape edges list.
1664 AddEdge(newEdge);
1665 // add new edge to the list of new edges passed as argument:
1666 ioNewEdges.push_back(newEdge);
1667
1668 // update edge A'B for the next pointing edge
1669 newEdge->setNextEdge((fe)->nextEdge());
1670 fe->nextEdge()->setPreviousEdge(newEdge);
1671 Id id(fe->getId().getFirst(), fe->getId().getSecond() + 1);
1672 newEdge->setId(fe->getId());
1673 fe->setId(id);
1674
1675 // update edge AA' for the next pointing edge
1676 // ioEdge->setNextEdge(newEdge);
1677 (fe)->setNextEdge(nullptr);
1678
1679 // update vertex pointing edges list:
1680 // -- vertex B --
1681 svB->Replace((fe), newEdge);
1682 // -- vertex A' --
1683 (*sv)->AddFEdge((fe));
1684 (*sv)->AddFEdge(newEdge);
1685 }
1686 }
1687
1688 /* splits an edge into 2 edges. The new vertex and edge are added to the sshape list of vertices
1689 * and edges a new chain is also created. returns the new edge. ioEdge The edge that gets
1690 * splitted newpoint x,y,z coordinates of the new point.
1691 */
1692 inline FEdge *SplitEdgeIn2(FEdge *ioEdge, SVertex *ioNewVertex)
1693 {
1694 // soc unused - SVertex *A = ioEdge->vertexA();
1695 SVertex *B = ioEdge->vertexB();
1696
1697 // We split edge AB into AA' and A'B. A' and A'B are created.
1698 // AB becomes (address speaking) AA'. B is updated.
1699 //--------------------------------------------------
1700 // a new edge, A'B is created.
1701 FEdge *newEdge;
1702 if (ioEdge->isSmooth()) {
1703 newEdge = new FEdgeSmooth(ioNewVertex, B);
1704 FEdgeSmooth *se = dynamic_cast<FEdgeSmooth *>(newEdge);
1705 FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(ioEdge);
1706 se->setNormal(fes->normal());
1708 se->setFaceMark(fes->faceMark());
1709 }
1710 else {
1711 newEdge = new FEdgeSharp(ioNewVertex, B);
1712 FEdgeSharp *se = dynamic_cast<FEdgeSharp *>(newEdge);
1713 FEdgeSharp *fes = dynamic_cast<FEdgeSharp *>(ioEdge);
1714 se->setNormalA(fes->normalA());
1715 se->setNormalB(fes->normalB());
1718 se->setaFaceMark(fes->aFaceMark());
1719 se->setbFaceMark(fes->bFaceMark());
1720 }
1721 newEdge->setNature(ioEdge->getNature());
1722
1723 if (ioEdge->nextEdge() != 0) {
1724 ioEdge->nextEdge()->setPreviousEdge(newEdge);
1725 }
1726
1727 // update edge A'B for the next pointing edge
1728 newEdge->setNextEdge(ioEdge->nextEdge());
1729 // update edge A'B for the previous pointing edge
1730 newEdge->setPreviousEdge(0); // because it is now a TVertex
1731 Id id(ioEdge->getId().getFirst(), ioEdge->getId().getSecond() + 1);
1732 newEdge->setId(ioEdge->getId());
1733 ioEdge->setId(id);
1734
1735 // update edge AA' for the next pointing edge
1736 ioEdge->setNextEdge(0); // because it is now a TVertex
1737
1738 // update vertex pointing edges list:
1739 // -- vertex B --
1740 B->Replace(ioEdge, newEdge);
1741 // -- vertex A' --
1742 ioNewVertex->AddFEdge(ioEdge);
1743 ioNewVertex->AddFEdge(newEdge);
1744
1745 // to build a new chain:
1746 AddChain(newEdge);
1747 AddEdge(newEdge); // FIXME ??
1748
1749 // The edge AB becomes edge AA'.
1750 ioEdge->setVertexB(ioNewVertex);
1751
1752 if (ioEdge->isSmooth()) {
1753 ((FEdgeSmooth *)newEdge)->setFace(((FEdgeSmooth *)ioEdge)->face());
1754 }
1755
1756 return newEdge;
1757 }
1758
1760 inline void setBBox(const BBox<Vec3r> &iBBox)
1761 {
1762 _BBox = iBBox;
1763 }
1764
1766 inline void ComputeBBox()
1767 {
1768 if (0 == _verticesList.size()) {
1769 return;
1770 }
1771
1772 Vec3r firstVertex = _verticesList[0]->point3D();
1773 real XMax = firstVertex[0];
1774 real YMax = firstVertex[1];
1775 real ZMax = firstVertex[2];
1776
1777 real XMin = firstVertex[0];
1778 real YMin = firstVertex[1];
1779 real ZMin = firstVertex[2];
1780
1781 vector<SVertex *>::iterator v, vend;
1782 // parse all the coordinates to find the Xmax, YMax, ZMax
1783 for (v = _verticesList.begin(), vend = _verticesList.end(); v != vend; v++) {
1784 Vec3r vertex = (*v)->point3D();
1785 // X
1786 real x = vertex[0];
1787 if (x > XMax) {
1788 XMax = x;
1789 }
1790 else if (x < XMin) {
1791 XMin = x;
1792 }
1793
1794 // Y
1795 real y = vertex[1];
1796 if (y > YMax) {
1797 YMax = y;
1798 }
1799 else if (y < YMin) {
1800 YMin = y;
1801 }
1802
1803 // Z
1804 real z = vertex[2];
1805 if (z > ZMax) {
1806 ZMax = z;
1807 }
1808 else if (z < ZMin) {
1809 ZMin = z;
1810 }
1811 }
1812
1813 setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
1814 }
1815
1816 inline void RemoveEdgeFromChain(FEdge *iEdge)
1817 {
1818 for (vector<FEdge *>::iterator fe = _chains.begin(), feend = _chains.end(); fe != feend; fe++)
1819 {
1820 if (iEdge == (*fe)) {
1821 _chains.erase(fe);
1822 break;
1823 }
1824 }
1825 }
1826
1827 inline void RemoveEdge(FEdge *iEdge)
1828 {
1829 for (vector<FEdge *>::iterator fe = _edgesList.begin(), feend = _edgesList.end(); fe != feend;
1830 fe++)
1831 {
1832 if (iEdge == (*fe)) {
1833 _edgesList.erase(fe);
1834 break;
1835 }
1836 }
1837 }
1838
1839 /* accessors */
1841 inline vector<SVertex *> &getVertexList()
1842 {
1843 return _verticesList;
1844 }
1845
1847 inline vector<FEdge *> &getEdgeList()
1848 {
1849 return _edgesList;
1850 }
1851
1852 inline vector<FEdge *> &getChains()
1853 {
1854 return _chains;
1855 }
1856
1858 inline const BBox<Vec3r> &bbox()
1859 {
1860 return _BBox;
1861 }
1862
1864 inline const FrsMaterial &frs_material(uint i) const
1865 {
1866 return _FrsMaterials[i];
1867 }
1868
1870 inline const vector<FrsMaterial> &frs_materials() const
1871 {
1872 return _FrsMaterials;
1873 }
1874
1876 {
1877 return _ViewShape;
1878 }
1879
1880 inline float importance() const
1881 {
1882 return _importance;
1883 }
1884
1886 inline Id getId() const
1887 {
1888 return _Id;
1889 }
1890
1892 inline const string &getName() const
1893 {
1894 return _Name;
1895 }
1896
1898 inline const string &getLibraryPath() const
1899 {
1900 return _LibraryPath;
1901 }
1902
1903 /* Modifiers */
1905 inline void setId(Id id)
1906 {
1907 _Id = id;
1908 }
1909
1911 inline void setName(const string &name)
1912 {
1913 _Name = name;
1914 }
1915
1917 inline void setLibraryPath(const string &path)
1918 {
1919 _LibraryPath = path;
1920 }
1921
1923 inline void setFrsMaterials(const vector<FrsMaterial> &iMaterials)
1924 {
1925 _FrsMaterials = iMaterials;
1926 }
1927
1928 inline void setViewShape(ViewShape *iShape)
1929 {
1930 _ViewShape = iShape;
1931 }
1932
1933 inline void setImportance(float importance)
1934 {
1935 _importance = importance;
1936 }
1937
1938#ifdef WITH_CXX_GUARDEDALLOC
1939 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SShape")
1940#endif
1941};
1942
1943} /* namespace Freestyle */
A class to hold a bounding box.
unsigned short ushort
unsigned int uint
GTS - Library for the manipulation of triangulated surfaces.
Singleton to manage exceptions.
Configuration definitions.
Class used to handle materials.
Vectors and Matrices (useful type definitions)
Interface to 0D elements.
Interface 1D and related tools definitions.
Read Guarded memory(de)allocation.
Class to define a polygon.
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
static int raiseException(exception_type exception=UNDEFINED)
Definition Exception.h:32
SVertexIterator & operator=(const SVertexIterator &vi)
Definition Silhouette.h:987
virtual SVertexIterator & operator--()
virtual bool operator==(const Interface0DIteratorNested &it) const
virtual string getExactTypeName() const
Definition Silhouette.h:994
SVertexIterator(const SVertexIterator &vi)
Definition Silhouette.h:975
virtual SVertexIterator operator--(int)
SVertexIterator(SVertex *v, FEdge *edge)
Definition Silhouette.h:981
virtual SVertexIterator * copy() const
virtual SVertexIterator & operator++()
virtual SVertexIterator operator++(int)
const FrsMaterial & aFrsMaterial() const
void setaFaceMark(bool iFaceMark)
void setaFrsMaterialIndex(uint i)
virtual string getExactTypeName() const
uint aFrsMaterialIndex() const
const Vec3r & normalA()
bool bFaceMark() const
FEdgeSharp(FEdgeSharp &iBrother)
void setNormalB(const Vec3r &iNormal)
const FrsMaterial & bFrsMaterial() const
const Vec3r & normalB()
bool aFaceMark() const
void setbFrsMaterialIndex(uint i)
FEdgeSharp(SVertex *vA, SVertex *vB)
void setbFaceMark(bool iFaceMark)
virtual FEdge * duplicate()
void setNormalA(const Vec3r &iNormal)
uint bFrsMaterialIndex() const
const Vec3r & normal()
virtual string getExactTypeName() const
void setNormal(const Vec3r &iNormal)
void setFrsMaterialIndex(uint i)
virtual FEdge * duplicate()
FEdgeSmooth(FEdgeSmooth &iBrother)
const FrsMaterial & frs_material() const
FEdgeSmooth(SVertex *vA, SVertex *vB)
void setFaceMark(bool iFaceMark)
void setFace(void *iFace)
void * face() const
uint frs_materialIndex() const
virtual Id getId() const
Definition Silhouette.h:485
virtual Interface0DIterator verticesBegin()
bool getOccludeeEmpty()
Definition Silhouette.h:700
void setOccludeeEmpty(bool iempty)
Definition Silhouette.h:798
ViewEdge * viewedge() const
Definition Silhouette.h:658
void setTemporary(bool iFlag)
Definition Silhouette.h:816
const int qi() const
Definition Silhouette.h:872
bool occluders_empty() const
int occluders_size() const
void setVertexB(SVertex *vB)
Definition Silhouette.h:729
occluder_container::const_iterator occluders_end() const
SShape * shape()
Definition Silhouette.h:636
const SVertex * max2d() const
Definition Silhouette.h:855
SVertex * _VertexB
Definition Silhouette.h:502
ViewEdge * _ViewEdge
Definition Silhouette.h:509
occluder_container::const_iterator occluders_begin() const
static SVertex * CommonVertex(FEdge *iEdge1, FEdge *iEdge2)
Definition Silhouette.h:824
void setId(const Id &id)
Definition Silhouette.h:735
SVertex * _VertexA
Definition Silhouette.h:501
Id shape_id() const
virtual FEdge * duplicate()
Definition Silhouette.h:589
virtual Interface0DIterator pointsBegin(float t=0.0f)
const SVertex * min2d() const
Definition Silhouette.h:845
FEdge * nextEdge()
Definition Silhouette.h:623
Vec3r orientation2d() const
Definition Silhouette.h:910
SVertex * vertexA()
Definition Silhouette.h:597
bool isInImage() const
Definition Silhouette.h:711
bool isTemporary() const
Definition Silhouette.h:716
void setViewEdge(ViewEdge *iViewEdge)
Definition Silhouette.h:766
const Polygon3r & aFace() const
Definition Silhouette.h:690
const SShape * occluded_shape() const
int viewedge_nature() const
SVertex * vertexB()
Definition Silhouette.h:603
void setNextEdge(FEdge *iEdge)
Definition Silhouette.h:741
SVertex * operator[](const ushort &i) const
Definition Silhouette.h:609
FEdge(SVertex *vA, SVertex *vB)
Definition Silhouette.h:547
virtual real getLength2D() const
Definition Silhouette.h:476
void setNature(Nature::EdgeNature iNature)
Definition Silhouette.h:753
Vec3r _occludeeIntersection
Definition Silhouette.h:514
virtual Interface0DIterator pointsEnd(float t=0.0f)
void setSmooth(bool iFlag)
Definition Silhouette.h:806
void setPreviousEdge(FEdge *iEdge)
Definition Silhouette.h:747
int invisibility() const
void setIsInImage(bool iFlag)
Definition Silhouette.h:811
virtual string getExactTypeName() const
Definition Silhouette.h:468
FEdge * previousEdge()
Definition Silhouette.h:631
float shape_importance() const
bool isSmooth() const
Definition Silhouette.h:706
void setaFace(Polygon3r &iFace)
Definition Silhouette.h:788
virtual Interface0DIterator verticesEnd()
Vec3r orientation3d() const
Definition Silhouette.h:915
void setVertexA(SVertex *vA)
Definition Silhouette.h:723
virtual ~FEdge()
Definition Silhouette.h:586
Polygon3r _aFace
Definition Silhouette.h:513
Nature::EdgeNature getNature() const
Definition Silhouette.h:615
void setOccludeeIntersection(const Vec3r &iPoint)
Definition Silhouette.h:793
FEdge * _PreviousEdge
Definition Silhouette.h:508
real z_discontinuity() const
Nature::EdgeNature _Nature
Definition Silhouette.h:504
const Vec3r & getOccludeeIntersection()
Definition Silhouette.h:695
const Polygon3r & occludee() const
Definition Silhouette.h:882
bool occludee_empty() const
FEdge(FEdge &iBrother)
Definition Silhouette.h:564
id_type getFirst() const
Definition Id.h:64
id_type getSecond() const
Definition Id.h:70
void RemoveEdgeFromChain(FEdge *iEdge)
void setId(Id id)
vector< SVertex * > & getVertexList()
FEdge * SplitEdgeIn2(FEdge *ioEdge, SVertex *ioNewVertex)
void AddChain(FEdge *iEdge)
void setFrsMaterials(const vector< FrsMaterial > &iMaterials)
void setImportance(float importance)
void setViewShape(ViewShape *iShape)
float importance() const
const BBox< Vec3r > & bbox()
const vector< FrsMaterial > & frs_materials() const
virtual SShape * duplicate()
SVertex * CreateSVertex(const Vec3r &P3D, const Vec3r &P2D, const Id &id)
void setLibraryPath(const string &path)
vector< FEdge * > & getChains()
void SplitEdge(FEdge *fe, const vector< Vec2r > &iParameters, vector< FEdge * > &ioNewEdges)
ViewShape * viewShape()
void RemoveEdge(FEdge *iEdge)
void setBBox(const BBox< Vec3r > &iBBox)
SShape(SShape &iBrother)
void AddNewVertex(SVertex *iv)
const FrsMaterial & frs_material(uint i) const
void setName(const string &name)
vector< FEdge * > & getEdgeList()
const string & getLibraryPath() const
const string & getName() const
void AddEdge(FEdge *iEdge)
virtual bool operator==(const SVertex &iBrother)
Definition Silhouette.h:219
ViewVertex * viewvertex()
Definition Silhouette.h:278
const SShape * occluded_shape() const
virtual FEdge * getFEdge(Interface0D &)
virtual real getY() const
Definition Silhouette.h:74
void setPoint2D(const Vec3r &iPoint2D)
Definition Silhouette.h:291
void setViewVertex(ViewVertex *iViewVertex)
Definition Silhouette.h:355
void setShape(SShape *iShape)
Definition Silhouette.h:350
Vec3r normal() const
Definition Silhouette.h:407
fedges_container::iterator fedges_begin()
Definition Silhouette.h:255
virtual Vec3r getPoint3D() const
Definition Silhouette.h:86
void setCurvatureInfo(CurvatureInfo *ci)
Definition Silhouette.h:303
virtual ViewVertex * castToViewVertex()
real z() const
Definition Silhouette.h:270
real z_discontinuity() const
occluder_container::const_iterator occluders_begin() const
virtual real getX() const
Definition Silhouette.h:68
fedges_container::iterator fedges_end()
Definition Silhouette.h:260
bool occluders_empty() const
void AddNormal(const Vec3r &iNormal)
Definition Silhouette.h:298
Id shape_id() const
const Vec3r & point3d() const
Definition Silhouette.h:402
virtual Vec2r getPoint2D() const
Definition Silhouette.h:110
virtual string getExactTypeName() const
Definition Silhouette.h:61
virtual NonTVertex * castToNonTVertex()
void setPoint3D(const Vec3r &iPoint3D)
Definition Silhouette.h:285
virtual SVertex * castToSVertex()
void AddFEdge(FEdge *iFEdge)
Definition Silhouette.h:361
occluder_container::const_iterator occluders_end() const
virtual real getProjectedZ() const
Definition Silhouette.h:104
virtual TVertex * castToTVertex()
const Vec3r & point2d() const
Definition Silhouette.h:397
virtual Nature::VertexNature getNature() const
int occluders_size() const
virtual real getZ() const
Definition Silhouette.h:80
const Polygon3r & occludee() const
virtual Id getId() const
Definition Silhouette.h:119
const Vec3r & point2D() const
Definition Silhouette.h:230
uint normalsSize() const
Definition Silhouette.h:245
void RemoveFEdge(FEdge *iFEdge)
Definition Silhouette.h:367
const vector< FEdge * > & fedges()
Definition Silhouette.h:250
virtual real getProjectedY() const
Definition Silhouette.h:98
void setId(const Id &id)
Definition Silhouette.h:340
vector< FEdge * > fedges_container
Definition Silhouette.h:140
SVertex(const Vec3r &iPoint3D, const Id &id)
Definition Silhouette.h:173
virtual SVertex * duplicate()
Definition Silhouette.h:212
void setFEdges(const vector< FEdge * > &iFEdges)
Definition Silhouette.h:345
set< Vec3r > normals()
Definition Silhouette.h:239
bool occludee_empty() const
virtual real getProjectedX() const
Definition Silhouette.h:92
SVertex(SVertex &iBrother)
Definition Silhouette.h:184
const Vec3r & point3D() const
Definition Silhouette.h:225
float shape_importance() const
void Replace(FEdge *e1, FEdge *e2)
Definition Silhouette.h:378
const CurvatureInfo * getCurvatureInfo() const
Definition Silhouette.h:311
value_type x() const
Definition VecMat.h:493
value_type z() const
Definition VecMat.h:513
value_type y() const
Definition VecMat.h:503
local_group_size(16, 16) .push_constant(Type b
#define T
#define B
VecMat::Vec2< real > Vec2r
Definition Geom.h:24
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
static const EdgeNature NO_FEATURE
Definition Nature.h:38
ushort VertexNature
Definition Nature.h:22
ushort EdgeNature
Definition Nature.h:36
inherits from class Rep
Definition AppCanvas.cpp:20
static uint c
Definition RandGen.cpp:87
vector< ViewShape * > occluder_container
Definition Silhouette.h:43
static uint x[3]
Definition RandGen.cpp:77
double real
Definition Precision.h:14
return ret