Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Hurstel
CGoGN
Commits
f17551a4
Commit
f17551a4
authored
Sep 20, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deformation plugin OK (interaction not finished..)
parent
dd6f4b63
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
48 deletions
+70
-48
SCHNApps/Plugins/surface_deformation/include/surface_deformation.h
...Plugins/surface_deformation/include/surface_deformation.h
+4
-2
SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp
...s/Plugins/surface_deformation/src/surface_deformation.cpp
+61
-45
SCHNApps/Plugins/surface_deformation/src/surface_deformation_dockTab.cpp
...s/surface_deformation/src/surface_deformation_dockTab.cpp
+4
-0
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+1
-1
No files found.
SCHNApps/Plugins/surface_deformation/include/surface_deformation.h
View file @
f17551a4
...
...
@@ -55,6 +55,7 @@ class Surface_Deformation_Plugin : public PluginInteraction
public:
Surface_Deformation_Plugin
()
:
m_draginit
(
false
),
m_dragging
(
false
)
{}
...
...
@@ -64,12 +65,12 @@ public:
virtual
bool
enable
();
virtual
void
disable
();
virtual
void
draw
(
View
*
view
)
{}
virtual
void
draw
(
View
*
view
)
;
virtual
void
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
{}
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
);
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
;
virtual
void
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mouseRelease
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mouseMove
(
View
*
view
,
QMouseEvent
*
event
);
virtual
void
wheelEvent
(
View
*
view
,
QWheelEvent
*
event
)
{}
...
...
@@ -104,6 +105,7 @@ protected:
Surface_Deformation_DockTab
*
m_dockTab
;
QHash
<
MapHandlerGen
*
,
MapParameters
>
h_parameterSet
;
bool
m_draginit
;
bool
m_dragging
;
PFP2
::
REAL
m_dragZ
;
qglviewer
::
Vec
m_dragPrevious
;
...
...
SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp
View file @
f17551a4
...
...
@@ -126,6 +126,10 @@ void Surface_Deformation_Plugin::disable()
disconnect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
}
void
Surface_Deformation_Plugin
::
draw
(
View
*
view
)
{
}
void
Surface_Deformation_Plugin
::
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{
switch
(
event
->
key
())
...
...
@@ -133,8 +137,21 @@ void Surface_Deformation_Plugin::keyPress(View* view, QKeyEvent* event)
case
Qt
::
Key_D
:
{
MapHandlerGen
*
mh
=
m_schnapps
->
getSelectedMap
();
const
MapParameters
&
p
=
h_parameterSet
[
mh
];
if
(
!
m_dragging
)
{
if
(
p
.
handleSelector
&&
!
p
.
handleSelector
->
getSelectedCells
().
empty
())
m_dragging
=
!
m_dragging
;
{
m_dragging
=
true
;
m_draginit
=
false
;
view
->
setMouseTracking
(
true
);
}
}
else
{
m_dragging
=
false
;
m_draginit
=
false
;
view
->
setMouseTracking
(
false
);
}
break
;
}
case
Qt
::
Key_R
:
{
...
...
@@ -152,14 +169,17 @@ void Surface_Deformation_Plugin::keyPress(View* view, QKeyEvent* event)
}
}
void
Surface_Deformation_Plugin
::
mouse
Press
(
View
*
view
,
QMouseEvent
*
event
)
void
Surface_Deformation_Plugin
::
mouse
Move
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
&&
m_dragging
)
if
(
m_dragging
)
{
MapHandlerGen
*
mh
=
m_schnapps
->
getSelectedMap
();
const
MapParameters
&
p
=
h_parameterSet
[
mh
];
MapParameters
&
p
=
h_parameterSet
[
mh
];
const
std
::
vector
<
Dart
>&
handle
=
p
.
handleSelector
->
getSelectedCells
();
if
(
!
m_draginit
)
{
m_dragZ
=
0
;
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
handle
.
begin
();
it
!=
handle
.
end
();
++
it
)
{
...
...
@@ -171,17 +191,11 @@ void Surface_Deformation_Plugin::mousePress(View* view, QMouseEvent* event)
qglviewer
::
Vec
pp
(
event
->
x
(),
event
->
y
(),
m_dragZ
);
m_dragPrevious
=
view
->
camera
()
->
unprojectedCoordinatesOf
(
pp
);
}
}
void
Surface_Deformation_Plugin
::
mouseMove
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
m_dragging
)
m_draginit
=
true
;
}
else
{
MapHandlerGen
*
mh
=
m_schnapps
->
getSelectedMap
();
MapParameters
&
p
=
h_parameterSet
[
mh
];
const
std
::
vector
<
Dart
>&
handle
=
p
.
handleSelector
->
getSelectedCells
();
qglviewer
::
Vec
pp
(
event
->
x
(),
event
->
y
(),
m_dragZ
);
qglviewer
::
Vec
qq
=
view
->
camera
()
->
unprojectedCoordinatesOf
(
pp
);
...
...
@@ -192,10 +206,13 @@ void Surface_Deformation_Plugin::mouseMove(View* view, QMouseEvent* event)
m_dragPrevious
=
qq
;
// matchDiffCoord(mh);
// asRigidAsPossible(mh);
// matchDiffCoord(map);
if
(
p
.
initialized
)
asRigidAsPossible
(
mh
);
mh
->
notifyAttributeModification
(
p
.
positionAttribute
);
static_cast
<
MapHandler
<
PFP2
>*>
(
mh
)
->
updateBB
(
p
.
positionAttribute
);
}
view
->
updateGL
();
}
...
...
@@ -271,7 +288,6 @@ void Surface_Deformation_Plugin::selectedCellsChanged()
{
// nlMakeCurrent(perMap->nlContext) ;
// nlReset(NL_FALSE) ;
}
...
...
@@ -484,18 +500,18 @@ void Surface_Deformation_Plugin::asRigidAsPossible(MapHandlerGen* mh)
nlMakeCurrent
(
p
.
nlContext
);
if
(
nlGetCurrentState
()
==
NL_STATE_INITIAL
)
nlBegin
(
NL_SYSTEM
)
;
nlBegin
(
NL_SYSTEM
);
for
(
int
coord
=
0
;
coord
<
3
;
++
coord
)
{
LinearSolving
::
setupVariables
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
lockedSelector
->
getMarker
(),
p
.
positionAttribute
,
coord
)
;
nlBegin
(
NL_MATRIX
)
;
// LinearSolving::addRowsRHS_Laplacian_Cotan<PFP2>(*map, p.vIndex, p.edgeWeight, p.vertexArea, p.rotatedDiffCoord, coord)
;
LinearSolving
::
addRowsRHS_Laplacian_Topo
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
rotatedDiffCoord
,
coord
)
;
nlEnd
(
NL_MATRIX
)
;
nlEnd
(
NL_SYSTEM
)
;
nlSolve
()
;
LinearSolving
::
getResult
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
positionAttribute
,
coord
)
;
nlReset
(
NL_TRUE
)
;
LinearSolving
::
setupVariables
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
lockedSelector
->
getMarker
(),
p
.
positionAttribute
,
coord
);
nlBegin
(
NL_MATRIX
);
// LinearSolving::addRowsRHS_Laplacian_Cotan<PFP2>(*map, p.vIndex, p.edgeWeight, p.vertexArea, p.rotatedDiffCoord, coord);
LinearSolving
::
addRowsRHS_Laplacian_Topo
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
rotatedDiffCoord
,
coord
);
nlEnd
(
NL_MATRIX
);
nlEnd
(
NL_SYSTEM
);
nlSolve
();
LinearSolving
::
getResult
<
PFP2
>
(
*
map
,
p
.
vIndex
,
p
.
positionAttribute
,
coord
);
nlReset
(
NL_TRUE
);
}
}
}
...
...
SCHNApps/Plugins/surface_deformation/src/surface_deformation_dockTab.cpp
View file @
f17551a4
...
...
@@ -113,11 +113,13 @@ void Surface_Deformation_DockTab::removeVertexSelector(const QString& name)
void
Surface_Deformation_DockTab
::
mapParametersInitialized
(
bool
b
)
{
b_updatingUI
=
true
;
combo_positionAttribute
->
setEnabled
(
!
b
);
combo_lockedSelector
->
setEnabled
(
!
b
);
combo_handleSelector
->
setEnabled
(
!
b
);
if
(
b
)
button_start_stop
->
setText
(
"Stop"
);
else
button_start_stop
->
setText
(
"Start"
);
b_updatingUI
=
false
;
}
void
Surface_Deformation_DockTab
::
updateMapParameters
()
...
...
@@ -173,6 +175,8 @@ void Surface_Deformation_DockTab::updateMapParameters()
else
button_start_stop
->
setText
(
"Start"
);
}
b_updatingUI
=
false
;
}
}
// namespace SCHNApps
...
...
SCHNApps/include/mapHandler.hpp
View file @
f17551a4
...
...
@@ -48,7 +48,7 @@ template <unsigned int ORBIT>
CellSelector
<
ORBIT
>*
MapHandlerGen
::
getCellSelector
(
const
QString
&
name
)
const
{
if
(
m_cellSelectors
[
ORBIT
].
contains
(
name
))
return
static_cast
<
CellSelector
<
VERTEX
>*>
(
m_cellSelectors
[
ORBIT
][
name
]);
return
static_cast
<
CellSelector
<
ORBIT
>*>
(
m_cellSelectors
[
ORBIT
][
name
]);
else
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment