Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
orientation.h
Go to the documentation of this file.
1 #pragma once
2 
8 #include "vect.h"
9 
11 #ifndef _PI_DEFINED
12 #define _PI_DEFINED
13 static const double dPi = 3.141592653589793238462643383279502884197169399;
14 #endif
15 static const double dDegrad = 0.01745329251994329576923690768488; // pi/180
16 
45 class Orientation2 {
46 public:
48  BASE_EXPORT Orientation2() : normal_(0.0,1.0), normalUser_(0,1.0), definedByNormal_(true) { }
51  BASE_EXPORT explicit Orientation2(const DVect2 &dv2) : normal_(dv2.unit()), normalUser_(dv2) { }
53  BASE_EXPORT explicit Orientation2(const double &dip) : normal_(getNormFromDip(dip)), normalUser_(getNormFromDip(dip)) { }
55  BASE_EXPORT bool operator==(const Orientation2 &o) const { return (normal_==o.normal_); }
56  BASE_EXPORT bool operator!=(const Orientation2 &o) const { return !operator==(o); }
57 
59  BASE_EXPORT const DVect2 &getNormal() const { return normal_; }
61  BASE_EXPORT const DVect2 &getNormalUser() const { return normalUser_; }
63  BASE_EXPORT double getDip() const { return getDipFromNorm(normal_); }
65  BASE_EXPORT bool wasDefinedByNormal() const { return definedByNormal_; }
67  BASE_EXPORT double getJointAngle() const { return getJointAngleFromNorm(normal_); }
68 
70  BASE_EXPORT void setNormal(const DVect2 &norm) { normal_ = norm.unit(); normalUser_ = norm; definedByNormal_ = true; }
72  BASE_EXPORT void setDip(const double &dip) { normalUser_ = normal_ = getNormFromDip(dip); definedByNormal_ = false; }
74  BASE_EXPORT void setJointAngle(const double &ja) { normalUser_ = normal_ = getNormFromJointAngle(ja); }
75 
77  static BASE_EXPORT DVect2 getNormFromDip(const double &dip);
79  static BASE_EXPORT double getDipFromNorm(const DVect2 &norm);
81  static BASE_EXPORT DVect2 getNormFromJointAngle(const double &ja);
83  static BASE_EXPORT double getJointAngleFromNorm(const DVect2 &norm);
84 
85 private:
86  DVect2 normal_;
87  DVect2 normalUser_;
88  bool definedByNormal_ = false;
89 };
90 
94 class Orientation3 {
95 public:
101  BASE_EXPORT explicit Orientation3(const DVect3 &dv3);
103  BASE_EXPORT explicit Orientation3(const double &dip,const double &dd=0.0);
107  BASE_EXPORT bool operator==(const Orientation3 &o) const { return(normal_==o.normal_); }
108  BASE_EXPORT bool operator!=(const Orientation3 &o) const { return !operator==(o); }
109 
111  BASE_EXPORT const DVect3 &getNormal() const { return(normal_); }
113  BASE_EXPORT const DVect3 &getNormalUser() const { return(normalUser_); }
115  BASE_EXPORT DVect2 getDipDD() const { return(dipdd_); }
117  BASE_EXPORT double getDip() const { return(dipdd_.x()); }
119  BASE_EXPORT double getDipDirection() const { return(dipdd_.y()); }
122  BASE_EXPORT bool wasDefinedByNormal() const { return(definedByNormal_); }
124  BASE_EXPORT double getJointAngle() const { return getJointAngleFromNorm(normal_); }
126  BASE_EXPORT double getAzimuth() const { return getAzimuthFromNorm(normal_); }
128  BASE_EXPORT double getPlunge() const { return getPlungeFromNorm(normal_); }
129 
131  BASE_EXPORT void setNormal(const DVect3 &norm);
133  BASE_EXPORT void setNormalX(const double &x);
135  BASE_EXPORT void setNormalY(const double &y);
137  BASE_EXPORT void setNormalZ(const double &z);
139  BASE_EXPORT void setDipDD(const double &dip,const double &dd);
141  BASE_EXPORT void setDip(const double &dip);
143  BASE_EXPORT void setDipDirection(const double &dd);
147  BASE_EXPORT void setJointAngle(const double &angle);
150  BASE_EXPORT void setAzimuthPlunge(const double &azimuth,const double &plunge);
152  BASE_EXPORT bool isIn(const DVect3 &normal,const DVect2 &tol) const;
153 
154  // Handy dip/dd to normal 3D conversion routines.
156  static BASE_EXPORT DVect3 getNormFromDipDD(const double &dip,const double &dd);
158  static BASE_EXPORT DVect3 getVectorFromAzimuthPlunge(const double &az,const double &plunge);
159  // Handy dip/dd to normal 3D conversion routines.
161  static BASE_EXPORT DVect3 getNormFromAzimuthPlunge(const double &azimuth,const double &plunge);
164  static BASE_EXPORT DVect2 getDipDDFromNorm(const DVect3 &norm);
166  static BASE_EXPORT Double getJointAngleFromNorm(const DVect3 &norm);
169  static BASE_EXPORT double getAzimuthFromNorm(const DVect3 &norm);
172  static BASE_EXPORT double getPlungeFromNorm(const DVect3 &norm);
175  static BASE_EXPORT bool getLHS() { return lhs_; }
176  static BASE_EXPORT void setLHS(bool b) { lhs_ = b; }
177 
178 private:
179  DVect3 normal_;
180  DVect3 normalUser_;
181  DVect2 dipdd_;
182  bool definedByNormal_;
183  BASE_EXPORT static bool lhs_;
184 };
185 
187 // EOF
BASE_EXPORT Orientation2(const double &dip)
Explicit constructor, orientation defined by dip (in radians).
Definition: orientation.h:53
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:65
BASE_EXPORT bool wasDefinedByNormal() const
Definition: orientation.h:122
BASE_EXPORT double getJointAngle() const
Returns the joing angle of this orientation, in radians.
Definition: orientation.h:67
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:200
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:237
BASE_EXPORT void setDip(const double &dip)
Sets the orientaion by dip (in radians).
Definition: orientation.h:72
BASE_EXPORT const DVect3 & getNormal() const
Returns the unit normal of this orientation.
Definition: orientation.h:111
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:74
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:84
BASE_EXPORT Orientation2(const DVect2 &dv2)
Definition: orientation.h:51
2D and 3D vector utility classes.
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:12
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:181
BASE_EXPORT void setNormal(const DVect2 &norm)
Sets the orientation by normal. norm need not be a unit vector.
Definition: orientation.h:70
BASE_EXPORT void setJointAngle(const double &angle)
Definition: orientation.cpp:121
BASE_EXPORT double getDip() const
Returns the equivalent dip angle (in radians).
Definition: orientation.h:63
static BASE_EXPORT bool getLHS()
Definition: orientation.h:175
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition: orientation.h:94
BASE_EXPORT Orientation3()
Default 3D orientation is +Z normal vector.
Definition: orientation.cpp:35
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:190
static BASE_EXPORT DVect2 getNormFromJointAngle(const double &ja)
Converts from a joint angle (in radians) to a normal vector.
Definition: orientation.cpp:22
static BASE_EXPORT double getPlungeFromNorm(const DVect3 &norm)
Definition: orientation.cpp:252
#define BASE_EXPORT
Definition: basedef.h:21
static BASE_EXPORT DVect2 getDipDDFromNorm(const DVect3 &norm)
Definition: orientation.cpp:208
BASE_EXPORT const DVect3 & getNormalUser() const
Returns the normal vector specified by the user, which may not be a unit vector.
Definition: orientation.h:113
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:92
BASE_EXPORT bool operator==(const Orientation2 &o) const
Equality operator.
Definition: orientation.h:55
BASE_EXPORT void setAzimuthPlunge(const double &azimuth, const double &plunge)
Definition: orientation.cpp:143
BASE_EXPORT void setDipDirection(const double &dd)
Sets the dip direction in radians, the dip is held constant.
Definition: orientation.cpp:114
static BASE_EXPORT double getAzimuthFromNorm(const DVect3 &norm)
Definition: orientation.cpp:244
BASE_EXPORT double getPlunge() const
Returns plunge in radians.
Definition: orientation.h:128
BASE_EXPORT void setDip(const double &dip)
Sets dip in radians, the dip direction is held constant.
Definition: orientation.cpp:107
double Double
64 bit floating point
Definition: basedef.h:40
BASE_EXPORT void setDipDD(const double &dip, const double &dd)
Sets the dip and dip direction, in radians.
Definition: orientation.cpp:100
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:27
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:76
BASE_EXPORT const DVect2 & getNormalUser() const
Returns the normal vector as specified by the user, not necessarily of unit lengths.
Definition: orientation.h:61
BASE_EXPORT const Orientation3 & operator=(const Orientation3 &o)
Equality operator.
Definition: orientation.cpp:59
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition: orientation.h:45
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:149
static BASE_EXPORT void setLHS(bool b)
Definition: orientation.h:176
BASE_EXPORT double getAzimuth() const
Returns azimuth in radians.
Definition: orientation.h:126
BASE_EXPORT double getDip() const
Returns the dip in radians.
Definition: orientation.h:117
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 operator==(const Orientation3 &o) const
Comparison operator, by normal vector (unit, not user).
Definition: orientation.h:107
BASE_EXPORT const DVect2 & getNormal() const
Returns the unit normal vector of the orientation.
Definition: orientation.h:59
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:68
BASE_EXPORT Orientation2()
Default constructor – defaults to +Y is (0,1), defined by normal.
Definition: orientation.h:48
BASE_EXPORT DVect2 getDipDD() const
Returns the dip and dip direction (in radians) encoded in a DVect2. x = dip, y = dd.
Definition: orientation.h:115
BASE_EXPORT double getJointAngle() const
Returns joint angle in radians.
Definition: orientation.h:124
BASE_EXPORT double getDipDirection() const
Returns the dip direction in radians.
Definition: orientation.h:119