Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KennethVanhoey
CGoGN
Commits
4eff38ed
Commit
4eff38ed
authored
Oct 18, 2011
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
occluding contours v1
parent
d204e178
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
34 deletions
+79
-34
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+6
-6
include/Algo/Geometry/feature.h
include/Algo/Geometry/feature.h
+4
-1
include/Algo/Geometry/feature.hpp
include/Algo/Geometry/feature.hpp
+62
-7
include/Algo/Remeshing/pliant.hpp
include/Algo/Remeshing/pliant.hpp
+1
-1
include/Geometry/bounding_box.hpp
include/Geometry/bounding_box.hpp
+1
-1
src/Utils/GLSLShader.cpp
src/Utils/GLSLShader.cpp
+1
-14
src/Utils/qtSimple.cpp
src/Utils/qtSimple.cpp
+4
-4
No files found.
include/Algo/Geometry/area.hpp
View file @
4eff38ed
...
@@ -37,9 +37,9 @@ namespace Geometry
...
@@ -37,9 +37,9 @@ namespace Geometry
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
triangleArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
typename
PFP
::
REAL
triangleArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
{
typename
PFP
::
VEC3
p1
=
position
[
d
];
typename
PFP
::
VEC3
p1
=
position
[
d
]
;
typename
PFP
::
VEC3
p2
=
position
[
map
.
phi1
(
d
)];
typename
PFP
::
VEC3
p2
=
position
[
map
.
phi1
(
d
)]
;
typename
PFP
::
VEC3
p3
=
position
[
map
.
phi_1
(
d
)];
typename
PFP
::
VEC3
p3
=
position
[
map
.
phi_1
(
d
)]
;
return
Geom
::
triangleArea
(
p1
,
p2
,
p3
)
;
return
Geom
::
triangleArea
(
p1
,
p2
,
p3
)
;
}
}
...
@@ -47,7 +47,7 @@ typename PFP::REAL triangleArea(typename PFP::MAP& map, Dart d, const typename P
...
@@ -47,7 +47,7 @@ typename PFP::REAL triangleArea(typename PFP::MAP& map, Dart d, const typename P
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
convexFaceArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
typename
PFP
::
REAL
convexFaceArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
VEC3
VEC3
;
if
(
map
.
isFaceTriangle
(
d
))
if
(
map
.
isFaceTriangle
(
d
))
return
triangleArea
<
PFP
>
(
map
,
d
,
position
)
;
return
triangleArea
<
PFP
>
(
map
,
d
,
position
)
;
...
@@ -58,8 +58,8 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename
...
@@ -58,8 +58,8 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename
Dart
it
=
d
;
Dart
it
=
d
;
do
do
{
{
VEC3
p1
=
position
[
it
];
VEC3
p1
=
position
[
it
]
;
VEC3
p2
=
position
[
map
.
phi1
(
it
)];
VEC3
p2
=
position
[
map
.
phi1
(
it
)]
;
area
+=
Geom
::
triangleArea
(
p1
,
p2
,
centroid
)
;
area
+=
Geom
::
triangleArea
(
p1
,
p2
,
centroid
)
;
it
=
map
.
phi1
(
it
)
;
it
=
map
.
phi1
(
it
)
;
}
while
(
it
!=
d
)
;
}
while
(
it
!=
d
)
;
...
...
include/Algo/Geometry/feature.h
View file @
4eff38ed
...
@@ -35,7 +35,10 @@ namespace Geometry
...
@@ -35,7 +35,10 @@ namespace Geometry
{
{
template
<
typename
PFP
>
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
DartMarker
&
feature
)
;
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
featureEdge
)
;
template
<
typename
PFP
>
std
::
vector
<
typename
PFP
::
VEC3
>
occludingContoursDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
VEC3
&
viewDir
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
normal
)
;
}
// namespace Geometry
}
// namespace Geometry
...
...
include/Algo/Geometry/feature.hpp
View file @
4eff38ed
...
@@ -35,28 +35,83 @@ namespace Geometry
...
@@ -35,28 +35,83 @@ namespace Geometry
{
{
template
<
typename
PFP
>
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
Dart
Marker
&
feature
)
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
Cell
Marker
&
feature
Edge
)
{
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
REAL
REAL
;
feature
.
unmarkAll
()
;
feature
Edge
.
unmarkAll
()
;
AttributeHandler
<
VEC3
>
fNormal
=
map
.
template
addAttribute
<
VEC3
>(
FACE
,
"fNormal"
)
;
AttributeHandler
<
VEC3
>
fNormal
=
map
.
template
getAttribute
<
VEC3
>(
FACE
,
"normal"
)
;
if
(
!
fNormal
.
isValid
())
fNormal
=
map
.
template
addAttribute
<
VEC3
>(
FACE
,
"normal"
)
;
Algo
::
Geometry
::
computeNormalFaces
<
PFP
>
(
map
,
position
,
fNormal
)
;
Algo
::
Geometry
::
computeNormalFaces
<
PFP
>
(
map
,
position
,
fNormal
)
;
Dart
Marker
m
(
map
)
;
Cell
Marker
m
(
map
,
EDGE
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
{
if
(
!
m
.
isMarked
(
d
))
if
(
!
m
.
isMarked
(
d
))
{
{
m
.
mark
Orbit
(
EDGE
,
d
)
;
m
.
mark
(
d
)
;
if
(
Geom
::
angle
(
fNormal
[
d
],
fNormal
[
map
.
phi2
(
d
)])
>
M_PI
/
REAL
(
6
))
if
(
Geom
::
angle
(
fNormal
[
d
],
fNormal
[
map
.
phi2
(
d
)])
>
M_PI
/
REAL
(
6
))
feature
.
mark
Orbit
(
EDGE
,
d
)
;
feature
Edge
.
mark
(
d
)
;
}
}
}
}
map
.
template
removeAttribute
<
VEC3
>(
fNormal
)
;
// map.template removeAttribute<VEC3>(fNormal) ;
}
template
<
typename
PFP
>
std
::
vector
<
typename
PFP
::
VEC3
>
occludingContoursDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
VEC3
&
viewDir
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
&
normal
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
std
::
vector
<
VEC3
>
occludingContours
;
CellMarker
m
(
map
,
FACE
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
m
.
isMarked
(
d
))
{
m
.
mark
(
d
)
;
REAL
dp1
=
viewDir
*
normal
[
d
]
;
REAL
dp2
=
viewDir
*
normal
[
map
.
phi1
(
d
)]
;
REAL
dp3
=
viewDir
*
normal
[
map
.
phi_1
(
d
)]
;
if
(
dp1
<
0
&&
dp2
>
0
)
{
REAL
alpha
=
-
dp1
/
(
-
dp1
+
dp2
)
;
occludingContours
.
push_back
(
alpha
*
position
[
d
]
+
(
1
-
alpha
)
*
position
[
map
.
phi1
(
d
)])
;
}
if
(
dp2
<
0
&&
dp1
>
0
)
{
REAL
alpha
=
dp1
/
(
dp1
-
dp2
)
;
occludingContours
.
push_back
(
alpha
*
position
[
d
]
+
(
1
-
alpha
)
*
position
[
map
.
phi1
(
d
)])
;
}
if
(
dp1
<
0
&&
dp3
>
0
)
{
REAL
alpha
=
-
dp1
/
(
-
dp1
+
dp3
)
;
occludingContours
.
push_back
(
alpha
*
position
[
d
]
+
(
1
-
alpha
)
*
position
[
map
.
phi_1
(
d
)])
;
}
if
(
dp3
<
0
&&
dp1
>
0
)
{
REAL
alpha
=
dp1
/
(
dp1
-
dp3
)
;
occludingContours
.
push_back
(
alpha
*
position
[
d
]
+
(
1
-
alpha
)
*
position
[
map
.
phi_1
(
d
)])
;
}
if
(
dp2
<
0
&&
dp3
>
0
)
{
REAL
alpha
=
-
dp2
/
(
-
dp2
+
dp3
)
;
occludingContours
.
push_back
(
alpha
*
position
[
map
.
phi1
(
d
)]
+
(
1
-
alpha
)
*
position
[
map
.
phi_1
(
d
)])
;
}
if
(
dp3
<
0
&&
dp2
>
0
)
{
REAL
alpha
=
dp2
/
(
dp2
-
dp3
)
;
occludingContours
.
push_back
(
alpha
*
position
[
map
.
phi1
(
d
)]
+
(
1
-
alpha
)
*
position
[
map
.
phi_1
(
d
)])
;
}
}
}
return
occludingContours
;
}
}
}
// namespace Geometry
}
// namespace Geometry
...
...
include/Algo/Remeshing/pliant.hpp
View file @
4eff38ed
...
@@ -81,7 +81,7 @@ void pliantRemeshing(typename PFP::MAP& map, typename PFP::TVEC3& position, type
...
@@ -81,7 +81,7 @@ void pliantRemeshing(typename PFP::MAP& map, typename PFP::TVEC3& position, type
}
}
// compute feature edges
// compute feature edges
Dart
Marker
featureEdge
(
map
)
;
Cell
Marker
featureEdge
(
map
,
EDGE
)
;
Algo
::
Geometry
::
featureEdgeDetection
<
PFP
>
(
map
,
position
,
featureEdge
)
;
Algo
::
Geometry
::
featureEdgeDetection
<
PFP
>
(
map
,
position
,
featureEdge
)
;
// compute feature vertices
// compute feature vertices
...
...
include/Geometry/bounding_box.hpp
View file @
4eff38ed
...
@@ -169,7 +169,7 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
...
@@ -169,7 +169,7 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
{
{
VEC
bbmin
=
bb
.
min
()
;
VEC
bbmin
=
bb
.
min
()
;
VEC
bbmax
=
bb
.
max
()
;
VEC
bbmax
=
bb
.
max
()
;
for
(
unsigned
int
i
=
0
;
i
<
bbmin
.
size
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
bbmin
.
dimension
();
++
i
)
{
{
if
(
bbmin
[
i
]
<
m_pMin
[
i
])
if
(
bbmin
[
i
]
<
m_pMin
[
i
])
m_pMin
[
i
]
=
bbmin
[
i
]
;
m_pMin
[
i
]
=
bbmin
[
i
]
;
...
...
src/Utils/GLSLShader.cpp
View file @
4eff38ed
...
@@ -910,14 +910,13 @@ void GLSLShader::addPathFileSeach(const std::string& path)
...
@@ -910,14 +910,13 @@ void GLSLShader::addPathFileSeach(const std::string& path)
m_pathes
.
push_back
(
path
);
m_pathes
.
push_back
(
path
);
}
}
unsigned
int
GLSLShader
::
bindVA_VBO
(
const
std
::
string
&
name
,
VBO
*
vbo
)
unsigned
int
GLSLShader
::
bindVA_VBO
(
const
std
::
string
&
name
,
VBO
*
vbo
)
{
{
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
//valid ?
//valid ?
if
(
idVA
<
0
)
if
(
idVA
<
0
)
{
{
CGoGNerr
<<
"GLSLShader: Attribute "
<<
name
<<
" does not exist in shader"
<<
CGoGNendl
;
CGoGNerr
<<
"GLSLShader: Attribute "
<<
name
<<
" does not exist in shader"
<<
CGoGNendl
;
return
idVA
;
return
idVA
;
}
}
// search if name already exist
// search if name already exist
...
@@ -937,16 +936,11 @@ unsigned int GLSLShader::bindVA_VBO(const std::string& name, VBO* vbo)
...
@@ -937,16 +936,11 @@ unsigned int GLSLShader::bindVA_VBO(const std::string& name, VBO* vbo)
return
(
m_va_vbo_binding
.
size
()
-
1
);
return
(
m_va_vbo_binding
.
size
()
-
1
);
}
}
void
GLSLShader
::
changeVA_VBO
(
unsigned
int
id
,
VBO
*
vbo
)
void
GLSLShader
::
changeVA_VBO
(
unsigned
int
id
,
VBO
*
vbo
)
{
{
m_va_vbo_binding
[
id
].
vbo_ptr
=
vbo
;
m_va_vbo_binding
[
id
].
vbo_ptr
=
vbo
;
}
}
void
GLSLShader
::
unbindVA
(
const
std
::
string
&
name
)
void
GLSLShader
::
unbindVA
(
const
std
::
string
&
name
)
{
{
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
...
@@ -971,9 +965,6 @@ void GLSLShader::unbindVA(const std::string& name)
...
@@ -971,9 +965,6 @@ void GLSLShader::unbindVA(const std::string& name)
CGoGNerr
<<
"GLSLShader: Attribute "
<<
name
<<
" not binded"
<<
CGoGNendl
;
CGoGNerr
<<
"GLSLShader: Attribute "
<<
name
<<
" not binded"
<<
CGoGNendl
;
}
}
void
GLSLShader
::
setCurrentOGLVersion
(
unsigned
int
version
)
void
GLSLShader
::
setCurrentOGLVersion
(
unsigned
int
version
)
{
{
CURRENT_OGL_VERSION
=
version
;
CURRENT_OGL_VERSION
=
version
;
...
@@ -1026,7 +1017,6 @@ void GLSLShader::disableVertexAttribs() const
...
@@ -1026,7 +1017,6 @@ void GLSLShader::disableVertexAttribs() const
this
->
unbind
();
this
->
unbind
();
}
}
void
GLSLShader
::
updateCurrentMatrices
()
void
GLSLShader
::
updateCurrentMatrices
()
{
{
glm
::
mat4
model
(
currentModelView
());
glm
::
mat4
model
(
currentModelView
());
...
@@ -1036,9 +1026,6 @@ void GLSLShader::updateCurrentMatrices()
...
@@ -1036,9 +1026,6 @@ void GLSLShader::updateCurrentMatrices()
it
->
second
->
updateMatrices
(
currentProjection
(),
model
);
it
->
second
->
updateMatrices
(
currentProjection
(),
model
);
}
}
}
// namespace Utils
}
// namespace Utils
}
// namespace CGoGN
}
// namespace CGoGN
src/Utils/qtSimple.cpp
View file @
4eff38ed
...
@@ -316,9 +316,9 @@ GLfloat SimpleQT::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f
...
@@ -316,9 +316,9 @@ GLfloat SimpleQT::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f
GLfloat
depth_t
[
25
];
GLfloat
depth_t
[
25
];
glReadPixels
(
x
-
2
,
yy
-
2
,
5
,
5
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
depth_t
);
glReadPixels
(
x
-
2
,
yy
-
2
,
5
,
5
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
depth_t
);
GLfloat
depth
=
0.0
f
;
GLfloat
depth
=
0.0
f
;
unsigned
int
nb
=
0
;
unsigned
int
nb
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
25
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
25
;
++
i
)
{
{
if
(
depth_t
[
i
]
!=
1.0
f
)
if
(
depth_t
[
i
]
!=
1.0
f
)
{
{
...
@@ -326,7 +326,7 @@ GLfloat SimpleQT::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f
...
@@ -326,7 +326,7 @@ GLfloat SimpleQT::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f
nb
++
;
nb
++
;
}
}
}
}
if
(
nb
>
0
)
if
(
nb
>
0
)
depth
/=
float
(
nb
);
depth
/=
float
(
nb
);
else
else
depth
=
0.5
f
;
depth
=
0.5
f
;
...
...
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