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
David Cazier
CGoGN
Commits
26cc8e85
Commit
26cc8e85
authored
Jun 30, 2011
by
Sylvain Thery
Browse files
Ajour rendu de points en svg
parent
c5c74a8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Algo/Render/SVG/mapSVGRender.h
View file @
26cc8e85
...
...
@@ -87,15 +87,21 @@ public:
};
class
SvgPo
lyline
:
public
SvgObj
class
SvgPo
ints
:
public
SvgObj
{
protected:
float
m_pointSize
;
public:
SvgPoints
()
:
m_pointSize
(
4
)
{}
void
save
(
std
::
ofstream
&
out
);
void
setPointSize
(
float
ps
)
{
m_pointSize
=
ps
;}
};
class
SvgPolyline
:
public
SvgObj
{
public:
void
save
(
std
::
ofstream
&
out
);
};
...
...
@@ -153,6 +159,10 @@ public:
template
<
typename
PFP
>
void
renderFacesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
float
shrink
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
template
<
typename
PFP
>
void
renderPointsToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
void
orderPrimitives
(
std
::
list
<
SvgObj
*>&
primitives
);
};
...
...
include/Algo/Render/SVG/mapSVGRender.hpp
View file @
26cc8e85
...
...
@@ -38,6 +38,32 @@ namespace Render
namespace
SVG
{
template
<
typename
PFP
>
void
SVGOut
::
renderPointsToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
,
unsigned
int
thread
)
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
SvgPoints
*
points
=
new
SvgPoints
();
points
->
setColor
(
global_color
);
DartMarker
m
(
map
,
thread
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
m
.
isMarked
(
d
)
&&
good
(
d
))
{
const
Geom
::
Vec3f
&
P
=
position
[
d
];
glm
::
vec3
Q
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
m_proj
,
viewport
);
glm
::
vec3
R
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
glm
::
mat4
(
1.0
),
viewport
);
points
->
addVertex
(
Geom
::
Vec3f
(
Q
[
0
],
float
(
viewport
[
3
])
-
Q
[
1
],
Q
[
2
]));
m
.
markOrbit
(
VERTEX
,
d
);
}
}
m_objs
.
push_back
(
points
);
}
template
<
typename
PFP
>
void
SVGOut
::
renderLinesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
,
unsigned
int
thread
)
{
...
...
src/Algo/Render/mapSVGRender.cpp
View file @
26cc8e85
...
...
@@ -86,6 +86,35 @@ Geom::Vec3f SvgObj::normal()
}
void
SvgPoints
::
save
(
std
::
ofstream
&
out
)
{
std
::
stringstream
ss
;
std
::
cout
<<
"SAVE"
<<
std
::
endl
;
for
(
std
::
vector
<
Geom
::
Vec3f
>::
iterator
it
=
m_vertices
.
begin
();
it
!=
m_vertices
.
end
();
++
it
)
{
out
<<
"<circle cx=
\"
"
<<
(
*
it
)[
0
];
out
<<
"
\"
cy=
\"
"
<<
(
*
it
)[
1
];
out
<<
"
\"
r=
\"
"
<<
m_pointSize
;
out
<<
"
\"
style=
\"
stroke: none; fill: #"
;
out
<<
std
::
hex
;
unsigned
int
wp
=
out
.
width
(
2
);
char
prev
=
out
.
fill
(
'0'
);
out
<<
int
(
m_color
[
0
]
*
255
);
out
.
width
(
2
);
out
.
fill
(
'0'
);
out
<<
int
(
m_color
[
1
]
*
255
);
out
.
width
(
2
);
out
.
fill
(
'0'
);
out
<<
int
(
m_color
[
2
]
*
255
)
<<
std
::
dec
;
out
.
fill
(
prev
);
out
.
width
(
wp
);
out
<<
"
\"
/>"
<<
std
::
endl
;
}
}
void
SvgPolyline
::
save
(
std
::
ofstream
&
out
)
{
...
...
@@ -208,12 +237,13 @@ void SVGOut::setWidth(float w)
void
SVGOut
::
closeFile
()
{
// here do the sort in necessary
compNormObj
cmp
;
std
::
sort
(
m_objs
.
begin
(),
m_objs
.
end
(),
cmp
);
//
compNormObj cmp;
//
std::sort(m_objs.begin(),m_objs.end(),cmp);
std
::
list
<
SvgObj
*>
primitives
;
std
::
cout
<<
"CLOSE"
<<
std
::
endl
;
// std::list<SvgObj*> primitives;
for
(
std
::
list
<
SvgObj
*>::
iterator
it
=
primitive
s
.
begin
();
it
!=
primitive
s
.
end
();
++
it
)
for
(
std
::
vector
<
SvgObj
*>::
iterator
it
=
m_obj
s
.
begin
();
it
!=
m_obj
s
.
end
();
++
it
)
{
(
*
it
)
->
save
(
*
m_out
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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