Revision: 56830
          http://sourceforge.net/p/brlcad/code/56830
Author:   phoenixyjll
Date:     2013-08-14 07:16:36 +0000 (Wed, 14 Aug 2013)
Log Message:
-----------
Implement IsPointOnLoop() to determine whether a point is on the boundary of 
the loop (using point-curve intersection)

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/boolean.cpp

Modified: brlcad/trunk/src/libbrep/boolean.cpp
===================================================================
--- brlcad/trunk/src/libbrep/boolean.cpp        2013-08-14 07:09:52 UTC (rev 
56829)
+++ brlcad/trunk/src/libbrep/boolean.cpp        2013-08-14 07:16:36 UTC (rev 
56830)
@@ -165,6 +165,9 @@
     //   -1: the input is not a valid loop
     //   0:  the point is not inside the loop or on boundary
     //   1:  the point is inside the loop or on boundary
+    // note:
+    //   If you want to know whether this point is on boundary, please call
+    //   IsPointOnLoop().
 
     ON_PolyCurve polycurve;
     if (!IsLoopValid(loop, ON_ZERO_TOLERANCE, &polycurve))
@@ -192,6 +195,23 @@
 }
 
 
+HIDDEN int
+IsPointOnLoop(const ON_2dPoint& pt, const ON_SimpleArray<ON_Curve*>& loop)
+{
+    // returns:
+    //   -1: the input is not a valid loop
+    //   0:  the point is on the boundary of the loop
+    //   1:  the point is not on the boundary of the loop
+
+    ON_PolyCurve polycurve;
+    if (!IsLoopValid(loop, ON_ZERO_TOLERANCE, &polycurve))
+       return -1;
+
+    ON_ClassArray<ON_PX_EVENT> px_event;
+    return ON_Intersect(ON_3dPoint(pt), polycurve, px_event, INTERSECTION_TOL) 
? 1 : 0;
+}
+
+
 HIDDEN void
 link_curves(const ON_SimpleArray<ON_Curve*>& in, ON_SimpleArray<ON_Curve*>& 
out)
 {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to