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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
ee777b79
Commit
ee777b79
authored
Jan 30, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: add methods in diff properties plugin to call from script
parent
eae3aa52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
145 additions
and
65 deletions
+145
-65
SCHNApps/Plugins/CMakeLists.txt
SCHNApps/Plugins/CMakeLists.txt
+1
-0
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
...s/differentialProperties/include/differentialProperties.h
+24
-2
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
...ins/differentialProperties/src/differentialProperties.cpp
+113
-61
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+7
-2
No files found.
SCHNApps/Plugins/CMakeLists.txt
View file @
ee777b79
...
...
@@ -7,3 +7,4 @@ ADD_SUBDIRECTORY(render)
ADD_SUBDIRECTORY
(
renderVector
)
ADD_SUBDIRECTORY
(
renderExplod
)
ADD_SUBDIRECTORY
(
subdivideSurface
)
ADD_SUBDIRECTORY
(
surfaceDeformation
)
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
View file @
ee777b79
...
...
@@ -41,8 +41,30 @@ public slots:
void
openComputeNormalDialog
();
void
openComputeCurvatureDialog
();
void
computeNormal
();
void
computeCurvature
();
void
computeNormalFromDialog
();
void
computeCurvatureFromDialog
();
void
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
const
QString
&
normalAttributeName
=
"normal"
,
bool
createNormalVBO
=
true
);
void
computeCurvature
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
const
QString
&
normalAttributeName
=
"normal"
,
const
QString
&
KmaxAttributeName
=
"Kmax"
,
const
QString
&
kmaxAttributeName
=
"kmax"
,
const
QString
&
KminAttributeName
=
"Kmin"
,
const
QString
&
kminAttributeName
=
"kmin"
,
const
QString
&
KnormalAttributeName
=
"Knormal"
,
bool
createKmaxVBO
=
true
,
bool
createkmaxVBO
=
true
,
bool
createKminVBO
=
true
,
bool
createkminVBO
=
true
,
bool
createKnormalVBO
=
true
);
private:
ComputeNormalDialog
*
m_computeNormalDialog
;
...
...
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
View file @
ee777b79
...
...
@@ -19,11 +19,11 @@ bool DifferentialPropertiesPlugin::enable()
connect
(
m_computeNormalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openComputeNormalDialog
()));
connect
(
m_computeCurvatureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openComputeCurvatureDialog
()));
connect
(
m_computeNormalDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeNormal
()));
connect
(
m_computeNormalDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeNormal
()));
connect
(
m_computeNormalDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeNormal
FromDialog
()));
connect
(
m_computeNormalDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeNormal
FromDialog
()));
connect
(
m_computeCurvatureDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeCurvature
()));
connect
(
m_computeCurvatureDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeCurvature
()));
connect
(
m_computeCurvatureDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeCurvature
FromDialog
()));
connect
(
m_computeCurvatureDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeCurvature
FromDialog
()));
return
true
;
}
...
...
@@ -38,13 +38,12 @@ void DifferentialPropertiesPlugin::openComputeCurvatureDialog()
m_computeCurvatureDialog
->
show
();
}
void
DifferentialPropertiesPlugin
::
computeNormal
()
void
DifferentialPropertiesPlugin
::
computeNormal
FromDialog
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_computeNormalDialog
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapname
));
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
QString
positionName
=
m_computeNormalDialog
->
combo_positionAttribute
->
currentText
();
QString
normalName
;
...
...
@@ -53,109 +52,162 @@ void DifferentialPropertiesPlugin::computeNormal()
else
normalName
=
m_computeNormalDialog
->
normalAttributeName
->
text
();
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionName
);
VertexAttribute
<
PFP2
::
VEC3
>
normal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalName
);
if
(
!
normal
.
isValid
())
normal
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalName
);
bool
createVBO
=
(
m_computeNormalDialog
->
check_createVBO
->
checkState
()
==
Qt
::
Checked
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP2
>
(
*
map
,
position
,
normal
);
if
(
m_computeNormalDialog
->
check_createVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
normal
);
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
computeNormal
(
mapName
,
positionName
,
normalName
,
createVBO
);
}
}
void
DifferentialPropertiesPlugin
::
computeCurvature
()
void
DifferentialPropertiesPlugin
::
computeCurvature
FromDialog
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_computeCurvatureDialog
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapname
));
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
QString
positionName
=
m_computeCurvatureDialog
->
combo_positionAttribute
->
currentText
();
QString
normalName
=
m_computeCurvatureDialog
->
combo_normalAttribute
->
currentText
();
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionName
);
VertexAttribute
<
PFP2
::
VEC3
>
normal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalName
);
QString
KmaxName
;
if
(
m_computeCurvatureDialog
->
KmaxAttributeName
->
text
().
isEmpty
())
KmaxName
=
m_computeCurvatureDialog
->
combo_KmaxAttribute
->
currentText
();
else
KmaxName
=
m_computeCurvatureDialog
->
KmaxAttributeName
->
text
();
VertexAttribute
<
PFP2
::
VEC3
>
Kmax
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KmaxName
);
if
(
!
Kmax
.
isValid
())
Kmax
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KmaxName
);
QString
kmaxName
;
if
(
m_computeCurvatureDialog
->
kmaxAttributeName
->
text
().
isEmpty
())
kmaxName
=
m_computeCurvatureDialog
->
combo_kmaxAttribute
->
currentText
();
else
kmaxName
=
m_computeCurvatureDialog
->
kmaxAttributeName
->
text
();
VertexAttribute
<
PFP2
::
REAL
>
kmax
=
mh
->
getAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kmaxName
);
if
(
!
kmax
.
isValid
())
kmax
=
mh
->
addAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kmaxName
);
QString
KminName
;
if
(
m_computeCurvatureDialog
->
KminAttributeName
->
text
().
isEmpty
())
KminName
=
m_computeCurvatureDialog
->
combo_KminAttribute
->
currentText
();
else
KminName
=
m_computeCurvatureDialog
->
KminAttributeName
->
text
();
VertexAttribute
<
PFP2
::
VEC3
>
Kmin
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KminName
);
if
(
!
Kmin
.
isValid
())
Kmin
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KminName
);
QString
kminName
;
if
(
m_computeCurvatureDialog
->
kminAttributeName
->
text
().
isEmpty
())
kminName
=
m_computeCurvatureDialog
->
combo_kminAttribute
->
currentText
();
else
kminName
=
m_computeCurvatureDialog
->
kminAttributeName
->
text
();
VertexAttribute
<
PFP2
::
REAL
>
kmin
=
mh
->
getAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kminName
);
if
(
!
kmin
.
isValid
())
kmin
=
mh
->
addAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kminName
);
QString
KnormalName
;
if
(
m_computeCurvatureDialog
->
KnormalAttributeName
->
text
().
isEmpty
())
KnormalName
=
m_computeCurvatureDialog
->
combo_KnormalAttribute
->
currentText
();
else
KnormalName
=
m_computeCurvatureDialog
->
KnormalAttributeName
->
text
();
VertexAttribute
<
PFP2
::
VEC3
>
Knormal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KnormalName
);
if
(
!
Knormal
.
isValid
())
Knormal
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KnormalName
);
EdgeAttribute
<
PFP2
::
REAL
>
edgeAngle
=
mh
->
getAttribute
<
PFP2
::
REAL
,
EDGE
>
(
"edgeAngle"
);
if
(
!
edgeAngle
.
isValid
())
edgeAngle
=
mh
->
addAttribute
<
PFP2
::
REAL
,
EDGE
>
(
"edgeAngle"
);
bool
KmaxVBO
=
(
m_computeCurvatureDialog
->
check_KmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP2
>
(
*
map
,
position
,
edgeAngle
);
Algo
::
Surface
::
Geometry
::
computeCurvatureVertices_NormalCycles_Projected
<
PFP2
>
(
*
map
,
0.01
f
*
mh
->
getBBdiagSize
(),
position
,
normal
,
edgeAngle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
);
bool
kmaxVBO
=
(
m_computeCurvatureDialog
->
check_kmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
if
(
m_computeCurvatureDialog
->
check_KmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
Kmax
);
bool
KminVBO
=
(
m_computeCurvatureDialog
->
check_KminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
if
(
m_computeCurvatureDialog
->
check_kmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
kmax
);
bool
kminVBO
=
(
m_computeCurvatureDialog
->
check_kminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
if
(
m_computeCurvatureDialog
->
check_KminCreateVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
Kmin
);
bool
KnormalVBO
=
(
m_computeCurvatureDialog
->
check_KnormalCreateVBO
->
checkState
()
==
Qt
::
Checked
);
if
(
m_computeCurvatureDialog
->
check_kminCreateVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
kmin
);
computeCurvature
(
mapName
,
positionName
,
normalName
,
KmaxName
,
kmaxName
,
KminName
,
kminName
,
KnormalName
,
KmaxVBO
,
kmaxVBO
,
KminVBO
,
kminVBO
,
KnormalVBO
);
}
}
if
(
m_computeCurvatureDialog
->
check_KnormalCreateVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
Knormal
);
void
DifferentialPropertiesPlugin
::
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
const
QString
&
normalAttributeName
,
bool
createNormalVBO
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
VertexAttribute
<
PFP2
::
VEC3
>
normal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalAttributeName
);
if
(
!
normal
.
isValid
())
normal
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalAttributeName
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP2
>
(
*
map
,
position
,
normal
);
if
(
createNormalVBO
)
mh
->
createVBO
(
normal
);
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
void
DifferentialPropertiesPlugin
::
computeCurvature
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
const
QString
&
normalAttributeName
,
const
QString
&
KmaxAttributeName
,
const
QString
&
kmaxAttributeName
,
const
QString
&
KminAttributeName
,
const
QString
&
kminAttributeName
,
const
QString
&
KnormalAttributeName
,
bool
createKmaxVBO
,
bool
createkmaxVBO
,
bool
createKminVBO
,
bool
createkminVBO
,
bool
createKnormalVBO
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
VertexAttribute
<
PFP2
::
VEC3
>
normal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalAttributeName
);
if
(
!
normal
.
isValid
())
return
;
VertexAttribute
<
PFP2
::
VEC3
>
Kmax
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KmaxAttributeName
);
if
(
!
Kmax
.
isValid
())
Kmax
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KmaxAttributeName
);
VertexAttribute
<
PFP2
::
REAL
>
kmax
=
mh
->
getAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kmaxAttributeName
);
if
(
!
kmax
.
isValid
())
kmax
=
mh
->
addAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kmaxAttributeName
);
VertexAttribute
<
PFP2
::
VEC3
>
Kmin
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KminAttributeName
);
if
(
!
Kmin
.
isValid
())
Kmin
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KminAttributeName
);
VertexAttribute
<
PFP2
::
REAL
>
kmin
=
mh
->
getAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kminAttributeName
);
if
(
!
kmin
.
isValid
())
kmin
=
mh
->
addAttribute
<
PFP2
::
REAL
,
VERTEX
>
(
kminAttributeName
);
VertexAttribute
<
PFP2
::
VEC3
>
Knormal
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KnormalAttributeName
);
if
(
!
Knormal
.
isValid
())
Knormal
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
KnormalAttributeName
);
EdgeAttribute
<
PFP2
::
REAL
>
edgeAngle
=
mh
->
getAttribute
<
PFP2
::
REAL
,
EDGE
>
(
"edgeAngle"
);
if
(
!
edgeAngle
.
isValid
())
edgeAngle
=
mh
->
addAttribute
<
PFP2
::
REAL
,
EDGE
>
(
"edgeAngle"
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP2
>
(
*
map
,
position
,
edgeAngle
);
Algo
::
Surface
::
Geometry
::
computeCurvatureVertices_NormalCycles_Projected
<
PFP2
>
(
*
map
,
0.02
f
*
mh
->
getBBdiagSize
(),
position
,
normal
,
edgeAngle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
);
if
(
createKmaxVBO
)
mh
->
createVBO
(
Kmax
);
if
(
createkmaxVBO
)
mh
->
createVBO
(
kmax
);
if
(
createKminVBO
)
mh
->
createVBO
(
Kmin
);
if
(
createkminVBO
)
mh
->
createVBO
(
kmin
);
if
(
createKnormalVBO
)
mh
->
createVBO
(
Knormal
);
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
#ifndef DEBUG
...
...
SCHNApps/bin/init.py
View file @
ee777b79
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurface"
);
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialProperties"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"Render"
);
renderVectorPlugin
=
schnapps
.
loadPlugin
(
"RenderVector"
);
hand
=
importPlugin
.
importFromFile
(
"/home/kraemer/Media/Data/surface/midRes/handman_12
k.off"
);
obj
=
importPlugin
.
importFromFile
(
"/home/kraemer/Media/Data/surface/midRes/bimba_75
k.off"
);
v
=
schnapps
.
getView
(
"view_0"
);
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderPlugin
.
getName
());
schnapps
.
linkViewAndMap
(
v
.
getName
(),
hand
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderVectorPlugin
.
getName
());
schnapps
.
linkViewAndMap
(
v
.
getName
(),
obj
.
getName
());
#differentialPropertiesPlugin.computeNormal(obj.getName());
#differentialPropertiesPlugin.computeCurvature(obj.getName());
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