Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hurstel
CGoGN
Commits
be80cebc
Commit
be80cebc
authored
Mar 08, 2011
by
Thomas
Browse files
Merge branch 'master' of cgogn:~kraemer/CGoGN
parents
6d915276
dcb3252d
Changes
35
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/Release/CMakeLists.txt
View file @
be80cebc
...
...
@@ -17,7 +17,6 @@ include_directories(
${
CGoGN_ROOT_DIR
}
/ThirdParty/OpenCTM
${
CGoGN_ROOT_DIR
}
/ThirdParty/Assimp/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/glm
)
# define libs path
...
...
Apps/Examples/miniTest.cpp
View file @
be80cebc
...
...
@@ -43,7 +43,8 @@
#include
"Algo/Geometry/laplacian.h"
#include
"Algo/Modelisation/subdivision.h"
#include
"Algo/Decimation/decimation.h"
#include
"Algo/Filters2D/filters2D.h"
#include
"Algo/Remeshing/pliant.h"
#include
"Algo/Geometry/feature.h"
using
namespace
CGoGN
;
...
...
@@ -349,7 +350,7 @@ void MyGlutWin::myRedraw()
glPushMatrix
()
;
float
sc
=
50.
/
gWidthObj
;
float
sc
=
50.
0
f
/
gWidthObj
;
glScalef
(
sc
,
sc
,
sc
)
;
glTranslatef
(
-
gPosObj
[
0
],
-
gPosObj
[
1
],
-
gPosObj
[
2
])
;
...
...
@@ -432,61 +433,102 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
{
case
'l'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"loop: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"loop: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
'c'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"catmull-clark: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"catmull-clark: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
'3'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
Sqrt3Subdivision
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"sqrt3: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
if
(
!
laplacian
.
isValid
())
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
't'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
trianguleFaces
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"triangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"triangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
...
...
@@ -494,19 +536,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'q'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
quadranguleFaces
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"quadrangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"quadrangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
...
...
@@ -516,19 +562,23 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
{
unsigned
int
nbVertices
=
myMap
.
getNbOrbits
(
VERTEX_ORBIT
)
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Decimation
::
S_QEM
,
Algo
::
Decimation
::
A_QEM
,
position
,
nbVertices
*
0.75
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"decimation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"decimation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
...
...
@@ -536,40 +586,68 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'd'
:
{
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
normal
)
;
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
laplacian
)
;
AttributeHandler
<
PFP
::
VEC3
>
newPosition
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
newPosition
)
;
AttributeHandler
<
PFP
::
VEC3
>
positionF
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
positionF
)
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Modelisation
::
computeDual
<
PFP
>
(
myMap
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"dual computation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"dual computation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
newPosition
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
newPosition
)
;
position
=
positionF
;
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
if
(
!
laplacian
.
isValid
())
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
'3'
:
case
'r'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
Algo
::
Remeshing
::
pliantRemeshing
<
PFP
>
(
myMap
,
position
,
normal
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"pliant remeshing: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
'9'
:
{
CellMarker
markVisit
(
myMap
,
VERTEX_CELL
)
;
...
...
@@ -623,6 +701,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
glutPostRedisplay
()
;
break
;
}
...
...
include/Algo/Geometry/area.h
View file @
be80cebc
...
...
@@ -46,11 +46,11 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const typename PFP::TVEC3&
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
face_area
,
const
FunctorSelect
&
select
=
SelectorTrue
())
;
}
}
// namespace Geometry
}
}
// namespace Algo
}
}
// namespace CGoGN
#include
"Algo/Geometry/area.hpp"
...
...
include/Algo/Geometry/basic.h
View file @
be80cebc
...
...
@@ -40,7 +40,7 @@ namespace Geometry
* vectorOutOfDart return a dart from the position of vertex attribute of d to the position of vertex attribute of phi1(d)
*/
template
<
typename
PFP
>
typename
PFP
::
VEC3
vectorOutOfDart
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
inline
typename
PFP
::
VEC3
vectorOutOfDart
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
VEC3
vec
=
position
[
map
.
phi1
(
d
)]
;
vec
-=
position
[
d
]
;
...
...
@@ -48,11 +48,17 @@ typename PFP::VEC3 vectorOutOfDart(typename PFP::MAP& map, Dart d, const typenam
}
template
<
typename
PFP
>
float
angle
(
typename
PFP
::
MAP
&
map
,
Dart
d
1
,
Dart
d2
,
const
typename
PFP
::
TVEC3
&
position
)
inline
typename
PFP
::
REAL
edgeLength
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
VEC3
v1
,
v2
;
vectorOutOfDart
<
PFP
>
(
map
,
d1
,
position
,
v1
)
;
vectorOutOfDart
<
PFP
>
(
map
,
d2
,
position
,
v2
)
;
typename
PFP
::
VEC3
v
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
return
v
.
norm
()
;
}
template
<
typename
PFP
>
inline
float
angle
(
typename
PFP
::
MAP
&
map
,
Dart
d1
,
Dart
d2
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
VEC3
v1
=
vectorOutOfDart
<
PFP
>
(
map
,
d1
,
position
)
;
typename
PFP
::
VEC3
v2
=
vectorOutOfDart
<
PFP
>
(
map
,
d2
,
position
)
;
return
Geom
::
angle
(
v1
,
v2
)
;
}
...
...
include/Algo/Geometry/centroid.hpp
View file @
be80cebc
...
...
@@ -119,9 +119,9 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
Dart
it
=
d
;
do
{
center
+=
attributs
[
map
.
phi
2
(
it
)];
center
+=
attributs
[
map
.
phi
1
(
it
)];
++
count
;
it
=
map
.
phi1
(
map
.
phi2
(
it
)
)
;
it
=
map
.
alpha1
(
it
)
;
}
while
(
it
!=
d
)
;
center
/=
count
;
return
center
;
...
...
include/Algo/Geometry/feature.h
0 → 100644
View file @
be80cebc
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__
namespace
CGoGN
{
namespace
Algo
{
namespace
Geometry
{
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
DartMarker
&
feature
)
;
}
// namespace Geometry
}
// namespace Algo
}
// namespace CGoGN
#include
"Algo/Geometry/feature.hpp"
#endif
include/Algo/Geometry/feature.hpp
0 → 100644
View file @
be80cebc
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include
"Geometry/basic.h"
#include
"Algo/Geometry/normal.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
Geometry
{
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
DartMarker
&
feature
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
feature
.
unmarkAll
()
;
AttributeHandler
<
VEC3
>
fNormal
=
map
.
template
addAttribute
<
VEC3
>(
FACE_ORBIT
,
"fNormal"
)
;
Algo
::
Geometry
::
computeNormalFaces
<
PFP
>
(
map
,
position
,
fNormal
)
;
DartMarker
m
(
map
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
m
.
isMarked
(
d
))
{
m
.
markOrbit
(
EDGE_ORBIT
,
d
)
;
if
(
Geom
::
angle
(
fNormal
[
d
],
fNormal
[
map
.
phi2
(
d
)])
>
M_PI
/
REAL
(
6
))
feature
.
markOrbit
(
EDGE_ORBIT
,
d
)
;
}
}
map
.
template
removeAttribute
<
VEC3
>(
fNormal
)
;
}
}
// namespace Geometry
}
// namespace Algo
}
// namespace CGoGN
include/Algo/Geometry/localFrame.h
View file @
be80cebc
...
...
@@ -44,8 +44,8 @@ namespace Geometry
template
<
typename
PFP
>
void
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
VEC3
&
X
,
typename
PFP
::
VEC3
&
Y
,
typename
PFP
::
VEC3
&
Z
)
{
Z
=
vertexNormal
<
PFP
>
(
map
,
d
,
position
)
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Z
=
vertexNormal
<
PFP
>
(
map
,
d
,
position
)
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Y
=
Z
^
X
;
Y
.
normalize
()
;
X
=
Y
^
Z
;
...
...
@@ -56,7 +56,7 @@ template <typename PFP>
typename
PFP
::
MATRIX33
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
VEC3
X
,
Y
,
Z
;
vertexLocalFrame
<
PFP
>
(
map
,
d
,
position
,
X
,
Y
,
Z
)
;
vertexLocalFrame
<
PFP
>
(
map
,
d
,
position
,
X
,
Y
,
Z
)
;
typename
PFP
::
MATRIX33
frame
;
frame
(
0
,
0
)
=
X
[
0
]
;
frame
(
0
,
1
)
=
X
[
1
]
;
frame
(
0
,
2
)
=
X
[
2
]
;
frame
(
1
,
0
)
=
Y
[
0
]
;
frame
(
1
,
1
)
=
Y
[
1
]
;
frame
(
1
,
2
)
=
Y
[
2
]
;
...
...
@@ -70,7 +70,7 @@ template <typename PFP>
void
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
VEC3
&
normal
,
typename
PFP
::
VEC3
&
X
,
typename
PFP
::
VEC3
&
Y
,
typename
PFP
::
VEC3
&
Z
)
{
Z
=
normal
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
X
=
vectorOutOfDart
<
PFP
>
(
map
,
d
,
position
)
;
Y
=
Z
^
X
;
Y
.
normalize
()
;
X
=
Y
^
Z
;
...
...
@@ -81,7 +81,7 @@ template <typename PFP>
typename
PFP
::
MATRIX33
vertexLocalFrame
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
VEC3
&
normal
)
{
typename
PFP
::
VEC3
X
,
Y
,
Z
;
vertexLocalFrame
<
PFP
>
(
map
,
d
,
position
,
normal
,
X
,
Y
,
Z
)
;
vertexLocalFrame
<
PFP
>
(
map
,
d
,
position
,
normal
,
X
,
Y
,
Z
)
;
typename
PFP
::
MATRIX33
frame
;
frame
(
0
,
0
)
=
X
[
0
]
;
frame
(
0
,
1
)
=
X
[
1
]
;
frame
(
0
,
2
)
=
X
[
2
]
;
frame
(
1
,
0
)
=
Y
[
0
]
;
frame
(
1
,
1
)
=
Y
[
1
]
;
frame
(
1
,
2
)
=
Y
[
2
]
;
...
...
include/Algo/Geometry/normal.hpp
View file @
be80cebc
...
...
@@ -40,9 +40,9 @@ typename PFP::VEC3 triangleNormal(typename PFP::MAP& map, Dart d, const typename
{
typedef
typename
PFP
::
VEC3
VEC3
;
VEC3
p1
=
position
[
d
];
VEC3
p2
=
position
[
map
.
phi1
(
d
)];
VEC3
p3
=
position
[
map
.
phi_1
(
d
)];
const
VEC3
&
p1
=
position
[
d
];
const
VEC3
&
p2
=
position
[
map
.
phi1
(
d
)];
const
VEC3
&
p3
=
position
[
map
.
phi_1
(
d
)];
VEC3
N
=
Geom
::
triangleNormal
(
p1
,
p2
,
p3
)
;
N
.
normalize
()
;
...
...
@@ -64,8 +64,8 @@ typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP
do
{
VEC3
n
=
triangleNormal
<
PFP
>
(
map
,
it
,
position
)
;
//if(!std::isnan(n[0]))
if
(
n
[
0
]
==
n
[
0
])
//if(!std::isnan(n[0])
&& !std::isnan(n[1]) && !std::isnan(n[2])
)
if
(
n
[
0
]
==
n
[
0
]
&&
n
[
1
]
==
n
[
1
]
&&
n
[
2
]
==
n
[
2
]
)
N
+=
n
;
it
=
map
.
phi1
(
it
)
;
}
while
(
it
!=
d
)
;
...
...
@@ -84,10 +84,13 @@ typename PFP::VEC3 vertexNormal(typename PFP::MAP& map, Dart d, const typename P
do
{
VEC3
n
=
faceNormal
<
PFP
>
(
map
,
it
,
position
)
;
VEC3
v1
=
vectorOutOfDart
<
PFP
>
(
map
,
it
,
position
)
;
VEC3
v2
=
vectorOutOfDart
<
PFP
>
(
map
,
map
.
phi_1
(
it
),
position
)
;
n
*=
convexFaceArea
<
PFP
>
(
map
,
it
,
position
)
/
(
v1
.
norm2
()
*
v2
.
norm2
())
;
N
+=
n
;
if
(
!
n
.
hasNan
())
{
VEC3
v1
=
vectorOutOfDart
<
PFP
>
(
map
,
it
,
position
)
;
VEC3
v2
=
vectorOutOfDart
<
PFP
>
(
map
,
map
.
phi_1
(
it
),
position
)
;
n
*=
convexFaceArea
<
PFP
>
(
map
,
it
,
position
)
/
(
v1
.
norm2
()
*
v2
.
norm2
())
;
N
+=
n
;
}
it
=
map
.
phi1
(
map
.
phi2
(
it
))
;
}
while
(
it
!=
d
)
;
N
.
normalize
()
;
...
...
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
View file @
be80cebc
...
...
@@ -343,15 +343,14 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
unsigned
int
orbit
=
this
->
m_o
rbit
;
unsigned
int
orbit
=
this
->
getO
rbit
()
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
if
(
index
==
EMBNULL
&&
nbSteps
==
0
)
if
(
index
==
EMBNULL
)
{
index
=
m
->
embedNewCell
(
orbit
,
d
)
;