![]() |
![]() |
SubPath.GetIntersections
Function GetIntersections(Target As SubPath, [OffsetType As cdrSegmentOffsetType = cdrRelativeSegmentOffset]) As CrossPoints
Member of SubPath
The GetIntersections method finds all of the points of intersection for two subpaths.
Parameters
|
Description
|
Target
|
Specifies the object that you select second in an intersect operation
|
OffsetType
|
Specifies the type of offset of the intersection point. This parameter returns cdrSegmentOffsetType.
This parameter is optional, and its default value is cdrRelativeSegmentOffset (1).
|
The following code example displays the number of times the two selected curves intersect, and it marks each intersection point with a small circle:
Sub Test() Dim sr As ShapeRange Dim sp1 As SubPath, sp2 As SubPath Dim cps As CrossPoints, cp As CrossPoint Dim x As Double, y As Double, n As Long Set sr = ActiveSelectionRange If sr.Count <> 2 Then MsgBox "Please select two curves", vbCritical Exit Sub End If If sr(1).Type <> cdrCurveShape Or sr(2).Type <> cdrCurveShape Then MsgBox "One of the selected shapes is not a curve", vbCritical Exit Sub End If n = 0 For Each sp1 In sr(1).Curve.Subpaths For Each sp2 In sr(2).Curve.Subpaths Set cps = sp1.GetIntersections(sp2) For Each cp In cps ActiveLayer.CreateEllipse2 cp.PositionX, cp.PositionY, 0.05 Next cp n = n + cps.Count Next sp2 Next sp1 MsgBox n & " intersection point(s) found" End Sub
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.