PlanarClosedCurveContainment

Determines the relationship between the regions bounded by two coplanar simple closed curves.

Syntax

rhinoscriptsyntax.PlanarClosedCurveContainment (curve_a, curve_b, plane=None, tolerance=None)

rhinoscript.curve.PlanarClosedCurveContainment (curve_a, curve_b, plane=None, tolerance=None)

Parameters

curve_a

Required.  String or Guid.  The object identifier of the first planar, closed curve.

curve_b

Required.  String or Guid.  The object identifier of the second planar, closed curve.

plane

Optional.  The new construction plane.  If omitted, the currently active construction plane is used.

tolerance

Optional.  Number.  The tolerance.  If omitted, the current document absolute tolerance is used.

Returns

Number

A number identifying the relationship if successful.  The possible values are as follows:

Value

Description

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, or on error.

Example

import rhinoscriptsyntax as rs

curve1 = rs.GetObject("Select first curve", rs.filter.curve )

curve2 = rs.GetObject("Select second curve", rs.filter.curve )

if rs.IsCurvePlanar(curve1) and rs.IsCurvePlanar(curve2):

    if rs.IsCurveClosed(curve1) and rs.IsCurveClosed(curve2):

        if rs.IsCurveInPlane(curve1) and rs.IsCurveInPlane(curve2):

            result = rs.PlanarClosedCurveContainment(curve1, curve2)

            if result==0: print "The regions bounded by the curves are disjoint."

            elif result==1: print "The two curves intersect.."

            elif result==2: print "The region bounded by Curve1 is inside of Curve2."

            else: print "The region bounded by Curve2 is inside of Curve1."

Also See

PlanarCurveCollision

PointInPlanarClosedCurve