maxY) maxY=y;
128 | }
129 | bValid=true;
130 | if(oldMinX!=minX || oldMinY!=minY || oldMaxX!=maxX || oldMaxY!=maxY ) return true;
131 | else return false;
132 | }
133 |
134 | /** \brief Add a point
135 | * \return true if the bounding box changes, false otherwise
136 | */
137 |
138 | bool add(const Point2& p)
139 | {
140 | //std::cout<<"Add point: "<maxX) maxX=b.maxX;
164 | if(b.minYmaxY) maxY=b.maxY;
166 | return *this;
167 | }
168 |
169 | #if GEOM_PSEUDO3D==GEOM_TRUE
170 | /** \brief Get the min point
171 | * \return the point with the three minimum coordinates, the z-coordinate is set to 0
172 | */
173 | #else
174 | /** \brief Get the min point
175 | * \return the point with the three minimum coordinates
176 | */
177 | #endif
178 |
179 | Point2 getMinPoint() const
180 | {
181 | #if GEOM_PSEUDO3D==GEOM_TRUE
182 | return Point2(minX,minY,0);
183 | #else
184 | return Point2(minX,minY);
185 | #endif
186 | }
187 |
188 |
189 | #if GEOM_PSEUDO3D==GEOM_TRUE
190 | /** \brief Get the max point
191 | * \return the point with the three maximum coordinates, the z-coordinate is set to 0
192 | */
193 | #else
194 | /** \brief Get the max point
195 | * \return the point with the three maximum coordinates
196 | */
197 | #endif
198 |
199 | Point2 getMaxPoint() const
200 | {
201 | #if GEOM_PSEUDO3D==GEOM_TRUE
202 | return Point2(maxX,maxY,0);
203 | #else
204 | return Point2(maxX,maxY);
205 | #endif
206 | }
207 |
208 | /** \brief Get minimum coordinate
209 | * \return the smallest coordinate value of {x,y}
210 | */
211 |
212 | double getMinCoord() const
213 | {
214 | if(minXmaxY) return maxX;
224 | else return maxY;
225 | }
226 | /** \brief Get x range
227 | * \return maxX-minX
228 | */
229 |
230 | double getRangeX() const
231 | {
232 | return maxX-minX;
233 | }
234 | /** \brief Get y range
235 | * \return maxY-minY
236 | */
237 |
238 | double getRangeY() const
239 | {
240 | return maxY-minY;
241 | }
242 | /** \brief Get max range
243 | * \return the largest range of {x,y}
244 | */
245 |
246 | double getMaxRange() const
247 | {
248 | double range0=getRangeX();
249 | double range1=getRangeY();
250 | if(range0>range1) std::swap(range0,range1);
251 | return range1;
252 | }
253 | /** \brief Get minX
254 | * \return minX
255 | */
256 | double get_minX() {return minX;}
257 | /** \brief Get minY
258 | * \return minY
259 | */
260 | double get_minY() {return minY;}
261 | /** \brief Get maxX
262 | * \return maxX
263 | */
264 | double get_maxX() {return maxX;}
265 | /** \brief Get maxY
266 | * \return maxY
267 | */
268 | double get_maxY() {return maxY;}
269 |
270 | /** \brief Double the box size
271 | * Changes the bounds such that the box grows in each direction by half the range
272 | */
273 |
274 | void doubleTheBox();
275 |
276 | protected:
277 | /** \brief Add a point to a valid box
278 | */
279 |
280 | inline void treatPointForValidBox(const Point2& p)
281 | {
282 | double x,y;
283 | p.xy(x,y);
284 | if(xmaxX) maxX=x;
286 | if(ymaxY) maxY=y;
288 | }
289 |
290 | /** \brief Add a point to an uninitialized
291 | */
292 |
293 | inline void treatPointForInvalidBox(const Point2& p)
294 | {
295 | p.xy(minX,minY);
296 | p.xy(maxX,maxY);
297 | bValid=true;
298 | }
299 |
300 |
301 |
302 |
303 | protected:
304 | double minX,minY;
305 | double maxX,maxY;
306 | bool bValid;
307 | friend std::ostream &operator<<(std::ostream &stream, Bbox2& pC);
308 | GeomTest* pGeomTest;
309 | };
310 |
311 |
312 | inline std::ostream &operator<<(std::ostream &stream, Bbox2& pC)
313 | {
314 | stream<<"Bbox2: ("< ("<
23 |
24 |
25 | #include "common.h"
26 | #if GEOM_PSEUDO3D==GEOM_TRUE
27 | namespace GEOM_FADE25D {
28 | #elif GEOM_PSEUDO3D==GEOM_FALSE
29 | namespace GEOM_FADE2D {
30 | #else
31 | #error GEOM_PSEUDO3D is not defined
32 | #endif
33 |
34 | class Dt2; // Forward
35 | class ConstraintSegment2; // Forward
36 | class GeomTest; // Forward
37 |
38 |
39 | /** \brief ConstraintGraph2 is a set of enforced edges
40 | *
41 | * \see \ref createConstraint in the Fade2D class
42 | *
43 | * \image html crop_ignoreBike.jpg "Constraints in a triangulation"
44 | * \image latex crop_ignoreBike.eps "Constraints in a triangulation" width=12cm
45 | */
46 | class ConstraintGraph2
47 | {
48 | public:
49 | /** \brief Internal use
50 | *
51 | * Constructor for one or more ConstraintSegment2 objects
52 | */
53 | CLASS_DECLSPEC
54 | ConstraintGraph2(
55 | Dt2* pDt2_,
56 | std::vector& vCSegments,
57 | ConstraintInsertionStrategy
58 | );
59 |
60 | /** \brief Internal use
61 | *
62 | * Constructor for one or more ConstraintSegment2 objects whose
63 | * direction is given by mPPReverse. Used for bounded zones
64 | */
65 | CLASS_DECLSPEC
66 | ConstraintGraph2(
67 | Dt2* pDt2_,
68 | std::vector& vCSegments_,
69 | std::map,bool > mPPReverse,
70 | ConstraintInsertionStrategy cis_
71 | );
72 |
73 | /** \brief Internal use
74 | *
75 | * Called by the two constructors
76 | */
77 | void init(std::vector& vCSegments_);
78 |
79 |
80 | /** \brief Does the constraint graph form a closed polygon?
81 | *
82 | * @note This method does not check if it is a simple polygon (one
83 | * without self-intersections).
84 | */
85 | CLASS_DECLSPEC
86 | bool isPolygon() const;
87 |
88 | /** \brief Are the segments of the constraint graph oriented?
89 | *
90 | * @return true if the constraint graph has been created with
91 | * bOrientedSegments=true or if automatic reorientation was possible
92 | * which is the case for simple polygons.
93 | */
94 | CLASS_DECLSPEC
95 | bool isOriented() const;
96 |
97 | /** \brief Get the vertices of the constraint segments
98 | *
99 | * Use this method to retrieve the segments of *this in form of a vector
100 | * of vertices. If *this is a closed polygon, then the points are ordered
101 | * and oriented in counterclockwise direction, e.g. (a,b,b,c,c,d,d,a). If
102 | * the *this is not a polygon, then the segments are returned in the
103 | * original direction.
104 | *
105 | * @note If it was necessary to split the constraint segments, then the
106 | * splitted segments are returned. If, in the above example, the constraint
107 | * segment (a,b) crosses some previously inserted point x, then the
108 | * result is (a,x,x,b,b,c,c,d,d,a).
109 | *
110 | */
111 | CLASS_DECLSPEC
112 | void getPolygonVertices(std::vector& vTriangulationPoints_) ;
113 |
114 | /** \brief Get the constraint insertion strategy
115 | *
116 | * \if SECTION_FADE25D
117 | * @return CIS_CONFORMING_DELAUNAY, CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL or @n
118 | * CIS_CONSTRAINED_DELAUNAY
119 | * \else
120 | * @return CIS_CONFORMING_DELAUNAY or CIS_CONSTRAINED_DELAUNAY
121 | * \endif
122 | *
123 | */
124 | CLASS_DECLSPEC
125 | ConstraintInsertionStrategy getInsertionStrategy() const;
126 |
127 | /** \brief Check if an edge is a constraint
128 | *
129 | * Checks if the edge (p0,p1) is a constraint of *this
130 | */
131 | CLASS_DECLSPEC
132 | bool isConstraint(Point2* p0,Point2* p1) const;
133 |
134 |
135 |
136 | /** \brief Visualization
137 | *
138 | */
139 | CLASS_DECLSPEC
140 | void show(const std::string& name);
141 |
142 |
143 |
144 | /** \brief Get the original ConstraintSegment2 objects
145 | *
146 | * Get the original, not subdivided ConstraintSegment2 objects. The
147 | * ones which have been splitted are not alive anymore. But they
148 | * have children (for which the same may hold).
149 | *
150 | */
151 | CLASS_DECLSPEC
152 | void getOriginalConstraintSegments(std::vector& vConstraintSegments_) const;
153 |
154 | /** \brief Update a constraint segment of *this
155 | * Internal method
156 | */
157 | void updateSplittedConstraintSegment(ConstraintSegment2* pCSeg,bool bDirChange0,bool bDirChange1,ConstraintSegment2* pChild0,ConstraintSegment2* pChild1);
158 | /**
159 | * \return the Delaunay class it belongs to
160 | */
161 | Dt2* getDt2();
162 | void getAliveConstraintChain(std::vector& vAliveCSeg) ; // For debugging
163 | protected:
164 | bool isReverse(ConstraintSegment2* pCSeg) const;
165 | bool checkAndSortPolygon(std::vector& vCSegments_);
166 |
167 |
168 | // Data
169 | Dt2* pDt2;
170 | GeomTest* pGeomPredicates;
171 | ConstraintInsertionStrategy cis;
172 | std::vector vCSegParents;
173 | bool bIsPolygon;
174 | std::map > mCSegReverse;
175 | std::map mSplitPointNum;
176 | bool bIsOriented;
177 | };
178 |
179 | } // (namespace)
180 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/ConstraintSegment2.h:
--------------------------------------------------------------------------------
1 | // (c) 2010 Geom e.U. Bernhard Kornberger, Graz/Austria. All rights reserved.
2 | //
3 | // This file is part of the Fade2D library. You can use it for your personal
4 | // non-commercial research. Licensees holding a commercial license may use this
5 | // file in accordance with the Commercial License Agreement provided
6 | // with the Software.
7 | //
8 | // This software is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
9 | // THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | //
11 | // Please contact the author if any conditions of this licensing are not clear
12 | // to you.
13 | //
14 | // Author: Bernhard Kornberger, bkorn (at) geom.at
15 | // http://www.geom.at
16 |
17 | #pragma once
18 | #include
19 |
20 | #include "common.h"
21 | #if GEOM_PSEUDO3D==GEOM_TRUE
22 | namespace GEOM_FADE25D {
23 | #elif GEOM_PSEUDO3D==GEOM_FALSE
24 | namespace GEOM_FADE2D {
25 | #else
26 | #error GEOM_PSEUDO3D is not defined
27 | #endif
28 |
29 | class Point2; // FWD
30 | class ConstraintGraph2; // FWD
31 |
32 |
33 | /** \brief Constraint Insertion Strategy
34 | * determines how a constraint edge shall be inserted:
35 | *
36 | * - CIS_CONSTRAINED_DELAUNAY inserts a segment without subdivision
37 | * unless required (which is the case if existing vertices or constraint
38 | * segments are crossed).
39 | * - CIS_CONFORMING_DELAUNAY subdivides a segment if necessary to
40 | * maintain the empty circle property of the surrounding triangles.
41 | * In general this insertion strategy creates more but better shaped
42 | * triangles than CIS_CONSTRAINED_DELAUNAY.
43 | * \if SECTION_FADE25D
44 | * The height (z-coordinate) of new split points is adapted to existing
45 | * triangles.
46 | * - CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL is the same as the strategy
47 | * CIS_CONFORMING_DELAUNAY except that split points are not projected
48 | * to an existing surface but their height is interpolated between the
49 | * endpoints of the segment to be inserted.
50 | * \endif
51 | *
52 | * \note In former library versions the terms CIS_IGNORE_DELAUNAY
53 | * and CIS_KEEP_DELAUNAY were used but these were misleading and
54 | * are now deprecated. For backwards compatibility they are kept.
55 | */
56 | enum ConstraintInsertionStrategy
57 | {
58 | CIS_CONFORMING_DELAUNAY=0,
59 | CIS_CONSTRAINED_DELAUNAY=1,
60 | #if GEOM_PSEUDO3D==GEOM_TRUE
61 | CIS_CONFORMING_DELAUNAY_SEGMENT_LEVEL=2,
62 | #endif
63 | CIS_KEEP_DELAUNAY=0, // Deprecated name
64 | CIS_IGNORE_DELAUNAY=1 // Deprecated name
65 | };
66 |
67 | /** \brief Constraint segment
68 | */
69 | class ConstraintSegment2
70 | {
71 | public:
72 | ConstraintSegment2(Point2* p0_,Point2* p1_,ConstraintInsertionStrategy cis_);
73 | ~ConstraintSegment2();
74 | /** \brief Get the source point
75 | * \return the source point
76 | */
77 | CLASS_DECLSPEC
78 | Point2* getSrc() const;
79 | /** \brief Get the target point
80 | * \return the source point
81 | */
82 | CLASS_DECLSPEC
83 | Point2* getTrg() const;
84 | /**
85 | * \return if the object is alive
86 | */
87 | CLASS_DECLSPEC
88 | bool isAlive() const;
89 | /**
90 | * \return the constraint insertion strategy (CIS)
91 | */
92 | ConstraintInsertionStrategy getCIS() const;
93 |
94 | /** \brief operator<(..)
95 | * Compares by vertex pointers
96 | */
97 |
98 | CLASS_DECLSPEC
99 | bool operator<(const ConstraintSegment2& pOther) const;
100 |
101 | /** \brief Split a constraint segment
102 | *
103 | * internal use.
104 | */
105 | CLASS_DECLSPEC
106 | bool split(Point2* pSplit);
107 | /** \brief Split a constraint segment
108 | *
109 | * internal use
110 | */
111 | CLASS_DECLSPEC
112 | bool splitAndRemovePrev(Point2* pSplit);
113 | /** \brief Add an owner
114 | *
115 | * Sets a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
116 | * internal use.
117 | */
118 | void addOwner(ConstraintGraph2* pOwner);
119 | /** \brief Remove an owner
120 | * Removes a specific ConstraintGraph2 as owner of the current ConstraintSegment2.
121 | * Mostly for internal use.
122 | */
123 | void removeOwner(ConstraintGraph2* pOwner);
124 | CLASS_DECLSPEC
125 | /** \brief Get all children
126 | * Recursively retrieve all children of the current ConstraintSegment2.
127 | */
128 | void getChildrenRec(std::vector& vChildConstraintSegments);
129 | CLASS_DECLSPEC
130 | /** \brief Get the children and the split point
131 | * Retrieve the two direct children of the current ConstraintSegment2 as well as the split point.
132 | */
133 | void getChildrenAndSplitPoint(ConstraintSegment2*& pCSeg0,ConstraintSegment2*& pCSeg1,Point2*& pSplitPoint);
134 | CLASS_DECLSPEC
135 | friend std::ostream &operator<<(std::ostream &stream, const ConstraintSegment2& cSeg);
136 | /** \brief Return the number of owners
137 | * Returns the number of ConstraintGraphs where the current ConstraintSegment2 is a member
138 | */
139 | CLASS_DECLSPEC
140 | size_t getNumberOfOwners() const;
141 |
142 |
143 | /** \brief Set adjacent area
144 | * A customer specific method, not thought for public use. If the
145 | * current constraint segment is a border segment, then the area of
146 | * the (non-existing) outside triangle can manually be deposited
147 | * here. This value is used by the extended meshing method when a
148 | * grow factor is given or ignored if not set.
149 | * \note Only use if you know what you are doing.
150 | */
151 | CLASS_DECLSPEC
152 | void setAdjacentArea(double adjacentArea_);
153 |
154 | /** \brief Get adjacent area
155 | * A customer specific method, not thought for public use. Returns
156 | * a previously via setAdjacentArea(double adjacentArea_) deposited
157 | * value. If not explicitly set, DBL_MAX is returned.
158 | */
159 | CLASS_DECLSPEC
160 | double getAdjacentArea() const;
161 |
162 |
163 | protected:
164 | Point2 *p0,*p1;
165 | ConstraintInsertionStrategy cis;
166 | std::set sOwners;
167 | std::vector vChildren;
168 | double adjacentArea;
169 | };
170 |
171 | } // NAMESPACE
172 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/Edge2.h:
--------------------------------------------------------------------------------
1 | // (c) 2010 Geom e.U. Bernhard Kornberger, Graz/Austria. All rights reserved.
2 | //
3 | // This file is part of the Fade2D library. You can use it for your personal
4 | // non-commercial research. Licensees holding a commercial license may use this
5 | // file in accordance with the Commercial License Agreement provided
6 | // with the Software.
7 | //
8 | // This software is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
9 | // THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | //
11 | // Please contact the author if any conditions of this licensing are not clear
12 | // to you.
13 | //
14 | // Author: Bernhard Kornberger, bkorn (at) geom.at
15 | // http://www.geom.at
16 |
17 |
18 | #pragma once
19 |
20 | #include "common.h"
21 | #if GEOM_PSEUDO3D==GEOM_TRUE
22 | namespace GEOM_FADE25D {
23 | #elif GEOM_PSEUDO3D==GEOM_FALSE
24 | namespace GEOM_FADE2D {
25 | #else
26 | #error GEOM_PSEUDO3D is not defined
27 | #endif
28 |
29 | class Triangle2;
30 | class Point2;
31 |
32 | class Edge2
33 | {
34 | public:
35 | Edge2();
36 | Edge2(const Edge2& e_);
37 | Edge2(Triangle2* c_,int oppIdx_);
38 | ~Edge2();
39 |
40 | // Combinatorial operator<
41 | bool operator<(const Edge2& e) const
42 | {
43 | if(ce.c) return false;
45 | if(oppIdxe1.getLength2D()) return true;
90 | else return false;
91 | }
92 | };
93 |
94 | #if GEOM_PSEUDO3D==GEOM_TRUE
95 | struct Func_ltEdge25D
96 | {
97 | bool operator()(const Edge2& e0,const Edge2& e1) const
98 | {
99 | if(e0.getLength25D() inline void unusedParameter(const T&){} // Avoids compiler warnings
17 |
18 |
19 |
20 | /** \brief Parameters for the mesh generator
21 | *
22 | * This class serves as container for mesh generator parameters. Client
23 | * code can provide a class which derives from MeshGenParams an which
24 | * provides custom implementations of the getMaxTriangleArea(Triangle* pT)
25 | * method or the getMaxEdgeLength(Triangle* pT) method in order to
26 | * gain control over the local density of the generated mesh. When the
27 | * meshing algorithm decides if a certain triangle T must be refined,
28 | * then it calls these functions.
29 | */
30 | class CLASS_DECLSPEC MeshGenParams
31 | {
32 | public:
33 | MeshGenParams(Zone2* pZone_):
34 | #if GEOM_PSEUDO3D==GEOM_TRUE
35 | // *** The following two parameters exist only in Fade2.5D ***
36 | pHeightGuideTriangulation(NULL),
37 | maxHeightError(DBL_MAX),
38 | #endif
39 | pZone(pZone_),
40 | minAngleDegree(20.0),
41 | minEdgeLength(1e-3),
42 | maxEdgeLength(DBL_MAX),
43 | maxTriangleArea(DBL_MAX),
44 | bAllowConstraintSplitting(true),
45 | growFactor(DBL_MAX),
46 | growFactorMinArea(1e-3),
47 | capAspectLimit(10.0),
48 | gridLength(0.0)
49 | {
50 | if( pZone->getZoneLocation()!=ZL_INSIDE &&
51 | pZone->getZoneLocation()!=ZL_BOUNDED )
52 | {
53 | std::cerr<<"\n\n\nMeshGenParams::MeshGenParams(..), ERROR: \n\tbehavior since Fade 1.39: The zoneLocation must be ZL_INSIDE or ZL_BOUNDED. Please convert the zone using pZone->convertToBoundedZone(..)\n\n"<5.0, Default: growFactor=DBL_MAX
179 | */
180 | double growFactor;
181 |
182 | /** \brief growFactorMinArea
183 | *
184 | * The growFactor value is ignored for triangles with a smaller area
185 | * than growFactorMinArea. This value prevents generation of hundreds
186 | * of tiny triangles around one that is unusually small. Default: 0.001
187 | */
188 | double growFactorMinArea;
189 |
190 | /** \brief capAspectLimit
191 | *
192 | * Limits the quotient edgeLength / height. Default value: 10.0
193 | */
194 | double capAspectLimit;
195 |
196 |
197 | /** \brief gridVector
198 | *
199 | * When pre-meshing with grid points is used then the grid will be
200 | * aligned along this vector. By default %s gridVector is axis aligned.
201 | */
202 | Vector2 gridVector;
203 |
204 | /** \brief gridLength
205 | *
206 | * Set %gridLength > 0 to insert grid points before the mesh generator
207 | * runs. By default % gridLength=0 (off).
208 | *
209 | * @warning Small values can produce a huge number of triangles
210 | */
211 | double gridLength;
212 |
213 | /** \brief Commad
214 | *
215 | * A command string, not for public use.
216 | */
217 | // std::string command;
218 | };
219 |
220 |
221 | } // NAMESPACE
222 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/MsgBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 |
5 | #if GEOM_PSEUDO3D==GEOM_TRUE
6 | namespace GEOM_FADE25D {
7 | #elif GEOM_PSEUDO3D==GEOM_FALSE
8 | namespace GEOM_FADE2D {
9 | #else
10 | #error GEOM_PSEUDO3D is not defined
11 | #endif
12 |
13 | enum MsgType
14 | {
15 | MSG_PROGRESS,
16 | MSG_WARNING
17 | };
18 |
19 | /** \brief %MsgBase
20 | *
21 | * MsgBase is a base class from which message subscriber classes (for
22 | * example widgets, progress bars, ...) can be derived which then
23 | * receive messages (progress, warnings, ...) from Fade.
24 | *
25 | */
26 | class CLASS_DECLSPEC MsgBase
27 | {
28 | public:
29 | MsgBase(){};
30 | virtual ~MsgBase(){}
31 |
32 |
33 | /** \brief update
34 | *
35 | * This method must be defined in derived message subscriber classes. It
36 | * is automatically called everytime Fade has a message of type \e msgType.
37 | *
38 | */
39 | virtual void update(MsgType msgType,const std::string& s,double d)=0;
40 | };
41 |
42 |
43 | } // Namespace
44 |
45 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/Performance.h:
--------------------------------------------------------------------------------
1 | // (c) 2010 Geom e.U. Bernhard Kornberger, Graz/Austria. All rights reserved.
2 | //
3 | // This file is part of the Fade2D library. You can use it for your personal
4 | // non-commercial research. Licensees holding a commercial license may use this
5 | // file in accordance with the Commercial License Agreement provided
6 | // with the Software.
7 | //
8 | // This software is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
9 | // THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | //
11 | // Please contact the author if any conditions of this licensing are not clear
12 | // to you.
13 | //
14 | // Author: Bernhard Kornberger, bkorn (at) geom.at
15 | // http://www.geom.at
16 |
17 |
18 | #pragma once
19 | #include
20 |
21 |
22 | #include "common.h"
23 | #if GEOM_PSEUDO3D==GEOM_TRUE
24 | namespace GEOM_FADE25D {
25 | #elif GEOM_PSEUDO3D==GEOM_FALSE
26 | namespace GEOM_FADE2D {
27 | #else
28 | #error GEOM_PSEUDO3D is not defined
29 | #endif
30 |
31 |
32 | /** \brief Timer
33 | *
34 | * Call the timer function with a certain string to start time
35 | * measurement. Call it a second time with the same string to
36 | * finish the time measurement.
37 | *
38 | * @return -1 when the timer is started or the elapsed time in
39 | * seconds when the timer is stopped.
40 | */
41 | CLASS_DECLSPEC
42 | double timer(const std::string& str);
43 |
44 | } // (namespace)
45 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/Publisher.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "common.h"
3 | #include "MsgBase.h"
4 |
5 | #if GEOM_PSEUDO3D==GEOM_TRUE
6 | namespace GEOM_FADE25D {
7 | #elif GEOM_PSEUDO3D==GEOM_FALSE
8 | namespace GEOM_FADE2D {
9 | #else
10 | #error GEOM_PSEUDO3D is not defined
11 | #endif
12 |
13 | typedef std::multimap MMTypMsg;
14 | typedef MMTypMsg::iterator MMTypMsgIt;
15 | class Publisher
16 | {
17 | public:
18 | Publisher():progress_todo(0),progress_done(0),progress_broadcast_interval(0),bEndPublished(false)
19 | {
20 | }
21 | void startProgress(const std::string& name,size_t todo)
22 | {
23 | if(mmSubscribers.empty()) return;
24 | progress_todo=todo;
25 | progress_done=0;
26 | progress_name=name;
27 | progress_broadcast_interval=progress_todo/100;
28 | if(progress_broadcast_interval<1) progress_broadcast_interval=1;
29 | bEndPublished=false;
30 | }
31 | void endProgress()
32 | {
33 | if(mmSubscribers.empty()) return;
34 | progress_done=progress_todo;
35 | if(!bEndPublished) broadcast(MSG_PROGRESS,progress_name,1.0);
36 | progress_name.clear();
37 | progress_todo=0;
38 | progress_done=0;
39 | }
40 | void incProgress(size_t increment=1)
41 | {
42 | if(mmSubscribers.empty() || progress_todo==0 || bEndPublished) return;
43 | progress_done+=increment;
44 | if(progress_done%progress_broadcast_interval==0)
45 | {
46 | double prog(double(progress_done)/double(progress_todo));
47 | if(prog>=1.0)
48 | {
49 | prog=1.0;
50 | bEndPublished=true;
51 | }
52 | broadcast(MSG_PROGRESS,progress_name,prog);
53 | }
54 | }
55 |
56 | void incTodo(size_t increment=1)
57 | {
58 | if(mmSubscribers.empty()) return;
59 | progress_todo+=increment;
60 | }
61 |
62 | void broadcast(MsgType msgType,const std::string& s,double d)
63 | {
64 | std::pair result(mmSubscribers.equal_range(msgType));
65 | for(;result.first!=result.second;++result.first)
66 | {
67 | MsgBase* pCurrentMsgBase(result.first->second);
68 | pCurrentMsgBase->update(msgType,s,d);
69 | }
70 | }
71 |
72 | void subscribe(MsgType msgType,MsgBase* pMsg)
73 | {
74 | std::pair result(mmSubscribers.equal_range(msgType));
75 | for(;result.first!=result.second;++result.first)
76 | {
77 | MsgBase* pCurrentMsgBase(result.first->second);
78 | if(pCurrentMsgBase==pMsg)
79 | {
80 | return;
81 | }
82 | }
83 | mmSubscribers.insert(std::make_pair(msgType,pMsg));
84 | }
85 | void unsubscribe(MsgType msgType,MsgBase* pMsg)
86 | {
87 | std::pair result(mmSubscribers.equal_range(msgType));
88 | for(;result.first!=result.second;++result.first)
89 | {
90 | MsgBase* pCurrentMsgBase(result.first->second);
91 | if(pCurrentMsgBase==pMsg)
92 | {
93 | mmSubscribers.erase(result.first);
94 | return;
95 | }
96 | }
97 | std::cerr<<"Publisher::unsubscribe(), warning, no such subscriber found"<getSrc()getSrc()) return true;
113 | if(seg0->getSrc()>seg1->getSrc()) return false;
114 | if(seg0->getTrg()getTrg()) return true;
115 | if(seg0->getTrg()>seg1->getTrg()) return false;
116 | return false;
117 | }
118 | };
119 | /**
120 | \endcond
121 | */
122 | } // (namespace)
123 |
--------------------------------------------------------------------------------
/third_party/fade_v1.46a/include_fade2d/SegmentChecker.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | #pragma once
4 | #include