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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Etienne Schmitt
CGoGN
Commits
2aeb3bb5
Commit
2aeb3bb5
authored
Feb 17, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start import MRDAT
parent
de2a68b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
307 additions
and
7 deletions
+307
-7
include/Algo/Import/importMRDAT.h
include/Algo/Import/importMRDAT.h
+89
-0
include/Algo/Import/importMRDAT.hpp
include/Algo/Import/importMRDAT.hpp
+164
-0
include/Algo/Import/importSvg.h
include/Algo/Import/importSvg.h
+27
-4
include/Algo/Import/importSvg.hpp
include/Algo/Import/importSvg.hpp
+27
-3
No files found.
include/Algo/Import/importMRDAT.h
0 → 100644
View file @
2aeb3bb5
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __IMPORT_MR_DAT__
#define __IMPORT_MR_DAT__
namespace
CGoGN
{
namespace
Algo
{
namespace
Import
{
template
<
typename
PFP
>
bool
importMRDAT
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
typename
PFP
::
TVEC3
&
position
)
;
class
QuadTreeNode
{
public:
QuadTreeNode
()
{
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
indices
[
i
]
=
-
1
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
children
[
i
]
=
NULL
;
}
~
QuadTreeNode
()
{
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
if
(
children
[
i
]
!=
NULL
)
delete
children
[
i
]
;
}
void
subdivide
()
{
assert
(
children
[
0
]
==
NULL
)
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
children
[
i
]
=
new
QuadTreeNode
()
;
}
unsigned
int
indices
[
3
]
;
QuadTreeNode
*
children
[
4
]
;
}
;
class
QuadTree
{
public:
std
::
vector
<
QuadTreeNode
*>
roots
;
~
QuadTree
()
{
for
(
unsigned
int
i
=
0
;
i
<
roots
.
size
();
++
i
)
delete
roots
[
i
]
;
}
}
;
}
// namespace Import
}
// namespace Algo
}
// namespace CGoGN
#include "Algo/Import/importMRDAT.hpp"
#endif
include/Algo/Import/importMRDAT.hpp
0 → 100644
View file @
2aeb3bb5
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace
CGoGN
{
namespace
Algo
{
namespace
Import
{
inline
void
nextNonEmptyLine
(
std
::
ifstream
&
fp
,
std
::
string
&
line
)
{
do
{
std
::
getline
(
fp
,
line
)
;
}
while
(
line
.
size
()
==
0
)
;
}
template
<
typename
PFP
>
bool
importMRDAT
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
typename
PFP
::
TVEC3
&
position
)
{
AttributeContainer
&
container
=
map
.
getAttributeContainer
(
VERTEX
)
;
// open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
)
;
if
(
!
fp
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
filename
<<
CGoGNendl
;
return
false
;
}
std
::
string
line
;
nextNonEmptyLine
(
fp
,
line
)
;
if
(
line
.
rfind
(
"Multires data file"
)
==
std
::
string
::
npos
)
{
CGoGNerr
<<
"Problem reading MRDAT file"
<<
CGoGNendl
;
CGoGNerr
<<
line
<<
CGoGNendl
;
return
false
;
}
// read the depth
unsigned
int
depth
;
{
nextNonEmptyLine
(
fp
,
line
)
;
std
::
stringstream
oss
(
line
)
;
oss
>>
depth
;
}
// read vertices
nextNonEmptyLine
(
fp
,
line
)
;
if
(
line
.
rfind
(
"Vertices"
)
==
std
::
string
::
npos
)
{
CGoGNerr
<<
"Problem reading MRDAT file"
<<
CGoGNendl
;
CGoGNerr
<<
line
<<
CGoGNendl
;
return
false
;
}
std
::
vector
<
typename
PFP
::
VEC3
>
positions
;
std
::
vector
<
unsigned
int
>
nbVerticesPerLevel
;
nbVerticesPerLevel
.
resize
(
depth
+
1
)
;
nextNonEmptyLine
(
fp
,
line
)
;
while
(
line
.
rfind
(
"Triangles"
)
!=
std
::
string
::
npos
)
{
std
::
stringstream
oss
(
line
)
;
unsigned
int
level
;
oss
>>
level
;
++
nbVerticesPerLevel
[
level
-
(
depth
+
1
)]
;
float
x
,
y
,
z
;
oss
>>
x
;
oss
>>
y
;
oss
>>
z
;
positions
.
push_back
(
typename
PFP
::
VEC3
(
x
,
y
,
z
))
;
nextNonEmptyLine
(
fp
,
line
)
;
}
QuadTree
qt
;
QuadTreeNode
*
current
=
NULL
;
unsigned
int
prevNum
=
-
1
;
nextNonEmptyLine
(
fp
,
line
)
;
while
(
line
.
rfind
(
"end"
)
!=
std
::
string
::
npos
)
{
std
::
stringstream
oss
(
line
)
;
std
::
string
name
;
oss
>>
name
;
unsigned
int
num
,
root
,
idx0
,
idx1
,
idx2
;
oss
>>
num
;
oss
>>
root
;
oss
>>
idx0
;
oss
>>
idx1
;
oss
>>
idx2
;
if
(
root
==
1
)
{
assert
(
num
==
0
)
;
QuadTreeNode
*
n
=
new
QuadTreeNode
()
;
n
->
indices
[
0
]
=
idx0
;
n
->
indices
[
1
]
=
idx1
;
n
->
indices
[
2
]
=
idx2
;
qt
.
roots
.
push_back
(
n
)
;
current
=
n
;
prevNum
=
0
;
}
else
{
if
(
num
>
prevNum
)
// on lit un autre triangle du même niveau
{
}
else
// on subdivise le triangle courant
{
if
(
num
==
0
)
{
current
->
subdivide
()
;
}
else
{
}
}
}
nextNonEmptyLine
(
fp
,
line
)
;
}
fp
.
close
();
return
true
;
}
}
// namespace Import
}
// namespace Algo
}
// namespace CGoGN
include/Algo/Import/importSvg.h
View file @
2aeb3bb5
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __IMPORTSVG_H__
#define __IMPORTSVG_H__
...
...
@@ -35,12 +59,11 @@ bool importBB(const std::string& filename, std::vector<Geom::BoundingBox<typenam
template
<
typename
PFP
>
bool
importSVG
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
);
}
// namespace Import
}
}
}
// namespace Algo
}
}
// namespace CGoGN
#include "Algo/Import/importSvg.hpp"
...
...
include/Algo/Import/importSvg.hpp
View file @
2aeb3bb5
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "Geometry/bounding_box.h"
#include "Geometry/plane_3d.h"
...
...
@@ -692,8 +716,8 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, typename PFP
return
true
;
}
}
//
i
mport
}
//
namespace I
mport
}
//
a
lgo
}
//
namespace A
lgo
}
//
cgogn
}
//
namespace CGoGN
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