API Documentation > CorelDRAW > 2025-v26 > Segment > IVGSegment
Segment.GetPerpendicularAt method
Finds the perpendicular line to a point on the segment
Syntax:
Function GetPerpendicularAt(Optional ByVal Offset As Double = 0.5, Optional ByVal OffsetType As cdrSegmentOffsetType = cdrParamSegmentOffset) As Double
Parameters:
Name Type Description
Offset
Double
Specifies the offset, in document units, from the beginning of a segment's subpath. 5.
OffsetType
Specifies the type of offset of the point on the curve's subpath, and returns cdrSegmentOffsetType.
Remarks:
The GetPerpendicularAt method returns the angle of the perpendicular at a specified point on a curve segment.
Examples:
The following VBA 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 x, y, t, cdrRelativeSegmentOffset
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