MorphoGraphX
2.0-1-227
src
CuttingSurface.hpp
Go to the documentation of this file.
1
//
2
// This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3
// Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4
//
5
// If you use MorphoGraphX in your work, please cite:
6
// http://dx.doi.org/10.7554/eLife.05864
7
//
8
// MorphoGraphX is free software, and is licensed under under the terms of the
9
// GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10
//
11
#ifndef CUTTINGSURFACE_HPP
12
#define CUTTINGSURFACE_HPP
13
14
#include <Config.hpp>
15
16
#include <
Geometry.hpp
>
17
#include <MGXViewer/qglviewer.h>
18
#include <
Bezier.hpp
>
19
20
namespace
mgx
21
{
22
class
SetupProcess;
23
24
typedef
Vector<2, int>
Point2i
;
25
typedef
Vector<3, float>
Point3f
;
26
27
class
mgx_EXPORT
CuttingSurface
:
public
QObject
28
{
29
Q_OBJECT
30
friend
class
SetupProcess;
31
32
public
:
33
CuttingSurface
();
34
~
CuttingSurface
();
35
36
enum
Mode
{ PLANE,
THREE_AXIS
, BEZIER };
37
38
Mode
mode
()
const
{
39
return
_mode;
40
}
41
void
setMode
(
Mode
m)
42
{
43
if
(m != _mode) {
44
_mode = m;
45
hasChanged();
46
}
47
}
48
49
bool
drawGrid
()
const
{
50
return
_drawGrid;
51
}
52
53
void
showGrid
()
54
{
55
if
(!_drawGrid) {
56
_drawGrid =
true
;
57
hasChanged();
58
}
59
}
60
61
void
hideGrid
()
62
{
63
if
(_drawGrid) {
64
_drawGrid =
false
;
65
hasChanged();
66
}
67
}
68
69
void
show
()
70
{
71
if
(!_draw) {
72
_draw =
true
;
73
hasChanged();
74
}
75
}
76
void
hide
()
77
{
78
if
(_draw) {
79
_draw =
false
;
80
hasChanged();
81
}
82
}
83
bool
isVisible
()
const
{
84
return
_draw;
85
}
86
87
const
Point3f
&
size
()
const
{
88
return
_size;
89
}
90
void
setSize
(
const
Point3f
& s)
91
{
92
if
(s != _size) {
93
_size = s;
94
hasChanged();
95
}
96
}
97
98
const
Point2i
&
surfSize
()
const
{
99
return
_surfSize;
100
}
101
void
setSurfSize
(
const
Point2i
& s)
102
{
103
if
(s != _surfSize) {
104
_surfSize = s;
105
hasChanged();
106
}
107
}
108
109
// Get frame
110
qglviewer::ManipulatedFrame
&
frame
() {
111
return
_frame;
112
}
113
const
qglviewer::ManipulatedFrame
&
frame
()
const
{
114
return
_frame;
115
}
116
117
// Get cutting plane rectangle
118
void
getSurfPoints(
const
qglviewer::Frame
* stk_frame, std::vector<Point3f>& points,
int
& uSize,
int
& vSize);
119
120
// Evaluate coordinates on surface
121
Point3f
evalCoord(
float
u,
float
v)
const
;
122
Point3f
evalNormal(
float
u,
float
v)
const
;
123
124
// Get bezier object
125
const
Bezier
&
bezier
()
const
{
126
return
_bez;
127
}
128
Bezier
&
bezier
() {
129
return
_bez;
130
}
131
132
void
hasChanged
() {
133
_changed =
true
;
134
}
135
bool
changed
()
const
{
136
return
_changed;
137
}
138
139
protected
:
140
void
resetModified
() {
141
_changed =
false
;
142
}
143
144
Mode
_mode
;
145
bool
_drawGrid
;
146
Point3f
_size
;
147
bool
_draw
;
148
Point2i
_surfSize
;
149
bool
_changed
;
150
Bezier
_bez
;
151
152
// Clipping plane frame
153
qglviewer::ManipulatedFrame
_frame
;
154
};
155
}
156
#endif
mgx::CuttingSurface::bezier
const Bezier & bezier() const
Definition:
CuttingSurface.hpp:125
Bezier.hpp
mgx::Bezier
Definition:
Bezier.hpp:20
mgx::CuttingSurface::frame
const qglviewer::ManipulatedFrame & frame() const
Definition:
CuttingSurface.hpp:113
mgx::CuttingSurface::bezier
Bezier & bezier()
Definition:
CuttingSurface.hpp:128
mgx::CuttingSurface::showGrid
void showGrid()
Definition:
CuttingSurface.hpp:53
mgx::CuttingSurface::_bez
Bezier _bez
Definition:
CuttingSurface.hpp:150
mgx::CuttingSurface::resetModified
void resetModified()
Definition:
CuttingSurface.hpp:140
mgx::CuttingSurface::isVisible
bool isVisible() const
Definition:
CuttingSurface.hpp:83
mgx::Point2i
Vector< 2, int > Point2i
Definition:
CuttingSurface.hpp:22
qglviewer::ManipulatedFrame
mgx::CuttingSurface::hide
void hide()
Definition:
CuttingSurface.hpp:76
mgx::CuttingSurface::_mode
Mode _mode
Definition:
CuttingSurface.hpp:144
mgx::CuttingSurface::setSurfSize
void setSurfSize(const Point2i &s)
Definition:
CuttingSurface.hpp:101
mgx::CuttingSurface::_surfSize
Point2i _surfSize
Definition:
CuttingSurface.hpp:148
mgx::CuttingSurface::mode
Mode mode() const
Definition:
CuttingSurface.hpp:38
Geometry.hpp
mgx::CuttingSurface
Definition:
CuttingSurface.hpp:27
mgx
Distributed matrix library.
Definition:
Assert.hpp:26
mgx::CuttingSurface::frame
qglviewer::ManipulatedFrame & frame()
Definition:
CuttingSurface.hpp:110
mgx::CuttingSurface::THREE_AXIS
@ THREE_AXIS
Definition:
CuttingSurface.hpp:36
mgx::CuttingSurface::_draw
bool _draw
Definition:
CuttingSurface.hpp:147
mgx::CuttingSurface::Mode
Mode
Definition:
CuttingSurface.hpp:36
mgx::Point3f
Vector< 3, float > Point3f
Definition:
CuttingSurface.hpp:25
mgx::CuttingSurface::_size
Point3f _size
Definition:
CuttingSurface.hpp:146
mgx::CuttingSurface::setSize
void setSize(const Point3f &s)
Definition:
CuttingSurface.hpp:90
mgx::CuttingSurface::_frame
qglviewer::ManipulatedFrame _frame
Definition:
CuttingSurface.hpp:153
qglviewer::Frame
mgx::CuttingSurface::changed
bool changed() const
Definition:
CuttingSurface.hpp:135
mgx::CuttingSurface::surfSize
const Point2i & surfSize() const
Definition:
CuttingSurface.hpp:98
mgx::CuttingSurface::hideGrid
void hideGrid()
Definition:
CuttingSurface.hpp:61
mgx::CuttingSurface::drawGrid
bool drawGrid() const
Definition:
CuttingSurface.hpp:49
mgx::CuttingSurface::_changed
bool _changed
Definition:
CuttingSurface.hpp:149
mgx::CuttingSurface::hasChanged
void hasChanged()
Definition:
CuttingSurface.hpp:132
mgx::CuttingSurface::size
const Point3f & size() const
Definition:
CuttingSurface.hpp:87
mgx::CuttingSurface::setMode
void setMode(Mode m)
Definition:
CuttingSurface.hpp:41
mgx::Vector< 2, int >
mgx::CuttingSurface::_drawGrid
bool _drawGrid
Definition:
CuttingSurface.hpp:145
mgx::CuttingSurface::show
void show()
Definition:
CuttingSurface.hpp:69
Generated on Fri Jul 9 2021 18:34:54 for MorphoGraphX by
1.8.17