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
KennethVanhoey
CGoGN
Commits
a52d10da
Commit
a52d10da
authored
Feb 20, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
missing file
parent
b1e0f7cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
156 additions
and
0 deletions
+156
-0
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
+156
-0
No files found.
src/Topology/map/map2MR/map2MR_PrimalRegular.cpp
0 → 100644
View file @
a52d10da
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#include "Topology/map/map2MR/map2MR_PrimalRegular.h"
namespace
CGoGN
{
Map2MR_PrimalRegular
::
Map2MR_PrimalRegular
()
:
shareVertexEmbeddings
(
true
)
{
initMR
()
;
}
bool
Map2MR_PrimalRegular
::
isOddVertex
(
Dart
d
)
{
assert
(
getDartLevel
(
d
)
<=
getCurrentLevel
()
||
!
"isOddVertex : called with a dart inserted after current level"
)
;
return
getDartLevel
(
d
)
==
getCurrentLevel
()
;
}
void
Map2MR_PrimalRegular
::
addNewLevel
(
bool
embedNewVertices
)
{
pushLevel
()
;
addLevel
()
;
setCurrentLevel
(
getMaxLevel
())
;
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
unsigned
int
newindex
=
copyDartLine
((
*
m_mrDarts
[
m_mrCurrentLevel
])[
i
])
;
// duplicate all darts
(
*
m_mrDarts
[
m_mrCurrentLevel
])[
i
]
=
newindex
;
// on the new max level
if
(
!
shareVertexEmbeddings
)
(
*
m_embeddings
[
VERTEX
])[
newindex
]
=
EMBNULL
;
// set vertex embedding to EMBNULL if no sharing
}
// cut edges
TraversorE
<
Map2MR_PrimalRegular
>
travE
(
*
this
)
;
for
(
Dart
d
=
travE
.
begin
();
d
!=
travE
.
end
();
d
=
travE
.
next
())
{
if
(
!
shareVertexEmbeddings
)
{
if
(
getEmbedding
(
VERTEX
,
d
)
==
EMBNULL
)
embedNewCell
(
VERTEX
,
d
)
;
if
(
getEmbedding
(
VERTEX
,
phi1
(
d
))
==
EMBNULL
)
embedNewCell
(
VERTEX
,
d
)
;
}
cutEdge
(
d
)
;
travE
.
mark
(
d
)
;
travE
.
mark
(
phi1
(
d
))
;
if
(
embedNewVertices
)
embedNewCell
(
VERTEX
,
phi1
(
d
))
;
}
// split faces
TraversorF
<
Map2MR_PrimalRegular
>
travF
(
*
this
)
;
for
(
Dart
d
=
travF
.
begin
();
d
!=
travF
.
end
();
d
=
travF
.
next
())
{
Dart
old
=
d
;
if
(
getDartLevel
(
old
)
==
getMaxLevel
())
old
=
phi1
(
old
)
;
decCurrentLevel
()
;
unsigned
int
degree
=
faceDegree
(
old
)
;
incCurrentLevel
()
;
if
(
degree
==
3
)
// if subdividing a triangle
{
Dart
dd
=
phi1
(
old
)
;
Dart
e
=
phi1
(
phi1
(
dd
))
;
splitFace
(
dd
,
e
)
;
travF
.
mark
(
dd
)
;
dd
=
e
;
e
=
phi1
(
phi1
(
dd
))
;
splitFace
(
dd
,
e
)
;
travF
.
mark
(
dd
)
;
dd
=
e
;
e
=
phi1
(
phi1
(
dd
))
;
splitFace
(
dd
,
e
)
;
travF
.
mark
(
dd
)
;
travF
.
mark
(
e
)
;
}
else
// if subdividing a polygonal face
{
Dart
dd
=
phi1
(
old
)
;
Dart
next
=
phi1
(
phi1
(
dd
))
;
splitFace
(
dd
,
next
)
;
// insert a first edge
Dart
ne
=
alpha1
(
dd
)
;
cutEdge
(
ne
)
;
// cut the new edge to insert the central vertex
travF
.
mark
(
dd
)
;
if
(
embedNewVertices
)
embedNewCell
(
VERTEX
,
phi1
(
ne
))
;
dd
=
phi1
(
phi1
(
next
))
;
while
(
dd
!=
ne
)
// turn around the face and insert new edges
{
// linked to the central vertex
Dart
tmp
=
phi1
(
ne
)
;
splitFace
(
tmp
,
dd
)
;
travF
.
mark
(
tmp
)
;
dd
=
phi1
(
phi1
(
dd
))
;
}
travF
.
mark
(
ne
)
;
}
}
popLevel
()
;
}
void
Map2MR_PrimalRegular
::
analysis
()
{
assert
(
getCurrentLevel
()
>
0
||
!
"analysis : called on level 0"
)
;
decCurrentLevel
()
;
for
(
unsigned
int
i
=
0
;
i
<
analysisFilters
.
size
();
++
i
)
(
*
analysisFilters
[
i
])()
;
}
void
Map2MR_PrimalRegular
::
synthesis
()
{
assert
(
getCurrentLevel
()
<
getMaxLevel
()
||
!
"synthesis : called on max level"
)
;
for
(
unsigned
int
i
=
0
;
i
<
synthesisFilters
.
size
();
++
i
)
(
*
synthesisFilters
[
i
])()
;
incCurrentLevel
()
;
}
}
// namespace CGoGN
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