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
CGoGN
CGoGN
Commits
2e814a6d
Commit
2e814a6d
authored
Apr 24, 2012
by
untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~vanhoey/CGoGN
Conflicts: include/Algo/Import/import2tablesSurface.hpp
parents
50a9f367
74a22c4f
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1249 additions
and
277 deletions
+1249
-277
Apps/Examples/clipping.h
Apps/Examples/clipping.h
+2
-2
Apps/Examples/mcmesh.h
Apps/Examples/mcmesh.h
+2
-2
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+5
-1
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+2
-2
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+1
-1
Apps/Tuto/show_traversors.h
Apps/Tuto/show_traversors.h
+1
-1
Apps/Tuto/tuto5.h
Apps/Tuto/tuto5.h
+1
-1
Apps/Tuto/tuto_mt.cpp
Apps/Tuto/tuto_mt.cpp
+1
-1
Apps/Tuto/tuto_oper2.h
Apps/Tuto/tuto_oper2.h
+1
-1
Apps/Tuto/tuto_oper3.h
Apps/Tuto/tuto_oper3.h
+1
-1
Apps/Tuto/tuto_orbits.h
Apps/Tuto/tuto_orbits.h
+1
-1
include/Algo/Decimation/geometryApproximator.hpp
include/Algo/Decimation/geometryApproximator.hpp
+3
-3
include/Algo/Export/export.h
include/Algo/Export/export.h
+17
-3
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+225
-18
include/Algo/Geometry/feature.h
include/Algo/Geometry/feature.h
+115
-13
include/Algo/Geometry/feature.hpp
include/Algo/Geometry/feature.hpp
+337
-138
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+3
-3
include/Algo/Import/import2tablesSurface.hpp
include/Algo/Import/import2tablesSurface.hpp
+25
-24
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+3
-0
include/Algo/Parallel/parallel_foreach.hpp
include/Algo/Parallel/parallel_foreach.hpp
+7
-3
include/Topology/map/map3MR/filters_Primal.h
include/Topology/map/map3MR/filters_Primal.h
+362
-16
include/Utils/Qt/qtSimple.h
include/Utils/Qt/qtSimple.h
+1
-0
include/Utils/nameTypes.h
include/Utils/nameTypes.h
+29
-0
include/Utils/qtInputs.h
include/Utils/qtInputs.h
+0
-0
include/Utils/qtui.h
include/Utils/qtui.h
+0
-0
include/Utils/textures.hpp
include/Utils/textures.hpp
+2
-2
src/Algo/Import/ply.c
src/Algo/Import/ply.c
+100
-39
src/Utils/qtinputs.cpp
src/Utils/qtinputs.cpp
+2
-1
No files found.
Apps/Examples/clipping.h
View file @
2e814a6d
...
...
@@ -28,11 +28,11 @@
#include <iostream>
#include "Utils/Qt/qtSimple.h"
#include "Utils/
Qt/
qtInputs.h"
#include "Utils/qtInputs.h"
#include "ui_clipping.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
...
...
Apps/Examples/mcmesh.h
View file @
2e814a6d
...
...
@@ -17,7 +17,7 @@
* 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
s
://
iggservis.u-strasbg.fr/CGoGN/
*
* Web site: http://
cgogn.unistra.fr
*
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
...
...
@@ -26,7 +26,7 @@
#include "Utils/Qt/qtSimple.h"
#include "ui_mcmesh.h"
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
...
...
Apps/Examples/viewer.cpp
View file @
2e814a6d
...
...
@@ -234,7 +234,11 @@ void Viewer::exportMesh(std::string& filename)
if
(
extension
==
std
::
string
(
".off"
))
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
else
if
(
extension
.
compare
(
0
,
4
,
std
::
string
(
".ply"
))
==
0
)
Algo
::
Export
::
exportPLY
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
{
std
::
vector
<
typename
PFP
::
TVEC3
*
>
attributes
;
attributes
.
push_back
(
&
position
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
true
,
allDarts
)
;
}
else
if
(
extension
==
std
::
string
(
".map"
))
myMap
.
saveMapBin
(
filename
)
;
else
...
...
Apps/Examples/viewer.h
View file @
2e814a6d
...
...
@@ -17,7 +17,7 @@
* 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/ *
* Web site: http://cgogn.unistra.fr/
*
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
...
...
@@ -26,7 +26,7 @@
#include "Utils/Qt/qtSimple.h"
#include "ui_viewer.h"
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
...
...
Apps/Examples/volumeExplorer.h
View file @
2e814a6d
...
...
@@ -46,7 +46,7 @@
#include "Utils/frameManipulator.h"
#include "ui_volumeExplorer.h"
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
using
namespace
CGoGN
;
...
...
Apps/Tuto/show_traversors.h
View file @
2e814a6d
...
...
@@ -56,7 +56,7 @@
#include "ui_show_traversors.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
using
namespace
CGoGN
;
...
...
Apps/Tuto/tuto5.h
View file @
2e814a6d
...
...
@@ -57,7 +57,7 @@
#include "ui_tuto5.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
using
namespace
CGoGN
;
...
...
Apps/Tuto/tuto_mt.cpp
View file @
2e814a6d
...
...
@@ -42,7 +42,7 @@
#include "Algo/Parallel/parallel_foreach.h"
// for file input
#include "Utils/
Qt/
qtInputs.h"
#include "Utils/qtInputs.h"
using
namespace
CGoGN
;
...
...
Apps/Tuto/tuto_oper2.h
View file @
2e814a6d
...
...
@@ -40,7 +40,7 @@
#include "ui_tuto_oper2.h"
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
...
...
Apps/Tuto/tuto_oper3.h
View file @
2e814a6d
...
...
@@ -40,7 +40,7 @@
#include "ui_tuto_oper3.h"
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
...
...
Apps/Tuto/tuto_orbits.h
View file @
2e814a6d
...
...
@@ -57,7 +57,7 @@
#include "ui_tuto_orbits.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/
Qt/
qtui.h"
#include "Utils/qtui.h"
using
namespace
CGoGN
;
...
...
include/Algo/Decimation/geometryApproximator.hpp
View file @
2e814a6d
...
...
@@ -207,7 +207,7 @@ void Approximator_MidEdge<PFP>::approximate(Dart d)
Dart
d2
=
m
.
phi2
(
m
.
phi_1
(
d
))
;
Dart
dd2
=
m
.
phi2
(
m
.
phi_1
(
dd
))
;
VEC3
v2
=
this
->
m_attrV
[
dd
]
;
//
VEC3 v2 = this->m_attrV[dd] ;
// temporary edge collapse
m
.
extractTrianglePair
(
d
)
;
...
...
@@ -297,9 +297,9 @@ void Approximator_CornerCutting<PFP>::approximate(Dart d)
// get some darts
Dart
dd
=
m
.
phi2
(
d
)
;
Dart
d1
=
m
.
phi2
(
m
.
phi1
(
d
))
;
//
Dart d1 = m.phi2(m.phi1(d)) ;
Dart
d2
=
m
.
phi2
(
m
.
phi_1
(
d
))
;
Dart
dd1
=
m
.
phi2
(
m
.
phi1
(
dd
))
;
//
Dart dd1 = m.phi2(m.phi1(dd)) ;
Dart
dd2
=
m
.
phi2
(
m
.
phi_1
(
dd
))
;
// get the contracted edge vertices positions
...
...
include/Algo/Export/export.h
View file @
2e814a6d
...
...
@@ -26,6 +26,7 @@
#define __EXPORT_H__
#include "Topology/generic/attributeHandler.h"
#include <stdint.h>
namespace
CGoGN
{
...
...
@@ -39,11 +40,24 @@ namespace Export
/**
* export the map into a PLY file
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template
<
typename
PFP
>
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
=
allDarts
)
;
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
bool
binary
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* export the map into a PLY file
* @param the_map map to be exported
* @param vertexAttrNames the vertex attribute names
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template
<
typename
PFP
>
bool
exportPLYnew
(
typename
PFP
::
MAP
&
map
,
const
std
::
vector
<
typename
PFP
::
TVEC3
*
>&
attributeHandlers
,
const
char
*
filename
,
const
bool
binary
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* export the map into a OFF file
...
...
@@ -74,7 +88,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @param filename filename of ply file
* @param position the position container
* @return true
*
/
*
template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
...
...
@@ -89,7 +103,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
* @param filename filename of ply file
* @param position the position container
* @return true
*
/
*
template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
...
...
include/Algo/Export/export.hpp
View file @
2e814a6d
...
...
@@ -38,12 +38,18 @@ namespace Export
{
template
<
typename
PFP
>
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
const
FunctorSelect
&
good
)
bool
exportPLY
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
char
*
filename
,
bool
binary
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
std
::
ofstream
out
(
filename
,
std
::
ios
::
out
)
;
// open file
std
::
ofstream
out
;
if
(
!
binary
)
out
.
open
(
filename
,
std
::
ios
::
out
)
;
else
out
.
open
(
filename
,
std
::
ios
::
out
|
std
::
ios
::
binary
)
;
if
(
!
out
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
CGoGNendl
;
...
...
@@ -60,6 +66,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
std
::
vector
<
unsigned
int
>
vertices
;
vertices
.
reserve
(
nbDarts
/
6
)
;
// Go over all faces
CellMarker
markV
(
map
,
VERTEX
)
;
TraversorF
<
MAP
>
t
(
map
,
good
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
...
@@ -84,31 +91,231 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
facesIdx
.
push_back
(
fidx
)
;
}
// Start writing the file
out
<<
"ply"
<<
std
::
endl
;
out
<<
"format ascii 1.0"
<<
std
::
endl
;
out
<<
"comment no comment"
<<
std
::
endl
;
// ascii or binary
if
(
!
binary
)
out
<<
"format ascii 1.0"
<<
std
::
endl
;
else
{
// test endianness
union
{
uint32_t
i
;
char
c
[
4
]
;
}
bint
=
{
0x01020304
}
;
if
(
bint
.
c
[
0
]
==
1
)
// big endian
out
<<
"format binary_big_endian 1.0"
<<
std
::
endl
;
else
out
<<
"format binary_little_endian 1.0"
<<
std
::
endl
;
}
out
<<
"comment File generated by the CGoGN library"
<<
std
::
endl
;
out
<<
"comment See : http://cgogn.unistra.fr/"
<<
std
::
endl
;
out
<<
"comment or contact : cgogn@unistra.fr"
<<
std
::
endl
;
// Vertex elements
out
<<
"element vertex "
<<
vertices
.
size
()
<<
std
::
endl
;
out
<<
"property float x"
<<
std
::
endl
;
out
<<
"property float y"
<<
std
::
endl
;
out
<<
"property float z"
<<
std
::
endl
;
// Position property
if
(
position
.
isValid
())
{
out
<<
"property "
<<
nameOfTypePly
(
position
[
0
][
0
])
<<
" x"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
(
position
[
0
][
1
])
<<
" y"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
(
position
[
0
][
2
])
<<
" z"
<<
std
::
endl
;
}
// Face element
out
<<
"element face "
<<
facesSize
.
size
()
<<
std
::
endl
;
out
<<
"property list u
char int
vertex_indices"
<<
std
::
endl
;
out
<<
"property list u
int8 uint"
<<
8
*
sizeof
(
facesIdx
[
0
][
0
])
<<
"
vertex_indices"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
if
(
!
binary
)
// ascii
{
const
VEC3
&
v
=
position
[
vertices
[
i
]]
;
out
<<
v
[
0
]
<<
" "
<<
v
[
1
]
<<
" "
<<
v
[
2
]
<<
std
::
endl
;
// ascii vertices
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
out
<<
position
[
vertices
[
i
]]
<<
std
::
endl
;
// ascii faces
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
out
<<
facesSize
[
i
]
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
else
// binary
{
out
<<
facesSize
[
i
]
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
// binary vertices
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
{
Geom
::
Vec3f
v
=
position
[
vertices
[
i
]]
;
out
.
write
((
char
*
)(
&
(
v
[
0
])),
sizeof
(
v
))
;
}
// binary faces
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
unsigned
char
nbe
=
facesSize
[
i
]
;
out
.
write
((
char
*
)(
&
nbe
),
sizeof
(
unsigned
char
))
;
out
.
write
((
char
*
)(
&
(
facesIdx
[
i
][
0
])),
facesSize
[
i
]
*
sizeof
(
facesIdx
[
i
][
0
]))
;
}
}
out
.
close
()
;
return
true
;
}
template
<
typename
PFP
>
bool
exportPLYnew
(
typename
PFP
::
MAP
&
map
,
const
std
::
vector
<
typename
PFP
::
TVEC3
*>&
attributeHandlers
,
const
char
*
filename
,
bool
binary
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
// open file
std
::
ofstream
out
;
if
(
!
binary
)
out
.
open
(
filename
,
std
::
ios
::
out
)
;
else
out
.
open
(
filename
,
std
::
ios
::
out
|
std
::
ios
::
binary
)
;
if
(
!
out
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
CGoGNendl
;
return
false
;
}
unsigned
int
nbDarts
=
map
.
getNbDarts
()
;
std
::
vector
<
unsigned
int
>
facesSize
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
facesIdx
;
facesSize
.
reserve
(
nbDarts
/
3
)
;
facesIdx
.
reserve
(
nbDarts
/
3
)
;
std
::
map
<
unsigned
int
,
unsigned
int
>
vIndex
;
unsigned
int
vCpt
=
0
;
std
::
vector
<
unsigned
int
>
vertices
;
vertices
.
reserve
(
nbDarts
/
6
)
;
// Go over all faces
CellMarker
markV
(
map
,
VERTEX
)
;
TraversorF
<
MAP
>
t
(
map
,
good
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
std
::
vector
<
unsigned
int
>
fidx
;
fidx
.
reserve
(
8
)
;
unsigned
int
degree
=
0
;
Traversor2FV
<
typename
PFP
::
MAP
>
tfv
(
map
,
d
)
;
for
(
Dart
it
=
tfv
.
begin
();
it
!=
tfv
.
end
();
it
=
tfv
.
next
())
{
++
degree
;
unsigned
int
vNum
=
map
.
getEmbedding
(
VERTEX
,
it
)
;
if
(
!
markV
.
isMarked
(
it
))
{
markV
.
mark
(
it
)
;
vIndex
[
vNum
]
=
vCpt
++
;
vertices
.
push_back
(
vNum
)
;
}
fidx
.
push_back
(
vIndex
[
vNum
])
;
}
facesSize
.
push_back
(
degree
)
;
facesIdx
.
push_back
(
fidx
)
;
}
// Start writing the file
out
<<
"ply"
<<
std
::
endl
;
// ascii or binary
if
(
!
binary
)
out
<<
"format ascii 1.0"
<<
std
::
endl
;
else
{
// test endianness
union
{
uint32_t
i
;
char
c
[
4
]
;
}
bint
=
{
0x01020304
}
;
if
(
bint
.
c
[
0
]
==
1
)
// big endian
out
<<
"format binary_big_endian 1.0"
<<
std
::
endl
;
else
out
<<
"format binary_little_endian 1.0"
<<
std
::
endl
;
}
out
<<
"comment File generated by the CGoGN library"
<<
std
::
endl
;
out
<<
"comment See : http://cgogn.unistra.fr/"
<<
std
::
endl
;
out
<<
"comment or contact : cgogn@unistra.fr"
<<
std
::
endl
;
// Vertex elements
out
<<
"element vertex "
<<
vertices
.
size
()
<<
std
::
endl
;
for
(
typename
std
::
vector
<
typename
PFP
::
TVEC3
*
>::
const_iterator
attrHandler
=
attributeHandlers
.
begin
()
;
attrHandler
!=
attributeHandlers
.
end
()
;
++
attrHandler
)
{
if
((
*
attrHandler
)
->
isValid
()
&&
((
*
attrHandler
)
->
getOrbit
()
==
VERTEX
)
)
{
if
((
*
attrHandler
)
->
name
().
compare
(
"position"
)
==
0
)
// Vertex position property
{
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
0
])
<<
" x"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
1
])
<<
" y"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
2
])
<<
" z"
<<
std
::
endl
;
}
else
if
((
*
attrHandler
)
->
name
().
compare
(
"normal"
)
==
0
)
// normal property
{
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
0
])
<<
" nx"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
1
])
<<
" ny"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
2
])
<<
" nz"
<<
std
::
endl
;
}
else
if
((
*
attrHandler
)
->
name
().
compare
(
"color"
)
==
0
)
// vertex color property
{
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
0
])
<<
" red"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
1
])
<<
" green"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
2
])
<<
" blue"
<<
std
::
endl
;
}
else
// other vertex properties
{
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
0
])
<<
" "
<<
(
*
attrHandler
)
->
name
()
<<
"_0"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
1
])
<<
" "
<<
(
*
attrHandler
)
->
name
()
<<
"_1"
<<
std
::
endl
;
out
<<
"property "
<<
nameOfTypePly
((
*
(
*
attrHandler
))[
0
][
2
])
<<
" "
<<
(
*
attrHandler
)
->
name
()
<<
"_2"
<<
std
::
endl
;
}
}
}
// Face element
out
<<
"element face "
<<
facesSize
.
size
()
<<
std
::
endl
;
out
<<
"property list uint8 "
<<
nameOfTypePly
(
facesIdx
[
0
][
0
])
<<
" vertex_indices"
<<
std
::
endl
;
out
<<
"end_header"
<<
std
::
endl
;
if
(
!
binary
)
// ascii
{
// ascii vertices
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
for
(
typename
std
::
vector
<
typename
PFP
::
TVEC3
*
>::
const_iterator
attrHandler
=
attributeHandlers
.
begin
()
;
attrHandler
!=
attributeHandlers
.
end
()
;
++
attrHandler
)
if
((
*
attrHandler
)
->
isValid
()
&&
(
*
attrHandler
)
->
getOrbit
()
==
VERTEX
)
out
<<
(
*
(
*
attrHandler
))[
vertices
[
i
]]
<<
std
::
endl
;
// ascii faces
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
out
<<
facesSize
[
i
]
;
for
(
unsigned
int
j
=
0
;
j
<
facesIdx
[
i
].
size
();
++
j
)
out
<<
" "
<<
facesIdx
[
i
][
j
]
;
out
<<
std
::
endl
;
}
}
else
// binary
{
// binary vertices
for
(
unsigned
int
i
=
0
;
i
<
vertices
.
size
();
++
i
)
for
(
typename
std
::
vector
<
typename
PFP
::
TVEC3
*>::
const_iterator
attrHandler
=
attributeHandlers
.
begin
()
;
attrHandler
!=
attributeHandlers
.
end
()
;
++
attrHandler
)
if
((
*
attrHandler
)
->
isValid
()
&&
(
*
attrHandler
)
->
getOrbit
()
==
VERTEX
)
{
const
typename
PFP
::
VEC3
&
v
=
(
*
(
*
attrHandler
))[
vertices
[
i
]]
;
out
.
write
((
char
*
)(
&
(
v
[
0
])),
sizeof
(
v
))
;
}
// binary faces
for
(
unsigned
int
i
=
0
;
i
<
facesSize
.
size
();
++
i
)
{
uint8_t
nbe
=
facesSize
[
i
]
;
out
.
write
((
char
*
)(
&
nbe
),
sizeof
(
unsigned
char
))
;
out
.
write
((
char
*
)(
&
(
facesIdx
[
i
][
0
])),
facesSize
[
i
]
*
sizeof
(
facesIdx
[
i
][
0
]))
;
}
}
out
.
close
()
;
return
true
;
}
...
...
@@ -320,7 +527,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
out
.
close
()
;
return
true
;
}
/*
template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{
...
...
@@ -596,7 +803,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p
out.close() ;
return true ;
}
*/
template
<
typename
PFP
>
bool
exportPLYPTM
(
typename
PFP
::
MAP
&
map
,
const
char
*
filename
,
const
typename
PFP
::
TVEC3
&
position
,
const
typename
PFP
::
TVEC3
frame
[
3
],
const
typename
PFP
::
TVEC3
colorPTM
[
6
],
const
FunctorSelect
&
good
)
...
...
include/Algo/Geometry/feature.h
View file @
2e814a6d
...
...
@@ -25,6 +25,8 @@
#ifndef __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__
namespace
CGoGN
{
...
...
@@ -34,44 +36,144 @@ namespace Algo
namespace
Geometry
{
enum
{
EMPTY
,
SEGMENT
,
BARY
};
//#define EMPTY 0
//#define SEGMENT 1
//#define BARY 2
typedef
struct
{
Dart
d
;
float
w
;
}
e0point
;
typedef
struct
{
e0point
p1
;
e0point
p2
;
unsigned
char
type
;
}
e0segment
;
typedef
NoMathIONameAttribute
<
e0segment
>
ridgeSegment
;
template
<
typename
PFP
>
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
featureEdge
)
;
void
featureEdgeDetection
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
featureEdge
)
;
template
<
typename
PFP
>
void
computeArea
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
area
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
void
computeFaceGradient
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
//template <typename PFP>
//void computeVertexGradient(
// typename PFP::MAP& map,
// const typename PFP::TVEC3& position,
// typename PFP::TVEC3& gradient,
// typename PFP::TVEC3& face_gradient,
// const typename PFP::TREAL& area,
// const FunctorSelect& select = allDarts,
// unsigned int thread = 0) ;
template
<
typename
PFP
>
void
computeFaceGradient
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TVEC3
&
face_normal
,
const
typename
PFP
::
TREAL
&
kmax
,
const
typename
PFP
::
TREAL
&
area
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
void
computeTriangleType
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
Kmax
,
CellMarker
&
regularMarker
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
void
computeGradient
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
gradient
,
typename
PFP
::
TVEC3
&
face_gradient
,
const
typename
PFP
::
TREAL
&
area
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
void
computeRidgeLines
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
const
typename
PFP
::
TVEC3
&
faceGradient
,
const
typename
PFP
::
TREAL
&
area
,
const
typename
PFP
::
TVEC3
&
K
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
void
computeTriangleType
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
void
initRidgeSegments
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
AttributeHandler
<
ridgeSegment
>&
ridge_segments
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
void
computeCurvatureSign
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
triangle_type
,
typename
PFP
::
TVEC3
&
k
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
void
computeSingularTriangle
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
CellMarker
&
regularMarker
,
typename
PFP
::
TVEC3
&
k
,