Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::gmi::AxesCoord Class Reference

All axis values in one structure accompanied by some handy manipulation methods. More...

#include <AxesCoord.h>

Public Types

enum  ECompare : unsigned int { crEQUAL = 0 , crTHIS_EQUAL = 1 , crOTHER_EQUAL = 2 , crNOT_EQUAL = 3 }
 Result of the compare function. More...
 
typedef double value_type
 Type the axes values are stored in.
 
typedef TVector< AxesCoordVector
 Type definition.
 

Public Member Functions

 AxesCoord ()
 Default constructor.
 
 AxesCoord (const AxesCoord &ac)
 Copy constructor.
 
AxesCoordoperator= (const AxesCoord &ac)
 Assignment operator.
 
 AxesCoord (const std::string &s)
 Constructor using a string containing the axis values.
 
void clear ()
 Clears all values in the coordinate.
 
void set (int axis_loc, value_type value)
 Sets an axis value.
 
void unset (int axis_loc)
 Unsets an axis value.
 
bool isSet (int axis_loc) const
 Returns true if value of location 'axis_loc' is available.
 
value_typegetValue (int axis_loc)
 Returns the value in the array.
 
value_type getValue (int axis_loc) const
 Gets axis value of the passed axis.
 
int getMap () const
 Gets the bitmap of set axes.
 
void setMap (int map)
 Sets the bitmap of axes.
 
std::string toString () const
 Gets the string representation of the 2D vector formed like '(1.23,4.56)'.
 
AxesCoordfromString (const std::string &s) noexcept(false)
 Gets the vector value from the string representation formed like '(1.23,4.56,7.89)'. Throws an exception when the string is not in the correct format.
 
AxesCoordoperator<< (const AxisValue &av)
 Assign the axis value to the value in the coord and enables it in the map.
 
AxesCoordoperator= (const AxisValue &av)
 Assign the axis value to the value in the coord but does not enable the value in the map.
 
AxesCoordoperator-= (const AxisValue &av)
 Subtracts the axis value to the current value in the coord.
 
AxesCoordoperator+= (const AxisValue &av)
 Adds the axis value to the current value in the coord.
 
bool isEqual (const AxesCoord &ac, value_type tol=tolerance) const
 Compares if the given coord is equal to this one. Comparing the mapped axes and also their values using the given tolerance.
 
bool operator== (const AxesCoord &ac) const
 Compare equal operator using the default tolerance. Calls isEqual() under the hood.
 
bool operator!= (const AxesCoord &ac) const
 Compare unequal operator using the default tolerance. Calls isEqual() under the hood.
 
AxesCoordoperator|= (const AxesCoord &ac)
 Operator which add the axes not yet set in this instance.
 
AxesCoordoperator&= (const AxesCoord &ac)
 Operator which sets the axes already set in this instance.
 
AxesCoordoperator-= (const AxesCoord &ac)
 Subtracts only axis values form axes set in this instance.
 
AxesCoordoperator+= (const AxesCoord &ac)
 Adds only axis values form axes set in this instance.
 
ECompare compare (const AxesCoord &ac, const AxesCoord &tolerance) const
 Compares two coordinates using a second coordinate containing max differences. Tests only the values in the coordinate that exists in both coordinates. For radial unlimited axes the default axis movements are used.
 
ECompare compare (const AxesCoord &ac, const AxesCoord &tolerance, const AxisLocations &rad_unlimited) const
 Same as above except the radial unlimited axes can be specified.
 
AxesCoordoperator>> (int axis_loc)
 Unsets a axis value.
 
AxisValue operator[] (size_t axis_loc) const
 Assigns a specific axis value to this structure.
 
Vector3D getVector () const
 Gets the 3D vector formed by the XYZ axis.
 
AxesCoordsetVector (const Vector3D &vect)
 Sets the 3D vector formed by the XYZ axis.
 
AxesCoordoffset (const Vector3D &ofs)
 Adds an offset to the existing coordinate.
 
AxesCoord offsetBy (const Vector3D &ofs) const
 Adds an offset to the coordinate and returns the new formed coord.
 

Static Public Attributes

static constexpr auto tolerance = std::numeric_limits<value_type>::epsilon() * 10.0
 Tolerance for when comparing in the equal operator. Empirical chosen epsilon multiplier to make it work. Used in: sf::isEqual()
 

Detailed Description

All axis values in one structure accompanied by some handy manipulation methods.

Member Typedef Documentation

◆ value_type

Type the axes values are stored in.

◆ Vector

Type definition.

Member Enumeration Documentation

◆ ECompare

enum sf::gmi::AxesCoord::ECompare : unsigned int

Result of the compare function.

Enumerator
crEQUAL 

Both values are exactly the same according to the max-diff values. All specified values are equal to those specified by the other.

crTHIS_EQUAL 

This instance specified values are the same as the other instance values. Only for the by this instance specified values.

crOTHER_EQUAL 

Other instance specified values are the same as these instance values. Only for the by the other instance specified values.

crNOT_EQUAL 

One of the values specified in both instances were not equal.

Constructor & Destructor Documentation

◆ AxesCoord() [1/3]

sf::gmi::AxesCoord::AxesCoord ( )

Default constructor.

◆ AxesCoord() [2/3]

sf::gmi::AxesCoord::AxesCoord ( const AxesCoord ac)

Copy constructor.

◆ AxesCoord() [3/3]

sf::gmi::AxesCoord::AxesCoord ( const std::string &  s)
explicit

Constructor using a string containing the axis values.

Parameters
s

Member Function Documentation

◆ clear()

void sf::gmi::AxesCoord::clear ( )

Clears all values in the coordinate.

◆ compare() [1/2]

ECompare sf::gmi::AxesCoord::compare ( const AxesCoord ac,
const AxesCoord tolerance 
) const

Compares two coordinates using a second coordinate containing max differences. Tests only the values in the coordinate that exists in both coordinates. For radial unlimited axes the default axis movements are used.

Parameters
acAxes coord being compared.
toleranceAxes values containing accuracy of the comparison.
Returns
Comparison result value.

◆ compare() [2/2]

ECompare sf::gmi::AxesCoord::compare ( const AxesCoord ac,
const AxesCoord tolerance,
const AxisLocations rad_unlimited 
) const

Same as above except the radial unlimited axes can be specified.

Parameters
acAxes coord being compared.
toleranceAxes values containing accuracy of the comparison.
rad_unlimitedSet of radial unlimited axis.
Returns
Comparison result value.

◆ fromString()

AxesCoord & sf::gmi::AxesCoord::fromString ( const std::string &  s)

Gets the vector value from the string representation formed like '(1.23,4.56,7.89)'. Throws an exception when the string is not in the correct format.

Exceptions
std::invalid_argument

◆ getMap()

int sf::gmi::AxesCoord::getMap ( ) const

Gets the bitmap of set axes.

Returns
Bitmap of axis.

◆ getValue() [1/2]

value_type & sf::gmi::AxesCoord::getValue ( int  axis_loc)

Returns the value in the array.

Parameters
axis_locAxis location.
Returns

◆ getValue() [2/2]

value_type sf::gmi::AxesCoord::getValue ( int  axis_loc) const

Gets axis value of the passed axis.

Parameters
axis_loc
Returns
Axis value.

◆ getVector()

Vector3D sf::gmi::AxesCoord::getVector ( ) const

Gets the 3D vector formed by the XYZ axis.

Returns
The 3D -vector.

◆ isEqual()

bool sf::gmi::AxesCoord::isEqual ( const AxesCoord ac,
value_type  tol = tolerance 
) const

Compares if the given coord is equal to this one. Comparing the mapped axes and also their values using the given tolerance.

Parameters
acInstance reference to be compared with.
tolTolerance on the floating point comparison.
Returns
True when found equal.

◆ isSet()

bool sf::gmi::AxesCoord::isSet ( int  axis_loc) const

Returns true if value of location 'axis_loc' is available.

Parameters
axis_loc
Returns

◆ offset()

AxesCoord & sf::gmi::AxesCoord::offset ( const Vector3D &  ofs)

Adds an offset to the existing coordinate.

Parameters
ofs3D vector offset.
Returns
This instance reference.

◆ offsetBy()

AxesCoord sf::gmi::AxesCoord::offsetBy ( const Vector3D &  ofs) const

Adds an offset to the coordinate and returns the new formed coord.

Parameters
ofs
Returns
Offset copy of this instance reference.

◆ operator!=()

bool sf::gmi::AxesCoord::operator!= ( const AxesCoord ac) const

Compare unequal operator using the default tolerance. Calls isEqual() under the hood.

◆ operator&=()

AxesCoord & sf::gmi::AxesCoord::operator&= ( const AxesCoord ac)

Operator which sets the axes already set in this instance.

Parameters
acSource instance.
Returns
This instance reference.

◆ operator+=() [1/2]

AxesCoord & sf::gmi::AxesCoord::operator+= ( const AxesCoord ac)

Adds only axis values form axes set in this instance.

Parameters
acSource instance.
Returns
This instance reference.

◆ operator+=() [2/2]

AxesCoord & sf::gmi::AxesCoord::operator+= ( const AxisValue av)

Adds the axis value to the current value in the coord.

Parameters
av
Returns
This instance reference.

◆ operator-=() [1/2]

AxesCoord & sf::gmi::AxesCoord::operator-= ( const AxesCoord ac)

Subtracts only axis values form axes set in this instance.

Parameters
acSource instance.
Returns
This instance reference.

◆ operator-=() [2/2]

AxesCoord & sf::gmi::AxesCoord::operator-= ( const AxisValue av)

Subtracts the axis value to the current value in the coord.

Parameters
av
Returns
This instance reference.

◆ operator<<()

AxesCoord & sf::gmi::AxesCoord::operator<< ( const AxisValue av)

Assign the axis value to the value in the coord and enables it in the map.

Parameters
av
Returns
This instance reference.

◆ operator=() [1/2]

AxesCoord & sf::gmi::AxesCoord::operator= ( const AxesCoord ac)

Assignment operator.

◆ operator=() [2/2]

AxesCoord & sf::gmi::AxesCoord::operator= ( const AxisValue av)

Assign the axis value to the value in the coord but does not enable the value in the map.

Parameters
av
Returns
This instance reference.

◆ operator==()

bool sf::gmi::AxesCoord::operator== ( const AxesCoord ac) const

Compare equal operator using the default tolerance. Calls isEqual() under the hood.

◆ operator>>()

AxesCoord & sf::gmi::AxesCoord::operator>> ( int  axis_loc)

Unsets a axis value.

Parameters
axis_locAxis location to remove.
Returns
This instance reference.

◆ operator[]()

AxisValue sf::gmi::AxesCoord::operator[] ( size_t  axis_loc) const

Assigns a specific axis value to this structure.

Parameters
axis_loc
Returns
This instance reference.

◆ operator|=()

AxesCoord & sf::gmi::AxesCoord::operator|= ( const AxesCoord ac)

Operator which add the axes not yet set in this instance.

Parameters
acSource instance.
Returns
This instance reference.

◆ set()

void sf::gmi::AxesCoord::set ( int  axis_loc,
value_type  value 
)

Sets an axis value.

Parameters
axis_locThe target axis sf::gmi::EAxisLocation.
valueThe axis value in axis units.

◆ setMap()

void sf::gmi::AxesCoord::setMap ( int  map)

Sets the bitmap of axes.

Parameters
map

◆ setVector()

AxesCoord & sf::gmi::AxesCoord::setVector ( const Vector3D &  vect)

Sets the 3D vector formed by the XYZ axis.

Parameters
vect3D vector.
Returns
This instance as reference.

◆ toString()

std::string sf::gmi::AxesCoord::toString ( ) const

Gets the string representation of the 2D vector formed like '(1.23,4.56)'.

◆ unset()

void sf::gmi::AxesCoord::unset ( int  axis_loc)

Unsets an axis value.

Parameters
axis_loc

Member Data Documentation

◆ tolerance

constexpr auto sf::gmi::AxesCoord::tolerance = std::numeric_limits<value_type>::epsilon() * 10.0
staticconstexpr

Tolerance for when comparing in the equal operator. Empirical chosen epsilon multiplier to make it work. Used in: sf::isEqual()


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