OpendTect  6.3
vistransform.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: Kris Tingdahl
8  Date: Jan 2002
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "visdatagroup.h"
14 #include "position.h"
15 
16 namespace osg { class MatrixTransform; class Vec3d; class Vec3f; class Quat; }
17 
18 
19 namespace visBase
20 {
21 #define mDefTransType( func, tp ) \
22  void func( tp& ) const; \
23  void func( const tp& f, tp& t ) const; \
24  static void func( const Transformation* tr, tp& v ) \
25  { if ( tr ) tr->func( v ); } \
26  static void func( const Transformation* tr, const tp& f, tp& t );
27 
28 #define mDefTrans( tp ) \
29 mDefTransType( transform, tp ); \
30 mDefTransType( transformBack, tp ); \
31 mDefTransType( transformDir, tp ); \
32 mDefTransType( transformBackDir, tp ); \
33 mDefTransType( transformSize, tp ); \
34 mDefTransType( transformBackSize, tp ); \
35 mDefTransType( transformNormal, tp ); \
36 mDefTransType( transformBackNormal, tp );
37 
38 
39 #define mDefConvTransType( func, frtp, totp ) \
40 void func( const frtp&, totp& ) const; \
41 static void func( const Transformation* tr, const frtp& f, totp& t);
42 
43 #define mDefConvTrans( frtp, totp ) \
44 mDefConvTransType( transform, frtp, totp ); \
45 mDefConvTransType( transformBack, frtp, totp ); \
46 mDefConvTransType( transformDir, frtp, totp ); \
47 mDefConvTransType( transformBackDir, frtp, totp ); \
48 mDefConvTransType( transformSize, frtp, totp ); \
49 mDefConvTransType( transformBackSize, frtp, totp ); \
50 mDefConvTransType( transformNormal, frtp, totp ); \
51 mDefConvTransType( transformBackNormal, frtp, totp );
52 
53 
72 {
73 public:
76 
77  void reset();
78 
79  void setA(double a11,double a12,double a13,double a14,
80  double a21,double a22,double a23,double a24,
81  double a31,double a32,double a33,double a34,
82  double a41,double a42,double a43,double a44 );
83 
84  void setMatrix(const Coord3& trans,
85  const Coord3& rotvec,double rotangle,
86  const Coord3& scale);
87 
88  void setTranslation(const Coord3&);
89  void setRotation(const Coord3& vec,double angle);
90  void setScale(const Coord3&);
91  void setScaleOrientation(const Coord3& vec,double angle);
92 
93  Coord3 getTranslation() const;
94  Coord3 getScale() const;
95  void getRotation(Coord3& vec,double& angle) const;
96 
97 
98  void setAbsoluteReferenceFrame();
99  const osg::MatrixTransform* getTransformNode() const { return node_; };
100 
103  mDefTrans( osg::Vec3d );
104  mDefTrans( osg::Vec3f );
105  mDefConvTrans( Coord3, osg::Vec3d );
106  mDefConvTrans( Coord3, osg::Vec3f );
107  mDefConvTrans( osg::Vec3d, Coord3 );
108  mDefConvTrans( osg::Vec3f, Coord3 );
109 
110  Transformation& operator*=(const Transformation&);
111 
112 private:
113 
114  virtual ~Transformation();
115 
116  void updateMatrix();
117  void updateNormalizationMode();
118 
119  osg::MatrixTransform* node_;
120 
121  osg::Vec3d& curscale_;
122  osg::Vec3d& curtrans_;
123  osg::Quat& currot_;
124  osg::Quat& curso_;
125 };
126 
127 }
#define mDefTrans(tp)
Definition: vistransform.h:28
#define mExpClass(module)
Definition: commondefs.h:157
osg::Quat & curso_
Definition: vistransform.h:124
Definition: visdatagroup.h:24
#define mDefConvTrans(frtp, totp)
Definition: vistransform.h:43
osg::MatrixTransform * node_
Definition: vistransform.h:119
3D point or vector
Definition: commontypes.h:57
osg::Vec3d & curscale_
Definition: vistransform.h:121
osg::Quat & currot_
Definition: vistransform.h:123
Definition: visannot.h:40
osg::Vec3d & curtrans_
Definition: vistransform.h:122
Open Scene Graph.
Definition: visannot.h:26
static Transformation * create()
Definition: vistransform.h:74
#define mCreateDataObj(clss)
Definition: visdata.h:210
The Transformation is an object that transforms everything following the node.
Definition: vistransform.h:71

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