![]() |
Scanframe Modular Application 0.1.0
|
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< AxesCoord > | Vector |
Type definition. | |
Public Member Functions | |
AxesCoord () | |
Default constructor. | |
AxesCoord (const AxesCoord &ac) | |
Copy constructor. | |
AxesCoord & | operator= (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_type & | getValue (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)'. | |
AxesCoord & | fromString (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. | |
AxesCoord & | operator<< (const AxisValue &av) |
Assign the axis value to the value in the coord and enables it in the map. | |
AxesCoord & | operator= (const AxisValue &av) |
Assign the axis value to the value in the coord but does not enable the value in the map. | |
AxesCoord & | operator-= (const AxisValue &av) |
Subtracts the axis value to the current value in the coord. | |
AxesCoord & | operator+= (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. | |
AxesCoord & | operator|= (const AxesCoord &ac) |
Operator which add the axes not yet set in this instance. | |
AxesCoord & | operator&= (const AxesCoord &ac) |
Operator which sets the axes already set in this instance. | |
AxesCoord & | operator-= (const AxesCoord &ac) |
Subtracts only axis values form axes set in this instance. | |
AxesCoord & | operator+= (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. | |
AxesCoord & | operator>> (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. | |
AxesCoord & | setVector (const Vector3D &vect) |
Sets the 3D vector formed by the XYZ axis. | |
AxesCoord & | offset (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() | |
All axis values in one structure accompanied by some handy manipulation methods.
typedef double sf::gmi::AxesCoord::value_type |
Type the axes values are stored in.
typedef TVector<AxesCoord> sf::gmi::AxesCoord::Vector |
Type definition.
enum sf::gmi::AxesCoord::ECompare : unsigned int |
Result of the compare function.
sf::gmi::AxesCoord::AxesCoord | ( | ) |
Default constructor.
sf::gmi::AxesCoord::AxesCoord | ( | const AxesCoord & | ac | ) |
Copy constructor.
|
explicit |
Constructor using a string containing the axis values.
s |
void sf::gmi::AxesCoord::clear | ( | ) |
Clears all values in the coordinate.
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.
ac | Axes coord being compared. |
tolerance | Axes values containing accuracy of the comparison. |
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.
ac | Axes coord being compared. |
tolerance | Axes values containing accuracy of the comparison. |
rad_unlimited | Set of radial unlimited axis. |
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.
std::invalid_argument |
int sf::gmi::AxesCoord::getMap | ( | ) | const |
Gets the bitmap of set axes.
value_type & sf::gmi::AxesCoord::getValue | ( | int | axis_loc | ) |
Returns the value in the array.
axis_loc | Axis location. |
value_type sf::gmi::AxesCoord::getValue | ( | int | axis_loc | ) | const |
Gets axis value of the passed axis.
axis_loc |
Vector3D sf::gmi::AxesCoord::getVector | ( | ) | const |
Gets the 3D vector formed by the XYZ axis.
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.
ac | Instance reference to be compared with. |
tol | Tolerance on the floating point comparison. |
bool sf::gmi::AxesCoord::isSet | ( | int | axis_loc | ) | const |
Returns true if value of location 'axis_loc' is available.
axis_loc |
AxesCoord & sf::gmi::AxesCoord::offset | ( | const Vector3D & | ofs | ) |
Adds an offset to the existing coordinate.
ofs | 3D vector offset. |
AxesCoord sf::gmi::AxesCoord::offsetBy | ( | const Vector3D & | ofs | ) | const |
Adds an offset to the coordinate and returns the new formed coord.
ofs |
bool sf::gmi::AxesCoord::operator!= | ( | const AxesCoord & | ac | ) | const |
Compare unequal operator using the default tolerance. Calls isEqual() under the hood.
Operator which sets the axes already set in this instance.
ac | Source instance. |
Adds only axis values form axes set in this instance.
ac | Source instance. |
Adds the axis value to the current value in the coord.
av |
Subtracts only axis values form axes set in this instance.
ac | Source instance. |
Subtracts the axis value to the current value in the coord.
av |
Assign the axis value to the value in the coord and enables it in the map.
av |
Assign the axis value to the value in the coord but does not enable the value in the map.
av |
bool sf::gmi::AxesCoord::operator== | ( | const AxesCoord & | ac | ) | const |
Compare equal operator using the default tolerance. Calls isEqual() under the hood.
AxesCoord & sf::gmi::AxesCoord::operator>> | ( | int | axis_loc | ) |
Unsets a axis value.
axis_loc | Axis location to remove. |
AxisValue sf::gmi::AxesCoord::operator[] | ( | size_t | axis_loc | ) | const |
Assigns a specific axis value to this structure.
axis_loc |
Operator which add the axes not yet set in this instance.
ac | Source instance. |
void sf::gmi::AxesCoord::set | ( | int | axis_loc, |
value_type | value | ||
) |
Sets an axis value.
axis_loc | The target axis sf::gmi::EAxisLocation. |
value | The axis value in axis units. |
void sf::gmi::AxesCoord::setMap | ( | int | map | ) |
Sets the bitmap of axes.
map |
AxesCoord & sf::gmi::AxesCoord::setVector | ( | const Vector3D & | vect | ) |
Sets the 3D vector formed by the XYZ axis.
vect | 3D vector. |
std::string sf::gmi::AxesCoord::toString | ( | ) | const |
Gets the string representation of the 2D vector formed like '(1.23,4.56)'.
void sf::gmi::AxesCoord::unset | ( | int | axis_loc | ) |
Unsets an axis value.
axis_loc |
|
staticconstexpr |
Tolerance for when comparing in the equal operator. Empirical chosen epsilon multiplier to make it work. Used in: sf::isEqual()