HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_Hedge.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GEO_Hedge.h ( GEO Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GEO_Hedge__
12 #define __GEO_Hedge__
13 
14 #include "GEO_API.h"
15 #include <GA/GA_Detail.h>
16 #include <GA/GA_Types.h>
17 #include <UT/UT_Assert.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <SYS/SYS_Inline.h>
20 #include <SYS/SYS_Math.h>
21 #include <SYS/SYS_Types.h>
22 
23 #include <math.h>
24 
25 class GEO_Detail;
26 class GEO_Hedge;
27 class GEO_PrimPoly;
28 
30 
31 /// An invalid hedge is sometimes returned if an operation is unsuccessful
32 #define GEO_INVALID_HEDGE GEO_Hedge(GA_INVALID_OFFSET)
33 
34 namespace geo_hedge
35 {
36 
38 
39 }; // namespace geo_hedge
40 
41 /// GEO_Hedge encapsulates a half-edge (hedge) which is the *restriction* of
42 // an edge to one primitive incident to that edge, or equivalently the
43 // contribution to an edge of one primitive incident to it. It essentially
44 // stores only one GA_Offset which is the source (src) vertex for the
45 // half-edge it represents. It can therefore be freely copied and assigned.
46 
48 {
49 public:
50  explicit constexpr GEO_Hedge() : mySrcVertex(GA_INVALID_OFFSET) { }
51  explicit constexpr GEO_Hedge(GA_Offset vtx) : mySrcVertex(vtx) { }
52 
54  bool operator==(GEO_Hedge h) const
55  { return mySrcVertex == h.mySrcVertex; }
56 
58  bool operator!=(GEO_Hedge h) const
59  { return mySrcVertex != h.mySrcVertex; }
60 
62  size_t hash() const { return SYShash(int64(mySrcVertex)); }
63 
64  friend class GEO_SHedge;
66 
67 private:
68  GA_Offset mySrcVertex;
69 };
70 
72 size_t hash_value(const GEO_Hedge &h)
73 {
74  return h.hash();
75 }
76 
77 /// GEO_SHedge encapsulates a *signed* half-edge. It is a half-edge together
78 // with a sign in {+1, -1}. It is implemented by using the second most
79 // significant bit of a half-edge's source vertex offset for the sign bit.
80 // This means that a signed half-edge cannot have a source vertex offset
81 // between 2^62 and 2^63 - 1.
82 
83 #define GEO_INVALID_SHEDGE GEO_SHedge(GEO_INVALID_HEDGE, 1)
84 #define NEG_MASK (1ll << 62)
85 
87 {
88 public:
89  explicit constexpr GEO_SHedge() : myBits(-1) { }
90 
91  explicit GEO_SHedge(GEO_Hedge hedge, int sign = 1) :
92  myBits(hedge.mySrcVertex) { setSign(sign); }
93 
94  GEO_SHedge(const GEO_SHedge &other) = default;
95 
96  int sign() const { return isPositive() ? 1 : -1; }
97  bool isPositive() const { return !isNegative(); }
98  bool isNegative() const { return (myBits & NEG_MASK); }
99  bool isValid() const { return myBits >= 0; }
100 
102  void setSign(int sign);
103 
105  GEO_Hedge hedge() const;
106 
108  GEO_SHedge &operator=(const GEO_SHedge &other);
109 
111  bool operator==(const GEO_SHedge& other) const
112  { return myBits == other.myBits; }
113 
115  bool operator!=(const GEO_SHedge& other) const
116  { return myBits != other.myBits; }
117 
120  { return GEO_SHedge(hedge(), -sign()); }
121 
123  size_t hash() const { return SYShash(int64(myBits)); }
124 
125 private:
126  GA_Size myBits;
127 
128 #ifndef SESI_LITTLE_ENDIAN
129 #error "Make sure the bitfields in the union work on big endian platforms!"
130 #endif
131 };
132 
133 void
135 {
136  if (sign >= 0)
137  myBits &= (~NEG_MASK);
138  else
139  myBits |= NEG_MASK;
140 }
141 
143 GEO_SHedge &
145 {
146  myBits = other.myBits;
147  return *this;
148 }
149 
150 GEO_Hedge
152 {
153  if (myBits < 0)
154  return GEO_INVALID_HEDGE;
155 
156  return GEO_Hedge(GA_Offset(myBits & (~NEG_MASK)));
157 }
158 
160 size_t hash_value(const GEO_SHedge &h)
161 {
162  return h.hash();
163 }
164 
165 
166 namespace geo_hedge
167 {
168 // static methods for common use with a given detail, or a templated
169 // interface parameter that supplies nextEquivalentHedge() or other
170 // half-edge supporting interface methods.
171 
172 // NOTE: You probably shouldn't be calling these directly! Instead use
173 // an interface class that binds to your detail and provides a wrapper
174 // for all or most of these.
175 
176 
178 GA_Offset
180 {
181  return h.mySrcVertex;
182 }
183 
185 GA_Offset
187 {
188  return gdp->vertexPoint(geo_hedge::srcVertex(h));
189 }
190 
192 GA_Offset
194 {
195  return gdp->vertexPrimitive(geo_hedge::srcVertex(h));
196 }
197 
199 const GA_Primitive*
201 {
202  return gdp->getPrimitive(hedgePrimitiveOffset(gdp, h));
203 }
204 
208 {
209  return gdp->getPrimitive(hedgePrimitiveOffset(gdp, h));
210 }
211 
212 template <typename T>
214 GA_Offset
216 {
217  return iface.polyNext(srcVertex(h));
218 }
219 
220 template <typename T>
222 GA_Offset
224 {
225  return iface.polyPrev(srcVertex(h));
226 }
227 
228 template <typename T>
230 GA_Offset
232 {
233  GA_Offset next_v;
234  next_v = iface.polyNext(geo_hedge::srcVertex(h));
235  if (!GAisValid(next_v))
236  return GA_INVALID_OFFSET;
237 
238  return iface.polyNext(next_v);
239 }
240 
241 template <typename T>
243 GA_Offset
244 dstPoint(T &iface, GEO_Hedge h)
245 {
246  return iface.vertexPoint(dstVertex(iface, h));
247 }
248 
249 template <typename T>
251 GA_Offset
253 {
254  return iface.vertexPoint(preSrcVertex(iface, h));
255 }
256 
257 template <typename T>
259 GA_Offset
261 {
262  return iface.vertexPoint(postDstVertex(iface, h));
263 }
264 
265 template <typename T>
267 GEO_Hedge
269 {
270  return GEO_Hedge(dstVertex(iface, h));
271 }
272 
273 template <typename T>
275 GEO_Hedge
277 {
278  return GEO_Hedge(preSrcVertex(iface, h));
279 }
280 
281 template <typename T>
283 GEO_Hedge
285 {
286  if (iface.srcPoint(h) == pt)
287  return iface.lprev(h);
288 
289  if (iface.dstPoint(h) == pt)
290  return iface.lnext(h);
291 
292  return GEO_INVALID_HEDGE;
293 }
294 
295 template <typename T>
297 bool
299 {
300  auto dst1 = iface.dstPoint(h1);
301  auto src1 = iface.srcPoint(h1);
302  auto dst2 = iface.dstPoint(h2);
303  auto src2 = iface.srcPoint(h2);
304  return ((dst1 == dst2 && src1 == src2) || (dst1 == src2 && src1 == dst2));
305 }
306 
307 template<typename T>
308 SYS_FORCE_INLINE bool
310 {
311  return iface.nextEquivalentHedge(h) == h;
312 }
313 
314 template<typename T>
315 bool
317 {
318  GEO_Hedge h0 = iface.nextEquivalentHedge(h);
319  if (h0 == h)
320  return false;
321 
322  GA_Offset esrcv = iface.srcVertex(h);
323  GA_Offset eprim = iface.vertexPrimitive(esrcv);
324  GA_Offset esrcp = iface.vertexPoint(esrcv);
325 
326  while (h0 != h)
327  {
328  GA_Offset e0srcv = iface.srcVertex(h);
329  if (iface.vertexPrimitive(e0srcv) == eprim &&
330  iface.vertexPoint(e0srcv) != esrcp)
331  return true;
332  h0 = iface.nextEquivalentHedge(h0);
333  }
334 
335  return false;
336 }
337 
338 template<typename T>
340 bool
341 isManifoldHedge(T &iface, GEO_Hedge h, bool accept_bd)
342 {
343  GEO_Hedge ne = iface.nextEquivalentHedge(h);
344 
345  if (ne == h)
346  return accept_bd;
347 
348  if (iface.nextEquivalentHedge(ne) != h)
349  return false;
350 
351  return (iface.srcPoint(h) != iface.srcPoint(ne));
352 }
353 
354 template<typename T>
356 GA_Size
358 {
359  int res = 0;
360  GEO_Hedge h0 = h;
361  do
362  {
363  res++;
364  h0 = iface.nextEquivalentHedge(h0);
365  } while (h0 != h);
366 
367  return res;
368 }
369 
370 template <typename T>
372 bool
373 areOpposite(T &iface, GEO_Hedge h1, GEO_Hedge h2)
374 {
375  auto dst1 = iface.dstPoint(h1);
376  auto src1 = iface.srcPoint(h1);
377  auto dst2 = iface.dstPoint(h2);
378  auto src2 = iface.srcPoint(h2);
379  return (src1 == dst2 && dst1 == src2);
380 }
381 
382 /// [first/next]IncidentHedge run over all half-edges incident
383 /// at src or dst to the given point in a specific order as
384 /// follows: all candiate vertices for incident half-edges are
385 /// traversed, by going over the vertices wired to the given point
386 /// in the order determined by GA_Topology and interleaving these
387 /// with (potential) half-edges that precede the one determined
388 /// by each vertex on its respective primitive.
389 
390 template <typename T>
391 GEO_Hedge
393 {
394  for (auto vtx = iface.pointVertex(pt); GAisValid(vtx);
395  vtx = iface.vertexToNextVertex(vtx))
396  {
397  // try outoing hedge at vtx, its dst must differ from pt
398  GEO_Hedge h(vtx);
399  if (iface.isValidHedge(h) && iface.dstPoint(h) != pt)
400  return h;
401 
402  // now try the previous vertex on primitive, its src shouldn't be pt
403  GEO_Hedge hprev(iface.polyPrev(vtx));
404  if (iface.isValidHedge(hprev) && iface.srcPoint(hprev) != pt)
405  return hprev;
406  }
407 
408  return GEO_INVALID_HEDGE;
409 }
410 
411 template <typename T>
412 GEO_Hedge
414 {
415  UT_ASSERT_P(iface.isValidHedge(h));
416 
417  GA_Offset vtx = srcVertex(h);
418  GA_Offset v0;
419  auto vprev = GA_INVALID_OFFSET;
420  auto vnext = iface.polyNext(vtx, vprev);
421 
422  // figure out whether to return the previous edge on the same poly
423  // or continue with next vertex wired to poin.
424 
425  if (iface.vertexPoint(vtx) == pt && iface.vertexPoint(vnext) != pt)
426  {
427  // pt is src of h: return previous hedge unless invalid
428  GEO_Hedge hprev(vprev);
429  if (iface.isValidHedge(hprev) && iface.vertexPoint(vprev) != pt)
430  return hprev;
431  v0 = vtx;
432  }
433  else
434  {
435  // pt must be dst of h: move to the next wired vertex
436  UT_ASSERT_P(iface.vertexPoint(vnext) == pt);
437  v0 = vnext;
438  }
439 
440  UT_ASSERT_P(iface.vertexPoint(v0) == pt);
441 
442  auto vtmp = GA_INVALID_OFFSET;
443  for (GA_Offset v = GAisValid(vtmp = iface.vertexToNextVertex(v0)) ?
444  vtmp : iface.pointVertex(pt); true;
445  v = GAisValid(vtmp = iface.vertexToNextVertex(v)) ? vtmp :
446  iface.pointVertex(pt))
447  {
448  UT_ASSERT_P(iface.vertexPoint(v) == pt);
449  GEO_Hedge h0(v);
450  if (iface.isValidHedge(h0) && iface.dstPoint(h0) != pt)
451  return h0;
452 
453  GEO_Hedge hprev(iface.polyPrev(v));
454  if (iface.isValidHedge(hprev) && iface.srcPoint(hprev) != pt)
455  return hprev;
456 
457  // shouldn't be getting to here since by this time we
458  // should have returned h itself
459  UT_ASSERT_P(v != v0);
460  if (v == v0)
461  break;
462  }
463 
464  UT_ASSERT_MSG(0, "Control should not reach this pt!");
465  return GEO_INVALID_HEDGE;
466 }
467 
468 /// firstIncidentEdge and nextIncidentEdge, simply filter out
469 /// non-primary half-edges out of the results of firstIncidentHedge
470 /// and nextIncidentHedge
471 
472 template <typename T>
473 GEO_Hedge
475 {
476  GEO_Hedge h = iface.firstIncidentHedge(pt);
477  if (!iface.isValidHedge(h))
478  return GEO_INVALID_HEDGE;
479 
480  while (!iface.isPrimary(h))
481  {
482  h = iface.nextIncidentHedge(h, pt);
483 
484  UT_ASSERT_P(iface.isValidHedge(h));
485 
486  if (!iface.isValidHedge(h))
487  return GEO_INVALID_HEDGE;
488  }
489  return h;
490 }
491 
492 template <typename T>
493 GEO_Hedge
495 {
496  GEO_Hedge h0 = iface.nextIncidentHedge(h, point);
497  if (!iface.isValidHedge(h0))
498  return GEO_INVALID_HEDGE;
499 
500  while (!iface.isPrimary(h0))
501  {
502  h0 = iface.nextIncidentHedge(h0, point);
503  if (!iface.isValidHedge(h0))
504  return GEO_INVALID_HEDGE;
505  }
506  return h0;
507 }
508 
509 template <typename T>
510 GEO_Hedge
512 {
513  for (GA_Offset vtx = iface.pointVertex(point); GAisValid(vtx);
514  vtx = iface.vertexToNextVertex(vtx))
515  {
516  GEO_Hedge h(vtx);
517  if (iface.isValidHedge(h))
518  return h;
519  }
520  return GEO_INVALID_HEDGE;
521 }
522 
523 template <typename T>
524 GEO_Hedge
526 {
527  GA_Offset vtx = iface.srcVertex(h);
528  if (!GAisValid(vtx))
529  return GEO_INVALID_HEDGE;
530 
531  GA_Offset point = iface.vertexPoint(vtx);
532 
533  if (!GAisValid(point))
534  return h;
535 
536  GA_Offset v0 = vtx;
537 
538  auto vtmp = GA_INVALID_OFFSET;
539  for (GA_Offset v = GAisValid(vtmp = iface.vertexToNextVertex(v0)) ? vtmp :
540  iface.pointVertex(point); true;
541  v = GAisValid(vtmp = iface.vertexToNextVertex(v)) ? vtmp :
542  iface.pointVertex(point))
543  {
544  GEO_Hedge h0(v);
545  if (iface.isValidHedge(h0))
546  return h0;
547 
548  if (v == v0)
549  break;
550  }
551 
552  UT_ASSERT(0 && "Cotnrol should not reach this point!");
553  return GEO_INVALID_HEDGE;
554 }
555 
556 template <typename T>
557 GEO_Hedge
559 {
560  for (GA_Offset vtx = iface.pointVertex(pt); GAisValid(vtx);
561  vtx = iface.vertexToNextVertex(vtx))
562  {
563  GA_Offset vprev = iface.polyPrev(vtx);
564  if (GAisValid(vprev))
565  {
566  GEO_Hedge hprev(vprev);
567  if (iface.isValidHedge(hprev))
568  return hprev;
569  }
570  }
571  return GEO_INVALID_HEDGE;
572 }
573 
574 template <typename T>
575 GEO_Hedge
577 {
578  GA_Offset vtx = iface.dstVertex(h);
579  if (!GAisValid(vtx))
580  return GEO_INVALID_HEDGE;
581 
582  GA_Offset point = iface.vertexPoint(vtx);
583  if (!GAisValid(point))
584  return h;
585 
586  GA_Offset v0 = vtx;
587  auto vtmp = GA_INVALID_OFFSET;
588  for (auto v = GAisValid(vtmp = iface.vertexToNextVertex(v0)) ? vtmp :
589  iface.pointVertex(point); true;
590  v = GAisValid(vtmp = iface.vertexToNextVertex(v)) ? vtmp :
591  iface.pointVertex(point))
592  {
593 
594  GA_Offset vprev = iface.polyPrev(v);
595  if (GAisValid(vprev))
596  {
597  GEO_Hedge hprev(vprev);
598  if (iface.isValidHedge(hprev))
599  return hprev;
600  }
601 
602  if (v == v0)
603  break;
604  }
605 
606  UT_ASSERT(0 && "Cotnrol should not reach this point!");
607  return GEO_INVALID_HEDGE;
608 
609 }
610 
611 template<typename T>
612 GEO_Hedge
614 {
615  GEO_Hedge hprev = iface.prevPrimitiveHedge(h);
616  GEO_Hedge hprevmate = iface.nextEquivalentHedge(hprev);
617  if (hprevmate == hprev ||
618  iface.nextEquivalentHedge(hprevmate) != hprev)
619  return GEO_INVALID_HEDGE;
620 
621  if (iface.srcPoint(hprev) != iface.dstPoint(hprevmate))
622  return GEO_INVALID_HEDGE;
623 
624  return hprevmate;
625 }
626 
627 template<typename T>
628 GEO_Hedge
630 {
631  GEO_Hedge hmate = iface.nextEquivalentHedge(h);
632  if (hmate == h || iface.nextEquivalentHedge(hmate) != h)
633  return GEO_INVALID_HEDGE;
634 
635  if (iface.srcPoint(h) != iface.dstPoint(hmate))
636  return GEO_INVALID_HEDGE;
637 
638  GEO_Hedge hmatenext = iface.nextPrimitiveHedge(hmate);
639  if (!iface.isValidHedge(hmatenext))
640  return GEO_INVALID_HEDGE;
641  return hmatenext;
642 }
643 
644 template<typename T>
645 GEO_Hedge
647 {
648  GEO_Hedge hnext = iface.nextPrimitiveHedge(h);
649  GEO_Hedge hnextmate = iface.nextEquivalentHedge(hnext);
650  if (hnextmate == hnext ||
651  iface.nextEquivalentHedge(hnextmate) != hnext)
652  return GEO_INVALID_HEDGE;
653  if (iface.srcPoint(hnext) != iface.dstPoint(hnextmate))
654  return GEO_INVALID_HEDGE;
655  return hnextmate;
656 }
657 
658 template<typename T>
659 GEO_Hedge
661 {
662  GEO_Hedge hmate = iface.nextEquivalentHedge(h);
663  if (hmate == h || iface.nextEquivalentHedge(hmate) != h)
664  return GEO_INVALID_HEDGE;
665  if (iface.srcPoint(h) != iface.dstPoint(hmate))
666  return GEO_INVALID_HEDGE;
667  GEO_Hedge hmateprev = iface.prevPrimitiveHedge(hmate);
668  if (!iface.isValidHedge(hmateprev))
669  return GEO_INVALID_HEDGE;
670  return hmateprev;
671 }
672 
673 template<typename T>
674 GEO_Hedge
676 {
677  GEO_Hedge h0 = h;
678  do
679  {
680  GEO_Hedge hprev = prevManifoldOutgoingHedge(iface, h);
681  if (!iface.isValidHedge(hprev))
682  return h;
683  h = hprev;
684  } while (h0 != h);
685  return h0;
686 }
687 
688 template<typename T>
689 GEO_Hedge
691 {
692  GEO_Hedge h0 = h;
693  do
694  {
695  GEO_Hedge hprev = prevManifoldIncomingHedge(iface, h);
696  if (!iface.isValidHedge(hprev))
697  return h;
698  h = hprev;
699  } while (h0 != h);
700  return h0;
701 }
702 
703 template <typename T>
705 fpreal
706 length(T &iface, GEO_Hedge h)
707 {
708  auto gdp = iface.getDetail();
709  return distance3d(gdp->getPos3(srcPoint(gdp, h)),
710  gdp->getPos3(dstPoint(iface, h)));
711 }
712 
713 template <typename T>
716 {
717  const GA_Detail *gdp = iface.getDetail();
718  auto v_prev = GA_INVALID_OFFSET;
719  auto v_next = iface.polyNext(v, v_prev);
720 
721  if (!GAisValid(v_prev) || !GAisValid(v_next))
722  return M_PI / 2.0;
723 
724  UT_Vector3 v1 = gdp->getPos3(iface.vertexPoint(v_next));
725  UT_Vector3 v0 = gdp->getPos3(iface.vertexPoint(v));
726  v1 -= v0;
727  v0 = gdp->getPos3(iface.vertexPoint(v_prev)) - v0;
728 
729  fpreal angle = UTangleBetween(v0, v1);
730  if (!nml || dot(v1, cross(*nml, v0)) >= 0.0)
731  return angle;
732 
733  return (2.0 * M_PI - angle);
734 }
735 
739 {
740  return gdp->getPos3(srcPoint(gdp, h));
741 }
742 
743 template <typename T>
746 dstPos3(T &iface, GEO_Hedge h)
747 {
748  return iface.getDetail()->getPos3(dstPoint(iface, h));
749 }
750 
751 template <typename T>
754 {
755  return vertexAngle(iface, srcVertex(h), nml);
756 }
757 
758 template <typename T>
761 {
762  return vertexAngle(iface, dstVertex(iface, h), nml);
763 }
764 
767 {
768  fpreal udotv = dot(u, v);
769 
770  fpreal ulen = u.length();
771  if (SYSequalZero(ulen))
772  return udotv >= 0.0 ? 1.0 : -1.0;
773 
774  fpreal vlen = v.length();
775  if (SYSequalZero(vlen))
776  return udotv >= 0.0 ? 1.0 : -1.0;
777 
778  return udotv/(ulen * vlen);
779 }
780 
781 template <typename T>
784 {
785  auto gdp = iface.getDetail();
786  UT_Vector3 pos = gdp->getPos3(srcPoint(gdp, h));
787  return angleCos(gdp->getPos3(dstPoint(iface, h)) - pos,
788  gdp->getPos3(preSrcPoint(iface, h)) - pos);
789 }
790 
791 template <typename T>
794 {
795  auto gdp = iface.getDetail();
796  UT_Vector3 pos = gdp->getPos3(dstPoint(iface, h));
797  return angleCos(gdp->getPos3(postDstPoint(iface, h)) - pos,
798  gdp->getPos3(srcPoint(gdp, h)) - pos);
799 }
800 
801 template <typename T>
802 GEO_Hedge
804 {
805  auto gdp = iface.getDetail();
806  for (GA_Offset v = gdp->pointVertex(p0); GAisValid(v);
807  v = gdp->vertexToNextVertex(v))
808  {
809  auto v_prev = GA_INVALID_OFFSET;
810  auto v_next = iface.polyNext(v, v_prev);
811  if (GAisValid(v_prev))
812  if (iface.vertexPoint(v_prev) == p1)
813  return GEO_Hedge(v_prev);
814  if (GAisValid(v_next))
815  if (iface.vertexPoint(v_next) == p1)
816  return GEO_Hedge(v);
817  }
818  return GEO_INVALID_HEDGE;
819 }
820 
821 template <typename T>
822 GA_Size
824 {
825  GEO_Hedge h0 = iface.firstIncidentEdge(pt);
826  if (!iface.isValidHedge(h0))
827  return 0;
828 
829  int res = 1;
830  GEO_Hedge h1 = iface.nextIncidentEdge(h0, pt);
831  while (h0 != h1)
832  {
833  res++;
834  h1 = iface.nextIncidentEdge(h1, pt);
835  }
836  return res;
837 }
838 
839 template <typename T>
840 GA_Size
842 {
843  GEO_Hedge h0 = iface.firstIncidentHedge(pt);
844  if (!iface.isValidHedge(h0))
845  return 0;
846 
847  int res = 1;
848  GEO_Hedge h1 = iface.nextIncidentHedge(h0, pt);
849  while (h1 != h0)
850  {
851  res++;
852  h1 = iface.nextIncidentHedge(h1, pt);
853  }
854  return res;
855 }
856 
857 }; // namespace geo_hedge_private
858 
859 
860 #endif
GEO_Hedge prevManifoldOutgoingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:629
SYS_FORCE_INLINE fpreal length(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:706
SYS_FORCE_INLINE GA_Offset hedgePrimitiveOffset(const GA_Detail *gdp, GEO_Hedge h)
Definition: GEO_Hedge.h:193
SYS_FORCE_INLINE GEO_Hedge coincidentPolyHedge(T &iface, GEO_Hedge h, GA_Offset pt)
Definition: GEO_Hedge.h:284
GEO_Hedge firstOutgoingHedge(T &iface, GA_Offset point)
Definition: GEO_Hedge.h:511
SYS_FORCE_INLINE GA_Offset srcPoint(const GA_Detail *gdp, GEO_Hedge h)
Definition: GEO_Hedge.h:186
SYS_FORCE_INLINE GA_Offset postDstPoint(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:260
GEO_Hedge firstManifoldOutgoingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:675
GA_Size numIncidentEdges(T &iface, GA_Offset pt)
Definition: GEO_Hedge.h:823
SYS_FORCE_INLINE GA_Primitive * getPrimitive(GA_Offset prim_off)
Definition: GA_Detail.h:380
SYS_FORCE_INLINE bool operator!=(GEO_Hedge h) const
Definition: GEO_Hedge.h:58
constexpr GEO_Hedge()
Definition: GEO_Hedge.h:50
SYS_FORCE_INLINE UT_Vector3 dstPos3(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:746
T distance3d(const UT_Vector3T< T > &p1, const UT_Vector3T< T > &p2)
Compute the distance between two points.
Definition: UT_Vector3.h:879
SYS_FORCE_INLINE size_t hash_value(const GEO_Hedge &h)
Definition: GEO_Hedge.h:72
SYS_FORCE_INLINE GA_Offset postDstVertex(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:231
GA_Size numIncidentHedges(T &iface, GA_Offset pt)
Definition: GEO_Hedge.h:841
bool GAisValid(GA_Size v)
Definition: GA_Types.h:645
constexpr GEO_SHedge()
Definition: GEO_Hedge.h:89
fpreal64 UTangleBetween(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
The angle between two vectors in radians.
Definition: UT_Vector3.h:760
#define NEG_MASK
Definition: GEO_Hedge.h:84
GA_Offset srcVertex(GEO_Hedge)
Definition: GEO_Hedge.h:179
GEO_Hedge nextIncomingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:576
SYS_FORCE_INLINE GEO_Hedge nextPrimitiveHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:268
GEO_Hedge nextManifoldOutgoingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:613
SYS_FORCE_INLINE const GA_Primitive * hedgePrimitive(const GA_Detail *gdp, GEO_Hedge h)
Definition: GEO_Hedge.h:200
constexpr GEO_Hedge(GA_Offset vtx)
Definition: GEO_Hedge.h:51
SYS_FORCE_INLINE GA_Offset preSrcPoint(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:252
SYS_FORCE_INLINE UT_Vector3 srcPos3(const GA_Detail *gdp, GEO_Hedge h)
Definition: GEO_Hedge.h:738
const GLdouble * v
Definition: glew.h:1391
SYS_FORCE_INLINE GA_Offset preSrcVertex(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:223
GEO_SHedge(GEO_Hedge hedge, int sign=1)
Definition: GEO_Hedge.h:91
bool isBridgeHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:316
#define GEO_INVALID_HEDGE
An invalid hedge is sometimes returned if an operation is unsuccessful.
Definition: GEO_Hedge.h:32
SYS_FORCE_INLINE size_t hash() const
Definition: GEO_Hedge.h:62
SYS_FORCE_INLINE void setSign(int sign)
Definition: GEO_Hedge.h:134
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:174
GLdouble angle
Definition: glew.h:9135
SYS_FORCE_INLINE bool operator==(GEO_Hedge h) const
Definition: GEO_Hedge.h:54
bool isNegative(const Type &x)
Return true if x is less than zero.
Definition: Math.h:338
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:231
#define M_PI
Definition: ImathPlatform.h:51
GEO_Hedge nextManifoldIncomingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:660
#define GA_INVALID_OFFSET
Definition: GA_Types.h:674
SYS_FORCE_INLINE fpreal srcPrimitiveAngleCos(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:783
#define UT_ASSERT_MSG(ZZ,...)
Definition: UT_Assert.h:138
GA_Size GA_Offset
Definition: GA_Types.h:637
long long int64
Definition: SYS_Types.h:111
GEO_Hedge firstManifoldIncomingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:690
SYS_FORCE_INLINE bool operator!=(const GEO_SHedge &other) const
Definition: GEO_Hedge.h:115
SYS_FORCE_INLINE fpreal srcPrimitiveAngle(T &iface, GEO_Hedge h, UT_Vector3 *nml)
Definition: GEO_Hedge.h:753
SYS_FORCE_INLINE bool areOpposite(T &iface, GEO_Hedge h1, GEO_Hedge h2)
Definition: GEO_Hedge.h:373
GEO_Hedge encapsulates a half-edge (hedge) which is the restriction of.
Definition: GEO_Hedge.h:47
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
Definition: CE_Vector.h:218
SYS_FORCE_INLINE GA_Size numEquivalentHedges(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:357
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
int sign() const
Definition: GEO_Hedge.h:96
SYS_FORCE_INLINE fpreal vertexAngle(T &iface, GA_Offset v, UT_Vector3 *nml)
Definition: GEO_Hedge.h:715
bool isPositive() const
Definition: GEO_Hedge.h:97
SYS_FORCE_INLINE GEO_SHedge operator-()
Definition: GEO_Hedge.h:119
#define GEO_API
Definition: GEO_API.h:14
SYS_FORCE_INLINE fpreal dstPrimitiveAngleCos(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:793
SYS_FORCE_INLINE fpreal angleCos(const UT_Vector3 &u, const UT_Vector3 &v)
Definition: GEO_Hedge.h:766
GEO_Hedge nextIncidentEdge(T &iface, GEO_Hedge h, GA_Offset point)
Definition: GEO_Hedge.h:494
GEO_Hedge nextIncidentHedge(T &iface, GEO_Hedge h, GA_Offset pt)
Definition: GEO_Hedge.h:413
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
Definition: GA_Detail.h:480
GEO_Hedge firstIncomingHedge(T &iface, GA_Offset pt)
Definition: GEO_Hedge.h:558
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:8011
int sign(T a)
Definition: ImathFun.h:63
SYS_FORCE_INLINE GA_Offset dstVertex(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:215
SYS_FORCE_INLINE fpreal dstPrimitiveAngle(T &iface, GEO_Hedge h, UT_Vector3 *nml)
Definition: GEO_Hedge.h:760
bool SYSequalZero(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:832
SYS_FORCE_INLINE bool isManifoldHedge(T &iface, GEO_Hedge h, bool accept_bd)
Definition: GEO_Hedge.h:341
SYS_FORCE_INLINE size_t hash() const
Definition: GEO_Hedge.h:123
SYS_FORCE_INLINE GA_Offset vertexPrimitive(GA_Offset vertex) const
Definition: GA_Detail.h:488
double fpreal
Definition: SYS_Types.h:276
GEO_Hedge nextOutgoingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:525
GEO_Hedge prevManifoldIncomingHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:646
GEO_Hedge findHedgeWithEndpoints(T &iface, GA_Offset p0, GA_Offset p1)
Definition: GEO_Hedge.h:803
GEO_Hedge firstIncidentEdge(T &iface, GA_Offset pt)
Definition: GEO_Hedge.h:474
GLfloat v0
Definition: glew.h:1848
SYS_FORCE_INLINE bool areEquivalent(T &iface, GEO_Hedge h1, GEO_Hedge h2)
Definition: GEO_Hedge.h:298
Container class for all geometry.
Definition: GA_Detail.h:95
SYS_FORCE_INLINE GEO_SHedge & operator=(const GEO_SHedge &other)
Definition: GEO_Hedge.h:144
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
GEO_Hedge firstIncidentHedge(T &iface, GA_Offset pt)
Definition: GEO_Hedge.h:392
bool isNegative() const
Definition: GEO_Hedge.h:98
SYS_FORCE_INLINE GEO_Hedge hedge() const
Definition: GEO_Hedge.h:151
bool isValid() const
Definition: GEO_Hedge.h:99
SYS_FORCE_INLINE Storage::MathFloat length() const
SYS_FORCE_INLINE GEO_Hedge prevPrimitiveHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:276
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
GLfloat GLfloat v1
Definition: glew.h:1852
SYS_FORCE_INLINE bool operator==(const GEO_SHedge &other) const
Definition: GEO_Hedge.h:111
GLuint res
Definition: glew.h:11507
SYS_FORCE_INLINE GA_Offset dstPoint(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:244
SYS_FORCE_INLINE bool isBoundaryHedge(T &iface, GEO_Hedge h)
Definition: GEO_Hedge.h:309