API Documentation > CorelDRAW > 2025-v26 > SubPath > IVGSubPath
SubPath.GetTangentAt method
Finds the tangent line to a point on the segment
Syntax:
Function GetTangentAt(Optional ByVal Offset As Double = 0.5, Optional ByVal OffsetType As cdrSegmentOffsetType = cdrRelativeSegmentOffset) As Double
Parameters:
Name Type Description
Offset
Double
Specifies, in document units, the offset of the tangent. 5.
OffsetType
Specifies the offset type, and returns cdrSegmentOffsetType.
Remarks:
The GetTangentAt method returns the tangent to a point on a curve's subpath.
Examples:
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