![]() |
![]() |
Segment.GetPeaks
Function GetPeaks(Angle As Double, Offset1 As Double, Offset2 As Double, [OffsetType As cdrSegmentOffsetType = cdrParamSegmentOffset]) As Long
Member of Segment
The GetPeaks method returns the number of points where a tangent at a specified angle can touch a curve segment. There might be up to two peaks on a segment.
Parameters
|
Description
|
Angle
|
Specifies the angle, measured in degrees
|
Offset1
|
Returns the offset, in document units, of the first tangent from the beginning of the curve
|
Offset2
|
Returns the offset, in document units, of the second tangent from the beginning of the curve
|
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 marks points on a curve through which tangents can be drawn at 30?
Sub Test() Const Angle As Double = 30 Dim seg As Segment Dim t1 As Double, t2 As Double, n As Long For Each seg In ActiveShape.Curve.Segments n = seg.GetPeaks(Angle, t1, t2) If n > 1 Then MarkPoint seg, t2, Angle If n > 0 Then MarkPoint seg, t1, Angle Next seg End Sub Private Sub MarkPoint(seg As Segment, t As Double, Angle As Double) Dim x As Double, y As Double Dim dx As Double, dy As Double Dim s As Shape, a As Double a = Angle * 3.1415926 / 180 dx = 1.5 * Cos(a) dy = 1.5 * Sin(a) seg.GetPointPositionAt t, cdrParamSegmentOffset, x, y ActiveLayer.CreateLineSegment x + dx, y + dy, x - dx, y - dy Set s = ActiveLayer.CreateEllipse2(x, y, 0.05) s.Fill.UniformColor.RGBAssign 255, 0, 0 End Sub
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.