Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
AxesCoord.h
Go to the documentation of this file.
1#pragma once
3#include <gmi/iface/global.h>
4#include <math/Types.h>
5
6namespace sf::gmi
7{
8
13{
14 public:
18 typedef double value_type;
19
24
30 static constexpr auto tolerance = std::numeric_limits<value_type>::epsilon() * 10.0;
31
36
40 AxesCoord(const AxesCoord& ac);
41
45 explicit AxesCoord(const vector3d_type& vect);
46
52 explicit AxesCoord(const std::string& s, bool ignore_err = false) noexcept(false);
53
57 AxesCoord& operator=(const AxesCoord& ac);
58
62 void clear();
63
67 bool isEmpty() const;
68
74 void set(int axis_loc, value_type value);
75
80 void unset(int axis_loc);
81
87 bool isSet(int axis_loc) const;
88
94 value_type& getValue(int axis_loc);
95
101 value_type getValue(int axis_loc) const;
102
107 int getMap() const;
108
113 void setMap(int map);
114
119 std::string toString() const;
120
129 AxesCoord& fromString(const std::string& s, bool ignore_err = false) noexcept(false);
130
136 AxesCoord& operator<<(const AxisValue& av);
137
143 AxesCoord& operator=(const AxisValue& av);
144
150 AxesCoord& operator-=(const AxisValue& av);
151
157 AxesCoord& operator+=(const AxisValue& av);
158
164 AxesCoord& operator|=(const AxesCoord& ac);
165
171 AxesCoord& operator&=(const AxesCoord& ac);
172
178 AxesCoord& operator-=(const AxesCoord& ac);
179
185 AxesCoord& operator+=(const AxesCoord& ac);
186
190 enum ECompare : unsigned int
191 {
209 };
210
219 ECompare compare(const AxesCoord& ac, const AxesCoord& tolerances, const AxisLocations& rad_unlimited) const;
220
229 ECompare compare(const AxesCoord& ac, const AxesCoord& tolerances) const;
230
237 bool isEqual(const AxesCoord& ac, const AxesCoord& tolerances = {}) const;
238
244 AxesCoord& operator>>(int axis_loc);
245
251 AxisValue operator[](size_t axis_loc) const;
252
258 vector3d_type getVector(bool all = true) const;
259
267 AxesCoord& setVector(const vector3d_type& vect, bool all = true);
268
275
282
287
288 private:
292 TSet<int> _map;
296 value_type _data[alLastEntry];
297};
298
299}// namespace sf::gmi
300
301namespace sf
302{
303
310_GMI_FUNC std::ostream& operator<<(std::ostream& os, const gmi::AxesCoord& ac);
311
318_GMI_FUNC std::istream& operator>>(std::istream& is, gmi::AxesCoord& ac);
319
320}// namespace sf
Template class for managing bit maks preferably when bits are defined as enumerate values.
Definition TSet.h:14
3-dimensional vector for math operations.
Definition TVector3D.h:17
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:19
All axis values in one structure accompanied by some handy manipulation methods.
Definition AxesCoord.h:13
void setMap(int map)
Sets the bitmap of axes.
double value_type
Type the axes values are stored in.
Definition AxesCoord.h:18
AxesCoord & operator>>(int axis_loc)
Unsets a axis value.
ECompare compare(const AxesCoord &ac, const AxesCoord &tolerances, const AxisLocations &rad_unlimited) const
Compares two coordinates using a second coordinate containing max differences.
vector3d_type getVector(bool all=true) const
Gets the 3D vector formed by the XYZ axis.
AxesCoord & offset(const vector3d_type &ofs)
Adds an offset to the existing coordinate.
void clear()
Clears all values in the coordinate.
AxesCoord(const AxesCoord &ac)
Copy constructor.
AxesCoord(const vector3d_type &vect)
Initializing constructor using a 3D vector.
bool isEqual(const AxesCoord &ac, const AxesCoord &tolerances={}) const
Compares if the given coord is equal to this one using the compare() method.
std::string toString() const
Gets the string representation of coord '(1.23,,1.56,,,,,)'. When an axis is not enabled the designat...
AxesCoord & fromString(const std::string &s, bool ignore_err=false) noexcept(false)
Gets the vector value from the string representation formed like '(1.23,4.56,7.89)'....
int getMap() const
Gets the bitmap of set axes.
TVector< AxesCoord > Vector
Type definition.
Definition AxesCoord.h:286
bool isEmpty() const
Gets empty status on when no axes are set.
AxesCoord & setVector(const vector3d_type &vect, bool all=true)
Sets the 3D vector formed by the XYZ axis.
bool isSet(int axis_loc) const
Returns true if value of location 'axis_loc' is available.
ECompare
Result of the compare function.
Definition AxesCoord.h:191
@ crEQUAL
Both values are exactly the same according to the max-diff values. All specified values are equal to ...
Definition AxesCoord.h:196
@ crNOT_EQUAL
One of the values specified in both instances were not equal.
Definition AxesCoord.h:208
@ crOTHER_EQUAL
Other instance specified values are the same as these instance values. Only for the by the other inst...
Definition AxesCoord.h:204
@ crTHIS_EQUAL
This instance specified values are the same as the other instance values. Only for the by this instan...
Definition AxesCoord.h:200
value_type & getValue(int axis_loc)
Returns the value in the array.
AxisValue operator[](size_t axis_loc) const
Assigns a specific axis value to this structure.
AxesCoord()
Default constructor.
void set(int axis_loc, value_type value)
Sets an axis value.
AxesCoord offsetBy(const vector3d_type &ofs) const
Adds an offset to the coordinate and returns the new formed coord.
void unset(int axis_loc)
Unsets an axis value.
ECompare compare(const AxesCoord &ac, const AxesCoord &tolerances) const
Compares two coordinates using a second coordinate containing max differences. Tests only the values ...
static constexpr auto tolerance
Tolerance for when comparing in the equal operator. Empirical chosen epsilon multiplier to make it wo...
Definition AxesCoord.h:30
AxesCoord(const std::string &s, bool ignore_err=false) noexcept(false)
Constructor using a string containing the axis values.
TVector3D< value_type > vector3d_type
Type for the 3D vector.
Definition AxesCoord.h:23
Single position, speed or acceleration value of a specific axis.
Definition GmiTypes.h:175
#define _GMI_FUNC
Definition gmi/iface/global.h:34
#define _GMI_CLASS
Definition gmi/iface/global.h:35
Definition AxesCoord.h:7
TSet< EAxisLocation > AxisLocations
Bitmap set of axis locations.
Definition GmiTypes.h:142
@ alLastEntry
The last entry used in iterations.
Definition GmiTypes.h:132
Definition Application.h:10
_GII_FUNC std::istream & operator>>(std::istream &is, ResultData &)
Stream operator for setting up this instance with a setup std::string.
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.