Itasca C++ Interface
Loading...
Searching...
No Matches
orientation.h
Go to the documentation of this file.
1#pragma once
8#include "vect.h"
9
11#ifndef _PI_DEFINED
12#define _PI_DEFINED
13static constexpr double dPi = 3.141592653589793238462643383279502884197169399;
14#endif
15static constexpr double dDegrad = 0.01745329251994329576923690768488; // pi/180
16static constexpr double cosSmallDeg = 9.999999998476913e-01; // cosine of 0.001 degrees
17static constexpr double cosHalfDeg = 9.999619230641713e-01; // cosine of 0.5 degrees
18static constexpr double cosOneDeg = 9.998476951563913e-01; // cosine of 1 degree
19static constexpr double cosTwoDeg = 9.993908270190958e-01; // cosine of 2 degrees
20static constexpr double cosFiveDeg = 9.961946980917455e-01; // cosine of 5 degrees
21
51public:
53 BASE_EXPORT Orientation2() : normal_(0.0,1.0), normalUser_(0,1.0), definedByNormal_(true) { }
56 BASE_EXPORT explicit Orientation2(const DVect2 &dv2) : normal_(dv2.unit()), normalUser_(dv2) { }
58 BASE_EXPORT explicit Orientation2(const double &dip) : normal_(getNormFromDip(dip)), normalUser_(getNormFromDip(dip)) { }
60 BASE_EXPORT bool operator==(const Orientation2 &o) const { return (normal_==o.normal_); }
61 BASE_EXPORT bool operator!=(const Orientation2 &o) const { return !operator==(o); }
62
64 BASE_EXPORT const DVect2 &getNormal() const { return normal_; }
66 BASE_EXPORT const DVect2 &getNormalUser() const { return normalUser_; }
68 BASE_EXPORT double getDip() const { return getDipFromNorm(normal_); }
70 BASE_EXPORT bool wasDefinedByNormal() const { return definedByNormal_; }
72 BASE_EXPORT double getJointAngle() const { return getJointAngleFromNorm(normal_); }
73
75 BASE_EXPORT void setNormal(const DVect2 &norm) { normal_ = norm.unit(); normalUser_ = norm; definedByNormal_ = true; }
77 BASE_EXPORT void setDip(const double &dip) { normalUser_ = normal_ = getNormFromDip(dip); definedByNormal_ = false; }
79 BASE_EXPORT void setJointAngle(const double &ja) { normalUser_ = normal_ = getNormFromJointAngle(ja); }
80
82 static BASE_EXPORT DVect2 getNormFromDip(const double &dip);
84 static BASE_EXPORT double getDipFromNorm(const DVect2 &norm);
86 static BASE_EXPORT DVect2 getNormFromJointAngle(const double &ja);
88 static BASE_EXPORT double getJointAngleFromNorm(const DVect2 &norm);
89
90private:
91 DVect2 normal_;
92 DVect2 normalUser_;
93 bool definedByNormal_ = false;
94};
95
100public:
106 BASE_EXPORT explicit Orientation3(const DVect3 &dv3);
108 BASE_EXPORT explicit Orientation3(const double &dip,const double &dd=0.0);
112 BASE_EXPORT bool operator==(const Orientation3 &o) const { return(normal_==o.normal_); }
113 BASE_EXPORT bool operator!=(const Orientation3 &o) const { return !operator==(o); }
114
116 BASE_EXPORT const DVect3 &getNormal() const { return(normal_); }
118 BASE_EXPORT const DVect3 &getNormalUser() const { return(normalUser_); }
120 BASE_EXPORT DVect2 getDipDD() const { return(dipdd_); }
122 BASE_EXPORT double getDip() const { return(dipdd_.x()); }
124 BASE_EXPORT double getDipDirection() const { return(dipdd_.y()); }
127 BASE_EXPORT bool wasDefinedByNormal() const { return(definedByNormal_); }
129 BASE_EXPORT double getJointAngle() const { return getJointAngleFromNorm(normal_); }
131 BASE_EXPORT double getAzimuth() const { return getAzimuthFromNorm(normal_); }
133 BASE_EXPORT double getPlunge() const { return getPlungeFromNorm(normal_); }
134
136 BASE_EXPORT void setNormal(const DVect3 &norm);
138 BASE_EXPORT void setNormalX(const double &x);
140 BASE_EXPORT void setNormalY(const double &y);
142 BASE_EXPORT void setNormalZ(const double &z);
144 BASE_EXPORT void setDipDD(const double &dip,const double &dd);
146 BASE_EXPORT void setDip(const double &dip);
148 BASE_EXPORT void setDipDirection(const double &dd);
152 BASE_EXPORT void setJointAngle(const double &angle);
155 BASE_EXPORT void setAzimuthPlunge(const double &azimuth,const double &plunge);
157 BASE_EXPORT bool isIn(const DVect3 &normal,const DVect2 &tol) const;
158
159 // Handy dip/dd to normal 3D conversion routines.
161 static BASE_EXPORT DVect3 getNormFromDipDD(const double &dip,const double &dd);
163 static BASE_EXPORT DVect3 getVectorFromAzimuthPlunge(const double &az,const double &plunge);
164 // Handy dip/dd to normal 3D conversion routines.
166 static BASE_EXPORT DVect3 getNormFromAzimuthPlunge(const double &azimuth,const double &plunge);
169 static BASE_EXPORT DVect2 getDipDDFromNorm(const DVect3 &norm);
171 static BASE_EXPORT double getJointAngleFromNorm(const DVect3 &norm);
174 static BASE_EXPORT double getAzimuthFromNorm(const DVect3 &norm);
177 static BASE_EXPORT double getPlungeFromNorm(const DVect3 &norm);
180 static BASE_EXPORT bool getLHS() { return lhs_; }
181 static BASE_EXPORT void setLHS(bool b) { lhs_ = b; }
182
183private:
184 DVect3 normal_;
185 DVect3 normalUser_;
186 DVect2 dipdd_;
187 bool definedByNormal_ = false;
188 BASE_EXPORT static bool lhs_;
189};
190
192// EOF
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition orientation.h:50
BASE_EXPORT Orientation2(const double &dip)
Explicit constructor, orientation defined by dip (in radians).
Definition orientation.h:58
BASE_EXPORT void setJointAngle(const double &ja)
Can be used to set a full normal vector, but returned joint angle is still always between 0 and 180.
Definition orientation.h:79
BASE_EXPORT const DVect2 & getNormal() const
Returns the unit normal vector of the orientation.
Definition orientation.h:64
BASE_EXPORT Orientation2()
Default constructor – defaults to +Y is (0,1), defined by normal.
Definition orientation.h:53
BASE_EXPORT Orientation2(const DVect2 &dv2)
Definition orientation.h:56
static BASE_EXPORT DVect2 getNormFromDip(const double &dip)
Converts from a dip (in radians) to a normal vector.
Definition orientation.cpp:6
BASE_EXPORT bool wasDefinedByNormal() const
Returs true if the orientation was specific by a normal vector, false if it was specified by dip.
Definition orientation.h:70
BASE_EXPORT void setNormal(const DVect2 &norm)
Sets the orientation by normal. norm need not be a unit vector.
Definition orientation.h:75
static BASE_EXPORT double getJointAngleFromNorm(const DVect2 &norm)
Converts from a normal vector (need not be unit) to a joint angle in radians.
Definition orientation.cpp:24
static BASE_EXPORT DVect2 getNormFromJointAngle(const double &ja)
Converts from a joint angle (in radians) to a normal vector.
Definition orientation.cpp:20
BASE_EXPORT void setDip(const double &dip)
Sets the orientaion by dip (in radians).
Definition orientation.h:77
static BASE_EXPORT double getDipFromNorm(const DVect2 &norm)
Converts from a normal vector (need not be unit) to a dip in radians.
Definition orientation.cpp:11
BASE_EXPORT const DVect2 & getNormalUser() const
Returns the normal vector as specified by the user, not necessarily of unit lengths.
Definition orientation.h:66
BASE_EXPORT bool operator==(const Orientation2 &o) const
Equality operator.
Definition orientation.h:60
BASE_EXPORT double getJointAngle() const
Returns the joing angle of this orientation, in radians.
Definition orientation.h:72
BASE_EXPORT double getDip() const
Returns the equivalent dip angle (in radians).
Definition orientation.h:68
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition orientation.h:99
BASE_EXPORT const Orientation3 & operator=(const Orientation3 &o)
Equality operator.
Definition orientation.cpp:48
static BASE_EXPORT double getAzimuthFromNorm(const DVect3 &norm)
Definition orientation.cpp:214
BASE_EXPORT DVect2 getDipDD() const
Returns the dip and dip direction (in radians) encoded in a DVect2. x = dip, y = dd.
Definition orientation.h:120
BASE_EXPORT bool operator==(const Orientation3 &o) const
Comparison operator, by normal vector (unit, not user).
Definition orientation.h:112
BASE_EXPORT void setAzimuthPlunge(const double &azimuth, const double &plunge)
Definition orientation.cpp:120
static BASE_EXPORT void setLHS(bool b)
Definition orientation.h:181
static BASE_EXPORT DVect3 getNormFromAzimuthPlunge(const double &azimuth, const double &plunge)
Converts from a dip and dip direction (in radians) to a normal vector.
Definition orientation.cpp:174
BASE_EXPORT void setNormalX(const double &x)
Sets the X-component of the normal user vector, the other components are held constant.
Definition orientation.cpp:63
BASE_EXPORT void setDip(const double &dip)
Sets dip in radians, the dip direction is held constant.
Definition orientation.cpp:90
BASE_EXPORT Orientation3()
Default 3D orientation is +Z normal vector.
Definition orientation.cpp:31
BASE_EXPORT void setNormal(const DVect3 &norm)
Sets the normal vector – this value need not be a unit vector, and it is recoverable in getNormalUser...
Definition orientation.cpp:56
static BASE_EXPORT DVect2 getDipDDFromNorm(const DVect3 &norm)
Definition orientation.cpp:181
BASE_EXPORT void setNormalY(const double &y)
Sets the Y-component of the normal user vector, the other components are held constant.
Definition orientation.cpp:70
BASE_EXPORT double getDipDirection() const
Returns the dip direction in radians.
Definition orientation.h:124
static BASE_EXPORT DVect3 getNormFromDipDD(const double &dip, const double &dd)
Converts from a dip and dip direction (in radians) to a normal vector.
Definition orientation.cpp:157
BASE_EXPORT void setJointAngle(const double &angle)
Definition orientation.cpp:102
BASE_EXPORT double getDip() const
Returns the dip in radians.
Definition orientation.h:122
static BASE_EXPORT double getJointAngleFromNorm(const DVect3 &norm)
Converts a normal vector (need not be unit) to a joint angle in radians.
Definition orientation.cpp:208
BASE_EXPORT void setDipDirection(const double &dd)
Sets the dip direction in radians, the dip is held constant.
Definition orientation.cpp:96
BASE_EXPORT void setDipDD(const double &dip, const double &dd)
Sets the dip and dip direction, in radians.
Definition orientation.cpp:84
static BASE_EXPORT double getPlungeFromNorm(const DVect3 &norm)
Definition orientation.cpp:221
BASE_EXPORT double getPlunge() const
Returns plunge in radians.
Definition orientation.h:133
BASE_EXPORT double getAzimuth() const
Returns azimuth in radians.
Definition orientation.h:131
BASE_EXPORT bool wasDefinedByNormal() const
Definition orientation.h:127
BASE_EXPORT double getJointAngle() const
Returns joint angle in radians.
Definition orientation.h:129
static BASE_EXPORT DVect3 getVectorFromAzimuthPlunge(const double &az, const double &plunge)
Converts from azimuth and plunge (in radians) to the corresponding vector.
Definition orientation.cpp:165
BASE_EXPORT const DVect3 & getNormal() const
Returns the unit normal of this orientation.
Definition orientation.h:116
BASE_EXPORT void setNormalZ(const double &z)
Sets the Z-component of the normal user vector, the other components are held constant.
Definition orientation.cpp:77
static BASE_EXPORT bool getLHS()
Definition orientation.h:180
BASE_EXPORT bool isIn(const DVect3 &normal, const DVect2 &tol) const
Utility class, returns TRUE if normal is within tolerance of this orientation.
Definition orientation.cpp:125
BASE_EXPORT const DVect3 & getNormalUser() const
Returns the normal vector specified by the user, which may not be a unit vector.
Definition orientation.h:118
#define BASE_EXPORT
Definition basedef.h:24
2D and 3D vector utility classes.