Object Model Reference : Classes : S : SubPath : Methods : SubPath.GetPerpendicularAt |
Function GetPerpendicularAt([Offset As Double = 0.5], [OffsetType As cdrSegmentOffsetType = cdrRelativeSegmentOffset]) As Double
Member of SubPath
The GetPerpendicularAt method returns the perpendicular to a point on a curves subpath.
Parameter
|
Description
|
Offset
|
Specifies the offset, in document units, of the perpendicular. This parameter is optional, and its default value is 0.5.
|
OffsetType
|
Specifies the offset type, and returns cdrSegmentOffsetType. This parameter is optional, and its default value is cdrRelativeSegmentOffset (1).
|
The following VBA example draws perpendicular and tangent vectors for several points uniformly distributed along the subpaths of the selected curve.
Sub Test() |
Dim sp As SubPath |
Dim t As Double |
For Each sp In ActiveShape.Curve.Subpaths |
For t = 0 To 0.9 Step 0.1 |
MarkPoint sp, t |
Next t |
Next sp |
End Sub |
Private Sub MarkPoint(sp As SubPath, t As Double) |
Dim x As Double, y As Double |
Dim dx As Double, dy As Double |
Dim a1 As Double, a2 As Double |
sp.GetPointPositionAt x, y, t, cdrRelativeSegmentOffset |
a1 = sp.GetTangentAt(t, cdrRelativeSegmentOffset) * 3.1415926 / 180 |
a2 = sp.GetPerpendicularAt(t, cdrRelativeSegmentOffset) * 3.1415926 / 180 |
dx = 0.5 * Cos(a1) |
dy = 0.5 * Sin(a1) |
With ActiveLayer.CreateLineSegment(x, y, x + dx, y + dy) |
.Outline.EndArrow = ArrowHeads(1) |
End With |
dx = 0.5 * Cos(a2) |
dy = 0.5 * Sin(a2) |
With ActiveLayer.CreateLineSegment(x, y, x + dx, y + dy) |
.Outline.EndArrow = ArrowHeads(1) |
End With |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.