60 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:Intersection")
65# pragma warning(disable : 4521)
68template<
class T,
class Po
int>
class Segment {
72 Segment(
T &s,
const Point &iA,
const Point &iB)
89 _edge = iBrother.
edge();
92 _Intersections = iBrother._Intersections;
93 _order = iBrother._order;
98 _edge = iBrother._edge;
101 _Intersections = iBrother._Intersections;
102 _order = iBrother._order;
107 _Intersections.clear();
112 return (
i % 2 == 0) ? A : B;
117 if (_edge == iBrother._edge) {
126 _Intersections.push_back(
i);
132 if ((A == S[0]) || (A == S[1])) {
136 if ((B == S[0]) || (B == S[1])) {
145 return _Intersections;
162 std::vector<Intersection<Segment<T, Point>> *>
166 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:Segment")
193 iend = _Intersections.end();
212 vector<Segment<T, Point> *> toadd;
213 typename vector<Segment<T, Point> *>::iterator s, send;
214 for (s = segments.begin(), send = segments.end(); s != send; s++) {
215 if (p == (*(*s))[0]) {
216 toadd.push_back((*s));
222 for (s = toadd.begin(), send = toadd.end(); s != send; s++) {
223 add((*s), binrule, epsilon);
239 if (
true == S->order()) {
240 v0[0] = ((*S)[0])[0];
241 v0[1] = ((*S)[0])[1];
242 v1[0] = ((*S)[1])[0];
243 v1[1] = ((*S)[1])[1];
246 v1[0] = ((*S)[0])[0];
247 v1[1] = ((*S)[0])[1];
248 v0[0] = ((*S)[1])[0];
249 v0[1] = ((*S)[1])[1];
251 for (
typename std::list<
Segment<T, Point> *>::iterator s = _set.begin(), send = _set.end();
256 if (
true != binrule(*S, *currentS)) {
260 if (
true == currentS->
order()) {
261 v2[0] = ((*currentS)[0])[0];
262 v2[1] = ((*currentS)[0])[1];
263 v3[0] = ((*currentS)[1])[0];
264 v3[1] = ((*currentS)[1])[1];
267 v3[0] = ((*currentS)[0])[0];
268 v3[1] = ((*currentS)[0])[1];
269 v2[0] = ((*currentS)[1])[0];
270 v2[1] = ((*currentS)[1])[1];
272 if (S->CommonVertex(*currentS, CP)) {
283 _Intersections.push_back(inter);
285 S->AddIntersection(inter);
287 currentS->AddIntersection(inter);
297 _IntersectedEdges.push_back(s);
304 return _IntersectedEdges;
309 return _Intersections;
313 std::list<Segment<T, Point> *>
315 std::vector<Segment<T, Point> *> _IntersectedEdges;
316 std::vector<Intersection<Segment<T, Point>> *> _Intersections;
318 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)
VecMat::Vec2< real > Vec2r
static const real M_EPSILON
binary_rule(const binary_rule< T3, T4 > &)
virtual bool operator()(T1 &, T2 &)