CurveCurveIntersection

Calculates the intersection of two curve objects.

Syntax

rhinoscriptsyntax.CurveCurveIntersection (curveA, curveB=None, tolerance=-1)

rhinoscript.curve.CurveCurveIntersection (curveA, curveB=None, tolerance=-1)

Parameters

curveA

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

curveB

Optional.  String or Guid.  The identifier of the second curve object.  If omitted, the a self-intersection test will be performed on curveA.

tolerance

Optional.  Number.  The absolute tolerance in drawing units.  If omitted, the document's current absolute tolerance is used.

Returns

List

A two-dimensional list of intersection information if successful.  The list will contain one or more of the following elements:

Element

Type

Description

[n][0]

Number

The intersection event type, either Point (1) or Overlap (2).

[n][1]

 

Point3d

If the event type is Point (1), then the intersection point on the first curve.

If the event type is Overlap (2), then intersection start point on the first curve.

[n][2]

 

Point3d

If the event type is Point (1), then the intersection point on the first curve.

If the event type is Overlap (2), then intersection end point on the first curve.

[n][3]

 

Point3d

If the event type is Point (1), then the intersection point on the second curve.

If the event type is Overlap (2), then intersection start point on the second curve.

[n][4]

 

Point3d

If the event type is Point (1), then the intersection point on the second curve.

If the event type is Overlap (2), then intersection end point on the second curve.

[n][5]

 

Number

If the event type is Point (1), then the first curve parameter.

If the event type is Overlap (2), then the start value of the first curve parameter range.

[n][6]

 

Number

If the event type is Point (1), then the first curve parameter.

If the event type is Overlap (2),  then the end value of the first curve parameter range.

[n][7]

 

Number

If the event type is Point (1), then the second curve parameter.

If the event type is Overlap (2), then the start value of the second curve parameter range.

[n][8]

 

Number

If the event type is Point (1), then the second curve parameter.

If the event type is Overlap (2), then the end value of the second curve parameter range.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

def ccx():

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

    if curve1 is None: return

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

    if curve2 is None: return

    intersection_list = rs.CurveCurveIntersection(curve1, curve2)

    if intersection_list is None:

        print "Selected curves do not intersect."

        return

    for intersection in intersection_list:

        if intersection[0] == 1:

            print "Point"

            print "Intersection point on first curve: ", intersection[1]

            print "Intersection point on second curve: ", intersection[3]

            print "First curve parameter: ", intersection[5]

            print "Second curve parameter: ", intersection[7]

        else:

            print "Overlap"

            print "Intersection start point on first curve: ", intersection[1]

            print "Intersection end point on first curve: ", intersection[2]

            print "Intersection start point on second curve: ", intersection[3]

            print "Intersection end point on second curve: ", intersection[4]

            print "First curve parameter range: ", intersection[5], " to ", intersection[6]

            print "Second curve parameter range: ", intersection[7], " to ", intersection[8]

ccx()

Also See

CurveSurfaceIntersection