Back to FabImage Studio website
You are here: Start » Filter Reference » Geometry 2D » Geometry 2D Normalizations » NormalizeSegmentOrientation_ByBaseOrientation
Module: | FoundationLite |
---|
Changes orientation of the given segment according to base orientation.
Name | Type | Description | |
---|---|---|---|
![]() |
inSegment | Segment2D | |
![]() |
inBaseOrientation | Real | An angle relative to which angle differences are calculated |
![]() |
outSegment | Segment2D | A segment which orientation is closer to inBaseOrientation |
Description
This operation changes the orientation of the inSegment segment according to the given angle. The resulting segment has possibly the smallest difference between its orientation and inBaseOrientation. In other words, the function returns the same segment as inSegment or rotated by 180 degrees - depending on the difference between the orientations.
Examples
Let's consider two cases with the same input segment, but different inBaseOrientation.
The coordinates of the segment are as follows:
inSegment.Point1.X | 99,000 |
inSegment.Point1.Y | 100,000 |
inSegment.Point2.X | 200,000 |
inSegment.Point2.Y | 201,000 |
-
Let's assume the inBaseOrientation to be equal to 90 degrees.
The orientation of the input segment is 45 degrees, whereas the orientation of the segment rotated by 180 degrees would be 225 degrees. The difference between 90 and 45 degrees is smaller than the one between 90 and 225, so the output segment would be the same as input. -
Now, let's assume the inBaseOrientation to be 180 degrees.
The orientation of the input segment is still 45 degrees, and the orientation of the segment rotated by 180 degrees is also still 225 degrees. But now, the difference between 90 and 45 degrees is greater than the one between 90 and 225, so the output segment would be rotated by 180 degrees. The vertexes of the output segment would be swapped as follows:inSegment.Point2.X 200,000 inSegment.Point2.Y 201,000 inSegment.Point1.X 99,000 inSegment.Point1.Y 100,000
Complexity Level
This filter is available on Advanced Complexity Level.
Filter Group
This filter is member of NormalizeSegment filter group.
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_ByCoordinate – Changes orientation of the given segment according to coordinates along selected axis.