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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
2f7d4461
Commit
2f7d4461
authored
Apr 04, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~jund/CGoGN
parents
61f307e8
73378a04
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
826 additions
and
124 deletions
+826
-124
Apps/Examples/Release/CMakeLists.txt
Apps/Examples/Release/CMakeLists.txt
+0
-1
Apps/Examples/Tests/CMakeLists.txt
Apps/Examples/Tests/CMakeLists.txt
+13
-0
Apps/Examples/Tests/Geom_inclusion.cpp
Apps/Examples/Tests/Geom_inclusion.cpp
+12
-0
Apps/Examples/miniTest.cpp
Apps/Examples/miniTest.cpp
+133
-55
include/Algo/Geometry/area.h
include/Algo/Geometry/area.h
+3
-3
include/Algo/Geometry/basic.h
include/Algo/Geometry/basic.h
+11
-5
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+2
-2
include/Algo/Geometry/feature.h
include/Algo/Geometry/feature.h
+48
-0
include/Algo/Geometry/feature.hpp
include/Algo/Geometry/feature.hpp
+66
-0
include/Algo/Geometry/inclusion.h
include/Algo/Geometry/inclusion.h
+1
-1
include/Algo/Geometry/localFrame.h
include/Algo/Geometry/localFrame.h
+5
-5
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+12
-9
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
+1
-2
include/Algo/ImplicitHierarchicalMesh/subdivision.hpp
include/Algo/ImplicitHierarchicalMesh/subdivision.hpp
+31
-5
include/Algo/Modelisation/extrusion.h
include/Algo/Modelisation/extrusion.h
+5
-3
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+10
-0
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+158
-1
include/Algo/MovingObjects/particle_cell_2D.hpp
include/Algo/MovingObjects/particle_cell_2D.hpp
+3
-3
include/Algo/Parallel/parallel_foreach.h
include/Algo/Parallel/parallel_foreach.h
+3
-8
include/Algo/Remeshing/pliant.h
include/Algo/Remeshing/pliant.h
+48
-0
include/Algo/Remeshing/pliant.hpp
include/Algo/Remeshing/pliant.hpp
+207
-0
include/Geometry/basic.hpp
include/Geometry/basic.hpp
+0
-1
include/Geometry/inclusion.hpp
include/Geometry/inclusion.hpp
+4
-4
include/Geometry/intersection.hpp
include/Geometry/intersection.hpp
+8
-1
include/Geometry/orientation.hpp
include/Geometry/orientation.hpp
+6
-5
include/Geometry/vector_gen.h
include/Geometry/vector_gen.h
+2
-0
include/Geometry/vector_gen.hpp
include/Geometry/vector_gen.hpp
+12
-2
include/Topology/generic/embeddedMap2.hpp
include/Topology/generic/embeddedMap2.hpp
+17
-3
include/Topology/map/map2.h
include/Topology/map/map2.h
+2
-2
src/Algo/ImplicitHierarchicalMesh/ihm.cpp
src/Algo/ImplicitHierarchicalMesh/ihm.cpp
+1
-1
src/Utils/glutwin_atb.cpp
src/Utils/glutwin_atb.cpp
+2
-2
No files found.
Apps/Examples/Release/CMakeLists.txt
View file @
2f7d4461
...
...
@@ -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/Tests/CMakeLists.txt
View file @
2f7d4461
...
...
@@ -9,6 +9,15 @@ SET(CMAKE_BUILD_TYPE Debug)
# define includes path
include_directories
(
${
CGoGN_ROOT_DIR
}
/include
/usr/include/libxml2/
${
CGoGN_ROOT_DIR
}
/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/Numerical
${
CGoGN_ROOT_DIR
}
/ThirdParty/Numerical/UFconfig
${
CGoGN_ROOT_DIR
}
/ThirdParty/gzstream
${
CGoGN_ROOT_DIR
}
/ThirdParty/Zinri
${
CGoGN_ROOT_DIR
}
/ThirdParty/AntTweakBar/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/OpenCTM
${
CGoGN_ROOT_DIR
}
/ThirdParty/Assimp/include
)
# define libs path
...
...
@@ -26,3 +35,7 @@ target_link_libraries( Geom_orientationD
add_executable
(
Geom_inclusionD ./Geom_inclusion.cpp
)
target_link_libraries
(
Geom_inclusionD
${
COMMON_LIBS
}
)
add_executable
(
Algo_Geom_inclusionD ./Algo_Geom_inclusion.cpp
)
target_link_libraries
(
Algo_Geom_inclusionD
containerD topologyD utilsD algoD
${
COMMON_LIBS
}
)
Apps/Examples/Tests/Geom_inclusion.cpp
View file @
2f7d4461
...
...
@@ -39,6 +39,8 @@ int main()
VEC3
tc
(
0
,
5
,
0
);
VEC3
pIn1
(
1
,
1
,
0
);
VEC3
pIn2
(
2
,
0
,
0
);
VEC3
pIn3
=
(
tb
+
tc
)
/
2.0
f
;
VEC3
pIn4
=
(
tc
+
ta
)
/
2.0
f
;
VEC3
pOut
(
6
,
0
,
0
);
if
(
Geom
::
isPointInTriangle
<
VEC3
>
(
pIn1
,
ta
,
tb
,
tc
)
!=
Geom
::
FACE_INCLUSION
)
...
...
@@ -51,6 +53,16 @@ int main()
std
::
cout
<<
"ERROR : isPointInTriangle : edge inclusion"
<<
std
::
endl
;
}
if
(
Geom
::
isPointInTriangle
<
VEC3
>
(
pIn3
,
ta
,
tb
,
tc
)
!=
Geom
::
EDGE_INCLUSION
)
{
std
::
cout
<<
"ERROR : isPointInTriangle : edge inclusion"
<<
std
::
endl
;
}
if
(
Geom
::
isPointInTriangle
<
VEC3
>
(
pIn4
,
ta
,
tb
,
tc
)
!=
Geom
::
EDGE_INCLUSION
)
{
std
::
cout
<<
"ERROR : isPointInTriangle : edge inclusion"
<<
std
::
endl
;
}
if
(
Geom
::
isPointInTriangle
<
VEC3
>
(
ta
,
ta
,
tb
,
tc
)
!=
Geom
::
VERTEX_INCLUSION
)
{
std
::
cout
<<
"ERROR : isPointInTriangle : vertex inclusion"
<<
std
::
endl
;
...
...
Apps/Examples/miniTest.cpp
View file @
2f7d4461
...
...
@@ -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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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.0f;
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
;
...
...
@@ -541,15 +591,15 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
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.0f;
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
;
position =
myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position")
;
position
=
positionF
;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
if
(
!
normal
.
isValid
())
...
...
@@ -558,19 +608,46 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
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.0f;
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
)
;
...
...
@@ -624,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 @
2f7d4461
...
...
@@ -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 @
2f7d4461
...
...
@@ -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
d1
,
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 @
2f7d4461
...
...
@@ -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 @
2f7d4461
/*******************************************************************************
* 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 @
2f7d4461
/*******************************************************************************
* 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/inclusion.h
View file @
2f7d4461
...
...
@@ -73,7 +73,7 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const typename PFP::T
* @param the point
*/
template
<
typename
PFP
>
bool
isPointInConvexFace2D
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
positions
,
const
typename
PFP
::
VEC3
&
point
,
bool
CCW
);
bool
isPointInConvexFace2D
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
positions
,
const
typename
PFP
::
VEC3
&
point
,
bool
CCW
=
true
);
/**
* test if a point is inside a face
...
...
include/Algo/Geometry/localFrame.h
View file @
2f7d4461
...
...
@@ -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 @
2f7d4461
...
...
@@ -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
;