Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
caxes.h
Go to the documentation of this file.
1 #pragma once
2 
8 #include "vect.h"
9 #include "avect.h"
10 #include "orientation.h"
11 
13 
25 class CAxes2D {
26 public:
30  BASE_EXPORT CAxes2D(const CAxes2D &a) : d1_(a.d1_) { }
33  BASE_EXPORT CAxes2D(const DVect2 &vx);
36  BASE_EXPORT explicit CAxes2D(const Double &dip) { setOrientation(dip); }
39  BASE_EXPORT explicit CAxes2D(const Orientation2 &o) { setOrientation(o); }
40 
42  BASE_EXPORT const CAxes2D &operator=(const CAxes2D &a) { d1_=a.d1_; return *this; }
44  BASE_EXPORT bool operator==(const CAxes2D &a) const;
46  BASE_EXPORT bool operator!=(const CAxes2D &a) const { return !operator==(a); }
47 
49  BASE_EXPORT void setOrientation(const Double &dip);
52 
54  BASE_EXPORT const DVect2 &e1() const { return d1_; }
56  BASE_EXPORT DVect2 e2() const { return DVect2(-d1_.y(),d1_.x()); }
57 
60  BASE_EXPORT DVect2 &re1() { return d1_; }
61 
63  BASE_EXPORT DVect2 toLocal(const DVect2 &v) const;
65  BASE_EXPORT const DAVect2 &toLocal(const DAVect2 &v) const { return v; }
67  BASE_EXPORT DVect2 toGlobal(const DVect2 &v) const;
69  BASE_EXPORT const DAVect2 &toGlobal(const DAVect2 &v) const { return v; }
71  BASE_EXPORT DVect2 getDir(unsigned int dof) const;
73  BASE_EXPORT Orientation2 getOrientation(unsigned int dof=0) const;
74 
75  // Static
77  static BASE_EXPORT CAxes2D make(const DVect2 &y);
79  static BASE_EXPORT CAxes2D makeX(const DVect2 &x);
81  static BASE_EXPORT CAxes2D make(const Orientation2 &o);
83  static BASE_EXPORT CAxes2D makeX(const Orientation2 &o);
86  static BASE_EXPORT void setTolerance(const double &d);
87 private:
88  DVect2 d1_;
89 };
90 
92 
103 class CAxes3D {
104 public:
108  BASE_EXPORT CAxes3D(const CAxes3D &a) : d1_(a.d1_), d2_(a.d2_) { }
110  BASE_EXPORT explicit CAxes3D(const CAxes2D &a) : d1_(toVect3(a.e1())), d2_(toVect3(a.e2())) { }
113  BASE_EXPORT CAxes3D(const DVect3 &vx, const DVect3 &vy);
119  BASE_EXPORT CAxes3D(const Double &dip, const Double &ddir, const Double &roll=0.0) { setOrientation(dip,ddir,roll); }
122  BASE_EXPORT explicit CAxes3D(const Orientation3 &o,const Double &roll=0.0) { setOrientation(o,roll); }
123 
125  BASE_EXPORT const CAxes3D &operator=(const CAxes3D &a) { d1_=a.d1_; d2_=a.d2_; return *this; }
127  BASE_EXPORT bool operator==(const CAxes3D &a) const;
129  BASE_EXPORT bool operator!=(const CAxes3D &a) const { return !operator==(a); }
130 
134  BASE_EXPORT void setOrientation(const Double &dip, const Double &ddir, const Double &roll=0.0); // radians
137  BASE_EXPORT void setOrientation(const Orientation3 &o,const Double &roll=0.0);
138 
140  BASE_EXPORT const DVect3 &e1() const { return d1_; }
142  BASE_EXPORT const DVect3 &e2() const { return d2_; }
144  BASE_EXPORT DVect3 e3() const { return d1_&d2_; }
145 
148  BASE_EXPORT DVect3 &re1() { return d1_; }
151  BASE_EXPORT DVect3 &re2() { return d2_; }
152 
154  BASE_EXPORT DVect3 toLocal(const DVect3 &v) const;
156  BASE_EXPORT DVect3 toGlobal(const DVect3 &v) const;
158  BASE_EXPORT DVect3 getDir(unsigned int dof) const;
160  BASE_EXPORT Orientation3 getOrientation(unsigned int dof=0) const;
163  BASE_EXPORT Double getRoll() const;
164 
165  // Static
170  static BASE_EXPORT CAxes3D make(const DVect3 &z,const Double &roll=0.0);
173  static BASE_EXPORT CAxes3D makeX(const DVect3 &x,const Double &roll=0.0);
178  static BASE_EXPORT CAxes3D make(const Orientation3 &o,const Double &roll=0.0);
181  static BASE_EXPORT CAxes3D makeX(const Orientation3 &o,const Double &roll=0.0);
184  static BASE_EXPORT void setTolerance(const double &d); // Defaults to 1e-6
185 private:
186  DVect3 d1_;
187  DVect3 d2_;
188 };
189 
191 // EOF
Class for specifying a particular 2D cartesian axes system, and converting to and from it.
Definition: caxes.h:25
Class for specifying a particular 3D cartesian axes system, and converting to and from it.
Definition: caxes.h:103
static BASE_EXPORT CAxes3D make(const DVect3 &z, const Double &roll=0.0)
Definition: caxes.cpp:182
BASE_EXPORT DVect2 & re1()
Definition: caxes.h:60
BASE_EXPORT DVect3 & re2()
Definition: caxes.h:151
BASE_EXPORT DVect3 getDir(unsigned int dof) const
Return e1, e2, or e3 based on degree-of-freedom (0-2)
Definition: caxes.cpp:149
BASE_EXPORT bool operator==(const CAxes2D &a) const
Comparison operator.
Definition: caxes.cpp:38
Class for storing an "orientation", or a direction in 2D or 3D space.
BASE_EXPORT DVect3 e3() const
The z unit direction.
Definition: caxes.h:144
BASE_EXPORT CAxes3D(const Double &dip, const Double &ddir, const Double &roll=0.0)
Definition: caxes.h:119
BASE_EXPORT CAxes2D(const Orientation2 &o)
Definition: caxes.h:39
BASE_EXPORT const CAxes3D & operator=(const CAxes3D &a)
Equality operator.
Definition: caxes.h:125
2D and 3D vector utility classes.
static BASE_EXPORT void setTolerance(const double &d)
Definition: caxes.cpp:205
BASE_EXPORT bool operator==(const CAxes3D &a) const
Comparison operator.
Definition: caxes.cpp:142
BASE_EXPORT void setOrientation(const Double &dip)
Specifies a new orientation for the axes, by dip (in radians).
Definition: caxes.cpp:14
BASE_EXPORT const DVect3 & e1() const
The x unit direction.
Definition: caxes.h:140
BASE_EXPORT DVect3 toGlobal(const DVect3 &v) const
Converts a vector from this system to a "global" system.
Definition: caxes.cpp:133
BASE_EXPORT CAxes2D()
Default construction, no initialization of data.
Definition: caxes.h:28
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition: orientation.h:94
BASE_EXPORT bool operator!=(const CAxes2D &a) const
Comparison operator.
Definition: caxes.h:46
BASE_EXPORT CAxes3D(const CAxes3D &a)
Copy constructor.
Definition: caxes.h:108
BASE_EXPORT CAxes2D(const Double &dip)
Definition: caxes.h:36
#define BASE_EXPORT
Definition: basedef.h:21
BASE_EXPORT DVect3 & re1()
Definition: caxes.h:148
BASE_EXPORT Orientation2 getOrientation(unsigned int dof=0) const
Returns the equivalent orientation of degree-of-freedom dof (0-1)
Definition: caxes.cpp:57
BASE_EXPORT bool operator!=(const CAxes3D &a) const
Comparison operator.
Definition: caxes.h:129
BASE_EXPORT const CAxes2D & operator=(const CAxes2D &a)
Equality operator.
Definition: caxes.h:42
BASE_EXPORT DVect3 toLocal(const DVect3 &v) const
Converts a vector from "global" (cartesian) system to this system.
Definition: caxes.cpp:128
BASE_EXPORT CAxes2D(const CAxes2D &a)
Copy constructor.
Definition: caxes.h:30
BASE_EXPORT CAxes3D(const CAxes2D &a)
Explicit construction from CAxes2D. e3() = (0,0,1).
Definition: caxes.h:110
Angular Vectors.
BASE_EXPORT const DVect2 & e1() const
The x unit vector.
Definition: caxes.h:54
BASE_EXPORT CAxes3D()
Default constructor, no initialization of data.
Definition: caxes.h:106
static BASE_EXPORT void setTolerance(const double &d)
Definition: caxes.cpp:75
BASE_EXPORT CAxes3D(const Orientation3 &o, const Double &roll=0.0)
Definition: caxes.h:122
double Double
64 bit floating point
Definition: basedef.h:40
BASE_EXPORT const DVect3 & e2() const
The y unit direction.
Definition: caxes.h:142
static BASE_EXPORT CAxes2D makeX(const DVect2 &x)
Creates an Axes using vector x in the +x direction (need not be unit).
Definition: caxes.cpp:69
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition: orientation.h:45
BASE_EXPORT void setOrientation(const Double &dip, const Double &ddir, const Double &roll=0.0)
Definition: caxes.cpp:85
BASE_EXPORT const DAVect2 & toGlobal(const DAVect2 &v) const
Convert DAVect2 v from this system to a "global" system (identity transformation).
Definition: caxes.h:69
BASE_EXPORT DVect2 toLocal(const DVect2 &v) const
Convert Dvect2 v from "global" system to this system.
Definition: caxes.cpp:27
BASE_EXPORT DVect2 getDir(unsigned int dof) const
Return e1 or e2 given degree-of-freedom dof (0-1)
Definition: caxes.cpp:44
BASE_EXPORT const DAVect2 & toLocal(const DAVect2 &v) const
Convert DAVect2 v from "global" system to this system (identity transformation).
Definition: caxes.h:65
BASE_EXPORT Orientation3 getOrientation(unsigned int dof=0) const
Returns equivalent orientation of e1, e2, or e2 based on degree-of-freedom (0-2)
Definition: caxes.cpp:164
BASE_EXPORT DVect2 toGlobal(const DVect2 &v) const
Convert DVect2 v from this system to a "global" system.
Definition: caxes.cpp:32
static BASE_EXPORT CAxes2D make(const DVect2 &y)
Creates an Axes using vector y in the +y direction (need not be unit).
Definition: caxes.cpp:63
static BASE_EXPORT CAxes3D makeX(const DVect3 &x, const Double &roll=0.0)
Definition: caxes.cpp:189
BASE_EXPORT Double getRoll() const
Definition: caxes.cpp:170
Vector3< T > toVect3(const Vector2< T > &v, const T &t=0)
Conversion between vectors of different dimension.
Definition: vect.h:339
BASE_EXPORT DVect2 e2() const
The y unit vector.
Definition: caxes.h:56