15#ifdef WITH_CXX_GUARDEDALLOC
62#ifdef WITH_CXX_GUARDEDALLOC
63 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:Intersection")
69# pragma warning(disable : 4521)
72template<
class T,
class Po
int>
class Segment {
76 Segment(T &s,
const Point &iA,
const Point &iB)
93 _edge = iBrother.
edge();
96 _Intersections = iBrother._Intersections;
97 _order = iBrother._order;
102 _edge = iBrother._edge;
105 _Intersections = iBrother._Intersections;
106 _order = iBrother._order;
111 _Intersections.clear();
116 return (i % 2 == 0) ? A : B;
121 if (_edge == iBrother._edge) {
130 _Intersections.push_back(i);
136 if ((A == S[0]) || (A == S[1])) {
140 if ((B == S[0]) || (B == S[1])) {
149 return _Intersections;
166 std::vector<Intersection<Segment<T, Point>> *>
170#ifdef WITH_CXX_GUARDEDALLOC
171 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:Segment")
199 iend = _Intersections.end();
218 vector<Segment<T, Point> *> toadd;
219 typename vector<Segment<T, Point> *>::iterator s, send;
220 for (s = segments.begin(), send = segments.end(); s != send; s++) {
221 if (p == (*(*s))[0]) {
222 toadd.push_back((*s));
228 for (s = toadd.begin(), send = toadd.end(); s != send; s++) {
229 add((*s), binrule, epsilon);
245 if (
true == S->
order()) {
246 v0[0] = ((*S)[0])[0];
247 v0[1] = ((*S)[0])[1];
248 v1[0] = ((*S)[1])[0];
249 v1[1] = ((*S)[1])[1];
252 v1[0] = ((*S)[0])[0];
253 v1[1] = ((*S)[0])[1];
254 v0[0] = ((*S)[1])[0];
255 v0[1] = ((*S)[1])[1];
257 for (
typename std::list<
Segment<T, Point> *>::iterator s = _set.begin(), send = _set.end();
262 if (
true != binrule(*S, *currentS)) {
266 if (
true == currentS->
order()) {
267 v2[0] = ((*currentS)[0])[0];
268 v2[1] = ((*currentS)[0])[1];
269 v3[0] = ((*currentS)[1])[0];
270 v3[1] = ((*currentS)[1])[1];
273 v3[0] = ((*currentS)[0])[0];
274 v3[1] = ((*currentS)[0])[1];
275 v2[0] = ((*currentS)[1])[0];
276 v2[1] = ((*currentS)[1])[1];
289 _Intersections.push_back(inter);
291 S->AddIntersection(inter);
293 currentS->AddIntersection(inter);
302 if (s->intersections().size() > 0) {
303 _IntersectedEdges.push_back(s);
310 return _IntersectedEdges;
315 return _Intersections;
319 std::list<Segment<T, Point> *>
321 std::vector<Segment<T, Point> *> _IntersectedEdges;
322 std::vector<Intersection<Segment<T, Point>> *> _Intersections;
324#ifdef WITH_CXX_GUARDEDALLOC
325 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:SweepLine")
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
Intersection(EdgeClass *eA, real ta, EdgeClass *eB, real tb)
real getParameter(Edge *iEdge)
Intersection(const Intersection &iBrother)
void AddIntersection(Intersection< Segment< T, Point > > *i)
vector< Intersection< Segment< T, Point > > * > & intersections()
Point operator[](const ushort &i) const
Segment(const Segment< T, Point > &iBrother)
Segment(T &s, const Point &iA, const Point &iB)
bool operator==(const Segment< T, Point > &iBrother)
bool CommonVertex(const Segment< T, Point > &S, Point &CP)
Segment(Segment< T, Point > &iBrother)
vector< Intersection< Segment< T, Point > > * > & intersections()
void add(Segment< T, Point > *S, binary_rule< Segment< T, Point >, Segment< T, Point > > &binrule, real epsilon)
vector< Segment< T, Point > * > & intersectedEdges()
void remove(Segment< T, Point > *s)
void process(Point &p, vector< Segment< T, Point > * > &segments, binary_rule< Segment< T, Point >, Segment< T, Point > > &binrule, real epsilon=M_EPSILON)
intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, real &t, real &u, real epsilon)
static const real M_EPSILON
binary_rule(const binary_rule< T3, T4 > &)
virtual bool operator()(T1 &, T2 &)