Geophysical Inversion and Modelling Library v1.5.4
Loading...
Searching...
No Matches
plane.h
1/******************************************************************************
2 * Copyright (C) 2007-2024 by the GIMLi development team *
3 * Carsten Rücker carsten@resistivity.net *
4 * *
5 * Licensed under the Apache License, Version 2.0 (the "License"); *
6 * you may not use this file except in compliance with the License. *
7 * You may obtain a copy of the License at *
8 * *
9 * http://www.apache.org/licenses/LICENSE-2.0 *
10 * *
11 * Unless required by applicable law or agreed to in writing, software *
12 * distributed under the License is distributed on an "AS IS" BASIS, *
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 * See the License for the specific language governing permissions and *
15 * limitations under the License. *
16 * *
17 ******************************************************************************/
18
19#ifndef _GIMLI_PLANE__H
20#define _GIMLI_PLANE__H
21
22#include "gimli.h"
23#include "pos.h"
24
25namespace GIMLI{
26
28
30class DLLEXPORT Plane{
31public:
33 Plane();
34
36 Plane(const RVector3 & norm, double d);
37
39 Plane(const RVector3 & norm, const RVector3 & x0);
40
42 Plane(const RVector3 & p0, const RVector3 & p1, const RVector3 & p2);
43
45 Plane(double a, double b, double c, double d);
46
48 Plane(const Plane & plane);
49
51 ~Plane();
52
54 Plane & operator = (const Plane & plane);
55
57 inline bool operator == (const Plane & plane){
58 return this->compare(plane);
59 }
60
62 inline bool operator != (const Plane & plane){
63 return !(*this== plane);
64 }
65
69 bool compare(const Plane & p, double tol=TOLERANCE, bool bothDirs=false);
70
71
74 bool touch (const RVector3 & pos, double tol = TOLERANCE);
75
78 Line intersect(const Plane & plane, double tol = TOLERANCE);
79
83 RVector3 intersect(const Line & line, double tol = TOLERANCE, bool inside = false);
84
87 inline const RVector3 & norm() const { return norm_; }
88
90 inline const RVector3 x0() const { return norm_ * d_; }
91
93 inline double distance(const RVector3 & pos) const { return norm_.dot(pos) - d_ ; }
94
96 inline double d() const { return d_; }
97
99 bool checkValidity(double tol = TOLERANCE);
100
102 inline bool valid() const { return valid_; }
103
104protected:
105
107 void copy_(const Plane & plane);
108
109 RVector3 norm_;
110 double d_;
111 bool valid_;
112};
113
114std::ostream & operator << (std::ostream & str, const Plane & p);
115
116} //namespace GIMLI
117
118#endif // _GIMLI_PLANE__H
A line.
Definition line.h:30
A plane.
Definition plane.h:30
double distance(const RVector3 &pos) const
Definition plane.h:93
const RVector3 x0() const
Definition plane.h:90
const RVector3 & norm() const
Definition plane.h:87
bool compare(const Plane &p, double tol=TOLERANCE, bool bothDirs=false)
Definition plane.cpp:190
double d() const
Definition plane.h:96
bool valid() const
Definition plane.h:102
Plane()
Definition plane.cpp:36
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24