OpendTect  6.3
linear.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H.Bril
8  Date: Jan 2005
9 ________________________________________________________________________
10 
11 -*/
12 
13 
14 #include "algomod.h"
15 #include "coord.h"
16 #include "mathfunc.h"
17 
18 class Plane3;
19 
24 template <class T>
25 mClass(Algo) LineParameters : public MathFunction<T,T>
26 {
27 public:
28  LineParameters( T i0=0, T i1=0 )
29  : a0(i0), ax(i1) {}
30 
31  inline T getValue( T x ) const
32  { return a0 + ax * x; }
33  inline T getXValue( T y ) const
34  { return ax ? (y - a0) / ax : 0; }
35  inline T getProjectedX( T x, T y ) const
36  { return (x + ax * (y - a0)) / (1 + ax * ax); }
37  inline T getValue( const T* x ) const
38  { return getValue(*x); }
39 
40  T a0, ax;
41 };
42 
44 
45 
50 template <class T>
52 {
53 public:
54  PlaneParameters( T i0=0, T i1=0, T i2=0 )
55  : a0(i0), ax(i1), ay(i2) {}
56 
57  inline T getValue( T x, T y ) const
58  { return a0 + ax * x + ay * y; }
59  inline T getValue( const T* x ) const
60  { return getValue(x[0],x[1]); }
61 
62  T a0, ax, ay;
63 
64 };
65 
67 
68 
74 {
75 public:
76  LinStats2D() : corrcoeff(0) {}
77 
80  float corrcoeff;
81 
82  void use(const float*,const float*,int nrpts);
83  void use(const Geom::Point2D<float>*,int nrpts);
84 };
85 
86 
92 {
93 public:
94  LinStats3D() : corrcoeff(0) {}
95 
98  float corrcoeff;
99 
100 };
101 
104 {
105 public:
106  Plane3DFit();
107 
108  bool compute(const TypeSet<Coord3>& points,Plane3& result);
109 
110 protected:
111 
112  void setScatterMatrix(double scattermatrix[3][3],
113  int order[3]);
114  void tqli(double d[3],double e[3],double z[3][3]);
115  void tred2(double a[3][3],double d[3],double e[3]);
116 
119 };
LineParameters< float > LinePars
Definition: linear.h:43
#define mExpClass(module)
Definition: commondefs.h:157
T getXValue(T y) const
Definition: linear.h:33
Steepness and intercept.
Definition: linear.h:25
LinePars lp
Parameters.
Definition: linear.h:78
PlanePars sd
Standard deviations in parameters.
Definition: linear.h:97
T ay
Definition: linear.h:62
LineParameters(T i0=0, T i1=0)
Definition: linear.h:28
Mathematical function.
Definition: mathfunc.h:59
linear stats in 2D.
Definition: linear.h:73
A Plane3 is a plane in space, with the equation: Ax + By + Cz + D = 0.
Definition: trigonometry.h:449
Coord3 centroid_
Definition: linear.h:118
LinStats2D()
Definition: linear.h:76
3D point or vector
Definition: commontypes.h:57
Set of (small) copyable elements.
Definition: commontypes.h:26
T ax
Definition: linear.h:40
T getValue(T x) const
Definition: linear.h:31
PlaneParameters< float > PlanePars
Definition: linear.h:66
T getValue(const T *x) const
Definition: linear.h:37
T getValue(const T *x) const
Definition: linear.h:59
Steepnesses and intercept.
Definition: linear.h:51
A Math Function as in F(x,y).
Definition: mathfunc.h:103
T getValue(T x, T y) const
Definition: linear.h:57
LinePars sd
Standard deviations in parameters.
Definition: linear.h:79
LinStats3D()
Definition: linear.h:94
linear stats in 3D.
Definition: linear.h:91
T getProjectedX(T x, T y) const
Definition: linear.h:35
TypeSet< Coord3 > points_
Definition: linear.h:117
PlanePars pp
Parameters.
Definition: linear.h:96
PlaneParameters(T i0=0, T i1=0, T i2=0)
Definition: linear.h:54
#define mClass(module)
Definition: commondefs.h:161
float corrcoeff
Correlation coefficient.
Definition: linear.h:98
Best fit plane based on 3D points.
Definition: linear.h:103
float corrcoeff
Correlation coefficient.
Definition: linear.h:80

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017