You are here: Start » AVL.NET » Function Reference » Geometry 2D » Geometry 2D Normalizations » AVL.NormalizeSegmentOrientation_ByCoordinate

AVL.NormalizeSegmentOrientation_ByCoordinate

Changes orientation of the given segment according to coordinates along selected axis.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void NormalizeSegmentOrientation_ByCoordinate
(
	AvlNet.Segment2D inSegment,
	AvlNet.Axis inAxis,
	out AvlNet.Segment2D outSegment
)

Parameters

Name Type Range Default Description
inSegmentAvlNet.Segment2D
inAxisAvlNet.AxisXAn axis relative to which coordinates are compared. Default value: X.
outSegmentAvlNet.Segment2DA segment in which the first point will have smaller coordinate along the selected axis.

Description

This operation changes the orientation of the inSegment segment according to the coordinates of the input segment's vertices. The first point in the outSegment will have smaller coordinate along selected axis.

Examples

Let's consider two cases with the same input segment, but different inAxis. The coordinates of the segment are as follows:
inSegment.Point1.X201,000
inSegment.Point1.Y100,000
inSegment.Point2.X100,000
inSegment.Point2.Y199,000
  1. Let's assume the inAxis to be X axis.

    The coordinates along X axis are 201 and 100. Obviously, 100 is smaller than 201, so the resulting segment will have reversed vertices. The coordinates will be as follows:
    inSegment.Point2.X100,000
    inSegment.Point2.Y199,000
    inSegment.Point1.X201,000
    inSegment.Point1.Y100,000
  2. Now, let's assume the inAxis to be Y axis.

    The coordinates along Y axis are 100 and 199. As in the previous case, 100 is smaller than 199, so the resulting segment will have the same coordinates as inSegment.

See also