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
e401dc09
Commit
e401dc09
authored
Apr 25, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draw topo in viewer + update feature lines
parent
3288e972
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
270 additions
and
316 deletions
+270
-316
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+27
-9
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+3
-0
Apps/Examples/viewer.ui
Apps/Examples/viewer.ui
+7
-0
include/Algo/Geometry/feature.h
include/Algo/Geometry/feature.h
+54
-70
include/Algo/Geometry/feature.hpp
include/Algo/Geometry/feature.hpp
+179
-237
No files found.
Apps/Examples/viewer.cpp
View file @
e401dc09
...
@@ -30,6 +30,7 @@ Viewer::Viewer() :
...
@@ -30,6 +30,7 @@ Viewer::Viewer() :
m_drawEdges
(
false
),
m_drawEdges
(
false
),
m_drawFaces
(
true
),
m_drawFaces
(
true
),
m_drawNormals
(
false
),
m_drawNormals
(
false
),
m_drawTopo
(
false
),
m_render
(
NULL
),
m_render
(
NULL
),
m_phongShader
(
NULL
),
m_phongShader
(
NULL
),
m_flatShader
(
NULL
),
m_flatShader
(
NULL
),
...
@@ -68,6 +69,7 @@ void Viewer::initGUI()
...
@@ -68,6 +69,7 @@ void Viewer::initGUI()
setCallBack
(
dock
.
check_drawEdges
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawEdges
(
bool
))
)
;
setCallBack
(
dock
.
check_drawEdges
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawEdges
(
bool
))
)
;
setCallBack
(
dock
.
check_drawFaces
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawFaces
(
bool
))
)
;
setCallBack
(
dock
.
check_drawFaces
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawFaces
(
bool
))
)
;
setCallBack
(
dock
.
combo_faceLighting
,
SIGNAL
(
currentIndexChanged
(
int
)),
SLOT
(
slot_faceLighting
(
int
))
)
;
setCallBack
(
dock
.
combo_faceLighting
,
SIGNAL
(
currentIndexChanged
(
int
)),
SLOT
(
slot_faceLighting
(
int
))
)
;
setCallBack
(
dock
.
check_drawTopo
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawTopo
(
bool
))
)
;
setCallBack
(
dock
.
check_drawNormals
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawNormals
(
bool
))
)
;
setCallBack
(
dock
.
check_drawNormals
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
slot_drawNormals
(
bool
))
)
;
setCallBack
(
dock
.
slider_normalsSize
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_normalsSize
(
int
))
)
;
setCallBack
(
dock
.
slider_normalsSize
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
slot_normalsSize
(
int
))
)
;
}
}
...
@@ -79,6 +81,9 @@ void Viewer::cb_initGL()
...
@@ -79,6 +81,9 @@ void Viewer::cb_initGL()
setFocal
(
5.0
f
)
;
setFocal
(
5.0
f
)
;
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_topoRender
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
m_topoRender
->
setInitialDartsColor
(
0.25
f
,
0.25
f
,
0.25
f
)
;
m_positionVBO
=
new
Utils
::
VBO
()
;
m_positionVBO
=
new
Utils
::
VBO
()
;
m_normalVBO
=
new
Utils
::
VBO
()
;
m_normalVBO
=
new
Utils
::
VBO
()
;
...
@@ -119,7 +124,6 @@ void Viewer::cb_initGL()
...
@@ -119,7 +124,6 @@ void Viewer::cb_initGL()
void
Viewer
::
cb_redraw
()
void
Viewer
::
cb_redraw
()
{
{
//glClearColor(1,1,1,0);
if
(
m_drawVertices
)
if
(
m_drawVertices
)
{
{
float
size
=
vertexScaleFactor
;
float
size
=
vertexScaleFactor
;
...
@@ -135,14 +139,6 @@ void Viewer::cb_redraw()
...
@@ -135,14 +139,6 @@ void Viewer::cb_redraw()
m_render
->
draw
(
m_simpleColorShader
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
draw
(
m_simpleColorShader
,
Algo
::
Render
::
GL2
::
LINES
)
;
}
}
if
(
m_drawNormals
)
{
float
size
=
normalBaseSize
*
normalScaleFactor
;
m_vectorShader
->
setScale
(
size
)
;
glLineWidth
(
1.0
f
)
;
m_render
->
draw
(
m_vectorShader
,
Algo
::
Render
::
GL2
::
POINTS
)
;
}
if
(
m_drawFaces
)
if
(
m_drawFaces
)
{
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
)
;
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
)
;
...
@@ -161,6 +157,19 @@ void Viewer::cb_redraw()
...
@@ -161,6 +157,19 @@ void Viewer::cb_redraw()
}
}
glDisable
(
GL_POLYGON_OFFSET_FILL
)
;
glDisable
(
GL_POLYGON_OFFSET_FILL
)
;
}
}
if
(
m_drawTopo
)
{
m_topoRender
->
drawTopo
()
;
}
if
(
m_drawNormals
)
{
float
size
=
normalBaseSize
*
normalScaleFactor
;
m_vectorShader
->
setScale
(
size
)
;
glLineWidth
(
1.0
f
)
;
m_render
->
draw
(
m_vectorShader
,
Algo
::
Render
::
GL2
::
POINTS
)
;
}
}
}
void
Viewer
::
cb_Open
()
void
Viewer
::
cb_Open
()
...
@@ -209,6 +218,8 @@ void Viewer::importMesh(std::string& filename)
...
@@ -209,6 +218,8 @@ void Viewer::importMesh(std::string& filename)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
// vertexBaseSize = normalBaseSize / 5.0f ;
// vertexBaseSize = normalBaseSize / 5.0f ;
...
@@ -271,6 +282,12 @@ void Viewer::slot_faceLighting(int i)
...
@@ -271,6 +282,12 @@ void Viewer::slot_faceLighting(int i)
updateGL
()
;
updateGL
()
;
}
}
void
Viewer
::
slot_drawTopo
(
bool
b
)
{
m_drawTopo
=
b
;
updateGL
()
;
}
void
Viewer
::
slot_drawNormals
(
bool
b
)
void
Viewer
::
slot_drawNormals
(
bool
b
)
{
{
m_drawNormals
=
b
;
m_drawNormals
=
b
;
...
@@ -280,6 +297,7 @@ void Viewer::slot_drawNormals(bool b)
...
@@ -280,6 +297,7 @@ void Viewer::slot_drawNormals(bool b)
void
Viewer
::
slot_normalsSize
(
int
i
)
void
Viewer
::
slot_normalsSize
(
int
i
)
{
{
normalScaleFactor
=
i
/
50.0
f
;
normalScaleFactor
=
i
/
50.0
f
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
i
/
100.0
f
,
i
/
100.0
f
)
;
updateGL
()
;
updateGL
()
;
}
}
...
...
Apps/Examples/viewer.h
View file @
e401dc09
...
@@ -90,11 +90,13 @@ public:
...
@@ -90,11 +90,13 @@ public:
bool
m_drawEdges
;
bool
m_drawEdges
;
bool
m_drawFaces
;
bool
m_drawFaces
;
bool
m_drawNormals
;
bool
m_drawNormals
;
bool
m_drawTopo
;
PFP
::
TVEC3
position
;
PFP
::
TVEC3
position
;
PFP
::
TVEC3
normal
;
PFP
::
TVEC3
normal
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Algo
::
Render
::
GL2
::
TopoRender
*
m_topoRender
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
Utils
::
VBO
*
m_normalVBO
;
...
@@ -123,6 +125,7 @@ public slots:
...
@@ -123,6 +125,7 @@ public slots:
void
slot_drawEdges
(
bool
b
)
;
void
slot_drawEdges
(
bool
b
)
;
void
slot_drawFaces
(
bool
b
)
;
void
slot_drawFaces
(
bool
b
)
;
void
slot_faceLighting
(
int
i
)
;
void
slot_faceLighting
(
int
i
)
;
void
slot_drawTopo
(
bool
b
)
;
void
slot_drawNormals
(
bool
b
)
;
void
slot_drawNormals
(
bool
b
)
;
void
slot_normalsSize
(
int
i
)
;
void
slot_normalsSize
(
int
i
)
;
};
};
Apps/Examples/viewer.ui
View file @
e401dc09
...
@@ -73,6 +73,13 @@
...
@@ -73,6 +73,13 @@
</item>
</item>
</widget>
</widget>
</item>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"check_drawTopo"
>
<property
name=
"text"
>
<string>
draw topo
</string>
</property>
</widget>
</item>
<item>
<item>
<widget
class=
"QCheckBox"
name=
"check_drawNormals"
>
<widget
class=
"QCheckBox"
name=
"check_drawNormals"
>
<property
name=
"text"
>
<property
name=
"text"
>
...
...
include/Algo/Geometry/feature.h
View file @
e401dc09
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
#ifndef __ALGO_GEOMETRY_FEATURE_H__
#ifndef __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__
namespace
CGoGN
namespace
CGoGN
{
{
...
@@ -38,15 +36,11 @@ namespace Geometry
...
@@ -38,15 +36,11 @@ namespace Geometry
enum
enum
{
{
EMPTY
,
EMPTY
=
0
,
SEGMENT
,
SEGMENT
=
1
,
BARY
BARY
=
2
};
};
//#define EMPTY 0
//#define SEGMENT 1
//#define BARY 2
typedef
struct
{
Dart
d
;
float
w
;
}
e0point
;
typedef
struct
{
Dart
d
;
float
w
;
}
e0point
;
typedef
struct
{
e0point
p1
;
e0point
p2
;
unsigned
char
type
;
}
e0segment
;
typedef
struct
{
e0point
p1
;
e0point
p2
;
unsigned
char
type
;
}
e0segment
;
typedef
NoMathIONameAttribute
<
e0segment
>
ridgeSegment
;
typedef
NoMathIONameAttribute
<
e0segment
>
ridgeSegment
;
...
@@ -61,22 +55,45 @@ template <typename PFP>
...
@@ -61,22 +55,45 @@ template <typename PFP>
void
computeFaceGradient
(
void
computeFaceGradient
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
face_area
,
typename
PFP
::
TVEC3
&
face_gradient
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
faceGradient
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
,
const
typename
PFP
::
TREAL
&
area
)
;
template
<
typename
PFP
>
void
computeVertexGradient
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TREAL
&
face_area
,
typename
PFP
::
TVEC3
&
vertex_gradient
,
const
FunctorSelect
&
select
=
allDarts
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexGradient
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TREAL
&
area
)
;
//template <typename PFP>
//template <typename PFP>
//
void computeVertexGradient
(
//
typename PFP::REAL extremality
(
// typename PFP::MAP& map,
// typename PFP::MAP& map,
// const typename PFP::TVEC3& position,
// Dart d,
// typename PFP::TVEC3& gradient,
// const typename PFP::VEC3& K,
// typename PFP::TVEC3& face_gradient,
// const typename PFP::TVEC3& face_gradient,
// const typename PFP::TREAL& area,
// const typename PFP::TREAL& face_area) ;
// const FunctorSelect& select = allDarts,
// unsigned int thread = 0) ;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
computeTriangleType
(
void
computeTriangleType
(
...
@@ -87,94 +104,61 @@ void computeTriangleType(
...
@@ -87,94 +104,61 @@ void computeTriangleType(
unsigned
int
thread
=
0
)
;
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
computeRidgeLines
(
bool
isTriangleRegular
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
Kmax
)
;
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
const
typename
PFP
::
TVEC3
&
faceGradient
,
const
typename
PFP
::
TREAL
&
area
,
const
typename
PFP
::
TVEC3
&
K
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
initRidgeSegments
(
void
initRidgeSegments
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
compute
SingularTriangle
(
void
compute
RidgeLines
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
CellMarker
&
regularMarker
,
typename
PFP
::
TVEC3
&
k
,
const
typename
PFP
::
TVEC3
&
vertex_gradient
,
const
typename
PFP
::
TVEC3
&
K
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
std
::
vector
<
typename
PFP
::
VEC3
>
occludingContoursDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
VEC3
&
cameraPosition
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
normal
)
;
template
<
typename
PFP
>
typename
PFP
::
VEC3
faceGradient
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
)
;
template
<
typename
PFP
>
bool
isTriangleRegular
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
Kmax
)
;
//template <typename PFP>
//bool isInSameOctant(const typename PFP::VEC3& pos1, const typename PFP::VEC3& pos2) ;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
ridgeLines
(
void
ridgeLines
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
K
,
const
typename
PFP
::
TVEC3
&
K
,
const
typename
PFP
::
TVEC3
&
faceGradient
,
const
typename
PFP
::
TVEC3
&
vertex_gradient
,
const
typename
PFP
::
TREAL
&
area
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
)
;
AttributeHandler
<
ridgeSegment
>&
ridge_segments
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
extremality
(
void
computeExtremalities
()
;
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
VEC3
&
K
,
const
typename
PFP
::
TVEC3
&
faceGradient
,
const
typename
PFP
::
TREAL
&
area
)
;
//
template <typename PFP>
template
<
typename
PFP
>
//typename PFP::TVEC3 vertexGradient
(
void
computeSingularTriangle
(
//
typename PFP::MAP& map,
typename
PFP
::
MAP
&
map
,
// Dart d
,
CellMarker
&
regularMarker
,
// const typename PFP::TVEC3& position
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
// const typename PFP::TVEC3& face_gradient
,
const
FunctorSelect
&
select
=
allDarts
,
// const typename PFP::TREAL& area
) ;
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
void
singularTriangle
(
void
singularTriangle
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
Dart
d
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
CellMarker
&
regularMarker
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
)
;
AttributeHandler
<
ridgeSegment
>&
ridge_segments
)
;
template
<
typename
PFP
>
template
<
typename
PFP
>
bool
isEdgeInTriangle
(
typename
PFP
::
MAP
&
map
,
Dart
edge
,
Dart
triangle
)
;
bool
isEdgeInTriangle
(
typename
PFP
::
MAP
&
map
,
Dart
edge
,
Dart
triangle
)
;
template
<
typename
PFP
>
std
::
vector
<
typename
PFP
::
VEC3
>
occludingContoursDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
VEC3
&
cameraPosition
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
normal
)
;
}
// namespace Geometry
}
// namespace Geometry
}
// namespace Algo
}
// namespace Algo
...
...
include/Algo/Geometry/feature.hpp
View file @
e401dc09
...
@@ -65,10 +65,10 @@ template <typename PFP>
...
@@ -65,10 +65,10 @@ template <typename PFP>
void
computeFaceGradient
(
void
computeFaceGradient
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
,
const
typename
PFP
::
TREAL
&
area
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
FunctorSelect
&
select
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
unsigned
int
thread
)
{
{
...
@@ -77,143 +77,6 @@ void computeFaceGradient(
...
@@ -77,143 +77,6 @@ void computeFaceGradient(
face_gradient
[
d
]
=
faceGradient
<
PFP
>
(
map
,
d
,
position
,
face_normal
,
kmax
,
area
)
;
face_gradient
[
d
]
=
faceGradient
<
PFP
>
(
map
,
d
,
position
,
face_normal
,
kmax
,
area
)
;
}
}
//template <typename PFP>
//void computeVertexGradient(
// typename PFP::MAP& map,
// const typename PFP::TVEC3& position,
// typename PFP::TVEC3& gradient,
// typename PFP::TVEC3& face_gradient,
// const typename PFP::TREAL& area,
// const FunctorSelect& select,
// unsigned int thread)
//{
// TraversorV<typename PFP::MAP> trav(map, select, thread);
// for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
// gradient[d] = vertexGradient<PFP>(map, d, position, face_gradient, area) ;
//}
template
<
typename
PFP
>
void
computeTriangleType
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
Kmax
,
CellMarker
&
regularMarker
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
,
select
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
if
(
isTriangleRegular
<
PFP
>
(
map
,
d
,
Kmax
))
regularMarker
.
mark
(
d
)
;
}
template
<
typename
PFP
>
void
computeRidgeLines
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
const
typename
PFP
::
TVEC3
&
faceGradient
,
const
typename
PFP
::
TREAL
&
area
,
const
typename
PFP
::
TVEC3
&
K
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
,
select
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
regularMarker
.
isMarked
(
d
))
ridgeLines
<
PFP
>
(
map
,
d
,
position
,
K
,
faceGradient
,
area
,
ridge_segments
)
;
}
}
template
<
typename
PFP
>
void
initRidgeSegments
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
,
select
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
ridge_segments
[
d
].
type
=
EMPTY
;
}
template
<
typename
PFP
>
void
computeSingularTriangle
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
{
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
,
select
,
thread
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
!
regularMarker
.
isMarked
(
d
))
singularTriangle
<
PFP
>
(
map
,
d
,
position
,
regularMarker
,
ridge_segments
)
;
}
}
template
<
typename
PFP
>
std
::
vector
<
typename
PFP
::
VEC3
>
occludingContoursDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
VEC3
&
cameraPosition
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
normal
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
std
::
vector
<
VEC3
>
occludingContours
;
TraversorF
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
VEC3
p1
=
position
[
d
]
;
VEC3
p2
=
position
[
map
.
phi1
(
d
)]
;
VEC3
p3
=
position
[
map
.
phi_1
(
d
)]
;
REAL
dp1
=
(
p1
-
cameraPosition
)
*
normal
[
d
]
;
REAL
dp2
=
(
p2
-
cameraPosition
)
*
normal
[
map
.
phi1
(
d
)]
;
REAL
dp3
=
(
p3
-
cameraPosition
)
*
normal
[
map
.
phi_1
(
d
)]
;
if
(
dp1
<
0
&&
dp2
>
0
)
{
REAL
alpha
=
-
dp1
/
(
-
dp1
+
dp2
)
;
occludingContours
.
push_back
(
alpha
*
p1
+
(
1
-
alpha
)
*
p2
)
;
}
if
(
dp2
<
0
&&
dp1
>
0
)
{
REAL
alpha
=
dp1
/
(
dp1
-
dp2
)
;
occludingContours
.
push_back
(
alpha
*
p1
+
(
1
-
alpha
)
*
p2
)
;
}
if
(
dp1
<
0
&&
dp3
>
0
)
{
REAL
alpha
=
-
dp1
/
(
-
dp1
+
dp3
)
;
occludingContours
.
push_back
(
alpha
*
p1
+
(
1
-
alpha
)
*
p3
)
;
}
if
(
dp3
<
0
&&
dp1
>
0
)
{
REAL
alpha
=
dp1
/
(
dp1
-
dp3
)
;
occludingContours
.
push_back
(
alpha
*
p1
+
(
1
-
alpha
)
*
p3
)
;
}
if
(
dp2
<
0
&&
dp3
>
0
)
{
REAL
alpha
=
-
dp2
/
(
-
dp2
+
dp3
)
;
occludingContours
.
push_back
(
alpha
*
p2
+
(
1
-
alpha
)
*
p3
)
;
}
if
(
dp3
<
0
&&
dp2
>
0
)
{
REAL
alpha
=
dp2
/
(
dp2
-
dp3
)
;
occludingContours
.
push_back
(
alpha
*
p2
+
(
1
-
alpha
)
*
p3
)
;
}
}
return
occludingContours
;
}
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
VEC3
faceGradient
(
typename
PFP
::
VEC3
faceGradient
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
...
@@ -221,7 +84,7 @@ typename PFP::VEC3 faceGradient(
...
@@ -221,7 +84,7 @@ typename PFP::VEC3 faceGradient(
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
)
const
typename
PFP
::
TREAL
&
face_
area
)
{
{
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
VEC3
VEC3
;
...
@@ -241,7 +104,7 @@ typename PFP::VEC3 faceGradient(
...
@@ -241,7 +104,7 @@ typename PFP::VEC3 faceGradient(
REAL
k3
=
kmax
[
it
]
;
REAL
k3
=
kmax
[
it
]
;
VEC3
n
=
face_normal
[
d
]
;
VEC3
n
=
face_normal
[
d
]
;
REAL
a
=
area
[
d
]
;
REAL
a
=
face_
area
[
d
]
;
VEC3
G
=
k1
*
(
(
n
^
(
pos3
-
pos2
)
)
/
(
2
*
a
)
)
+
VEC3
G
=
k1
*
(
(
n
^
(
pos3
-
pos2
)
)
/
(
2
*
a
)
)
+