Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
75789509
Commit
75789509
authored
Apr 26, 2016
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add schnapps plugin surface_lsm (least square meshes)
parent
1729eb93
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
909 additions
and
1 deletion
+909
-1
Apps/Benches/CMakeLists.txt
Apps/Benches/CMakeLists.txt
+3
-0
CGoGN/include/Algo/Import/import2tables.h
CGoGN/include/Algo/Import/import2tables.h
+1
-1
SCHNApps/Plugins/CMakeLists.txt
SCHNApps/Plugins/CMakeLists.txt
+1
-0
SCHNApps/Plugins/surface_lsm/CMakeLists.txt
SCHNApps/Plugins/surface_lsm/CMakeLists.txt
+32
-0
SCHNApps/Plugins/surface_lsm/forms/surface_deformation.ui
SCHNApps/Plugins/surface_lsm/forms/surface_deformation.ui
+105
-0
SCHNApps/Plugins/surface_lsm/include/surface_deformation.h
SCHNApps/Plugins/surface_lsm/include/surface_deformation.h
+117
-0
SCHNApps/Plugins/surface_lsm/include/surface_deformation_dockTab.h
...Plugins/surface_lsm/include/surface_deformation_dockTab.h
+50
-0
SCHNApps/Plugins/surface_lsm/src/surface_deformation.cpp
SCHNApps/Plugins/surface_lsm/src/surface_deformation.cpp
+401
-0
SCHNApps/Plugins/surface_lsm/src/surface_deformation_dockTab.cpp
...s/Plugins/surface_lsm/src/surface_deformation_dockTab.cpp
+197
-0
ThirdParty/include/Eigen/src/Core/Matrix.h
ThirdParty/include/Eigen/src/Core/Matrix.h
+2
-0
No files found.
Apps/Benches/CMakeLists.txt
View file @
75789509
...
...
@@ -10,3 +10,6 @@ target_link_libraries( bench_remesh ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
add_executable
(
bench_compact bench_compact.cpp
)
target_link_libraries
(
bench_compact
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
bench_import_trav bench_import_trav.cpp
)
target_link_libraries
(
bench_import_trav
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
CGoGN/include/Algo/Import/import2tables.h
View file @
75789509
...
...
@@ -62,7 +62,7 @@ class MeshTablesSurface
public:
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
VEC3
::
DATA_TYPE
DATA_TYPE
;
typedef
typename
VEC3
::
DATA_TYPE
DATA_TYPE
;
typedef
typename
PFP
::
REAL
REAL
;
protected:
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
75789509
...
...
@@ -23,6 +23,7 @@ ADD_SUBDIRECTORY(surface_differentialProperties)
ADD_SUBDIRECTORY
(
surface_subdivision
)
ADD_SUBDIRECTORY
(
surface_selection
)
ADD_SUBDIRECTORY
(
surface_deformation
)
ADD_SUBDIRECTORY
(
surface_lsm
)
ADD_SUBDIRECTORY
(
surface_modelisation
)
#ADD_SUBDIRECTORY(surface_tilings)
ADD_SUBDIRECTORY
(
surface_distance
)
...
...
SCHNApps/Plugins/surface_lsm/CMakeLists.txt
0 → 100644
View file @
75789509
cmake_minimum_required
(
VERSION 2.8
)
SET
(
PLUGIN_NAME Surface_LSM
)
SET
(
PLUGIN_ROOT_DIR
${
SCHNApps_ROOT_DIR
}
/Plugins/surface_lsm
)
INCLUDE_DIRECTORIES
(
${
PLUGIN_ROOT_DIR
}
/include
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
GLOB_RECURSE
PLUGIN_FILES
${
PLUGIN_ROOT_DIR
}
/src/*.cpp
${
PLUGIN_ROOT_DIR
}
/include/*.h
${
PLUGIN_ROOT_DIR
}
/include/*.hpp
)
file
(
GLOB_RECURSE
PLUGIN_UI_FILES
${
PLUGIN_ROOT_DIR
}
/forms/*.ui
)
SET
(
PLUGIN_QOBJECT_FILES
${
PLUGIN_ROOT_DIR
}
/include/surface_deformation.h
${
PLUGIN_ROOT_DIR
}
/include/surface_deformation_dockTab.h
)
include
(
${
SCHNApps_ROOT_DIR
}
/Plugins/plugins_cmake.txt
)
SCHNApps/Plugins/surface_lsm/forms/surface_deformation.ui
0 → 100644
View file @
75789509
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
Surface_Deformation_TabWidget
</class>
<widget
class=
"QWidget"
name=
"Surface_Deformation_TabWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
207
</width>
<height>
545
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<widget
class=
"QComboBox"
name=
"combo_freeSelector"
>
<item>
<property
name=
"text"
>
<string>
- select selector -
</string>
</property>
</item>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
Free vertices selector :
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<item>
<property
name=
"text"
>
<string>
- select attribute -
</string>
</property>
</item>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"10"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"button_start_stop"
>
<property
name=
"text"
>
<string>
Start
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"QComboBox"
name=
"combo_handleSelector"
>
<item>
<property
name=
"text"
>
<string>
- select selector -
</string>
</property>
</item>
</widget>
</item>
<item
row=
"11"
column=
"0"
colspan=
"2"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
156
</width>
<height>
161
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Handle vertices selector :
</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>
combo_positionAttribute
</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
SCHNApps/Plugins/surface_lsm/include/surface_deformation.h
0 → 100644
View file @
75789509
#ifndef _SURFACE_DEFORMATION_PLUGIN_H_
#define _SURFACE_DEFORMATION_PLUGIN_H_
#include "plugin_interaction.h"
#include "surface_deformation_dockTab.h"
#include "mapHandler.h"
#include "Container/fakeAttribute.h"
#include "NL/nl.h"
#include "Algo/LinearSolving/basic.h"
#include "Eigen/Dense"
namespace
CGoGN
{
namespace
SCHNApps
{
typedef
NoTypeNameAttribute
<
Eigen
::
Matrix3f
>
Eigen_Matrix3f
;
struct
MapParameters
{
MapParameters
();
~
MapParameters
();
void
start
(
MapHandlerGen
*
mh
);
void
stop
(
MapHandlerGen
*
mh
);
VertexAttribute
<
PFP2
::
VEC3
,
PFP2
::
MAP
>
positionAttribute
;
CellSelector
<
PFP2
::
MAP
,
VERTEX
>*
handleSelector
;
CellSelector
<
PFP2
::
MAP
,
VERTEX
>*
freeSelector
;
bool
initialized
;
VertexAttribute
<
PFP2
::
VEC3
,
PFP2
::
MAP
>
positionInit
;
VertexAttribute
<
unsigned
int
,
PFP2
::
MAP
>
vIndex
;
unsigned
int
nb_vertices
;
NLContext
nlContext
;
};
class
Surface_Deformation_Plugin
:
public
PluginInteraction
{
Q_OBJECT
Q_INTERFACES
(
CGoGN
::
SCHNApps
::
Plugin
)
#if CGOGN_QT_DESIRED_VERSION == 5
Q_PLUGIN_METADATA
(
IID
"CGoGN.SCHNapps.Plugin"
)
#endif
friend
class
Surface_Deformation_DockTab
;
public:
Surface_Deformation_Plugin
()
:
m_draginit
(
false
),
m_dragging
(
false
)
{}
~
Surface_Deformation_Plugin
()
{}
virtual
bool
enable
();
virtual
void
disable
();
virtual
void
draw
(
View
*
view
);
virtual
void
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
{}
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
);
virtual
void
keyRelease
(
View
*
,
QKeyEvent
*
)
{}
virtual
void
mousePress
(
View
*
,
QMouseEvent
*
)
{}
virtual
void
mouseRelease
(
View
*
,
QMouseEvent
*
)
{}
virtual
void
mouseMove
(
View
*
view
,
QMouseEvent
*
event
);
virtual
void
wheelEvent
(
View
*
,
QWheelEvent
*
)
{}
virtual
void
viewLinked
(
View
*
view
)
{}
virtual
void
viewUnlinked
(
View
*
view
)
{}
private
slots
:
// slots called from SCHNApps signals
void
selectedMapChanged
(
MapHandlerGen
*
prev
,
MapHandlerGen
*
cur
);
void
mapAdded
(
MapHandlerGen
*
map
);
void
mapRemoved
(
MapHandlerGen
*
map
);
// slots called from MapHandler signals
void
attributeAdded
(
unsigned
int
orbit
,
const
QString
&
name
);
void
cellSelectorAdded
(
unsigned
int
orbit
,
const
QString
&
name
);
void
cellSelectorRemoved
(
unsigned
int
orbit
,
const
QString
&
name
);
void
selectedCellsChanged
(
CellSelectorGen
*
cs
);
public
slots
:
// slots for Python calls
void
changePositionAttribute
(
const
QString
&
map
,
const
QString
&
name
);
void
changeHandleSelector
(
const
QString
&
map
,
const
QString
&
name
);
void
changeFreeSelector
(
const
QString
&
map
,
const
QString
&
name
);
protected:
void
toggleMapDeformation
(
MapHandlerGen
*
map
);
void
lsm
(
MapHandlerGen
*
map
);
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
;
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/surface_lsm/include/surface_deformation_dockTab.h
0 → 100644
View file @
75789509
#ifndef _SURFACE_DEFORMATION_DOCK_TAB_H_
#define _SURFACE_DEFORMATION_DOCK_TAB_H_
#include "ui_surface_deformation.h"
namespace
CGoGN
{
namespace
SCHNApps
{
class
SCHNApps
;
class
Surface_Deformation_Plugin
;
struct
MapParameters
;
class
Surface_Deformation_DockTab
:
public
QWidget
,
public
Ui
::
Surface_Deformation_TabWidget
{
Q_OBJECT
friend
class
Surface_Deformation_Plugin
;
public:
Surface_Deformation_DockTab
(
SCHNApps
*
s
,
Surface_Deformation_Plugin
*
p
);
private:
SCHNApps
*
m_schnapps
;
Surface_Deformation_Plugin
*
m_plugin
;
bool
b_updatingUI
;
private
slots
:
void
positionAttributeChanged
(
int
index
);
void
handleSelectorChanged
(
int
index
);
void
freeSelectorChanged
(
int
index
);
void
startStopButtonClicked
();
private:
void
addVertexAttribute
(
const
QString
&
nameAttr
);
void
addVertexSelector
(
const
QString
&
name
);
void
removeVertexSelector
(
const
QString
&
name
);
void
mapParametersInitialized
(
bool
b
);
void
updateMapParameters
();
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/surface_lsm/src/surface_deformation.cpp
0 → 100644
View file @
75789509
This diff is collapsed.
Click to expand it.
SCHNApps/Plugins/surface_lsm/src/surface_deformation_dockTab.cpp
0 → 100644
View file @
75789509
#include "surface_deformation_dockTab.h"
#include "surface_deformation.h"
#include "schnapps.h"
#include "mapHandler.h"
namespace
CGoGN
{
namespace
SCHNApps
{
Surface_Deformation_DockTab
::
Surface_Deformation_DockTab
(
SCHNApps
*
s
,
Surface_Deformation_Plugin
*
p
)
:
m_schnapps
(
s
),
m_plugin
(
p
),
b_updatingUI
(
false
)
{
setupUi
(
this
);
connect
(
combo_positionAttribute
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
positionAttributeChanged
(
int
)));
connect
(
combo_handleSelector
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
handleSelectorChanged
(
int
)));
connect
(
combo_freeSelector
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
freeSelectorChanged
(
int
)));
connect
(
button_start_stop
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
startStopButtonClicked
()));
}
void
Surface_Deformation_DockTab
::
positionAttributeChanged
(
int
index
)
{
if
(
!
b_updatingUI
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
{
if
(
index
==
0
)
;
else
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
map
);
m_plugin
->
h_parameterSet
[
map
].
positionAttribute
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
combo_positionAttribute
->
currentText
());
m_plugin
->
pythonRecording
(
"changePositionVBO"
,
""
,
map
->
getName
(),
combo_positionAttribute
->
currentText
());
}
}
}
}
void
Surface_Deformation_DockTab
::
handleSelectorChanged
(
int
index
)
{
if
(
!
b_updatingUI
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
map
);
m_plugin
->
h_parameterSet
[
map
].
handleSelector
=
mh
->
getCellSelector
<
VERTEX
>
(
combo_handleSelector
->
currentText
());
m_plugin
->
pythonRecording
(
"changeHandleSelector"
,
""
,
map
->
getName
(),
combo_handleSelector
->
currentText
());
}
}
}
void
Surface_Deformation_DockTab
::
freeSelectorChanged
(
int
index
)
{
if
(
!
b_updatingUI
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
map
);
m_plugin
->
h_parameterSet
[
map
].
freeSelector
=
mh
->
getCellSelector
<
VERTEX
>
(
combo_freeSelector
->
currentText
());
m_plugin
->
pythonRecording
(
"changeFreeSelector"
,
""
,
map
->
getName
(),
combo_freeSelector
->
currentText
());
}
}
}
void
Surface_Deformation_DockTab
::
startStopButtonClicked
()
{
if
(
!
b_updatingUI
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
m_plugin
->
toggleMapDeformation
(
map
);
}
}
void
Surface_Deformation_DockTab
::
addVertexAttribute
(
const
QString
&
name
)
{
b_updatingUI
=
true
;
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
const
QString
&
typeAttr
=
m_schnapps
->
getSelectedMap
()
->
getAttributeTypeName
(
VERTEX
,
name
);
if
(
typeAttr
==
vec3TypeName
)
combo_positionAttribute
->
addItem
(
name
);
b_updatingUI
=
false
;
}
void
Surface_Deformation_DockTab
::
addVertexSelector
(
const
QString
&
name
)
{
b_updatingUI
=
true
;
combo_handleSelector
->
addItem
(
name
);
combo_freeSelector
->
addItem
(
name
);
b_updatingUI
=
false
;
}
void
Surface_Deformation_DockTab
::
removeVertexSelector
(
const
QString
&
name
)
{
b_updatingUI
=
true
;
int
curIndex
=
combo_handleSelector
->
currentIndex
();
int
index
=
combo_handleSelector
->
findText
(
name
,
Qt
::
MatchExactly
);
if
(
curIndex
==
index
)
combo_handleSelector
->
setCurrentIndex
(
0
);
combo_handleSelector
->
removeItem
(
index
);
curIndex
=
combo_freeSelector
->
currentIndex
();
index
=
combo_freeSelector
->
findText
(
name
,
Qt
::
MatchExactly
);
if
(
curIndex
==
index
)
combo_freeSelector
->
setCurrentIndex
(
0
);
combo_freeSelector
->
removeItem
(
index
);
b_updatingUI
=
false
;
}
void
Surface_Deformation_DockTab
::
mapParametersInitialized
(
bool
b
)
{
b_updatingUI
=
true
;
combo_positionAttribute
->
setEnabled
(
!
b
);
combo_handleSelector
->
setEnabled
(
!
b
);
combo_freeSelector
->
setEnabled
(
!
b
);
if
(
b
)
button_start_stop
->
setText
(
"Stop"
);
else
button_start_stop
->
setText
(
"Start"
);
b_updatingUI
=
false
;
}
void
Surface_Deformation_DockTab
::
updateMapParameters
()
{
b_updatingUI
=
true
;
combo_positionAttribute
->
clear
();
combo_positionAttribute
->
addItem
(
"- select attribute -"
);
combo_handleSelector
->
clear
();
combo_handleSelector
->
addItem
(
"- select selector -"
);
combo_freeSelector
->
clear
();
combo_freeSelector
->
addItem
(
"- select selector -"
);
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
{
const
MapParameters
&
p
=
m_plugin
->
h_parameterSet
[
map
];
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
unsigned
int
i
=
1
;
const
AttributeSet
&
attribs
=
map
->
getAttributeSet
(
VERTEX
);
for
(
AttributeSet
::
const_iterator
it
=
attribs
.
constBegin
();
it
!=
attribs
.
constEnd
();
++
it
)
{
if
(
it
.
value
()
==
vec3TypeName
)
{
combo_positionAttribute
->
addItem
(
it
.
key
());
if
(
p
.
positionAttribute
.
isValid
()
&&
it
.
key
()
==
QString
::
fromStdString
(
p
.
positionAttribute
.
name
()))
combo_positionAttribute
->
setCurrentIndex
(
i
);
++
i
;
}
}
i
=
1
;
const
CellSelectorSet
&
selectors
=
map
->
getCellSelectorSet
(
VERTEX
);
for
(
CellSelectorSet
::
const_iterator
it
=
selectors
.
constBegin
();
it
!=
selectors
.
constEnd
();
++
it
)
{
combo_handleSelector
->
addItem
(
it
.
key
());
if
(
p
.
handleSelector
&&
it
.
key
()
==
p
.
handleSelector
->
getName
())
combo_handleSelector
->
setCurrentIndex
(
i
);
combo_freeSelector
->
addItem
(
it
.
key
());
if
(
p
.
freeSelector
&&
it
.
key
()
==
p
.
freeSelector
->
getName
())
combo_freeSelector
->
setCurrentIndex
(
i
);
++
i
;
}
if
(
p
.
initialized
)
button_start_stop
->
setText
(
"Stop"
);
else
button_start_stop
->
setText
(
"Start"
);
}
b_updatingUI
=
false
;
}
}
// namespace SCHNApps
}
// namespace CGoGN
ThirdParty/include/Eigen/src/Core/Matrix.h
View file @
75789509
...
...
@@ -129,6 +129,8 @@ class Matrix
{
public:
static
std
::
string
CGoGNnameOfType
()
{
return
""
;
}
/** \brief Base class typedef.
* \sa PlainObjectBase
*/
...
...
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