KiCad PCB EDA Suite
Loading...
Searching...
No Matches
HALF_LINE Class Reference

#include <half_line.h>

Public Member Functions

 HALF_LINE (const SEG &aSeg)
 Construct a ray from a segment - the ray will start at the segment's A point and extend infinitely in the direction of the segment, passing through its B point.
 
 HALF_LINE (const VECTOR2I &aStart, const VECTOR2I &aOtherContainedPoint)
 
const VECTOR2IGetStart () const
 Get the start point of the ray.
 
const VECTOR2IGetContainedPoint () const
 Get one (of the infinite number) of points that the ray passes through.
 
bool Contains (const VECTOR2I &aPoint) const
 
OPT_VECTOR2I Intersect (const SEG &aSeg) const
 
OPT_VECTOR2I Intersect (const HALF_LINE &aOther) const
 
VECTOR2I NearestPoint (const VECTOR2I &aPoint) const
 Get the nearest point on the ray to the given point.
 
bool operator== (const HALF_LINE &aOther) const
 Based on the ray being identically defined.
 
const SEGGetContainedSeg () const
 Gets the (one of the infinite number of) segments that the ray passes through.
 

Private Attributes

SEG m_seg
 Internally, we can represent a just a segment that the ray passes through.
 

Detailed Description

Definition at line 40 of file half_line.h.

Constructor & Destructor Documentation

◆ HALF_LINE() [1/2]

HALF_LINE::HALF_LINE ( const SEG aSeg)
inline

Construct a ray from a segment - the ray will start at the segment's A point and extend infinitely in the direction of the segment, passing through its B point.

Definition at line 47 of file half_line.h.

◆ HALF_LINE() [2/2]

HALF_LINE::HALF_LINE ( const VECTOR2I aStart,
const VECTOR2I aOtherContainedPoint 
)
inline

Definition at line 49 of file half_line.h.

Member Function Documentation

◆ Contains()

bool HALF_LINE::Contains ( const VECTOR2I aPoint) const

Definition at line 41 of file half_line.cpp.

References SEG::A, SEG::B, SEG::LineDistance(), m_seg, and VectorsInSameQuadrant().

◆ GetContainedPoint()

const VECTOR2I & HALF_LINE::GetContainedPoint ( ) const
inline

Get one (of the infinite number) of points that the ray passes through.

Definition at line 62 of file half_line.h.

References SEG::B, and m_seg.

◆ GetContainedSeg()

const SEG & HALF_LINE::GetContainedSeg ( ) const
inline

Gets the (one of the infinite number of) segments that the ray passes through.

The segment's A point is the start of the ray, and the B point is on the ray.

Definition at line 87 of file half_line.h.

References m_seg.

Referenced by Intersect().

◆ GetStart()

const VECTOR2I & HALF_LINE::GetStart ( ) const
inline

Get the start point of the ray.

Definition at line 57 of file half_line.h.

References SEG::A, and m_seg.

Referenced by KIGEOM::ClipHalfLineToBox().

◆ Intersect() [1/2]

OPT_VECTOR2I HALF_LINE::Intersect ( const HALF_LINE aOther) const

◆ Intersect() [2/2]

OPT_VECTOR2I HALF_LINE::Intersect ( const SEG aSeg) const

◆ NearestPoint()

VECTOR2I HALF_LINE::NearestPoint ( const VECTOR2I aPoint) const

Get the nearest point on the ray to the given point.

This will be the start point of the ray for half the 2D plane.

Definition at line 110 of file half_line.cpp.

References SEG::A, SEG::B, VECTOR2< T >::Dot(), m_seg, rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator==()

bool HALF_LINE::operator== ( const HALF_LINE aOther) const
inline

Based on the ray being identically defined.

TODO: this is not geoemetrical equality?!

Definition at line 80 of file half_line.h.

References m_seg.

Member Data Documentation

◆ m_seg

SEG HALF_LINE::m_seg
private

Internally, we can represent a just a segment that the ray passes through.

Definition at line 91 of file half_line.h.

Referenced by Contains(), GetContainedPoint(), GetContainedSeg(), GetStart(), Intersect(), NearestPoint(), and operator==().


The documentation for this class was generated from the following files: