Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
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
Hide 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
(
p
.
handleSelector
&&
!
p
.
handleSelector
->
getSelectedCells
().
empty
())
m_dragging
=
!
m_dragging
;
if
(
!
m_dragging
)
{
if
(
p
.
handleSelector
&&
!
p
.
handleSelector
->
getSelectedCells
().
empty
())
{
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,50 +169,50 @@ void Surface_Deformation_Plugin::keyPress(View* view, QKeyEvent* event)
}
}
void
Surface_Deformation_Plugin
::
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
&&
m_dragging
)
{
MapHandlerGen
*
mh
=
m_schnapps
->
getSelectedMap
();
const
MapParameters
&
p
=
h_parameterSet
[
mh
];
const
std
::
vector
<
Dart
>&
handle
=
p
.
handleSelector
->
getSelectedCells
();
m_dragZ
=
0
;
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
handle
.
begin
();
it
!=
handle
.
end
();
++
it
)
{
const
PFP2
::
VEC3
&
pp
=
p
.
positionAttribute
[
*
it
];
qglviewer
::
Vec
q
=
view
->
camera
()
->
projectedCoordinatesOf
(
qglviewer
::
Vec
(
pp
[
0
],
pp
[
1
],
pp
[
2
]));
m_dragZ
+=
q
.
z
;
}
m_dragZ
/=
handle
.
size
();
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
)
{
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
);
if
(
!
m_draginit
)
{
m_dragZ
=
0
;
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
handle
.
begin
();
it
!=
handle
.
end
();
++
it
)
{
const
PFP2
::
VEC3
&
pp
=
p
.
positionAttribute
[
*
it
];
qglviewer
::
Vec
q
=
view
->
camera
()
->
projectedCoordinatesOf
(
qglviewer
::
Vec
(
pp
[
0
],
pp
[
1
],
pp
[
2
]));
m_dragZ
+=
q
.
z
;
}
m_dragZ
/=
handle
.
size
();
qglviewer
::
Vec
vec
=
qq
-
m_dragPrevious
;
PFP2
::
VEC3
t
(
vec
.
x
,
vec
.
y
,
vec
.
z
);
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
handle
.
begin
();
it
!=
handle
.
end
();
++
it
)
p
.
positionAttribute
[
*
it
]
+=
t
;
qglviewer
::
Vec
pp
(
event
->
x
(),
event
->
y
(),
m_dragZ
);
m_dragPrevious
=
view
->
camera
()
->
unprojectedCoordinatesOf
(
pp
);
m_dragPrevious
=
qq
;
m_draginit
=
true
;
}
else
{
qglviewer
::
Vec
pp
(
event
->
x
(),
event
->
y
(),
m_dragZ
);
qglviewer
::
Vec
qq
=
view
->
camera
()
->
unprojectedCoordinatesOf
(
pp
);
qglviewer
::
Vec
vec
=
qq
-
m_dragPrevious
;
PFP2
::
VEC3
t
(
vec
.
x
,
vec
.
y
,
vec
.
z
);
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
handle
.
begin
();
it
!=
handle
.
end
();
++
it
)
p
.
positionAttribute
[
*
it
]
+=
t
;
// matchDiffCoord(mh);
// asRigidAsPossible(mh);
m_dragPrevious
=
qq
;
mh
->
notifyAttributeModification
(
p
.
positionAttribute
);
// 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