API Documentation > CorelDRAW > 2025-v26 > Segment > IVGSegment
Segment.GetPeaks method
Gets Peaks
Syntax:
Function GetPeaks(ByVal Angle As Double, ByRef Offset1 As Double, ByRef Offset2 As Double, Optional ByVal OffsetType As cdrSegmentOffsetType = cdrParamSegmentOffset) As Long
Parameters:
Name Type Description
Angle
Double
Offset1
Double
Offset2
Double
OffsetType
Specifies the type of offset of the point on the curve's subpath, and returns cdrSegmentOffsetType.
Remarks:
The GetPeaks method returns the number of points where a tangent at a specified angle can touch a curve segment. A segment can have up to two peaks.
Examples:
The following VBA example marks the 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 x, y, t, cdrParamSegmentOffset

 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