Back to Aurora Vision Library website

You are here: Start » Function Reference » Geometry 2D » Geometry 2D Normalizations » NormalizeSegmentOrientation_ByPointDistance

NormalizeSegmentOrientation_ByPointDistance


Header: AVL.h
Namespace: avl
Module: FoundationLite

Changes orientation of the given segment according to distance to the given point.

Syntax

C++
C#
 
void avl::NormalizeSegmentOrientation_ByPointDistance
(
	const avl::Segment2D& inSegment,
	const avl::Point2D& inReferencePoint,
	avl::Segment2D& outSegment
)

Parameters

Name Type Default Description
Input value inSegment const Segment2D&
Input value inReferencePoint const Point2D& A point relative to which distances are measured
Output value outSegment Segment2D& A segment in which the first point is closer to inReferencePoint

Description

This operation changes the orientation of the inSegment segment according to the distance between the input segment's vertices and given inReferencePoint. The resulting segment has the first vertex closer to the inReferencePoint.

Examples

Let's consider two cases with the same input segment, but different inReferencePoint. The coordinates of the segment are as follows:
inSegment.Point1.X99,000
inSegment.Point1.Y100,000
inSegment.Point2.X200,000
inSegment.Point2.Y201,000
  1. Let's assume the inReferencePoint to have coordinates X = 99, Y = 0.

    The distance between the first vertex of the segment (X = 99, Y = 100) is equal to 100, whereas the distance between the second vertex of the segment (X = 200, Y = 201) is about 225. That means the first vertex is closer to the inReferencePoint, so the resulting segment will have the same coordinates as the input segment.
  2. Now, let's assume the inReferencePoint to have coordinates X = 300, Y = 201.

    The distance between the first vertex of the segment (X = 99, Y = 100) is about 225, whereas the distance between the second vertex of the segment (X = 200, Y = 201) is equal to 100. That means the second vertex is closer to inReferencePoint, so the resulting segment will have reversed vertices. Their coordinates will be as follows:
    inSegment.Point2.X200,000
    inSegment.Point2.Y201,000
    inSegment.Point1.X99,000
    inSegment.Point1.Y100,000

See Also