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

Class to represent a linear equation. More...

#include <LinEquation.h>

Public Types

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

Public Member Functions

 LinEquation ()
 
 LinEquation (double angle, const Point &source=Point())
 
 LinEquation (const LinEquation &source)
 
LinEquationoperator= (const LinEquation &source)
 
bool operator== (const LinEquation &ref) const
 
bool operator== (const Point &ref) const
 
bool operator!= (const LinEquation &ref) const
 
bool operator< (const LinEquation &ref) const
 
bool isXAxis (double prec=math::eps) const
 
bool isYAxis (double prec=math::eps) const
 
bool isPerpendicularTo (const LinEquation &ref, double prec=math::eps) const
 
bool isParallelTo (const LinEquation &ref, double prec=math::eps) const
 
double azimuthAngle () const
 
Option getFlipped () const
 
Option getPerpendicular (const Point &ref) const
 
Option getParallel (const Point &ref) const
 
double angleTo (const LinEquation &ref) const
 
XPoint::Option intersectionWith (const LinEquation &ref) const
 
Position positionOf (const Point &ref, double prec=math::eps) const
 
bool xAtY (double y, double &x) const
 
bool yAtX (double x, double &y) const
 
Point closestPointTo (const Point &ref) const
 
double lengthTo (const Point &ref) const
 

Static Public Member Functions

static Option create (const Point &source)
 
static Option create (const Point &start, const Point &end)
 
static Option create (const Line &source)
 

Detailed Description

Class to represent a linear equation.

Constructor & Destructor Documentation

◆ LinEquation() [1/3]

LinEquation::LinEquation ( )

Constructor

◆ LinEquation() [2/3]

LinEquation::LinEquation ( double angle,
const Point & source = Point() )

Constructor

Parameters
angleAngle of the line
sourceA point along the line

◆ LinEquation() [3/3]

LinEquation::LinEquation ( const LinEquation & source)

Copy constructor

Parameters
sourceThe object to copy

Member Function Documentation

◆ angleTo()

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

Calculate the angle between two linear equations

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

◆ azimuthAngle()

double LinEquation::azimuthAngle ( ) const

Calculate the angle of this equation

Returns
The equation's angle (0 to 2*pi)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointTo()

Point LinEquation::closestPointTo ( const Point & ref) const

Calculate the closest point along this to a another specified point

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

◆ create() [1/3]

LinEquation::Option LinEquation::create ( const Line & source)
static

Create a new linear equation from a line

Parameters
sourceA line
Returns
A linear equation (nullopt if input is invalid)

◆ create() [2/3]

LinEquation::Option LinEquation::create ( const Point & source)
static

Create a new linear equation from a point (origin assumed to be 0,0,0)

Parameters
sourceThe end of the line
Returns
A linear equation (nullopt if input is invalid)
Here is the caller graph for this function:

◆ create() [3/3]

LinEquation::Option LinEquation::create ( const Point & start,
const Point & end )
static

Create a new linear equation from two points in a line

Parameters
startThe start of the line
endThe end of the line
Returns
A linear equation (nullopt if input is invalid)

◆ getFlipped()

LinEquation::Option LinEquation::getFlipped ( ) const

Create a linear equation opposite to this

Returns
An unique_ptr to the opposite equation

◆ getParallel()

LinEquation::Option LinEquation::getParallel ( const Point & ref) const

Create a linear equation parallel to this which passes through the specified point

Parameters
refThe point through which the new equation must pass
Returns
An unique_ptr to the parallel equation
Here is the call graph for this function:

◆ getPerpendicular()

LinEquation::Option LinEquation::getPerpendicular ( const Point & ref) const

Create a linear equation perpendicular to this which passes through the specified point

Parameters
refThe point through which the new equation must pass
Returns
An unique_ptr to the perpendicular equation
Here is the caller graph for this function:

◆ intersectionWith()

XPoint::Option LinEquation::intersectionWith ( const LinEquation & ref) const

Calculate the intersection point of two equations

Parameters
refThe intersecting line
Returns
An unique_ptr for the intersection point (or 0 if parallel)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParallelTo()

bool LinEquation::isParallelTo ( const LinEquation & ref,
double prec = math::eps ) const

Test two equations to determine if they are parallel

Parameters
refThe reference line
precThe required precision
Returns
True if the equations are parallel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPerpendicularTo()

bool LinEquation::isPerpendicularTo ( const LinEquation & ref,
double prec = math::eps ) const

Test two equations to determine if they are perpendicular

Parameters
refThe reference line
precThe required precision
Returns
True if the equations are perpendicular
Here is the call graph for this function:

◆ isXAxis()

bool active::geometry::LinEquation::isXAxis ( double prec = math::eps) const
inline

Test if the equation is parallel to the x axis

Parameters
precThe required precision
Returns
True the equation is parallel to the x axis
Here is the caller graph for this function:

◆ isYAxis()

bool active::geometry::LinEquation::isYAxis ( double prec = math::eps) const
inline

Test if the equation is parallel to the y axis

Parameters
precThe required precision
Returns
True the equation is parallel to the y axis
Here is the caller graph for this function:

◆ lengthTo()

double LinEquation::lengthTo ( const Point & ref) const

Calculate the minimum distance from a point to this

Parameters
refThe reference point
Returns
The minimum distance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

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

Inequality operator

Parameters
refThe object to compare
Returns
True if ref is not identical to this

◆ operator<()

bool LinEquation::operator< ( const LinEquation & ref) const

Less-than operator

Parameters
refThe object to compare
Returns
True if the angle of this equation is less than ref
Here is the call graph for this function:

◆ operator=()

LinEquation & LinEquation::operator= ( const LinEquation & source)

Assignment operator

Parameters
sourceThe object to copy
Returns
A reference to this

◆ operator==() [1/2]

bool LinEquation::operator== ( const LinEquation & ref) const

Equality operator

Parameters
refThe object to compare
Returns
True if ref is identical to this
Here is the call graph for this function:

◆ operator==() [2/2]

bool LinEquation::operator== ( const Point & ref) const

Test to determine if a point lies within this equation

Parameters
refA point to test
Returns
True if the point lies along the line
Here is the call graph for this function:

◆ positionOf()

Position LinEquation::positionOf ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the equation

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point (along, left, right)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xAtY()

bool LinEquation::xAtY ( double y,
double & x ) const

Calculate the x coordinate at the specifed y coordinate

Parameters
yThe y coordinate
xThe x coordinate (n/a if the equation is parallel to the x axis)
Returns
False if the equation is parallel to the x axis
Here is the call graph for this function:

◆ yAtX()

bool LinEquation::yAtX ( double x,
double & y ) const

Calculate the y coordinate at the specifed x coordinate

Parameters
xThe x coordinate
yThe y coordinate (n/a if the equation is parallel to the y axis)
Returns
False if the equation is parallel to the y axis
Here is the call graph for this function:

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