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
Hurstel
CGoGN
Commits
9ec12abd
Commit
9ec12abd
authored
Mar 14, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~cgogn/CGoGN
parents
11df28e3
bfceabf5
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
561 additions
and
289 deletions
+561
-289
Apps/Tuto/tuto_oper2.cpp
Apps/Tuto/tuto_oper2.cpp
+16
-0
Apps/Tuto/tuto_oper2.ui
Apps/Tuto/tuto_oper2.ui
+5
-0
include/Algo/Decimation/basic.h
include/Algo/Decimation/basic.h
+0
-153
include/Algo/MC/image.h
include/Algo/MC/image.h
+4
-1
include/Algo/MC/image.hpp
include/Algo/MC/image.hpp
+49
-6
include/Algo/MC/marchingcube.h
include/Algo/MC/marchingcube.h
+2
-9
include/Algo/MC/marchingcube.hpp
include/Algo/MC/marchingcube.hpp
+38
-20
include/Algo/Render/GL2/topo3Render.h
include/Algo/Render/GL2/topo3Render.h
+27
-4
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+67
-48
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+7
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+4
-0
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+9
-1
include/Container/holeblockref.h
include/Container/holeblockref.h
+9
-2
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+1
-0
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+6
-1
include/Topology/gmap/gmap0.h
include/Topology/gmap/gmap0.h
+1
-1
include/Topology/gmap/gmap0.hpp
include/Topology/gmap/gmap0.hpp
+1
-1
include/Topology/gmap/gmap1.h
include/Topology/gmap/gmap1.h
+1
-1
include/Topology/gmap/gmap1.hpp
include/Topology/gmap/gmap1.hpp
+1
-1
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+1
-1
include/Topology/gmap/gmap2.hpp
include/Topology/gmap/gmap2.hpp
+1
-1
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+1
-1
include/Topology/gmap/gmap3.hpp
include/Topology/gmap/gmap3.hpp
+1
-1
include/Topology/map/map1.h
include/Topology/map/map1.h
+1
-1
include/Topology/map/map1.hpp
include/Topology/map/map1.hpp
+1
-1
include/Topology/map/map2.h
include/Topology/map/map2.h
+1
-1
include/Topology/map/map2.hpp
include/Topology/map/map2.hpp
+1
-1
include/Topology/map/map3.h
include/Topology/map/map3.h
+1
-1
include/Topology/map/map3.hpp
include/Topology/map/map3.hpp
+1
-1
include/Utils/Shaders/shaderExplodeVolumes.geom
include/Utils/Shaders/shaderExplodeVolumes.geom
+1
-1
include/Utils/svg.h
include/Utils/svg.h
+28
-1
src/Algo/Render/topo3Render.cpp
src/Algo/Render/topo3Render.cpp
+79
-2
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+53
-0
src/Container/holeblockref.cpp
src/Container/holeblockref.cpp
+15
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+39
-0
src/Utils/frameManipulator.cpp
src/Utils/frameManipulator.cpp
+1
-1
src/Utils/svg.cpp
src/Utils/svg.cpp
+87
-24
No files found.
Apps/Tuto/tuto_oper2.cpp
View file @
9ec12abd
...
...
@@ -149,6 +149,17 @@ void MyQT::operation(int x)
m_selected
=
NIL
;
}
break
;
case
9
:
CGoGNout
<<
"delete face"
<<
CGoGNendl
;
if
(
m_selected
!=
NIL
)
{
myMap
.
deleteFace
(
m_selected
);
updateMap
();
m_selected
=
NIL
;
m_selected2
=
NIL
;
}
break
;
default:
break
;
}
...
...
@@ -325,6 +336,11 @@ void MyQT::cb_keyPress(int keycode)
void
MyQT
::
svg
()
{
if
(
m_selected
!=
NIL
)
m_render_topo
->
setDartColor
(
m_selected
,
0.8
f
,
0.0
f
,
0.0
f
);
if
(
m_selected2
!=
NIL
)
m_render_topo
->
setDartColor
(
m_selected2
,
0.0
f
,
0.8
f
,
0.0
f
);
std
::
string
filename
=
selectFileSave
(
"snapshot file"
,
"."
,
"(*.svg)"
);
m_render_topo
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
}
...
...
Apps/Tuto/tuto_oper2.ui
View file @
9ec12abd
...
...
@@ -94,6 +94,11 @@
<string>
mergeFace
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
deleteFace
</string>
</property>
</item>
</widget>
</item>
<item>
...
...
include/Algo/Decimation/basic.h
deleted
100644 → 0
View file @
11df28e3
/*******************************************************************************
* 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 __DECIMATION_BASIC_H_
#define __DECIMATION_BASIC_H_
namespace
CGoGN
{
namespace
Algo
{
namespace
Decimation
{
template
<
typename
PFP
>
bool
edgeCanCollapse
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
AttributeHandler
<
unsigned
int
>&
valences
)
{
Dart
dd
=
map
.
phi2
(
d
);
Dart
dp
=
map
.
phi_1
(
d
);
Dart
ddp
=
map
.
phi_1
(
dd
);
// Check valency conditions
unsigned
int
val_vd
=
valences
[
d
];
unsigned
int
val_vdd
=
valences
[
dd
];
unsigned
int
val_vd1
=
valences
[
dp
];
unsigned
int
val_vdd1
=
valences
[
ddp
];
if
(
val_vd
+
val_vdd
<
8
||
val_vd
+
val_vdd
>
11
||
val_vd1
<
5
||
val_vdd1
<
5
)
return
false
;
// Check vertex sharing condition
unsigned
int
vu1
[
32
];
// pas de vector mais un tableau (find a la main, mais pas d'allocation par reserve)
val_vd
-=
3
;
// evite le -3 dans la boucle
val_vdd
-=
3
;
Dart
vit1
=
map
.
phi2_1
(
map
.
phi2_1
(
d
));
for
(
unsigned
int
i
=
0
;
i
<
val_vd
;
++
i
)
{
unsigned
int
ve
=
map
.
getEmbedding
(
map
.
phi2
(
vit1
),
VERTEX
);
vu1
[
i
]
=
ve
;
vit1
=
map
.
phi2_1
(
vit1
);
}
val_vd
--
;
// pour le parcours avec while >=0
Dart
vit2
=
map
.
phi2_1
(
map
.
phi2_1
(
dd
));
for
(
unsigned
int
i
=
0
;
i
<
val_vdd
;
++
i
)
{
unsigned
int
ve
=
map
.
getEmbedding
(
map
.
phi2
(
vit2
),
VERTEX
);
int
j
=
val_vd
;
while
(
j
>=
0
)
{
if
(
vu1
[
j
]
==
ve
)
return
false
;
--
j
;
}
vit2
=
map
.
phi2_1
(
vit2
);
}
return
true
;
}
template
<
typename
PFP
>
bool
edgeCanCollapse
(
typename
PFP
::
MAP
&
map
,
Dart
d
)
{
Dart
dd
=
map
.
phi2
(
d
);
Dart
dp
=
map
.
phi_1
(
d
);
Dart
ddp
=
map
.
phi_1
(
dd
);
// Check valency conditions
int
val_vd
=
0
;
Dart
tmp
=
d
;
do
{
++
val_vd
;
tmp
=
map
.
phi2_1
(
tmp
)
;
}
while
(
tmp
!=
d
)
;
int
val_vdd
=
0
;
tmp
=
dd
;
do
{
++
val_vdd
;
tmp
=
map
.
phi2_1
(
tmp
)
;
}
while
(
tmp
!=
dd
)
;
int
val_vdp
=
0
;
tmp
=
dp
;
do
{
++
val_vdp
;
tmp
=
map
.
phi2_1
(
tmp
)
;
}
while
(
tmp
!=
dp
)
;
int
val_vddp
=
0
;
tmp
=
ddp
;
do
{
++
val_vddp
;
tmp
=
map
.
phi2_1
(
tmp
)
;
}
while
(
tmp
!=
ddp
)
;
if
(
val_vd
+
val_vdd
<
8
||
val_vd
+
val_vdd
>
11
||
val_vdp
<
5
||
val_vddp
<
5
)
return
false
;
// Check vertex sharing condition
unsigned
int
vu1
[
32
];
// pas de vector mais un tableau (find a la main, mais pas d'allocation par reserve)
val_vd
-=
3
;
// evite le -3 dans la boucle
val_vdd
-=
3
;
Dart
vit1
=
map
.
phi2_1
(
map
.
phi2_1
(
d
));
for
(
int
i
=
0
;
i
<
val_vd
;
++
i
)
{
unsigned
int
ve
=
map
.
getEmbedding
(
map
.
phi2
(
vit1
),
VERTEX
);
vu1
[
i
]
=
ve
;
vit1
=
map
.
phi2_1
(
vit1
);
}
val_vd
--
;
// pour le parcours avec while >=0
Dart
vit2
=
map
.
phi2_1
(
map
.
phi2_1
(
dd
));
for
(
int
i
=
0
;
i
<
val_vdd
;
++
i
)
{
unsigned
int
ve
=
map
.
getEmbedding
(
map
.
phi2
(
vit2
),
VERTEX
);
int
j
=
val_vd
;
while
(
j
>=
0
)
{
if
(
vu1
[
j
]
==
ve
)
return
false
;
--
j
;
}
vit2
=
map
.
phi2_1
(
vit2
);
}
return
true
;
}
}
// namespace Decimation
}
// namespace Algo
}
// namespace CGoGN
#endif
include/Algo/MC/image.h
View file @
9ec12abd
...
...
@@ -30,7 +30,9 @@
#include "Utils/img3D_IO.h"
#ifdef WITH_ZINRI
#include "Zinrimage.h"
#endif
namespace
CGoGN
{
...
...
@@ -121,11 +123,12 @@ protected:
*/
//bool correct(const gmtl::Vec3i& _V);
#ifdef WITH_ZINRI
/**
* internal inrimage prt
*/
PTRINRIMAGE
mImage
;
#endif
public:
...
...
include/Algo/MC/image.hpp
View file @
9ec12abd
...
...
@@ -29,9 +29,6 @@
#include <math.h>
#include <typeinfo>
#include "Utils/img3D_IO.h"
#include "Zinrimage.h"
namespace
CGoGN
{
...
...
@@ -177,6 +174,7 @@ void Image<DataType>::loadVox(char *filename)
m_Alloc
=
true
;
}
#ifdef WITH_QT
template
<
typename
DataType
>
bool
Image
<
DataType
>::
loadPNG3D
(
const
char
*
filename
)
{
...
...
@@ -199,8 +197,9 @@ bool Image<DataType>::loadPNG3D(const char* filename)
return
true
;
}
#endif
#ifdef WITH_ZINRI
template
<
typename
DataType
>
bool
Image
<
DataType
>::
loadInrgz
(
const
char
*
filename
)
{
...
...
@@ -230,7 +229,7 @@ bool Image<DataType>::loadInrgz(const char* filename)
return
true
;
}
#endif
...
...
@@ -472,9 +471,52 @@ Image<DataType>* Image<DataType>::Blur3()
return
newImg
;
}
//template<typename DataType>
//void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32radius)
//{
// // compute the width of the sphere for memory allocation
// int i32Width = 2*_i32radius + 1;
// // squared radius
// float fRad2 = (float)(_i32radius*_i32radius);
//
// // memory allocation
// // difficult to know how many voxels before computing,
// // so the reserve for the BB
// table.reserve(i32Width*i32Width*i32Width);
// table.clear();
//
// // scan all the BB of the sphere
// for (int z = -_i32radius; z<=_i32radius; z++)
// {
// for (int y = -_i32radius; y<=_i32radius; y++)
// {
// for (int x = -_i32radius; x<=_i32radius; x++)
// {
// Geom::Vec3f v((float)x,(float)y,(float)z);
// float fLength = v.norm2();
// // if inside the sphere
// if (fLength<=fRad2)
// {
// // the the index of the voxel
// int index = z * m_WXY + y * m_WX + x;
// table.push_back(index);
// }
// }
// }
// }
//}
template
<
typename
DataType
>
void
Image
<
DataType
>::
createMaskOffsetSphere
(
std
::
vector
<
int
>&
table
,
int
_i32radius
)
{
float
smin
=
std
::
min
(
m_SX
,
std
::
min
(
m_SY
,
m_SZ
));
float
xs
=
m_SX
/
smin
;
float
ys
=
m_SY
/
smin
;
float
zs
=
m_SZ
/
smin
;
// compute the width of the sphere for memory allocation
int
i32Width
=
2
*
_i32radius
+
1
;
// squared radius
...
...
@@ -493,7 +535,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
{
for
(
int
x
=
-
_i32radius
;
x
<=
_i32radius
;
x
++
)
{
Geom
::
Vec3f
v
(
(
float
)
x
,(
float
)
y
,(
float
)
z
);
Geom
::
Vec3f
v
(
float
(
x
)
*
xs
,
float
(
y
)
*
ys
,
float
(
z
)
*
zs
);
float
fLength
=
v
.
norm2
();
// if inside the sphere
if
(
fLength
<=
fRad2
)
...
...
@@ -507,6 +549,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
}
}
template
<
typename
DataType
>
float
Image
<
DataType
>::
computeCurvatureCount
(
const
DataType
*
ptrVox
,
const
std
::
vector
<
int
>&
sphere
,
DataType
val
)
{
...
...
include/Algo/MC/marchingcube.h
View file @
9ec12abd
...
...
@@ -189,14 +189,7 @@ protected:
void
setNeighbour
(
L_DART
d1
,
L_DART
d2
);
L_DART
createTriEmb
(
unsigned
int
e1
,
unsigned
int
e2
,
unsigned
int
e3
)
{
L_DART
d
=
m_map
->
newFace
(
3
);
//TODO change this which work only with 2-maps
m_map
->
setDartEmbedding
(
VERTEX
,
d
,
e1
);
d
=
m_map
->
phi1
(
d
);
m_map
->
setDartEmbedding
(
VERTEX
,
d
,
e2
);
d
=
m_map
->
phi1
(
d
);
m_map
->
setDartEmbedding
(
VERTEX
,
d
,
e3
);
d
=
m_map
->
phi1
(
d
);
return
d
;
}
L_DART
createTriEmb
(
unsigned
int
e1
,
unsigned
int
e2
,
unsigned
int
e3
);
public:
/**
...
...
@@ -261,7 +254,7 @@ public:
void
removeFacesOfBoundary
(
AttributeHandler
<
unsigned
char
>&
boundVertices
,
unsigned
int
frameWidth
);
void
recalPoints
();
void
recalPoints
(
const
Geom
::
Vec3f
&
origin
);
};
...
...
include/Algo/MC/marchingcube.hpp
View file @
9ec12abd
...
...
@@ -100,6 +100,29 @@ void MarchingCube<DataType, Windowing, PFP>::deleteMesh()
}
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
Dart
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
createTriEmb
(
unsigned
int
e1
,
unsigned
int
e2
,
unsigned
int
e3
)
{
L_DART
d
=
m_map
->
newFace
(
3
,
false
);
//TODO change this which work only with 2-maps
// m_map->setDartEmbedding(VERTEX,d,e1); d = m_map->phi1(d);
// m_map->setDartEmbedding(VERTEX,d,e2); d = m_map->phi1(d);
// m_map->setDartEmbedding(VERTEX,d,e3); d = m_map->phi1(d);
FunctorSetEmb
<
GenericMap
>
fsetemb
(
*
m_map
,
VERTEX
,
e1
);
m_map
->
foreach_dart_of_orbit
(
PFP
::
MAP
::
ORBIT_IN_PARENT
(
VERTEX
),
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
fsetemb
.
changeEmb
(
e2
);
m_map
->
foreach_dart_of_orbit
(
PFP
::
MAP
::
ORBIT_IN_PARENT
(
VERTEX
),
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
fsetemb
.
changeEmb
(
e3
);
m_map
->
foreach_dart_of_orbit
(
PFP
::
MAP
::
ORBIT_IN_PARENT
(
VERTEX
),
d
,
fsetemb
);
d
=
m_map
->
phi1
(
d
);
return
d
;
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
simpleMeshing
()
{
...
...
@@ -120,7 +143,7 @@ void MarchingCube<DataType, Windowing, PFP>::simpleMeshing()
// compute value to transform points directly to final system coordinate
//
m_fOrigin = typename PFP::VEC3((float)(m_Image->getOrigin()[0]),(float)(m_Image->getOrigin()[1]),(float)(m_Image->getOrigin()[2]));
m_fOrigin
=
typename
PFP
::
VEC3
((
float
)(
m_Image
->
getOrigin
()[
0
]),(
float
)(
m_Image
->
getOrigin
()[
1
]),(
float
)(
m_Image
->
getOrigin
()[
2
]));
m_fScal
[
0
]
=
m_Image
->
getVoxSizeX
();
m_fScal
[
1
]
=
m_Image
->
getVoxSizeY
();
...
...
@@ -483,7 +506,9 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_1(DataType *vox, const
unsigned
int
lVertTable
[
12
];
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// typename PFP::VEC3 vPos(float(_lX) , float(_lY) , float(_lZ) );
// typename PFP::VEC3 vPos(float(_lX) + 0.5f, float(_lY) + 0.5f, (float)_lZ + 0.5f);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
...
...
@@ -545,8 +570,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_2(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
;
...
...
@@ -603,8 +627,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_3(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
;
...
...
@@ -659,8 +682,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_4(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
;
...
...
@@ -718,8 +740,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_5(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
;
...
...
@@ -775,8 +796,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_6(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
+
1
;
...
...
@@ -837,8 +857,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_7(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
+
1
;
...
...
@@ -899,8 +918,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_8(DataType *vox, const
return
;
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
// create the new vertices
int
lX
=
_lX
+
1
;
...
...
@@ -953,14 +971,14 @@ template< typename DataType, template < typename D2 > class Windowing, typename
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
setNeighbourSimple
(
L_DART
d1
,
L_DART
d2
)
{
if
(
m_map
->
phi2
(
d1
)
!=
d2
)
m_map
->
sewFaces
(
d1
,
d2
);
m_map
->
sewFaces
(
d1
,
d2
,
false
);
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
setNeighbour
(
L_DART
d1
,
L_DART
d2
)
{
if
(
m_map
->
phi2
(
d1
)
!=
d2
)
m_map
->
sewFaces
(
d1
,
d2
);
m_map
->
sewFaces
(
d1
,
d2
,
false
);
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
...
...
@@ -1241,7 +1259,7 @@ void MarchingCube<DataType, Windowing, PFP>::removeFacesOfBoundary(AttributeHand
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
recalPoints
()
void
MarchingCube
<
DataType
,
Windowing
,
PFP
>::
recalPoints
(
const
Geom
::
Vec3f
&
origin
)
{
for
(
unsigned
int
i
=
m_positions
.
begin
();
i
!=
m_positions
.
end
();
m_positions
.
next
(
i
))
...
...
@@ -1251,7 +1269,7 @@ void MarchingCube<DataType, Windowing, PFP>::recalPoints()
P
[
0
]
=
P
[
0
]
*
m_fScal
[
0
];
P
[
1
]
=
P
[
1
]
*
m_fScal
[
1
];
P
[
2
]
=
P
[
2
]
*
m_fScal
[
2
];
P
+=
origin
;
}
}
...
...
include/Algo/Render/GL2/topo3Render.h
View file @
9ec12abd
...
...
@@ -36,6 +36,7 @@
#include "Geometry/vector_gen.h"
#include "Utils/vbo.h"
#include "Utils/svg.h"
// forward
namespace
CGoGN
{
namespace
Utils
{
class
ShaderSimpleColor
;
}
}
...
...
@@ -83,6 +84,11 @@ protected:
*/
GLuint
m_nbDarts
;
/**
* number of relations 2 to draw
*/
GLuint
m_nbRel1
;
/**
* number of relations 2 to draw
*/
...
...
@@ -266,8 +272,6 @@ public:
void
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* update all drawing buffers to render a dual map
* @param map the map
...
...
@@ -280,6 +284,14 @@ public:
template
<
typename
PFP
>
void
updateData
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* update color buffer with color attributte handler
* @param map the map
* @param good selector
* @param colors attribute of dart's colors
*/
template
<
typename
PFP
>
void
updateColors
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
colors
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* Get back middle position of drawed darts
...
...
@@ -290,6 +302,17 @@ public:
template
<
typename
PFP
>
void
computeDartMiddlePositions
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
posExpl
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* render to svg struct
*/
void
toSVG
(
Utils
::
SVG
::
SVGOut
&
svg
);
/**
* render svg into svg file
*/
void
svgout2D
(
const
std
::
string
&
filename
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
protected:
/**
* update all drawing buffers to render a dual map
...
...
@@ -301,7 +324,7 @@ protected:
* @param good selector
*/
template
<
typename
PFP
>
void
updateDataMap3
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
=
allDarts
);
void
updateDataMap3
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
);
/**
* update all drawing buffers to render a gmap
...
...
@@ -313,7 +336,7 @@ protected:
* @param good selector
*/
template
<
typename
PFP
>
void
updateDataGMap3
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
=
allDarts
);
void
updateDataGMap3
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
);
};
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
9ec12abd
...
...
@@ -33,8 +33,6 @@
#include "Topology/generic/traversorCell.h"
#include "Algo/Geometry/centroid.h"
#include <sys/time.h>
namespace
CGoGN
{
...
...
@@ -65,10 +63,6 @@ void Topo3Render::updateData(typename PFP::MAP& map, const typename PFP::TVEC3&
template
<
typename
PFP
>
void
Topo3Render
::
updateDataMap3
(
typename
PFP
::
MAP
&
mapx
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
// Map3& map = dynamic_cast<Map3&>(mapx);
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
...
...
@@ -92,8 +86,7 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
CellMarker
cmv
(
mapx
,
VOLUME
);
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
mapx
,
VOLUME
,
"centerVolumes"
);
Algo
::
Geometry
::
computeCentroidVolumes
<
PFP
>
(
mapx
,
positions
,
centerVolumes
,
good
);
Algo
::
Geometry
::
computeCentroidVolumes
<
PFP
>
(
mapx
,
positions
,
centerVolumes
,
allDarts
);