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