/usr/include/miaviewit-1.0/viewit/clip_plane.hh is in libmiaviewit-dev 1.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /* -*- mia-c++ -*-
*
* This file is part of viewitgui - a library and program for the
* visualization of 3D data sets.
*
* Copyright (c) Leipzig, Madrid 1999-2013 Mirco Hellmann, Gert Wollny
*
* viewitgui is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* viewitgui is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with viewitgui; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __clip_plane
#define __clip_plane
#include <viewit/slice.hh>
#include <mia.hh>
using namespace mia;
typedef T4DVector<double> T4DDVector;
extern const string type_TClipPlane;
#define CLIPPLANE_CLASSNAME "TClipPlane"
#define XYCLIPPLANE_CLASSNAME "TXYClipPlane"
#define XZCLIPPLANE_CLASSNAME "TXZClipPlane"
#define YZCLIPPLANE_CLASSNAME "TYZClipPlane"
#define FREECLIPPLANE_CLASSNAME "TFreeClipPlane"
/// a class to handle OpenGL clip planes
/**
This class is there to handle clip planes in OpenGL.
Each object in the scene can enable/disable all available clip planes individually.
The clip plane can be moved around, and the side to be clipped can be flipped.
*/
class TClipPlane : public TSlice {
int enabled;
int no;
static unsigned char elements[8];
protected:
C3DFVector strip[4];
T4DDVector eqn;
bool flipped;
virtual void calc_strip()=0;
public:
TClipPlane(const string& name,int _no);
TClipPlane(const string& name,const C3DFVector& normal, float dist ,int _no);
~TClipPlane();
virtual const string& get_type() const {
return type_TClipPlane;
}
/// flips the side to be clipped
void flip() {
eqn *= - 1.0f;
flipped = !flipped;
}
/// increments the slice index
virtual void inc_slice();
/// decrements the slice index
virtual void dec_slice();
/** sets the slice index
\param new_slice the new index
*/
virtual void set_slice(float new_slice);
/** get the index of the current slice
\returns indexof the current slice
*/
virtual float get_slice()const;
/** get the range this slice can be moved
\param from first slice index
\param to last slice index
*/
virtual void get_slice_range(float &from, float &to) const;
virtual const char* get_classname()const;
virtual void get_classname_list(list<string> *classlist) const;
void enable();
void disable();
void use_clip_plane() const;
int get_no()const {
return no;
}
bool is_enabled()const{
return enabled > 0;
}
protected:
virtual bool do_handle_key_event(int key);
virtual bool do_handle_command_event(PEventInfo info);
virtual void do_gl_draw(const TCamera& c) const;
};
/// an axial clip plane
class TXYClipPlane: public TClipPlane {
protected:
virtual void calc_strip();
public:
TXYClipPlane();
};
/// a coronal clip plane
class TXZClipPlane: public TClipPlane {
protected:
virtual void calc_strip();
public:
TXZClipPlane();
};
/// a saggital clip plane
class TYZClipPlane: public TClipPlane {
protected:
virtual void calc_strip();
public:
TYZClipPlane();
};
/// a free clip plane
class TFreeClipPlane: public TClipPlane {
private:
C3DFVector __vc;
TCamera * __camera;
unsigned short __points_given;
C3DFVector __P1;
C3DFVector __P2;
C3DFVector __loc3d;
public:
TFreeClipPlane(TCamera *camera);
/** rotates the clipplane normal
\param rot the rotation around the x,y,z-axis (in that order applied)
*/
void rot(const C3DFVector& rot);
/** sets the clipping plane by three points
\param p1 first point
\param p2 second point
\param p3 third point
*/
void set_position(const C3DFVector& p1, const C3DFVector& p2, const C3DFVector& p3);
virtual const char* get_classname()const;
virtual void get_classname_list(list<string> *classlist)const;
protected:
virtual void calc_strip();
virtual bool do_handle_command_event(PEventInfo info);
virtual bool do_handle_mouse_event(int button, int x, int y);
virtual void do_gl_draw(const TCamera& c) const;
virtual void do_unselect();
};
#endif
|