OpendTect-6_4  6.4
posidxpair2coord.h
Go to the documentation of this file.
1 #ifndef posidxpair2coord_h
2 #define posidxpair2coord_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Oct 2013
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "posidxpair.h"
17 #include "coord.h"
18 
19 
20 namespace Pos
21 {
22 
23 
27 {
28 public:
29 
31 
33 
34  bool operator==(const IdxPair2Coord&) const;
35  bool isSubsetOf(const IdxPair2Coord&) const;
36  bool isValid() const { return xtr.valid(ytr); }
37  Coord firstDir() const { return Coord(xtr.b,ytr.b); }
38  Coord secondDir() const { return Coord(xtr.c,ytr.c); }
39 
40  Coord transform(const IdxPair&) const;
41  IdxPair transformBack(const Coord&) const;
43  IdxPair transformBack(const Coord&,const IdxPair& start,
44  const IdxPairStep&) const;
47  Coord transformBackNoSnap(const Coord&) const;
50  Coord transform(const Coord& rc) const;
54  bool set3Pts(const Coord& c0,const Coord& c1,const Coord& c2,
55  const IdxPair& rc0,const IdxPair& rc1,
56  od_int32 col2 );
61  struct DirTransform
62  {
63  DirTransform() { a = b = c = 0; }
64 
65  inline double det( const DirTransform& bct ) const
66  { return b * bct.c - bct.b * c; }
67  inline bool valid( const DirTransform& bct ) const
68  { double d = det( bct ); return !mIsZero(d,mDefEps); }
69 
70  double a, b, c;
71  };
72 
73  void setTransforms( const DirTransform& x,
74  const DirTransform& y )
75  { xtr = x; ytr = y; }
76  const DirTransform& getTransform( bool x ) const
77  { return x ? xtr : ytr; }
78 
79  void fillPar(IOPar&) const;
80  void usePar(const IOPar&);
81 
82  // aliases
83 
84  inline Coord rowDir() const { return firstDir(); }
85  inline Coord colDir() const { return secondDir(); }
86  inline Coord inlDir() const { return firstDir(); }
87  inline Coord crlDir() const { return secondDir(); }
88 
89 
90 protected:
91 
94 
95  bool isNodeOn(const Pos::IdxPair2Coord&,int,int) const;
96 
97 };
98 
99 
100 } // namespace Pos
101 
102 #endif
#define mExpClass(module)
Definition: commondefs.h:160
void setTransforms(const DirTransform &x, const DirTransform &y)
Definition: posidxpair2coord.h:73
bool valid(const DirTransform &bct) const
Definition: posidxpair2coord.h:67
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Coord rowDir() const
Definition: posidxpair2coord.h:84
DirTransform()
Definition: posidxpair2coord.h:63
#define mIsZero(x, eps)
Definition: commondefs.h:53
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
Definition: posidxpair2coord.h:61
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:29
Coord colDir() const
Definition: posidxpair2coord.h:85
A cartesian coordinate in 2D space.
Definition: coord.h:25
DirTransform xtr
Definition: posidxpair2coord.h:92
Coord inlDir() const
Definition: posidxpair2coord.h:86
Coord firstDir() const
Definition: posidxpair2coord.h:37
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
const DirTransform & getTransform(bool x) const
Definition: posidxpair2coord.h:76
Position.
Definition: commontypes.h:42
double b
Definition: posidxpair2coord.h:70
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
Coord crlDir() const
Definition: posidxpair2coord.h:87
#define mDefEps
Definition: commondefs.h:58
DirTransform ytr
Definition: posidxpair2coord.h:93
IdxPair::IdxType IdxType
Definition: posidxpair2coord.h:30
Coord secondDir() const
Definition: posidxpair2coord.h:38
#define od_int32
Definition: plftypes.h:31
Index_Type IdxType
Definition: idxpair.h:34
double det(const DirTransform &bct) const
Definition: posidxpair2coord.h:65
bool isValid() const
Definition: posidxpair2coord.h:36
double c
Definition: posidxpair2coord.h:70
Encapsulates linear transform from (i,j) index to (x,y) coordinates.
Definition: posidxpair2coord.h:26
IdxPair2Coord()
Definition: posidxpair2coord.h:32

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