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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
ca1c0aac
Commit
ca1c0aac
authored
Mar 20, 2014
by
Lionel Untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
triangular tiling ok
parent
d916df01
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
309 additions
and
14 deletions
+309
-14
Apps/SandBox/testPlaneCutting.cpp
Apps/SandBox/testPlaneCutting.cpp
+11
-2
Apps/SandBox/tilings.cpp
Apps/SandBox/tilings.cpp
+9
-9
include/Algo/Modelisation/planeCutting.hpp
include/Algo/Modelisation/planeCutting.hpp
+2
-2
include/Algo/Tiling/Surface/triangular.h
include/Algo/Tiling/Surface/triangular.h
+88
-0
include/Algo/Tiling/Surface/triangular.hpp
include/Algo/Tiling/Surface/triangular.hpp
+198
-0
include/Geometry/plane_3d.h
include/Geometry/plane_3d.h
+1
-1
No files found.
Apps/SandBox/testPlaneCutting.cpp
View file @
ca1c0aac
...
...
@@ -245,7 +245,7 @@ void Viewer::cb_keyPress(int keycode)
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
CellMarker
<
FACE
>
over
(
myMap
);
Algo
::
Surface
::
Modelisation
::
planeCut2
<
PFP
>
(
myMap
,
position
,
plan
,
over
,
true
);
...
...
@@ -260,7 +260,6 @@ void Viewer::cb_keyPress(int keycode)
position
[
d
]
+=
n
;
}
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
...
...
@@ -274,6 +273,16 @@ void Viewer::cb_keyPress(int keycode)
break
;
}
case
'S'
:
{
Geom
::
Vec3f
p1
(
0.0
,
1.0
,
0.0
);
Geom
::
Vec3f
p2
(
1.0
,
0.0
,
0.0
);
Geom
::
Vec3f
p3
(
1.0
,
1.0
,
0.0
);
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
p1
,
p2
,
p3
);
}
case
'd'
:
{
...
...
Apps/SandBox/tilings.cpp
View file @
ca1c0aac
...
...
@@ -196,8 +196,8 @@ void MyQT::squareTiling(int code)
}
case
8
:
{
std
::
cout
<<
"square cylinder con
e tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cube
<
PFP
>
c
(
myMap
,
20
,
20
,
20
);
std
::
cout
<<
"square cub
e tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cube
<
PFP
>
c
(
myMap
,
1
,
1
,
2
);
c
.
embedIntoCube
(
position
,
1.0
,
1.0
,
1.0
);
Geom
::
Matrix44f
trf
;
...
...
@@ -297,17 +297,17 @@ void MyQT::triangularTiling(int code)
}
case
8
:
{
// std::cout << "triangle cylinder con
e tiling" << std::endl;
// Algo::Surface::Tilings::Square::Cube<PFP> c(myMap,20,20,20
);
//
c.embedIntoCube(position,5.0,5.0, 5.0);
std
::
cout
<<
"triangle cub
e tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Cube
<
PFP
>
c
(
myMap
,
4
,
4
,
4
);
c
.
embedIntoCube
(
position
,
5.0
,
5.0
,
5.0
);
break
;
}
case
9
:
{
// std::cout << "triangle cylinder con
e tiling" << std::endl;
// Algo::Surface::Tilings::Square
::Tore<PFP> c(myMap,20,10);
//
c.embedIntoTore(position,5.0,2.0);
std
::
cout
<<
"triangle tor
e tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
5.0
,
2.0
);
break
;
}
...
...
@@ -341,7 +341,7 @@ int main(int argc, char **argv)
else
if
(
argv
[
1
][
0
]
==
'T'
)
sqt
.
triangularTiling
(
atoi
(
argv
[
2
]));
}
myMap
.
check
();
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
include/Algo/Modelisation/planeCutting.hpp
View file @
ca1c0aac
...
...
@@ -130,7 +130,7 @@ void planeCut(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
template
<
typename
PFP
>
void
planeCut
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTriangles
=
false
,
bool
with_unsew
=
true
)
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTriangles
,
bool
with_unsew
)
{
typedef
typename
PFP
::
REAL
REAL
;
...
...
@@ -393,7 +393,7 @@ namespace Modelisation
template
<
typename
PFP
>
void
planeCut
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
Geom
::
Plane3D
<
typename
PFP
::
REAL
>&
plane
,
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTetrahedra
=
false
,
bool
with_unsew
=
true
)
CellMarker
<
FACE
>&
cmf_over
,
bool
keepTetrahedra
,
bool
with_unsew
)
{
typedef
typename
PFP
::
REAL
REAL
;
...
...
include/Algo/Tiling/Surface/triangular.h
View file @
ca1c0aac
...
...
@@ -202,6 +202,94 @@ protected:
//@}
};
/*! \brief The class of regular cube square tiling
*/
template
<
typename
PFP
>
class
Cube
:
public
Cylinder
<
PFP
>
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
public:
Cube
(
MAP
&
map
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
:
Cylinder
<
PFP
>
(
map
,
2
*
(
x
+
y
),
z
,
false
,
false
)
{
cube
(
x
,
y
,
z
);
}
/*! @name Embedding Operators
* Tiling creation
*************************************************************************/
//@{
//! Embed a topological cube
/*! @param position Attribute used to store vertices positions
* @param x
* @param y
* @param z
*/
void
embedIntoCube
(
VertexAttribute
<
VEC3
>&
position
,
float
x
,
float
y
,
float
z
);
//@}
protected:
/*! @name Topological Operators
* Tiling creation
*************************************************************************/
//@{
//! Create a subdivided 2D cube
/*! @param x nb of squares in x
* @param y nb of squares in y
* @param z nb of squares un z
*/
void
cube
(
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
);
//@}
};
/*! \brief The class of regular tore square tiling
*/
template
<
typename
PFP
>
class
Tore
:
public
Cylinder
<
PFP
>
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
public:
Tore
(
MAP
&
map
,
unsigned
int
n
,
unsigned
int
m
)
:
Cylinder
<
PFP
>
(
map
,
n
,
m
)
{
tore
(
n
,
m
);
}
/*! @name Embedding Operators
* Tiling creation
*************************************************************************/
//@{
//! Embed a topological tore
/*! @param position Attribute used to store vertices positions
* @param big_radius
* @param small_radius
*/
void
embedIntoTore
(
VertexAttribute
<
VEC3
>&
position
,
float
big_radius
,
float
small_radius
);
//@}
/*! @name Topological Operators
* Tiling creation
*************************************************************************/
//@{
protected:
//! Create a subdivided 2D tore
/*! @param n nb of squares around big circumference
* @param m nb of squares around small circumference
*/
//square -> tore -> cylinder + finish sewing
void
tore
(
unsigned
int
n
,
unsigned
int
m
);
//@}
};
}
// namespace Triangular
}
// namespace Tilings
...
...
include/Algo/Tiling/Surface/triangular.hpp
View file @
ca1c0aac
...
...
@@ -403,6 +403,204 @@ void Cylinder<PFP>::embedIntoCone(VertexAttribute<VEC3>& position, float radius,
}
/*! Cube
*************************************************************************/
template
<
typename
PFP
>
void
Cube
<
PFP
>::
cube
(
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
z
)
{
this
->
m_nx
=
x
;
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
);
// we now have the 4 sides, just need to create store and sew top & bottom
// the top
Grid
<
PFP
>
gtop
(
this
->
m_map
,
x
,
y
,
false
);
std
::
vector
<
Dart
>&
tableTop
=
gtop
.
getVertexDarts
();
int
index_side
=
2
*
(
x
+
y
)
*
(
z
-
1
);
for
(
unsigned
int
i
=
0
;
i
<
x
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[
index_side
++
];
d
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi1
(
d
)));
Dart
e
=
tableTop
[
i
];
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[
index_side
++
];
d
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi1
(
d
)));
Dart
e
=
tableTop
[
x
+
i
*
(
x
+
1
)];
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
x
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[
index_side
++
];
d
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi1
(
d
)));
Dart
e
=
tableTop
[(
x
+
1
)
*
(
y
+
1
)
-
2
-
i
];
e
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi_1
(
e
)));
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[
index_side
++
];
d
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi1
(
d
)));
Dart
e
=
tableTop
[(
y
-
1
-
i
)
*
(
x
+
1
)];
e
=
this
->
m_map
.
phi_1
(
e
);
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
// the bottom
Grid
<
PFP
>
gBottom
(
this
->
m_map
,
x
,
y
,
false
);
std
::
vector
<
Dart
>&
tableBottom
=
gBottom
.
getVertexDarts
();
index_side
=
3
*
(
x
+
y
)
+
(
x
-
1
);
for
(
unsigned
int
i
=
0
;
i
<
x
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[(
index_side
--
)
%
(
2
*
(
x
+
y
))];
Dart
e
=
tableBottom
[
i
];
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[(
index_side
--
)
%
(
2
*
(
x
+
y
))];
Dart
e
=
tableBottom
[
x
+
i
*
(
x
+
1
)];
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
x
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[(
index_side
--
)
%
(
2
*
(
x
+
y
))];
Dart
e
=
tableBottom
[(
x
+
1
)
*
(
y
+
1
)
-
2
-
i
];
e
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi_1
(
e
)));
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
for
(
unsigned
int
i
=
0
;
i
<
y
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[(
index_side
--
)
%
(
2
*
(
x
+
y
))];
Dart
e
=
tableBottom
[(
y
-
1
-
i
)
*
(
x
+
1
)];
e
=
this
->
m_map
.
phi_1
(
e
);
this
->
m_map
.
sewFaces
(
d
,
e
,
false
);
}
// and add new vertex in m_tableVertDarts
//top first
for
(
unsigned
int
i
=
1
;
i
<
y
;
++
i
)
{
for
(
unsigned
int
j
=
1
;
j
<
x
;
++
j
)
this
->
m_tableVertDarts
.
push_back
(
tableTop
[
i
*
(
x
+
1
)
+
j
]);
}
// then bottom
for
(
unsigned
int
i
=
1
;
i
<
y
;
++
i
)
{
for
(
unsigned
int
j
=
1
;
j
<
x
;
++
j
)
this
->
m_tableVertDarts
.
push_back
(
tableBottom
[
i
*
(
x
+
1
)
+
j
]);
}
}
template
<
typename
PFP
>
void
Cube
<
PFP
>::
embedIntoCube
(
VertexAttribute
<
VEC3
>&
position
,
float
sx
,
float
sy
,
float
sz
)
{
float
dz
=
sz
/
float
(
this
->
m_nz
);
float
dy
=
sy
/
float
(
this
->
m_ny
);
float
dx
=
sx
/
float
(
this
->
m_nx
);
// first embedding the sides
int
index
=
0
;
for
(
unsigned
int
k
=
0
;
k
<=
this
->
m_nz
;
++
k
)
{
float
z
=
float
(
k
)
*
dz
-
sz
/
2.0
f
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
m_nx
;
++
i
)
{
float
x
=
float
(
i
)
*
dx
-
sx
/
2.0
f
;
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
VEC3
(
x
,
-
sy
/
2.0
f
,
z
);
}
for
(
unsigned
int
i
=
0
;
i
<
this
->
m_ny
;
++
i
)
{
float
y
=
float
(
i
)
*
dy
-
sy
/
2.0
f
;
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
VEC3
(
sx
/
2.0
f
,
y
,
z
);
}
for
(
unsigned
int
i
=
0
;
i
<
this
->
m_nx
;
++
i
)
{
float
x
=
sx
/
2.0
f
-
float
(
i
)
*
dx
;
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
VEC3
(
x
,
sy
/
2.0
f
,
z
);
}
for
(
unsigned
int
i
=
0
;
i
<
this
->
m_ny
;
++
i
)
{
float
y
=
sy
/
2.0
f
-
float
(
i
)
*
dy
;
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
VEC3
(
-
sx
/
2.0
f
,
y
,
z
);
}
}
// the top
for
(
unsigned
int
i
=
1
;
i
<
this
->
m_ny
;
++
i
)
{
for
(
unsigned
int
j
=
1
;
j
<
this
->
m_nx
;
++
j
)
{
VEC3
pos
(
-
sx
/
2.0
f
+
float
(
j
)
*
dx
,
-
sy
/
2.0
f
+
float
(
i
)
*
dy
,
sz
/
2.0
f
);
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
pos
;
}
}
// the bottom
for
(
unsigned
int
i
=
1
;
i
<
this
->
m_ny
;
++
i
)
{
for
(
unsigned
int
j
=
1
;
j
<
this
->
m_nx
;
++
j
)
{
VEC3
pos
(
-
sx
/
2.0
f
+
float
(
j
)
*
dx
,
sy
/
2.0
f
-
float
(
i
)
*
dy
,
-
sz
/
2.0
f
);
position
[
this
->
m_tableVertDarts
[
index
++
]
]
=
pos
;
}
}
}
/*! Tore
*************************************************************************/
template
<
typename
PFP
>
void
Tore
<
PFP
>::
tore
(
unsigned
int
n
,
unsigned
int
m
)
{
//this->cylinder(n, m);
this
->
m_nx
=
n
;
this
->
m_ny
=
m
;
this
->
m_nz
=
-
1
;
// just finish to sew
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
Dart
d
=
this
->
m_tableVertDarts
[
i
];
Dart
e
=
this
->
m_tableVertDarts
[(
m
-
1
)
*
n
+
i
];
e
=
this
->
m_map
.
phi_1
(
this
->
m_map
.
phi2
(
this
->
m_map
.
phi1
(
e
)));
this
->
m_map
.
sewFaces
(
d
,
e
);
}
// remove the last n vertex darts that are no more necessary (sewed with n first)
// memory not freed (but will be when destroy the Polyhedron), not important ??
this
->
m_tableVertDarts
.
resize
(
m
*
n
);
}
template
<
typename
PFP
>
void
Tore
<
PFP
>::
embedIntoTore
(
VertexAttribute
<
VEC3
>&
position
,
float
big_radius
,
float
small_radius
)
{
float
alpha
=
float
(
2.0
*
M_PI
/
this
->
m_nx
);
float
beta
=
float
(
2.0
*
M_PI
/
this
->
m_ny
);
for
(
unsigned
int
i
=
0
;
i
<
this
->
m_nx
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
this
->
m_ny
;
++
j
)
{
float
z
=
small_radius
*
sin
(
beta
*
float
(
j
));
float
r
=
big_radius
+
small_radius
*
cos
(
beta
*
float
(
j
));
float
x
=
r
*
cos
(
alpha
*
float
(
i
));
float
y
=
r
*
sin
(
alpha
*
float
(
i
));
position
[
this
->
m_tableVertDarts
[
j
*
(
this
->
m_nx
)
+
i
]
]
=
VEC3
(
x
,
y
,
z
);
}
}
}
}
// namespace Triangular
}
// namespace Tilings
...
...
include/Geometry/plane_3d.h
View file @
ca1c0aac
...
...
@@ -109,7 +109,7 @@ class Plane3D
private:
Vector
<
3
,
T
>
m_normal
;
T
m_d
;
T
m_d
;
}
;
}
// namespace Geom
...
...
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