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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
b4752e7e
Commit
b4752e7e
authored
Jun 28, 2011
by
untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~jund/CGoGN
Conflicts: include/Algo/Import/importSvg.hpp include/Geometry/intersection.hpp
parents
3f75f814
200b462f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
413 additions
and
1059 deletions
+413
-1059
Apps/Tuto/stage_shader.h
Apps/Tuto/stage_shader.h
+2
-0
include/Algo/BooleanOperator/mergeVertices.h
include/Algo/BooleanOperator/mergeVertices.h
+55
-0
include/Algo/BooleanOperator/mergeVertices.hpp
include/Algo/BooleanOperator/mergeVertices.hpp
+82
-0
include/Algo/Export/exportPov.h
include/Algo/Export/exportPov.h
+1
-1
include/Algo/Import/importSvg.h
include/Algo/Import/importSvg.h
+1
-1
include/Algo/Import/importSvg.hpp
include/Algo/Import/importSvg.hpp
+0
-684
include/Algo/MovingObjects/particle_cell_2D.h
include/Algo/MovingObjects/particle_cell_2D.h
+3
-0
include/Algo/MovingObjects/particle_cell_2D.hpp
include/Algo/MovingObjects/particle_cell_2D.hpp
+87
-10
include/Container/fakeAttribute.h
include/Container/fakeAttribute.h
+1
-1
include/Geometry/intersection.hpp
include/Geometry/intersection.hpp
+0
-343
include/Geometry/plane_3d.h
include/Geometry/plane_3d.h
+4
-1
include/Geometry/plane_3d.hpp
include/Geometry/plane_3d.hpp
+15
-3
include/Topology/generic/embeddedMap2.h
include/Topology/generic/embeddedMap2.h
+18
-0
include/Topology/generic/embeddedMap2.hpp
include/Topology/generic/embeddedMap2.hpp
+70
-0
include/Topology/map/map1.h
include/Topology/map/map1.h
+7
-0
include/Topology/map/map1.hpp
include/Topology/map/map1.hpp
+8
-0
include/Topology/map/map2.h
include/Topology/map/map2.h
+21
-0
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+20
-0
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+18
-15
No files found.
Apps/Tuto/stage_shader.h
View file @
b4752e7e
...
...
@@ -49,6 +49,8 @@
#include "Algo/Render/GL2/topo3Render.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
...
...
include/Algo/BooleanOperator/mergeVertices.h
0 → 100644
View file @
b4752e7e
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, 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: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __ALGO_BOOLEANOPERATOR_VERTICES_H__
#define __ALGO_BOOLEANOPERATOR_VERTICES_H__
#include "Geometry/basic.h"
#include "Geometry/inclusion.h"
#include "Geometry/orientation.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
BooleanOperator
{
template
<
typename
PFP
>
void
mergeVertex
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
Dart
d
,
Dart
e
);
template
<
typename
PFP
>
void
mergeVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
);
}
}
}
#include "mergeVertices.hpp"
#endif
include/Algo/BooleanOperator/mergeVertices.hpp
0 → 100644
View file @
b4752e7e
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, 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: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace
CGoGN
{
namespace
Algo
{
namespace
BooleanOperator
{
template
<
typename
PFP
>
void
mergeVertex
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
Dart
d
,
Dart
e
)
{
assert
(
Geom
::
arePointsEquals
(
positions
[
d
],
positions
[
e
])
&&
!
map
.
sameVertex
(
d
,
e
));
Dart
dd
;
do
{
dd
=
map
.
alpha1
(
d
);
map
.
removeEdgeFromVertex
(
dd
);
Dart
ee
=
e
;
do
{
if
(
Geom
::
testOrientation2D
(
positions
[
map
.
phi1
(
dd
)],
positions
[
ee
],
positions
[
map
.
phi1
(
ee
)])
!=
Geom
::
RIGHT
&&
Geom
::
testOrientation2D
(
positions
[
map
.
phi1
(
dd
)],
positions
[
ee
],
positions
[
map
.
phi1
(
map
.
alpha1
(
ee
))])
==
Geom
::
RIGHT
)
{
break
;
}
ee
=
map
.
alpha1
(
ee
);
}
while
(
ee
!=
e
);
map
.
insertEdgeInVertex
(
ee
,
dd
);
}
while
(
dd
!=
d
);
}
template
<
typename
PFP
>
void
mergeVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
)
{
for
(
Dart
d
=
map
.
begin
()
;
d
!=
map
.
end
()
;
map
.
next
(
d
))
{
CellMarker
vM
(
map
,
VERTEX
);
vM
.
mark
(
d
);
for
(
Dart
dd
=
map
.
begin
()
;
dd
!=
map
.
end
()
;
map
.
next
(
dd
))
{
if
(
!
vM
.
isMarked
(
dd
))
{
vM
.
mark
(
dd
);
if
(
Geom
::
arePointsEquals
(
positions
[
d
],
positions
[
dd
]))
{
mergeVertex
<
PFP
>
(
map
,
positions
,
d
,
dd
);
}
}
}
}
}
}
}
}
include/Algo/Export/exportPov.h
View file @
b4752e7e
...
...
@@ -95,7 +95,7 @@ void exportMeshWire(std::ofstream& out, typename PFP::MAP& map, typename PFP::TV
if
(
position
[
dd
][
0
]
!=
position
[
map
.
phi1
(
dd
)][
0
]
||
position
[
dd
][
1
]
!=
position
[
map
.
phi1
(
dd
)][
1
]
||
position
[
dd
][
2
]
!=
position
[
map
.
phi1
(
dd
)][
2
])
{
out
<<
"cylinder{ "
<<
std
::
endl
;
out
<<
"<"
<<
position
[
dd
][
0
]
<<
","
<<
position
[
dd
][
2
]
<<
","
<<
position
[
dd
][
1
]
<<
">,"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
map
.
phi1
(
dd
)][
0
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
2
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
1
]
<<
">,
0
.5"
<<
std
::
endl
;
out
<<
"<"
<<
position
[
map
.
phi1
(
dd
)][
0
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
2
]
<<
","
<<
position
[
map
.
phi1
(
dd
)][
1
]
<<
">,
1
.5"
<<
std
::
endl
;
out
<<
"}"
<<
std
::
endl
;
}
dd
=
map
.
phi1
(
dd
);
...
...
include/Algo/Import/importSvg.h
View file @
b4752e7e
...
...
@@ -16,7 +16,7 @@ namespace Import
* @param name the name
* @ return true if node has the good name
*/
bool
chec
h
XmlNode
(
xmlNodePtr
node
,
const
std
::
string
&
name
);
bool
chec
k
XmlNode
(
xmlNodePtr
node
,
const
std
::
string
&
name
);
template
<
typename
PFP
>
bool
importSVG
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
polygons
);
...
...
include/Algo/Import/importSvg.hpp
deleted
100644 → 0
View file @
3f75f814
#include <iostream>
#include "Geometry/bounding_box.h"
#include <set>
#include <vector>
#include "Utils/cgognStream.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/primitives3d.h"
namespace
CGoGN
{
namespace
Algo
{
namespace
Import
{
inline
bool
chechXmlNode
(
xmlNodePtr
node
,
const
std
::
string
&
name
)
{
return
(
strcmp
((
char
*
)(
node
->
name
),(
char
*
)(
name
.
c_str
()))
==
0
);
}
template
<
typename
T
>
inline
bool
valueOf
(
const
std
::
string
&
s
,
T
&
obj
)
{
std
::
istringstream
is
(
s
);
return
is
>>
obj
;
}
template
<
typename
PFP
>
bool
importSVG
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
polygons
)
{
xmlDocPtr
doc
=
xmlReadFile
(
filename
.
c_str
(),
NULL
,
0
);
xmlNodePtr
map_node
=
xmlDocGetRootElement
(
doc
);
if
(
!
chechXmlNode
(
map_node
,
"svg"
))
{
CGoGNerr
<<
"Wrong xml format: Root node != svg"
<<
CGoGNendl
;
return
false
;
}
typedef
std
::
vector
<
typename
PFP
::
VEC3
>
POLYGON
;
std
::
vector
<
POLYGON
>
allPoly
;
for
(
xmlNode
*
cur_node
=
map_node
->
children
;
cur_node
;
cur_node
=
cur_node
->
next
)
{
// for each layer
if
(
chechXmlNode
(
cur_node
,
"g"
))
{
CGoGNout
<<
"----load layer----"
<<
CGoGNendl
;
for
(
xmlNode
*
cur_path
=
cur_node
->
children
;
cur_path
;
cur_path
=
cur_path
->
next
)
{
if
(
chechXmlNode
(
cur_path
,
"path"
))
{
allPoly
.
push_back
(
POLYGON
());
CGoGNout
<<
"--load a path--"
<<
CGoGNendl
;
xmlChar
*
prop
=
xmlGetProp
(
cur_path
,
BAD_CAST
"d"
);
// CGoGNout << "path "<< prop << CGoGNendl;
std
::
string
allcoords
((
reinterpret_cast
<
const
char
*>
(
prop
)));
std
::
stringstream
is
(
allcoords
);
bool
relative
;
bool
push_point
;
std
::
string
coord
;
int
mode
=
-
1
;
while
(
std
::
getline
(
is
,
coord
,
' '
)
)
{
float
x
,
y
;
push_point
=
false
;
if
(
coord
[
0
]
==
'm'
||
coord
[
0
]
==
'l'
||
coord
[
0
]
==
't'
)
//start point, line or quadratic bezier curve
{
mode
=
0
;
// std::cout << "relative coordinates" << std::endl;
relative
=
true
;
}
else
if
(
coord
[
0
]
==
'M'
||
coord
[
0
]
==
'L'
||
coord
[
0
]
==
'T'
)
//same in absolute coordinates
{
// std::cout << "absolute coordinates" << std::endl;
mode
=
1
;
relative
=
false
;
}
else
if
(
coord
[
0
]
==
'h'
||
coord
[
0
]
==
'H'
)
//horizontal line
{
mode
=
2
;
relative
=
(
coord
[
0
]
==
'h'
);
}
else
if
(
coord
[
0
]
==
'v'
||
coord
[
0
]
==
'V'
)
//vertical line
{
// std::cout << "vertical line" << std::endl;
mode
=
3
;
relative
=
(
coord
[
0
]
==
'v'
);
}
else
if
(
coord
[
0
]
==
'c'
||
coord
[
0
]
==
'C'
)
//bezier curve
{
// std::cout << "bezier line" << std::endl;
mode
=
4
;
relative
=
(
coord
[
0
]
==
'c'
);
}
else
if
(
coord
[
0
]
==
's'
||
coord
[
0
]
==
'S'
||
coord
[
0
]
==
'q'
||
coord
[
0
]
==
'Q'
)
//bezier curve 2
{
// std::cout << "bezier line 2" << std::endl;
mode
=
5
;
relative
=
((
coord
[
0
]
==
's'
)
||
(
coord
[
0
]
==
'q'
));
}
else
if
(
coord
[
0
]
==
'a'
||
coord
[
0
]
==
'A'
)
//elliptic arc
{
// std::cout << "elliptic arc" << std::endl;
mode
=
6
;
relative
=
(
coord
[
0
]
==
'a'
);
}
else
if
(
coord
[
0
]
==
'z'
)
{
// std::cout << "the end" << std::endl;
}
else
//coordinates
{
switch
(
mode
)
{
case
0
:
//relative
break
;
case
1
:
//absolute
break
;
case
2
:
//horizontal
{
std
::
stringstream
streamCoord
(
coord
);
std
::
string
xS
;
std
::
getline
(
streamCoord
,
xS
,
','
);
valueOf
(
xS
,
x
);
POLYGON
curPoly
=
allPoly
[
allPoly
.
size
()
-
1
];
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
y
=
previous
[
1
];
push_point
=
true
;
}
break
;
case
3
:
//vertical
{
std
::
stringstream
streamCoord
(
coord
);
std
::
string
yS
;
std
::
getline
(
streamCoord
,
yS
,
','
);
valueOf
(
yS
,
y
);
POLYGON
curPoly
=
allPoly
[
allPoly
.
size
()
-
1
];
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
x
=
previous
[
0
];
push_point
=
true
;
}
break
;
case
4
:
//bezier
{
std
::
getline
(
is
,
coord
,
' '
);
//ignore first control point
std
::
getline
(
is
,
coord
,
' '
);
//ignore second control point
}
break
;
case
5
:
//bezier 2
std
::
getline
(
is
,
coord
,
' '
);
//ignore control point
break
;
case
6
:
//elliptic
std
::
getline
(
is
,
coord
,
' '
);
//ignore rx
std
::
getline
(
is
,
coord
,
' '
);
//ignore ry
std
::
getline
(
is
,
coord
,
' '
);
//ignore x-rotation
std
::
getline
(
is
,
coord
,
' '
);
//ignore large arc flag
std
::
getline
(
is
,
coord
,
' '
);
//ignore sweep flag
break
;
}
std
::
stringstream
streamCoord
(
coord
);
std
::
string
xS
,
yS
;
std
::
getline
(
streamCoord
,
xS
,
','
);
std
::
getline
(
streamCoord
,
yS
,
','
);
valueOf
(
xS
,
x
);
valueOf
(
yS
,
y
);
push_point
=
true
;
}
//if there is a point to push
if
(
push_point
)
{
POLYGON
&
curPoly
=
allPoly
[
allPoly
.
size
()
-
1
];
if
(
relative
&&
curPoly
.
size
()
>
0
)
{
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
x
+=
previous
[
0
];
y
+=
previous
[
1
];
}
// std::cout << "coord " << x << " " << y << std::endl;
curPoly
.
push_back
(
typename
PFP
::
VEC3
(
x
,
y
,
0
));
}
}
}
}
}
}
xmlFreeDoc
(
doc
);
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
bb
(
*
(
allPoly
.
begin
()
->
begin
()));
typename
std
::
vector
<
POLYGON
>::
iterator
it
;
for
(
it
=
allPoly
.
begin
()
;
it
!=
allPoly
.
end
()
;
++
it
)
{
if
(
it
->
size
()
<
3
)
{
it
=
allPoly
.
erase
(
it
);
}
else
{
Dart
d
=
map
.
newFace
(
it
->
size
()
-
1
);
for
(
typename
POLYGON
::
iterator
emb
=
it
->
begin
()
;
emb
!=
it
->
end
()
;
emb
++
)
{
position
[
d
]
=
*
emb
;
bb
.
addPoint
(
*
emb
);
d
=
map
.
phi1
(
d
);
}
}
}
Dart
dBorder
=
map
.
newFace
(
4
);
typename
PFP
::
VEC3
bmin
=
bb
.
min
();
typename
PFP
::
VEC3
bmax
=
bb
.
max
();
position
[
dBorder
]
=
bmin
-
0.1
f
*
bmin
;
position
[
map
.
phi1
(
dBorder
)]
=
typename
PFP
::
VEC3
(
bmax
[
0
],
bmin
[
1
],
0
)
+
0.1
f
*
typename
PFP
::
VEC3
(
bmax
[
0
],
-
bmin
[
1
],
0
);
position
[
map
.
phi1
(
map
.
phi1
(
dBorder
))]
=
typename
PFP
::
VEC3
(
bmax
[
0
],
bmax
[
1
],
0
)
+
0.1
f
*
bmax
;
position
[
map
.
phi_1
(
dBorder
)]
=
typename
PFP
::
VEC3
(
bmin
[
0
],
bmax
[
1
],
0
)
+
0.1
f
*
typename
PFP
::
VEC3
(
-
bmin
[
0
],
bmax
[
1
],
0
);;
DartMarker
inside
(
map
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
map
.
phi2
(
d
)
==
d
)
{
polygons
.
mark
(
d
);
inside
.
mark
(
d
);
}
}
DartMarker
close
(
map
);
map
.
closeMap
(
close
);
CellMarker
linked
(
map
,
FACE
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
linked
.
isMarked
(
d
)
&&
!
inside
.
isMarked
(
d
))
{
linked
.
mark
(
d
);
Dart
dMin
;
float
distMin
=
(
bb
.
max
()
-
bb
.
min
()).
norm2
();
for
(
Dart
dd
=
map
.
begin
();
dd
!=
map
.
end
();
map
.
next
(
dd
))
{
if
(
!
map
.
sameFace
(
d
,
dd
))
{
float
dist
=
(
position
[
dd
]
-
position
[
d
]).
norm2
();
if
(
dist
<
distMin
)
{
distMin
=
dist
;
dMin
=
dd
;
}
}
}
// map.splitFace(d,d);
// map.splitFace(dMin,dMin);
// map.sewFaces(map.phi_1(d),map.phi_1(dMin));
// map.mergeFaces(map.phi_1(d));
}
}
return
true
;
}
template
<
typename
PFP
>
bool
readSVG
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
vector
<
typename
PFP
::
VEC3
>
>
&
allPoly
)
{
typedef
std
::
vector
<
typename
PFP
::
VEC3
>
POLYGON
;
xmlDocPtr
doc
=
xmlReadFile
(
filename
.
c_str
(),
NULL
,
0
);
xmlNodePtr
map_node
=
xmlDocGetRootElement
(
doc
);
if
(
!
chechXmlNode
(
map_node
,
"svg"
))
{
CGoGNerr
<<
"Wrong xml format: Root node != svg"
<<
CGoGNendl
;
return
false
;
}
//std::vector<POLYGON> allPoly;
for
(
xmlNode
*
cur_node
=
map_node
->
children
;
cur_node
;
cur_node
=
cur_node
->
next
)
{
// for each layer
if
(
chechXmlNode
(
cur_node
,
"g"
))
{
CGoGNout
<<
"----load layer----"
<<
CGoGNendl
;
for
(
xmlNode
*
cur_path
=
cur_node
->
children
;
cur_path
;
cur_path
=
cur_path
->
next
)
{
if
(
chechXmlNode
(
cur_path
,
"path"
))
{
allPoly
.
push_back
(
POLYGON
());
CGoGNout
<<
"--load a path--"
<<
CGoGNendl
;
xmlChar
*
prop
=
xmlGetProp
(
cur_path
,
BAD_CAST
"d"
);
// CGoGNout << "path "<< prop << CGoGNendl;
std
::
string
allcoords
((
reinterpret_cast
<
const
char
*>
(
prop
)));
std
::
stringstream
is
(
allcoords
);
bool
relative
=
false
;;
bool
push_point
;
std
::
string
coord
;
int
mode
=
-
1
;
while
(
std
::
getline
(
is
,
coord
,
' '
)
)
{
float
x
,
y
;
push_point
=
false
;
if
(
coord
[
0
]
==
'm'
||
coord
[
0
]
==
'l'
||
coord
[
0
]
==
't'
)
//start point, line or quadratic bezier curve
{
mode
=
0
;
// std::cout << "relative coordinates" << std::endl;
relative
=
true
;
}
else
if
(
coord
[
0
]
==
'M'
||
coord
[
0
]
==
'L'
||
coord
[
0
]
==
'T'
)
//same in absolute coordinates
{
// std::cout << "absolute coordinates" << std::endl;
mode
=
1
;
relative
=
false
;
}
else
if
(
coord
[
0
]
==
'h'
||
coord
[
0
]
==
'H'
)
//horizontal line
{
mode
=
2
;
relative
=
(
coord
[
0
]
==
'h'
);
}
else
if
(
coord
[
0
]
==
'v'
||
coord
[
0
]
==
'V'
)
//vertical line
{
// std::cout << "vertical line" << std::endl;
mode
=
3
;
relative
=
(
coord
[
0
]
==
'v'
);
}
else
if
(
coord
[
0
]
==
'c'
||
coord
[
0
]
==
'C'
)
//bezier curve
{
// std::cout << "bezier line" << std::endl;
mode
=
4
;
relative
=
(
coord
[
0
]
==
'c'
);
}
else
if
(
coord
[
0
]
==
's'
||
coord
[
0
]
==
'S'
||
coord
[
0
]
==
'q'
||
coord
[
0
]
==
'Q'
)
//bezier curve 2
{
// std::cout << "bezier line 2" << std::endl;
mode
=
5
;
relative
=
((
coord
[
0
]
==
's'
)
||
(
coord
[
0
]
==
'q'
));
}
else
if
(
coord
[
0
]
==
'a'
||
coord
[
0
]
==
'A'
)
//elliptic arc
{
// std::cout << "elliptic arc" << std::endl;
mode
=
6
;
relative
=
(
coord
[
0
]
==
'a'
);
}
else
if
(
coord
[
0
]
==
'z'
)
{
// std::cout << "the end" << std::endl;
}
else
//coordinates
{
switch
(
mode
)
{
case
0
:
//relative
break
;
case
1
:
//absolute
break
;
case
2
:
//horizontal
{
std
::
stringstream
streamCoord
(
coord
);
std
::
string
xS
;
std
::
getline
(
streamCoord
,
xS
,
','
);
valueOf
(
xS
,
x
);
POLYGON
curPoly
=
allPoly
[
allPoly
.
size
()
-
1
];
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
y
=
previous
[
1
];
push_point
=
true
;
}
break
;
case
3
:
//vertical
{
std
::
stringstream
streamCoord
(
coord
);
std
::
string
yS
;
std
::
getline
(
streamCoord
,
yS
,
','
);
valueOf
(
yS
,
y
);
POLYGON
curPoly
=
allPoly
[
allPoly
.
size
()
-
1
];
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
x
=
previous
[
0
];
push_point
=
true
;
}
break
;
case
4
:
//bezier
{
std
::
getline
(
is
,
coord
,
' '
);
//ignore first control point
std
::
getline
(
is
,
coord
,
' '
);
//ignore second control point
}
break
;
case
5
:
//bezier 2
std
::
getline
(
is
,
coord
,
' '
);
//ignore control point
break
;
case
6
:
//elliptic
std
::
getline
(
is
,
coord
,
' '
);
//ignore rx
std
::
getline
(
is
,
coord
,
' '
);
//ignore ry
std
::
getline
(
is
,
coord
,
' '
);
//ignore x-rotation
std
::
getline
(
is
,
coord
,
' '
);
//ignore large arc flag
std
::
getline
(
is
,
coord
,
' '
);
//ignore sweep flag
break
;
}
std
::
stringstream
streamCoord
(
coord
);