Calculates the intersection of two curve objects.
Rhino.CurveCurveIntersection (strObject1 [, strObject2 [, dblTolerance]])
strObject1 |
Required. String. The identifier of the first curve object. |
strObject2 |
Optional. String. The identifier of the second curve object. If omitted, the a self-intersection test will be performed on strObject1. |
dblTolerance |
Optional. Number. The intersection tolerance. If omitted, the document's absolute tolerance is used. |
Array |
A two-dimensional array of intersection information if successful. The array will contain one or more of the following elements:
|
||||||||||||||||||||||||||||||
Null |
If not successful, or on error. |
Sub CCX()
Const rhObjectCurve = 4
Dim strCurve1, strCurve2, arrCCX, i
strCurve1 = Rhino.GetObject("Select first curve", rhObjectCurve)
If IsNull(strCurve1) Or Rhino.IsCurve(strCurve1) = False Then Exit Sub
strCurve2 = Rhino.GetObject("Select second curve", rhObjectCurve)
If IsNull(strCurve2) Or Rhino.IsCurve(strCurve2) = False Then Exit Sub
arrCCX = Rhino.CurveCurveIntersection(strCurve1, strCurve2)
If Not IsArray(arrCCX) Then
Rhino.Print "Selected curves do not intersect."
Exit Sub
End If
For i = 0 To UBound(arrCCX)
If arrCCX(i,0) = 1 Then
Rhino.Print "Point"
Rhino.Print "Intersection point on first curve: " & Rhino.Pt2Str(arrCCX(i,1))
Rhino.Print "Intersection point on second curve: " & Rhino.Pt2Str(arrCCX(i,3))
Rhino.Print "First curve parameter: " & CStr(arrCCX(i,5))
Rhino.Print "Second curve parameter: " & CStr(arrCCX(i,7))
Else
Rhino.Print "Overlap"
Rhino.Print "Intersection start point on first curve: " & Rhino.Pt2Str(arrCCX(i,1))
Rhino.Print "Intersection end point on first curve: " & Rhino.Pt2Str(arrCCX(i,2))
Rhino.Print "Intersection start point on second curve: " & Rhino.Pt2Str(arrCCX(i,3))
Rhino.Print "Intersection end point on second curve: " & Rhino.Pt2Str(arrCCX(i,4))
Rhino.Print "First curve parameter range: " & CStr(arrCCX(i,5)) & " to " & CStr(arrCCX(i,6))
Rhino.Print "Second curve parameter range: " & CStr(arrCCX(i,7)) & " to " & CStr(arrCCX(i,8))
End If
Next
End Sub