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

#include <line.h>

Public Types

using ecoord = VECTOR2I::extended_type
 

Public Member Functions

 LINE (const SEG &aSeg)
 
 LINE (const VECTOR2I &aStart, const VECTOR2I &aEnd)
 
bool operator== (const LINE &aOther) const
 
const SEGGetContainedSeg () const
 Gets the (one of the infinite number of) segments that the line passes through.
 
OPT_VECTOR2I Intersect (const SEG &aOther) const
 
OPT_VECTOR2I Intersect (const LINE &aOther) const
 
int Distance (const VECTOR2I &aPoint) const
 Gets the distance from the line to the given point.
 
VECTOR2I NearestPoint (const VECTOR2I &aPoint) const
 Gets the nearest point on the line to the given point.
 

Private Attributes

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

Detailed Description

Definition at line 35 of file line.h.

Member Typedef Documentation

◆ ecoord

Definition at line 38 of file line.h.

Constructor & Destructor Documentation

◆ LINE() [1/2]

LINE::LINE ( const SEG aSeg)
inline

Definition at line 40 of file line.h.

◆ LINE() [2/2]

LINE::LINE ( const VECTOR2I aStart,
const VECTOR2I aEnd 
)
inline

Definition at line 42 of file line.h.

Member Function Documentation

◆ Distance()

int LINE::Distance ( const VECTOR2I aPoint) const

Gets the distance from the line to the given point.

Definition at line 46 of file line.cpp.

References SEG::LineDistance(), and m_seg.

◆ GetContainedSeg()

const SEG & LINE::GetContainedSeg ( ) const
inline

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

Definition at line 49 of file line.h.

References m_seg.

◆ Intersect() [1/2]

OPT_VECTOR2I LINE::Intersect ( const LINE aOther) const

Definition at line 40 of file line.cpp.

References SEG::Intersect(), and m_seg.

◆ Intersect() [2/2]

OPT_VECTOR2I LINE::Intersect ( const SEG aOther) const

Definition at line 22 of file line.cpp.

References SEG::Contains(), SEG::Intersect(), and m_seg.

Referenced by KIGEOM::ClipLineToBox().

◆ NearestPoint()

VECTOR2I LINE::NearestPoint ( const VECTOR2I aPoint) const

Gets the nearest point on the line to the given point.

Definition at line 52 of file line.cpp.

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

◆ operator==()

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

Definition at line 44 of file line.h.

References m_seg.

Member Data Documentation

◆ m_seg

SEG LINE::m_seg
private

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

Definition at line 66 of file line.h.

Referenced by Distance(), GetContainedSeg(), Intersect(), NearestPoint(), and operator==().


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