![]() |
![]() |
Segment.GetTangentAt
Function GetTangentAt([Offset As Double = 0.5], [OffsetType As cdrSegmentOffsetType = cdrParamSegmentOffset]) As Double
Member of Segment
The GetTangentAt method returns the angle of the tangent at a specified point on a curve segment.
Parameters
|
Description
|
Offset
|
Specifies the offset, in document units, from the beginning of a segments subpath
This parameter is optional, and its default value is 0.5.
|
OffsetType
|
Specifies the type of offset of a point on a curves subpath. This parameter returns cdrSegmentOffsetType.
This parameter is optional, and its default value is cdrParamSegmentOffset (2).
|
The following code example draws perpendicular and tangent vectors for several points uniformly distributed along the segments of the selected curve:
Sub Test() Dim seg As Segment Dim t As Double For Each seg In ActiveShape.Curve.Segments For t = 0 To 10 Step 2 MarkPoint seg, t / 10 Next t Next seg End Sub Private Sub MarkPoint(seg As Segment, t As Double) Dim x As Double, y As Double Dim dx As Double, dy As Double Dim a1 As Double, a2 As Double seg.GetPointPositionAt t, cdrRelativeSegmentOffset, x, y a1 = seg.GetTangentAt(t, cdrRelativeSegmentOffset) * 3.1415926 / 180 a2 = seg.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 2007 Corel Corporation. All rights reserved.