ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
active::geometry::Line Class Reference

Class to represent a line. More...

#include <Line.h>

Collaboration diagram for active::geometry::Line:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<Line>
 Unique pointer.
 
using Shared = std::shared_ptr<Line>
 Shared pointer.
 
using Option = std::optional<Line>
 Optional.
 

Public Member Functions

 Line (const Point &origin, const Point &end)
 
 Line (const Point &origin, double rad, double azim)
 
bool operator== (const Line &ref) const
 
bool operator!= (const Line &ref) const
 
Line operator+ (const Point &offset) const
 
Lineoperator+= (const Point &offset)
 
Line operator- (const Point &offset) const
 
Lineoperator-= (const Point &offset)
 
Line operator* (double scale) const
 
Lineoperator*= (double scale)
 
Line operator* (const Matrix3x3 &matrix) const
 
Lineoperator*= (const Matrix3x3 &matrix)
 
bool isEqual2D (const Line &ref, double prec=math::eps) const
 
bool isEqual3D (const Line &ref, double prec=math::eps) const
 
double length2D () const
 
double length3D () const
 
double azimuthAngle () const
 
double altitudeAngle () const
 
double angleTo (const Line &ref) const
 
Point midpoint () const
 
double heightAt (const Point &ref) const
 
bool isColinearTo2D (const Line &ref, double prec=math::eps) const
 
bool isColinearTo3D (const Line &ref, double prec=math::eps) const
 
bool isParallelTo2D (const Line &ref, double prec=math::eps) const
 
bool isParallelTo3D (const Line &ref, double prec=math::eps) const
 
Point closestPointTo2D (const Point &ref, double prec=math::eps) const
 
Point closestPointTo3D (const Point &ref, double prec=math::eps) const
 
Point closestPointAlong2D (const Point &ref, double prec=math::eps) const
 
Point closestPointAlong3D (const Point &ref, double prec=math::eps) const
 
XPoint::Option intersectionWith2D (const Line &ref, double prec=math::eps) const
 
vertex_index intersectionWith2D (const Line &ref, XList &inter, double prec=math::eps) const
 
vertex_index intersectionWith3D (const Line &ref, XList &inter, double prec=math::eps) const
 
Position positionOf2D (const Point &ref, double prec=math::eps) const
 
Position positionOf3D (const Point &ref, double prec=math::eps) const
 
bool encloses2D (const Point &ref, double prec) const
 
bool encloses3D (const Point &ref, double prec) const
 
double angleTo2D (const Line &ref) const
 
void extend (double len)
 
void movePolar (double len, double azim, double alt)
 
void movePolar (double len, double angle)
 
void flip ()
 

Public Attributes

Point origin
 The line origin.
 
Point end
 The line end.
 

Detailed Description

Class to represent a line.

Constructor & Destructor Documentation

◆ Line() [1/2]

active::geometry::Line::Line ( const Point & origin,
const Point & end )
inline

Constructor

Parameters
originOrigin point of the line
endEnd point of the line
Here is the caller graph for this function:

◆ Line() [2/2]

active::geometry::Line::Line ( const Point & origin,
double rad,
double azim )
inline

Constructor

Parameters
originOrigin point of the line
radThe radial offset to the end of the line
azimThe azimuth angle of the line
Here is the call graph for this function:

Member Function Documentation

◆ altitudeAngle()

double Line::altitudeAngle ( ) const

Get the altitude angle of the line

Returns
The altitude angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ angleTo()

double Line::angleTo ( const Line & ref) const

Get the angle between two lines

Parameters
refThe reference line
Returns
The angle between the lines
Here is the call graph for this function:
Here is the caller graph for this function:

◆ angleTo2D()

double Line::angleTo2D ( const Line & ref) const

Get the angle between two lines

Parameters
refThe reference line
Returns
The angle between the lines
Here is the call graph for this function:

◆ azimuthAngle()

double Line::azimuthAngle ( ) const

Get the azimuth angle of the line

Returns
The azimuth angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointAlong2D()

Point Line::closestPointAlong2D ( const Point & ref,
double prec = math::eps ) const

Get the closest point along the line to a given point in 2D

Parameters
refThe reference point
Returns
The closest point along the line to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointAlong3D()

Point Line::closestPointAlong3D ( const Point & ref,
double prec = math::eps ) const

Get the closest point along the line to a given point

Parameters
refThe reference point
Returns
The closest point along the line to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointTo2D()

Point Line::closestPointTo2D ( const Point & ref,
double prec = math::eps ) const

Get the closest point in the line to a given point in 2D

Parameters
refThe reference point
Returns
The closest point in the line to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointTo3D()

Point Line::closestPointTo3D ( const Point & ref,
double prec = math::eps ) const

Get the closest point in the line to a given point

Parameters
refThe reference point
Returns
The closest point in the line to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encloses2D()

bool Line::encloses2D ( const Point & ref,
double prec ) const

Determine if a point is enclosed by a line in 2D

Parameters
refThe reference point
Returns
True if the lineline encloses the point
Here is the call graph for this function:

◆ encloses3D()

bool Line::encloses3D ( const Point & ref,
double prec ) const

Determine if a point is enclosed by a line

Parameters
refThe reference point
Returns
True if the lineline encloses the point
Here is the call graph for this function:

◆ extend()

void Line::extend ( double len)

Extend the line length by the specified amount

Parameters
lenThe amount to extend the line by
Here is the call graph for this function:

◆ flip()

void Line::flip ( )

Flip the line

◆ heightAt()

double Line::heightAt ( const Point & ref) const

Get the height of the line at a specified point

Parameters
refThe point at which to calculate the height
Returns
The height at the specified point
Here is the call graph for this function:

◆ intersectionWith2D() [1/2]

XPoint::Option Line::intersectionWith2D ( const Line & ref,
double prec = math::eps ) const

Get the intersection point of two lines in 2D (NB: either along or projected beyond the line extents)

Parameters
refThe reference line
precThe required precision
Returns
The intersection point (nullopt if no intersection is possible)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersectionWith2D() [2/2]

vertex_index Line::intersectionWith2D ( const Line & ref,
XList & inter,
double prec = math::eps ) const

Get the intersection point of two lines in 2D

Parameters
refThe reference line
interThe intersection list to populate
precThe required precision
Returns
The number of intersections calculated
Here is the call graph for this function:

◆ intersectionWith3D()

vertex_index Line::intersectionWith3D ( const Line & ref,
XList & inter,
double prec = math::eps ) const

Get the intersection point of two lines in 3D ref: The reference line inter: The intersection list to populate prec: The required precision return: The number of intersections calculated

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isColinearTo2D()

bool Line::isColinearTo2D ( const Line & ref,
double prec = math::eps ) const

Check if two lines are colinear

Parameters
refThe reference line
Returns
True if the lines are colinear
Here is the call graph for this function:

◆ isColinearTo3D()

bool Line::isColinearTo3D ( const Line & ref,
double prec = math::eps ) const

Check if two lines are colinear

Parameters
refThe reference line
Returns
True if the lines are colinear
Here is the call graph for this function:

◆ isEqual2D()

bool Line::isEqual2D ( const Line & ref,
double prec = math::eps ) const

Determine if two lines are equal in 2D

Parameters
refThe line to compare with this
precThe required precision
Returns
True if the lines are identical
Here is the call graph for this function:

◆ isEqual3D()

bool Line::isEqual3D ( const Line & ref,
double prec = math::eps ) const

Determine if two lines are equal

Parameters
refThe line to compare with this
precThe required precision
Returns
True if the lines are identical
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParallelTo2D()

bool Line::isParallelTo2D ( const Line & ref,
double prec = math::eps ) const

Check if two lines are parallel

Parameters
refThe reference line
Returns
True if they are parallel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParallelTo3D()

bool Line::isParallelTo3D ( const Line & ref,
double prec = math::eps ) const

Check if two lines are parallel

Parameters
refThe reference line
Returns
True if the lines are parallel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ length2D()

double Line::length2D ( ) const

Get the length of the line in 2D

Returns
The 2D line length
Here is the call graph for this function:
Here is the caller graph for this function:

◆ length3D()

double Line::length3D ( ) const

Get the length of the line

Returns
The length of the line
Here is the call graph for this function:

◆ midpoint()

Point Line::midpoint ( ) const

Get the midpoint of the line

Returns
The midpoint of the line
Here is the caller graph for this function:

◆ movePolar() [1/2]

void Line::movePolar ( double len,
double angle )

Move the line by the specified distance and angle

Parameters
lenThe distance to move the line
angleThe angle to move the line along
Here is the call graph for this function:

◆ movePolar() [2/2]

void Line::movePolar ( double len,
double azim,
double alt )

Move the line by the specified distance and azimuth/altitude angles

Parameters
lenThe distance to move the line
azimThe azimuth angle to move the line along
altThe altitude angle to move the line along
Here is the call graph for this function:

◆ operator!=()

bool active::geometry::Line::operator!= ( const Line & ref) const
inline

Inequality operator

Parameters
refThe line to compare with this
Returns
True if the lines are different
Here is the call graph for this function:

◆ operator*() [1/2]

Line Line::operator* ( const Matrix3x3 & matrix) const

Multiplication operator

Parameters
matrixThe matrix to multiply the line by
Returns
A multiplied line
Here is the call graph for this function:

◆ operator*() [2/2]

Line Line::operator* ( double scale) const

Multiplication operator

Parameters
scaleThe amount to multiply the line by
Returns
A multiplied line
Here is the call graph for this function:

◆ operator*=() [1/2]

Line & Line::operator*= ( const Matrix3x3 & matrix)

Multiplication with assignment operator

Parameters
matrixThe matrix to multiply the line by
Returns
A reference to this

◆ operator*=() [2/2]

Line & Line::operator*= ( double scale)

Multiplication with assignment operator

Parameters
scaleThe amount to multiply the line by
Returns
A reference to this

◆ operator+()

Line Line::operator+ ( const Point & offset) const

Addition operator

Parameters
offsetThe amount to add to the line
Returns
An offset line
Here is the call graph for this function:

◆ operator+=()

Line & Line::operator+= ( const Point & offset)

Addition with assignment operator

Parameters
offsetThe amount to add to the line
Returns
A reference to this

◆ operator-()

Line Line::operator- ( const Point & offset) const

Subtraction operator

Parameters
offsetThe amount to subtract from the line
Returns
An offset line
Here is the call graph for this function:

◆ operator-=()

Line & Line::operator-= ( const Point & offset)

Subtraction with assignment operator

Parameters
offsetThe amount to subtract from the line
Returns
A reference to this

◆ operator==()

bool active::geometry::Line::operator== ( const Line & ref) const
inline

Equality operator

Parameters
refThe line to compare with this
Returns
True if the lines are identical
Here is the call graph for this function:

◆ positionOf2D()

Position Line::positionOf2D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the line in 2D

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ positionOf3D()

Position Line::positionOf3D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the line in 3D

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:
Here is the caller graph for this function:

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