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
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
Hide 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
template
<
typename
PFP
>
typename
PFP
::
REAL
triangleArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
VEC3
p1
=
position
[
d
];
typename
PFP
::
VEC3
p2
=
position
[
map
.
phi1
(
d
)];
typename
PFP
::
VEC3
p3
=
position
[
map
.
phi_1
(
d
)];
typename
PFP
::
VEC3
p1
=
position
[
d
]
;
typename
PFP
::
VEC3
p2
=
position
[
map
.
phi1
(
d
)]
;
typename
PFP
::
VEC3
p3
=
position
[
map
.
phi_1
(
d
)]
;
return
Geom
::
triangleArea
(
p1
,
p2
,
p3
)
;
}
...
...
@@ -47,7 +47,7 @@ typename PFP::REAL triangleArea(typename PFP::MAP& map, Dart d, const typename P
template
<
typename
PFP
>
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
))
return
triangleArea
<
PFP
>
(
map
,
d
,
position
)
;
...
...
@@ -58,8 +58,8 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename
Dart
it
=
d
;
do
{
VEC3
p1
=
position
[
it
];
VEC3
p2
=
position
[
map
.
phi1
(
it
)];
VEC3
p1
=
position
[
it
]
;
VEC3
p2
=
position
[
map
.
phi1
(
it
)]
;
area
+=
Geom
::
triangleArea
(
p1
,
p2
,
centroid
)
;
it
=
map
.
phi1
(
it
)
;
}
while
(
it
!=
d
)
;
...
...
include/Algo/Geometry/feature.h
View file @
4eff38ed
...
...
@@ -35,7 +35,10 @@ namespace Geometry
{
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
...
...
include/Algo/Geometry/feature.hpp
View file @
4eff38ed
...
...
@@ -35,28 +35,83 @@ namespace Geometry
{
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
DartMarker
&
featur
e
)
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
featureEdg
e
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
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
)
;
DartMarker
m
(
map
)
;
CellMarker
m
(
map
,
EDGE
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
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
))
feature
.
markOrbit
(
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
...
...
include/Algo/Remeshing/pliant.hpp
View file @
4eff38ed
...
...
@@ -81,7 +81,7 @@ void pliantRemeshing(typename PFP::MAP& map, typename PFP::TVEC3& position, type
}
// compute feature edges
DartMarker
featureEdge
(
map
)
;
CellMarker
featureEdge
(
map
,
EDGE
)
;
Algo
::
Geometry
::
featureEdgeDetection
<
PFP
>
(
map
,
position
,
featureEdge
)
;
// compute feature vertices
...
...
include/Geometry/bounding_box.hpp
View file @
4eff38ed
...
...
@@ -169,7 +169,7 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
{
VEC
bbmin
=
bb
.
min
()
;
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
])
m_pMin
[
i
]
=
bbmin
[
i
]
;
...
...
src/Utils/GLSLShader.cpp
View file @
4eff38ed
...
...
@@ -910,14 +910,13 @@ void GLSLShader::addPathFileSeach(const std::string& path)
m_pathes
.
push_back
(
path
);
}
unsigned
int
GLSLShader
::
bindVA_VBO
(
const
std
::
string
&
name
,
VBO
*
vbo
)
{
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
//valid ?
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
;
}
// search if name already exist
...
...
@@ -937,16 +936,11 @@ unsigned int GLSLShader::bindVA_VBO(const std::string& name, VBO* vbo)
return
(
m_va_vbo_binding
.
size
()
-
1
);
}
void
GLSLShader
::
changeVA_VBO
(
unsigned
int
id
,
VBO
*
vbo
)
{
m_va_vbo_binding
[
id
].
vbo_ptr
=
vbo
;
}
void
GLSLShader
::
unbindVA
(
const
std
::
string
&
name
)
{
GLint
idVA
=
glGetAttribLocation
(
this
->
m_program_object
,
name
.
c_str
());
...
...
@@ -971,9 +965,6 @@ void GLSLShader::unbindVA(const std::string& name)
CGoGNerr
<<
"GLSLShader: Attribute "
<<
name
<<
" not binded"
<<
CGoGNendl
;
}
void
GLSLShader
::
setCurrentOGLVersion
(
unsigned
int
version
)
{
CURRENT_OGL_VERSION
=
version
;
...
...
@@ -1026,7 +1017,6 @@ void GLSLShader::disableVertexAttribs() const
this
->
unbind
();
}
void
GLSLShader
::
updateCurrentMatrices
()
{
glm
::
mat4
model
(
currentModelView
());
...
...
@@ -1036,9 +1026,6 @@ void GLSLShader::updateCurrentMatrices()
it
->
second
->
updateMatrices
(
currentProjection
(),
model
);
}
}
// namespace Utils
}
// 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
GLfloat
depth_t
[
25
];
glReadPixels
(
x
-
2
,
yy
-
2
,
5
,
5
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
depth_t
);
GLfloat
depth
=
0.0
f
;
unsigned
int
nb
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
25
;
++
i
)
GLfloat
depth
=
0.0
f
;
unsigned
int
nb
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
25
;
++
i
)
{
if
(
depth_t
[
i
]
!=
1.0
f
)
{
...
...
@@ -326,7 +326,7 @@ GLfloat SimpleQT::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geom::Vec3f
nb
++
;
}
}
if
(
nb
>
0
)
if
(
nb
>
0
)
depth
/=
float
(
nb
);
else
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