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
David Cazier
CGoGN
Commits
041bfaed
Commit
041bfaed
authored
May 05, 2015
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add access to generated faces in tilings
parent
eadfb56d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
17 deletions
+74
-17
CGoGN/include/Algo/Tiling/Surface/hexagonal.hpp
CGoGN/include/Algo/Tiling/Surface/hexagonal.hpp
+5
-2
CGoGN/include/Algo/Tiling/Surface/square.hpp
CGoGN/include/Algo/Tiling/Surface/square.hpp
+28
-8
CGoGN/include/Algo/Tiling/Surface/triangular.hpp
CGoGN/include/Algo/Tiling/Surface/triangular.hpp
+29
-6
CGoGN/include/Algo/Tiling/tiling.h
CGoGN/include/Algo/Tiling/tiling.h
+12
-1
No files found.
CGoGN/include/Algo/Tiling/Surface/hexagonal.hpp
View file @
041bfaed
...
...
@@ -44,10 +44,12 @@ template <typename PFP>
void
Grid
<
PFP
>::
grid
(
unsigned
int
x
,
unsigned
int
y
,
bool
close
)
{
// nb vertices
int
nb
=
x
*
y
+
1
;
unsigned
int
nbV
=
x
*
y
+
1
;
unsigned
int
nbF
=
x
*
y
;
// vertice reservation
this
->
m_tableVertDarts
.
reserve
(
nb
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// creation of triangles and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
...
...
@@ -61,6 +63,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
this
->
m_tableVertDarts
.
push_back
(
this
->
m_map
.
phi_1
(
d
));
if
(
j
==
x
)
this
->
m_tableVertDarts
.
push_back
(
this
->
m_map
.
phi1
(
this
->
m_map
.
phi1
(
d
)));
this
->
m_tableFaceDarts
.
push_back
(
d
);
}
}
...
...
CGoGN/include/Algo/Tiling/Surface/square.hpp
View file @
041bfaed
...
...
@@ -46,10 +46,12 @@ template <typename PFP>
void
Grid
<
PFP
>::
grid
(
unsigned
int
x
,
unsigned
int
y
,
bool
close
)
{
// nb vertices
int
nb
=
(
x
+
1
)
*
(
y
+
1
);
unsigned
int
nbV
=
(
x
+
1
)
*
(
y
+
1
);
unsigned
int
nbF
=
x
*
y
;
// vertice reservation
this
->
m_tableVertDarts
.
reserve
(
nb
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// creation of quads and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
...
...
@@ -60,6 +62,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
this
->
m_tableVertDarts
.
push_back
(
d
);
if
(
j
==
x
)
this
->
m_tableVertDarts
.
push_back
(
this
->
m_map
.
phi1
(
d
));
this
->
m_tableFaceDarts
.
push_back
(
d
);
}
}
...
...
@@ -174,10 +177,12 @@ void Grid<PFP>::embedIntoHelicoid(VertexAttribute<VEC3, MAP>& position, float ra
template
<
typename
PFP
>
void
Cylinder
<
PFP
>::
cylinder
(
unsigned
int
n
,
unsigned
int
z
)
{
int
nb
=
(
n
)
*
(
z
+
1
)
+
2
;
unsigned
int
nbV
=
(
n
)
*
(
z
+
1
)
+
2
;
unsigned
int
nbF
=
n
*
z
;
// vertice reservation
this
->
m_tableVertDarts
.
reserve
(
nb
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// creation of quads and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
z
;
++
i
)
...
...
@@ -186,6 +191,7 @@ void Cylinder<PFP>::cylinder(unsigned int n, unsigned int z)
{
Dart
d
=
this
->
m_map
.
newFace
(
4
,
false
);
this
->
m_tableVertDarts
.
push_back
(
d
);
this
->
m_tableFaceDarts
.
push_back
(
d
);
}
}
...
...
@@ -405,13 +411,16 @@ void Cube<PFP>::cube(unsigned int x, unsigned int y, unsigned int z)
this
->
m_ny
=
y
;
this
->
m_nz
=
z
;
int
nb
=
2
*
(
x
+
y
)
*
(
z
+
1
)
+
2
*
(
x
-
1
)
*
(
y
-
1
);
this
->
m_tableVertDarts
.
reserve
(
nb
);
unsigned
int
nbV
=
2
*
(
x
+
y
)
*
(
z
+
1
)
+
2
*
(
x
-
1
)
*
(
y
-
1
);
unsigned
int
nbF
=
2
*
(
x
+
y
)
*
z
+
2
*
x
*
y
;
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// we now have the 4 sides, just need to create store and sew top & bottom
// the top
Grid
<
PFP
>
g
t
op
(
this
->
m_map
,
x
,
y
,
false
);
std
::
vector
<
Dart
>&
tableTop
=
g
t
op
.
getVertexDarts
();
Grid
<
PFP
>
g
T
op
(
this
->
m_map
,
x
,
y
,
false
);
std
::
vector
<
Dart
>&
tableTop
=
g
T
op
.
getVertexDarts
();
int
index_side
=
2
*
(
x
+
y
)
*
z
;
for
(
unsigned
int
i
=
0
;
i
<
x
;
++
i
)
...
...
@@ -488,6 +497,17 @@ void Cube<PFP>::cube(unsigned int x, unsigned int y, unsigned int z)
this
->
m_tableVertDarts
.
push_back
(
tableBottom
[
i
*
(
x
+
1
)
+
j
]);
}
const
std
::
vector
<
Dart
>&
tableTopFaces
=
gTop
.
getFaceDarts
();
for
(
Dart
f
:
tableTopFaces
)
{
this
->
m_tableFaceDarts
.
push_back
(
f
);
}
const
std
::
vector
<
Dart
>&
tableBottomFaces
=
gBottom
.
getFaceDarts
();
for
(
Dart
f
:
tableBottomFaces
)
{
this
->
m_tableFaceDarts
.
push_back
(
f
);
}
}
template
<
typename
PFP
>
...
...
CGoGN/include/Algo/Tiling/Surface/triangular.hpp
View file @
041bfaed
...
...
@@ -44,10 +44,12 @@ template <typename PFP>
void
Grid
<
PFP
>::
grid
(
unsigned
int
x
,
unsigned
int
y
,
bool
close
)
{
// nb vertices
int
nb
=
(
x
+
1
)
*
(
y
+
1
);
unsigned
int
nbV
=
(
x
+
1
)
*
(
y
+
1
);
unsigned
int
nbF
=
2
*
x
*
y
;
// vertices reservation
this
->
m_tableVertDarts
.
reserve
(
nb
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// creation of triangles and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
...
...
@@ -59,6 +61,9 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
this
->
m_map
.
sewFaces
(
this
->
m_map
.
phi1
(
d
),
this
->
m_map
.
phi_1
(
d2
),
false
);
this
->
m_tableVertDarts
.
push_back
(
d
);
this
->
m_tableFaceDarts
.
push_back
(
d
);
this
->
m_tableFaceDarts
.
push_back
(
d2
);
if
(
j
==
x
)
this
->
m_tableVertDarts
.
push_back
(
d2
);
}
...
...
@@ -179,10 +184,12 @@ template <typename PFP>
void
Cylinder
<
PFP
>::
cylinder
(
unsigned
int
n
,
unsigned
int
z
)
{
// nb vertices
int
nb
=
(
n
)
*
(
z
+
1
)
+
2
;
unsigned
int
nbV
=
(
n
)
*
(
z
+
1
)
+
2
;
unsigned
int
nbF
=
2
*
n
*
z
;
// vertices reservation
this
->
m_tableVertDarts
.
reserve
(
nb
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// creation of triangles and storing vertices
for
(
unsigned
int
i
=
0
;
i
<
z
;
++
i
)
...
...
@@ -193,6 +200,8 @@ void Cylinder<PFP>::cylinder(unsigned int n, unsigned int z)
Dart
d2
=
this
->
m_map
.
newFace
(
3
,
false
);
this
->
m_map
.
sewFaces
(
this
->
m_map
.
phi1
(
d
),
this
->
m_map
.
phi_1
(
d2
),
false
);
this
->
m_tableVertDarts
.
push_back
(
d
);
this
->
m_tableFaceDarts
.
push_back
(
d
);
this
->
m_tableFaceDarts
.
push_back
(
d2
);
}
}
...
...
@@ -413,8 +422,11 @@ void Cube<PFP>::cube(unsigned int x, unsigned int y, unsigned int z)
this
->
m_ny
=
y
;
this
->
m_nz
=
z
;
int
nb
=
2
*
(
x
+
y
)
*
(
z
+
1
)
+
2
*
(
x
-
1
)
*
(
y
-
1
);
this
->
m_tableVertDarts
.
reserve
(
nb
);
unsigned
int
nbV
=
2
*
(
x
+
y
)
*
(
z
+
1
)
+
2
*
(
x
-
1
)
*
(
y
-
1
);
unsigned
int
nbF
=
2
*
(
2
*
(
x
+
y
)
*
z
+
2
*
x
*
y
);
this
->
m_tableVertDarts
.
reserve
(
nbV
);
this
->
m_tableFaceDarts
.
reserve
(
nbF
);
// we now have the 4 sides, just need to create store and sew top & bottom
// the top
...
...
@@ -500,6 +512,17 @@ void Cube<PFP>::cube(unsigned int x, unsigned int y, unsigned int z)
this
->
m_tableVertDarts
.
push_back
(
tableBottom
[
i
*
(
x
+
1
)
+
j
]);
}
const
std
::
vector
<
Dart
>&
tableTopFaces
=
gTop
.
getFaceDarts
();
for
(
Dart
f
:
tableTopFaces
)
{
this
-
m_tableFaceDarts
.
push_back
(
f
);
}
const
std
::
vector
<
Dart
>&
tableBottomFaces
=
gBottom
.
getFaceDarts
();
for
(
Dart
f
:
tableBottomFaces
)
{
this
-
m_tableFaceDarts
.
push_back
(
f
);
}
}
template
<
typename
PFP
>
...
...
CGoGN/include/Algo/Tiling/tiling.h
View file @
041bfaed
...
...
@@ -69,6 +69,12 @@ protected:
*/
std
::
vector
<
Dart
>
m_tableVertDarts
;
/**
* Table of vertex darts (one dart per vertex)
* Order depend on tiling kind
*/
std
::
vector
<
Dart
>
m_tableFaceDarts
;
public:
Tiling
(
MAP
&
map
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
:
m_map
(
map
),
...
...
@@ -83,10 +89,15 @@ public:
Tiling
(
const
Tiling
<
PFP
>&
t1
,
const
Tiling
<
PFP
>
t2
);
/**
* get the table of darts (one per vertex)
* get the table of
vertex
darts (one per vertex)
*/
std
::
vector
<
Dart
>&
getVertexDarts
()
{
return
m_tableVertDarts
;
}
/**
* get the table of face darts (one per face)
*/
std
::
vector
<
Dart
>&
getFaceDarts
()
{
return
m_tableFaceDarts
;
}
void
computeCenter
(
VertexAttribute
<
VEC3
,
MAP
>&
position
);
//void Polyhedron<PFP>::transform(float* matrice)
...
...
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