ArcGIS Pro 2.8 API Reference Guide
QueryTangent(Multipart,SegmentExtension,Double,AsRatioOrLength,Double) Method
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class > QueryTangent Method : QueryTangent(Multipart,SegmentExtension,Double,AsRatioOrLength,Double) Method
The multipart to which the tangent line is constructed.
Specifies the extension method that determines the direction and position of the tangent line.
Specifies the distance along the segment from which the tangent line is constructed.
Determines whether the distanceAlongCurve is returned as a ratio of the segment length or as length from the start point.
Specifies the length of the returned tangent line.
Constructs a line tangent to a multipart from a point at a specified distance along the curve.
Syntax

Parameters

multipart
The multipart to which the tangent line is constructed.
extension
Specifies the extension method that determines the direction and position of the tangent line.
distanceAlongCurve
Specifies the distance along the segment from which the tangent line is constructed.
asRatioOrLength
Determines whether the distanceAlongCurve is returned as a ratio of the segment length or as length from the start point.
tangentLength
Specifies the length of the returned tangent line.

Return Value

Polyline representing the tangent line.
Exceptions
ExceptionDescription
multipartis null.
Spatial reference of multipartis an image coordinate system.
Remarks
The returned tangent line is in the same direction of the input multipart. The distanceAlongCurve parameter can be negative, and it can be larger than the length of the multipart. The extension parameter is ignored if distanceAlongCurve is greater than zero and less than the length of the multipart. For example, shown below in blue is a polyline that contains an elliptic arc segment with its start point in green and end point in red. The orange tangent line is constructed halfway along the curve and the extension parameter is ignored.

QueryTangent_NoExtensionHalfway

If distanceAlongCurve is less than zero, then the tangent line is embedded in an extension from the start point of the multipart. In the following example, distanceAlongCurve = -1.2, asRatioOrLength = AsRatioOrLength.AsRatio, and extension = SegmentExtension.ExtendTangentAtFrom. The extended tangent segment is the gray dashed line and is 1.2 * length of the input polyline. The constructed tangent is in orange.

QueryTangent_TangentAtFromNegative

If distanceAlongCurve is greater than the length of the input multipart, then the tangent line is embedded in an extension from the end point of the multipart. In the following example, distanceAlongCurve = 1.2, asRatioOrLength = AsRatioOrLength.AsRatio, and extension = SegmentExtension.ExtendTangentAtTo. Note that if asRatioOrLength = AsRatioOrLength.AsRatio, then the length of the input multipart is 1. The extended tangent segment is the gray dashed line and is 0.2 * length of the input polyline. The constructed tangent is in orange.

QueryTangent_TangentAtToPositive

SegmentExtension.ExtendEmbeddedAtTo, SegmentExtension.ExtendEmbeddedAtFrom, and SegmentExtension.ExtendEmbedded when applied to an elliptic arc segment refer to the embedded ellipse or circle. Shown below in blue is a polyline with an elliptic arc segment that is circular along with its embedded circle in gray.

QueryTangent_ArcWithEmbeddedCircle

Here is an example where distanceAlongCurve = 1.2, asRatioOrLength = AsRatioOrLength.AsRatio, and extension = SegmentExtension.ExtendEmbeddedAtTo.

QueryTangent_EmbeddedAtToPositive

If the input segment to be extended is not an elliptic arc segment, then SegmentExtension.ExtendEmbeddedAtTo, SegmentExtension.ExtendEmbeddedAtFrom, and SegmentExtension.ExtendEmbedded are equivalent to SegmentExtension.ExtendTangentAtTo, SegmentExtension.ExtendTangentAtFrom, and SegmentExtension.ExtendTangent respectively. There are cases when the tangent cannot be extended as specified by the extension parameter. For example, if the distanceAlongCurve is negative and extension = SegmentExtension.ExtendTangentAtTo. In this case, the tangent line is constructed at the start point of the input multipart. Similarly, if the distanceAlongCurve is greater than the length of the input segment and extension = SegmentExtension.ExtendTangentAtFrom, then the tangent line is constructed at the end point of the input multipart.

Example
LineSegment line = LineBuilder.CreateLineSegment(new Coordinate2D(0, 0), new Coordinate2D(1, 0));

// No extension, distanceAlongCurve = 0.5
LineSegment tangent = GeometryEngine.Instance.QueryTangent(line, SegmentExtension.NoExtension, 0.5, AsRatioOrLength.AsRatio, 1);
// tangent.StartCoordinate = (0.5, 0.0)
// tangent.EndCoordinate = (1.5, 0.0)

tangent = GeometryEngine.Instance.QueryTangent(line, SegmentExtension.NoExtension, 1.5, AsRatioOrLength.AsLength, 1);
// tangent.StartCoordinate = (1.0, 0.0)
// tangent.EndCoordinate = (2.0, 0.0)

tangent = GeometryEngine.Instance.QueryTangent(line, SegmentExtension.ExtendTangentAtTo, 1.5, AsRatioOrLength.AsLength, 1);
// tangent.StartCoordinate = (1.5, 0.0)
// tangent.EndCoordinate = (2.5, 0.0)

tangent = GeometryEngine.Instance.QueryTangent(line, SegmentExtension.ExtendTangentAtFrom, -1.5, AsRatioOrLength.AsLength, 1);
// tangent.StartCoordinate = (-1.5, 0.0)
// tangent.EndCoordinate = (-0.5, 0.0)

tangent = GeometryEngine.Instance.QueryTangent(line, SegmentExtension.ExtendTangentAtFrom, -0.5, AsRatioOrLength.AsRatio, 1);
// tangent.StartCoordinate = (-0.5, 0.0)
// tangent.EndCoordinate = (0.5, 0.0)
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GeometryEngine Class
GeometryEngine Members
Overload List