Back to FabImage Library Lite website
You are here: Start » Geometry 2D » Geometry 2D Normalizations » NormalizeSegmentOrientation_ByCoordinate

NormalizeSegmentOrientation_ByCoordinate
Header: | FIL.h |
---|---|
Namespace: | fil |
Changes orientation of the given segment according to coordinates along selected axis.
Syntax
void fil::NormalizeSegmentOrientation_ByCoordinate ( const fil::Segment2D& inSegment, const fil::Axis::Type inAxis, fil::Segment2D& outSegment )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inSegment | const Segment2D& | ||
![]() |
inAxis | const Axis::Type | X | An axis relative to which coordinates are compared |
![]() |
outSegment | Segment2D& | A 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.X | 201,000 |
inSegment.Point1.Y | 100,000 |
inSegment.Point2.X | 100,000 |
inSegment.Point2.Y | 199,000 |
-
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.X 100,000 inSegment.Point2.Y 199,000 inSegment.Point1.X 201,000 inSegment.Point1.Y 100,000 -
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
- SegmentOrientation – Computes the orientation of a segment.
- NormalizeSegmentOrientation_ByPointDistance – Changes orientation of the given segment according to distance to the given point.
- NormalizeSegmentOrientation_ByBaseOrientation – Changes orientation of the given segment according to base orientation.