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
25 static constexpr auto tolerance = std::numeric_limits<value_type>::epsilon() * 10.0;
26
31
35 AxesCoord(const AxesCoord& ac);
36
41
46 explicit AxesCoord(const std::string& s);
47
51 void clear();
52
56 bool isEmpy() const;
57
63 void set(int axis_loc, value_type value);
64
69 void unset(int axis_loc);
70
76 bool isSet(int axis_loc) const;
77
83 value_type& getValue(int axis_loc);
84
90 value_type getValue(int axis_loc) const;
91
96 int getMap() const;
97
102 void setMap(int map);
103
107 std::string toString() const;
108
117 AxesCoord& fromString(const std::string& s, bool ignore_err = false) noexcept(false);
118
124 AxesCoord& operator<<(const AxisValue& av);
125
131 AxesCoord& operator=(const AxisValue& av);
132
138 AxesCoord& operator-=(const AxisValue& av);
139
145 AxesCoord& operator+=(const AxisValue& av);
146
154 bool isEqual(const AxesCoord& ac, value_type tol = tolerance) const;
159 bool operator==(const AxesCoord& ac) const;
160
165 bool operator!=(const AxesCoord& ac) const;
166
172 AxesCoord& operator|=(const AxesCoord& ac);
173
179 AxesCoord& operator&=(const AxesCoord& ac);
180
186 AxesCoord& operator-=(const AxesCoord& ac);
187
193 AxesCoord& operator+=(const AxesCoord& ac);
194
198 enum ECompare : unsigned int
199 {
204 crEQUAL = 0,
208 crTHIS_EQUAL = 1,
212 crOTHER_EQUAL = 2,
216 crNOT_EQUAL = 3
217 };
218
227 ECompare compare(const AxesCoord& ac, const AxesCoord& tolerance) const;
228
236 ECompare compare(const AxesCoord& ac, const AxesCoord& tolerance, const AxisLocations& rad_unlimited) const;
237
243 AxesCoord& operator>>(int axis_loc);
244
250 AxisValue operator[](size_t axis_loc) const;
251
256 Vector3D getVector() const;
257
263 AxesCoord& setVector(const Vector3D& vect);
264
270 AxesCoord& offset(const Vector3D& ofs);
271
277 AxesCoord offsetBy(const Vector3D& ofs) const;
278
283
284 private:
288 TSet<int> _map;
292 value_type _data[alLastEntry];
293};
294
295}// namespace sf::gmi
296
297namespace sf
298{
299
306_GMI_FUNC std::ostream& operator<<(std::ostream& os, const gmi::AxesCoord& ac);
307
314_GMI_FUNC std::istream& operator>>(std::istream& is, gmi::AxesCoord& ac);
315
316}// namespace sf
Template class for managing bit maks preferably when bits are defined as enumerate values.
Definition TSet.h:14
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
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.
AxesCoord & offset(const Vector3D &ofs)
Adds an offset to the existing coordinate.
bool isEmpy() const
Gets empty status on when no axes are set.
AxesCoord & setVector(const Vector3D &vect)
Sets the 3D vector formed by the XYZ axis.
void clear()
Clears all values in the coordinate.
AxesCoord(const std::string &s)
Constructor using a string containing the axis values.
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(const AxesCoord &ac)
Copy constructor.
std::string toString() const
Gets the string representation of the 2D vector formed like '(1.23,4.56)'.
Vector3D getVector() const
Gets the 3D vector formed by the XYZ axis.
AxesCoord & operator=(const AxesCoord &ac)
Assignment operator.
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)'....
AxesCoord offsetBy(const Vector3D &ofs) const
Adds an offset to the coordinate and returns the new formed coord.
int getMap() const
Gets the bitmap of set axes.
value_type getValue(int axis_loc) const
Gets axis value of the passed axis.
TVector< AxesCoord > Vector
Type definition.
Definition AxesCoord.h:282
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:199
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.
void unset(int axis_loc)
Unsets an axis value.
ECompare compare(const AxesCoord &ac, const AxesCoord &tolerance) const
Compares two coordinates using a second coordinate containing max differences. Tests only the values ...
Single position, speed or acceleration value of a specific axis.
Definition GmiTypes.h:174
#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:141
@ alLastEntry
Last entry used in iterations.
Definition GmiTypes.h:131
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.