Last active
August 29, 2015 14:05
-
-
Save theTonyHo/e0296ad61e22f26558d6 to your computer and use it in GitHub Desktop.
PlanarClosedCurveContainment with Curve Geometries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def PlanarClosedCurveContainment(curve_a, curve_b, plane=None, tolerance=None): | |
"""Determines the relationship between the regions bounded by two coplanar | |
simple closed curves | |
Parameters: | |
curve_a, curve_b = identifiers of two planar, closed curves | |
plane[opt] = test plane. If omitted, the currently active construction | |
plane is used | |
tolerance[opt] = if omitted, the document absolute tolerance is used | |
Returns: | |
a number identifying the relationship if successful | |
0 = the regions bounded by the curves are disjoint | |
1 = the two curves intersect | |
2 = the region bounded by curve_a is inside of curve_b | |
3 = the region bounded by curve_b is inside of curve_a | |
None if not successful | |
""" | |
if tolerance is None or tolerance<=0: | |
tolerance = scriptcontext.doc.ModelAbsoluteTolerance | |
if plane: | |
plane = rhutil.coerceplane(plane) | |
else: | |
plane = scriptcontext.doc.Views.ActiveView.ActiveViewport.ConstructionPlane() | |
rc = Rhino.Geometry.Curve.PlanarClosedCurveRelationship(curve_a, curve_b, plane, tolerance) | |
return int(rc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment