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
Thomas Pitiot
CGoGN
Commits
7522659d
Commit
7522659d
authored
Feb 24, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update MC
modif tuto_oper
parent
8bfd76d1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
26 deletions
+88
-26
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/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
+1
-1
include/Algo/MC/marchingcube.hpp
include/Algo/MC/marchingcube.hpp
+13
-18
No files found.
Apps/Tuto/tuto_oper2.cpp
View file @
7522659d
...
@@ -149,6 +149,17 @@ void MyQT::operation(int x)
...
@@ -149,6 +149,17 @@ void MyQT::operation(int x)
m_selected
=
NIL
;
m_selected
=
NIL
;
}
}
break
;
break
;
case
9
:
CGoGNout
<<
"delete face"
<<
CGoGNendl
;
if
(
m_selected
!=
NIL
)
{
myMap
.
deleteFace
(
m_selected
);
updateMap
();
m_selected
=
NIL
;
m_selected2
=
NIL
;
}
break
;
default:
default:
break
;
break
;
}
}
...
@@ -325,6 +336,11 @@ void MyQT::cb_keyPress(int keycode)
...
@@ -325,6 +336,11 @@ void MyQT::cb_keyPress(int keycode)
void
MyQT
::
svg
()
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)"
);
std
::
string
filename
=
selectFileSave
(
"snapshot file"
,
"."
,
"(*.svg)"
);
m_render_topo
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
m_render_topo
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
}
}
...
...
Apps/Tuto/tuto_oper2.ui
View file @
7522659d
...
@@ -94,6 +94,11 @@
...
@@ -94,6 +94,11 @@
<string>
mergeFace
</string>
<string>
mergeFace
</string>
</property>
</property>
</item>
</item>
<item>
<property
name=
"text"
>
<string>
deleteFace
</string>
</property>
</item>
</widget>
</widget>
</item>
</item>
<item>
<item>
...
...
include/Algo/MC/image.h
View file @
7522659d
...
@@ -30,7 +30,9 @@
...
@@ -30,7 +30,9 @@
#include "Utils/img3D_IO.h"
#include "Utils/img3D_IO.h"
#ifdef WITH_ZINRI
#include "Zinrimage.h"
#include "Zinrimage.h"
#endif
namespace
CGoGN
namespace
CGoGN
{
{
...
@@ -121,11 +123,12 @@ protected:
...
@@ -121,11 +123,12 @@ protected:
*/
*/
//bool correct(const gmtl::Vec3i& _V);
//bool correct(const gmtl::Vec3i& _V);
#ifdef WITH_ZINRI
/**
/**
* internal inrimage prt
* internal inrimage prt
*/
*/
PTRINRIMAGE
mImage
;
PTRINRIMAGE
mImage
;
#endif
public:
public:
...
...
include/Algo/MC/image.hpp
View file @
7522659d
...
@@ -29,9 +29,6 @@
...
@@ -29,9 +29,6 @@
#include <math.h>
#include <math.h>
#include <typeinfo>
#include <typeinfo>
#include "Utils/img3D_IO.h"
#include "Zinrimage.h"
namespace
CGoGN
namespace
CGoGN
{
{
...
@@ -177,6 +174,7 @@ void Image<DataType>::loadVox(char *filename)
...
@@ -177,6 +174,7 @@ void Image<DataType>::loadVox(char *filename)
m_Alloc
=
true
;
m_Alloc
=
true
;
}
}
#ifdef WITH_QT
template
<
typename
DataType
>
template
<
typename
DataType
>
bool
Image
<
DataType
>::
loadPNG3D
(
const
char
*
filename
)
bool
Image
<
DataType
>::
loadPNG3D
(
const
char
*
filename
)
{
{
...
@@ -199,8 +197,9 @@ bool Image<DataType>::loadPNG3D(const char* filename)
...
@@ -199,8 +197,9 @@ bool Image<DataType>::loadPNG3D(const char* filename)
return
true
;
return
true
;
}
}
#endif
#ifdef WITH_ZINRI
template
<
typename
DataType
>
template
<
typename
DataType
>
bool
Image
<
DataType
>::
loadInrgz
(
const
char
*
filename
)
bool
Image
<
DataType
>::
loadInrgz
(
const
char
*
filename
)
{
{
...
@@ -230,7 +229,7 @@ bool Image<DataType>::loadInrgz(const char* filename)
...
@@ -230,7 +229,7 @@ bool Image<DataType>::loadInrgz(const char* filename)
return
true
;
return
true
;
}
}
#endif
...
@@ -472,9 +471,52 @@ Image<DataType>* Image<DataType>::Blur3()
...
@@ -472,9 +471,52 @@ Image<DataType>* Image<DataType>::Blur3()
return
newImg
;
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
>
template
<
typename
DataType
>
void
Image
<
DataType
>::
createMaskOffsetSphere
(
std
::
vector
<
int
>&
table
,
int
_i32radius
)
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
// compute the width of the sphere for memory allocation
int
i32Width
=
2
*
_i32radius
+
1
;
int
i32Width
=
2
*
_i32radius
+
1
;
// squared radius
// squared radius
...
@@ -493,7 +535,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
...
@@ -493,7 +535,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
{
{
for
(
int
x
=
-
_i32radius
;
x
<=
_i32radius
;
x
++
)
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
();
float
fLength
=
v
.
norm2
();
// if inside the sphere
// if inside the sphere
if
(
fLength
<=
fRad2
)
if
(
fLength
<=
fRad2
)
...
@@ -507,6 +549,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
...
@@ -507,6 +549,7 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
}
}
}
}
template
<
typename
DataType
>
template
<
typename
DataType
>
float
Image
<
DataType
>::
computeCurvatureCount
(
const
DataType
*
ptrVox
,
const
std
::
vector
<
int
>&
sphere
,
DataType
val
)
float
Image
<
DataType
>::
computeCurvatureCount
(
const
DataType
*
ptrVox
,
const
std
::
vector
<
int
>&
sphere
,
DataType
val
)
{
{
...
...
include/Algo/MC/marchingcube.h
View file @
7522659d
...
@@ -261,7 +261,7 @@ public:
...
@@ -261,7 +261,7 @@ public:
void
removeFacesOfBoundary
(
AttributeHandler
<
unsigned
char
>&
boundVertices
,
unsigned
int
frameWidth
);
void
removeFacesOfBoundary
(
AttributeHandler
<
unsigned
char
>&
boundVertices
,
unsigned
int
frameWidth
);
void
recalPoints
();
void
recalPoints
(
const
Geom
::
Vec3f
&
origin
);
};
};
...
...
include/Algo/MC/marchingcube.hpp
View file @
7522659d
...
@@ -120,7 +120,7 @@ void MarchingCube<DataType, Windowing, PFP>::simpleMeshing()
...
@@ -120,7 +120,7 @@ void MarchingCube<DataType, Windowing, PFP>::simpleMeshing()
// compute value to transform points directly to final system coordinate
// 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
[
0
]
=
m_Image
->
getVoxSizeX
();
m_fScal
[
1
]
=
m_Image
->
getVoxSizeY
();
m_fScal
[
1
]
=
m_Image
->
getVoxSizeY
();
...
@@ -483,7 +483,9 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_1(DataType *vox, const
...
@@ -483,7 +483,9 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_1(DataType *vox, const
unsigned
int
lVertTable
[
12
];
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
// create the new vertices
...
@@ -545,8 +547,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_2(DataType *vox, const
...
@@ -545,8 +547,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_2(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
;
int
lX
=
_lX
;
...
@@ -603,8 +604,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_3(DataType *vox, const
...
@@ -603,8 +604,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_3(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
;
int
lX
=
_lX
;
...
@@ -659,8 +659,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_4(DataType *vox, const
...
@@ -659,8 +659,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_4(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
;
int
lX
=
_lX
;
...
@@ -718,8 +717,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_5(DataType *vox, const
...
@@ -718,8 +717,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_5(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
;
int
lX
=
_lX
;
...
@@ -775,8 +773,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_6(DataType *vox, const
...
@@ -775,8 +773,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_6(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
+
1
;
int
lX
=
_lX
+
1
;
...
@@ -837,8 +834,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_7(DataType *vox, const
...
@@ -837,8 +834,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_7(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
+
1
;
int
lX
=
_lX
+
1
;
...
@@ -899,8 +895,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_8(DataType *vox, const
...
@@ -899,8 +895,7 @@ void MarchingCube<DataType, Windowing, PFP>::createFaces_8(DataType *vox, const
return
;
return
;
unsigned
int
lVertTable
[
12
];
unsigned
int
lVertTable
[
12
];
// typename PFP::VEC3 vPos((float)_lX , (float)_lY, (float)_lZ);
typename
PFP
::
VEC3
vPos
(
_lX
,
_lY
,
_lZ
);
typename
PFP
::
VEC3
vPos
((
float
)
_lX
+
0.5
f
,
(
float
)
_lY
+
0.5
f
,
(
float
)
_lZ
+
0.5
f
);
// create the new vertices
// create the new vertices
int
lX
=
_lX
+
1
;
int
lX
=
_lX
+
1
;
...
@@ -1241,7 +1236,7 @@ void MarchingCube<DataType, Windowing, PFP>::removeFacesOfBoundary(AttributeHand
...
@@ -1241,7 +1236,7 @@ void MarchingCube<DataType, Windowing, PFP>::removeFacesOfBoundary(AttributeHand
}
}
template
<
typename
DataType
,
template
<
typename
D2
>
class
Windowing
,
typename
PFP
>
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
))
for
(
unsigned
int
i
=
m_positions
.
begin
();
i
!=
m_positions
.
end
();
m_positions
.
next
(
i
))
...
@@ -1251,7 +1246,7 @@ void MarchingCube<DataType, Windowing, PFP>::recalPoints()
...
@@ -1251,7 +1246,7 @@ void MarchingCube<DataType, Windowing, PFP>::recalPoints()
P
[
0
]
=
P
[
0
]
*
m_fScal
[
0
];
P
[
0
]
=
P
[
0
]
*
m_fScal
[
0
];
P
[
1
]
=
P
[
1
]
*
m_fScal
[
1
];
P
[
1
]
=
P
[
1
]
*
m_fScal
[
1
];
P
[
2
]
=
P
[
2
]
*
m_fScal
[
2
];
P
[
2
]
=
P
[
2
]
*
m_fScal
[
2
];
P
+=
origin
;
}
}
}
}
...
...
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