Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hurstel
CGoGN
Commits
ed04faec
Commit
ed04faec
authored
Feb 10, 2012
by
untereiner
Browse files
Correction TraversorCell (manque 1 parametre)
parent
6a50a13f
Changes
11
Hide whitespace changes
Inline
Side-by-side
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
ed04faec
...
...
@@ -137,6 +137,12 @@ public:
*/
void
constructSplittingPath
(
Dart
d
,
std
::
vector
<
Dart
>&
v
,
DartMarker
&
m
);
//!
/*!
*
*/
void
swapEdges
(
Dart
d
,
Dart
e
);
// //!
// /*!
// *
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
ed04faec
...
...
@@ -639,7 +639,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
{
//volCenter += position[d];
//++degree;
Dart
f1
=
map
.
phi1
(
dit
);
Dart
e
=
dit
;
std
::
vector
<
Dart
>
v
;
...
...
@@ -684,17 +684,17 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
}
while
(
dd
!=
stop
);
}
//
else
//
{
//
unsigned int idface = map.getNewFaceId();
//
map.setFaceId(map.phi2(
f1
),idface, FACE);
//
}
else
{
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
map
.
phi2
(
v
.
front
()
),
idface
,
FACE
);
}
}
//switch inner faces
if
(
isNotTet
)
{
unsigned
int
i
=
0
;
DartMarker
me
(
map
)
;
for
(
Dart
dit
=
traV
.
begin
();
dit
!=
traV
.
end
();
dit
=
traV
.
next
())
{
...
...
@@ -704,58 +704,56 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
do
{
Dart
f3
=
map
.
phi3
(
f
);
Dart
tmp
=
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
f3
)))));
//future voisin par phi2
map
.
unsewFaces
(
f3
)
;
map
.
unsewFaces
(
tmp
);
map
.
sewFaces
(
f3
,
tmp
,
false
);
if
(
!
me
.
isMarked
(
f3
)
)
{
Dart
tmp
=
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
map
.
phi2
(
map
.
phi_1
(
f3
)))));
//future voisin par phi2
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
f3
)
,
tmp
)
;
map
.
copyDartEmbedding
(
VERTEX
,
map
.
phi2
(
tmp
),
f3
);
Dart
f32
=
map
.
phi2
(
f3
);
map
.
swapEdges
(
f3
,
tmp
);
// map.embedOrbit(VERTEX, f3, map.getEmbedding(VERTEX, f3)) ;
// map.embedOrbit(VERTEX, tmp, map.getEmbedding(VERTEX, tmp)) ;
unsigned
int
idface
=
map
.
getNewFaceId
();
map
.
setFaceId
(
map
.
phi2
(
f3
),
idface
,
FACE
);
me
.
markOrbit
(
EDGE
,
f3
);
me
.
markOrbit
(
EDGE
,
f32
);
}
// unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f3),idface, FACE);
f
=
map
.
phi2
(
map
.
phi_1
(
f
));
}
while
(
f
!=
x
);
}
}
position
[
centralDart
]
=
volCenter
;
//Third step : 3-sew internal faces
for
(
std
::
vector
<
std
::
pair
<
Dart
,
Dart
>
>::
iterator
it
=
subdividedfaces
.
begin
();
it
!=
subdividedfaces
.
end
();
++
it
)
{
Dart
f1
=
(
*
it
).
first
;
Dart
f2
=
(
*
it
).
second
;
//FAIS a la couture !!!!!!!
//id pour toutes les aretes exterieurs des faces quadrangulees
unsigned
int
idedge
=
map
.
getEdgeId
(
f1
);
map
.
setEdgeId
(
map
.
phi2
(
f1
),
idedge
,
DART
);
map
.
setEdgeId
(
map
.
phi2
(
f2
),
idedge
,
DART
);
// //Third step : 3-sew internal faces
// for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
// {
// Dart f1 = (*it).first;
// Dart f2 = (*it).second;
//
// //FAIS a la couture !!!!!!!
// //id pour toutes les aretes exterieurs des faces quadrangulees
// unsigned int idedge = map.getEdgeId(f1);
// map.setEdgeId(map.phi2(f1), idedge, DART);
// map.setEdgeId( map.phi2(f2), idedge, DART);
//
// }
//
// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
// //id pour les aretes interieurs : (i.e. 16 pour un octa)
// DartMarker mne(map);
// for(std::vector<Dart>::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it)
// {
// if(!mne.isMarked(*it))
// {
// unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId(*it, idedge, EDGE);
// mne.markOrbit(EDGE,*it);
// }
// }
//
//
// map.setCurrentLevel(cur) ;
}
//LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
//id pour les aretes interieurs : (i.e. 16 pour un octa)
DartMarker
mne
(
map
);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
newEdges
.
begin
()
;
it
!=
newEdges
.
end
()
;
++
it
)
{
if
(
!
mne
.
isMarked
(
*
it
))
{
unsigned
int
idedge
=
map
.
getNewEdgeId
();
map
.
setEdgeId
(
*
it
,
idedge
,
EDGE
);
mne
.
markOrbit
(
EDGE
,
*
it
);
}
}
map
.
setCurrentLevel
(
cur
)
;
}
...
...
include/Algo/Modelisation/polyhedron.hpp
View file @
ed04faec
...
...
@@ -139,7 +139,7 @@ Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides)
res
=
map
.
phi2
(
firstP
);
map
.
sewVolumes
(
firstP
,
secondP
);
map
.
mergeVolumes
(
firstP
);
//
map.mergeVolumes(firstP);
return
res
;
}
...
...
include/Algo/Render/GL2/explodeVolumeRender.h
View file @
ed04faec
...
...
@@ -108,8 +108,8 @@ public:
* @param positions attribute of position vertices
* @param good selector
*/
//
template<typename PFP>
//
void updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good = allDarts) ;
template
<
typename
PFP
>
void
updateData
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* update all drawing buffers
...
...
include/Algo/Render/GL2/explodeVolumeRender.hpp
View file @
ed04faec
...
...
@@ -75,103 +75,103 @@ inline ExplodeVolumeRender::~ExplodeVolumeRender()
delete
m_shaderL
;
}
//
template<typename PFP>
//
void ExplodeVolumeRender::updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good)
//
{
//
if (m_cpf)
//
{
//
CGoGNerr<< "ExplodeVolumeRender: problem wrong update fonction use the other" << CGoGNendl;
//
return;
//
}
//
//
typedef typename PFP::VEC3 VEC3;
//
typedef typename PFP::REAL REAL;
//
//
CellMarker cmv(map,VOLUME);
//
AutoAttributeHandler<VEC3> centerVolumes(map,VOLUME,"centerVolumes");
//
TraversorW<typename PFP::MAP> traVol(map,good);
//
for (Dart d=traVol.begin(); d!=traVol.end(); d=traVol.next())
//
{
//
centerVolumes[d] = Algo::Geometry::volumeCentroid<PFP>(map, d, positions);
//
}
//
//
std::vector<VEC3> buffer;
//
buffer.reserve(16384);
//
//
//
TraversorCell<typename PFP::MAP> traFace(map, PFP::MAP::ORBIT_IN_PARENT(FACE),good);
//
//
for (Dart d=traFace.begin(); d!=traFace.end(); d=traFace.next())
//
{
//
if (m_ef)
//
{
//
VEC3 centerFace = Algo::Geometry::faceCentroid<PFP>(map,d,positions);
//
Dart a = d;
//
Dart b = map.phi1(a);
//
Dart c = map.phi1(b);
//
//
// loop to cut a polygon in triangle on the fly (works only with convex faces)
//
do
//
{
//
buffer.push_back(centerVolumes[d]);
//
buffer.push_back(positions[d]);
//
buffer.push_back(positions[b]);
//
buffer.push_back(positions[c]);
//
buffer.push_back(centerFace); // not used
//
buffer.push_back(centerFace);
//
b = c;
//
c = map.phi1(b);
//
//
} while (c != d);
//
}
//
else
//
{
//
Dart a = d;
//
Dart b = map.phi1(a);
//
Dart c = map.phi1(b);
//
//
// loop to cut a polygon in triangle on the fly (works only with convex faces)
//
do
//
{
//
buffer.push_back(centerVolumes[d]);
//
buffer.push_back(positions[d]);
//
buffer.push_back(positions[b]);
//
buffer.push_back(positions[c]);
//
b = c;
//
c = map.phi1(b);
//
//
} while (c != d);
//
}
//
}
//
//
m_nbTris = buffer.size()/4;
//
//
m_vboPos->allocate(buffer.size());
//
VEC3* ptrPos = reinterpret_cast<VEC3*>(m_vboPos->lockPtr());
//
memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
//
m_vboPos->releasePtr();
//
m_shader->setAttributePosition(m_vboPos);
//
//
buffer.clear();
//
//
TraversorCell<typename PFP::MAP> traEdge(map, PFP::MAP::ORBIT_IN_PARENT(EDGE),good);
//
for (Dart d=traEdge.begin(); d!=traEdge.end(); d=traEdge.next())
//
{
//
buffer.push_back(centerVolumes[d]);
//
buffer.push_back(positions[d]);
//
buffer.push_back(positions[ map.phi1(d)]);
//
}
//
//
m_nbLines = buffer.size()/3;
//
//
m_vboPosLine->allocate(buffer.size());
//
//
ptrPos = reinterpret_cast<VEC3*>(m_vboPosLine->lockPtr());
//
memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
//
//
m_vboPosLine->releasePtr();
//
m_shaderL->setAttributePosition(m_vboPosLine);
//
}
template
<
typename
PFP
>
void
ExplodeVolumeRender
::
updateData
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
const
FunctorSelect
&
good
)
{
if
(
m_cpf
)
{
CGoGNerr
<<
"ExplodeVolumeRender: problem wrong update fonction use the other"
<<
CGoGNendl
;
return
;
}
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
CellMarker
cmv
(
map
,
VOLUME
);
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
map
,
VOLUME
,
"centerVolumes"
);
TraversorW
<
typename
PFP
::
MAP
>
traVol
(
map
,
good
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
centerVolumes
[
d
]
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
map
,
d
,
positions
);
}
std
::
vector
<
VEC3
>
buffer
;
buffer
.
reserve
(
16384
);
TraversorCell
<
typename
PFP
::
MAP
>
traFace
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
FACE
),
good
);
for
(
Dart
d
=
traFace
.
begin
();
d
!=
traFace
.
end
();
d
=
traFace
.
next
())
{
if
(
m_ef
)
{
VEC3
centerFace
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
d
,
positions
);
Dart
a
=
d
;
Dart
b
=
map
.
phi1
(
a
);
Dart
c
=
map
.
phi1
(
b
);
// loop to cut a polygon in triangle on the fly (works only with convex faces)
do
{
buffer
.
push_back
(
centerVolumes
[
d
]);
buffer
.
push_back
(
positions
[
d
]);
buffer
.
push_back
(
positions
[
b
]);
buffer
.
push_back
(
positions
[
c
]);
buffer
.
push_back
(
centerFace
);
// not used
buffer
.
push_back
(
centerFace
);
b
=
c
;
c
=
map
.
phi1
(
b
);
}
while
(
c
!=
d
);
}
else
{
Dart
a
=
d
;
Dart
b
=
map
.
phi1
(
a
);
Dart
c
=
map
.
phi1
(
b
);
// loop to cut a polygon in triangle on the fly (works only with convex faces)
do
{
buffer
.
push_back
(
centerVolumes
[
d
]);
buffer
.
push_back
(
positions
[
d
]);
buffer
.
push_back
(
positions
[
b
]);
buffer
.
push_back
(
positions
[
c
]);
b
=
c
;
c
=
map
.
phi1
(
b
);
}
while
(
c
!=
d
);
}
}
m_nbTris
=
buffer
.
size
()
/
4
;
m_vboPos
->
allocate
(
buffer
.
size
());
VEC3
*
ptrPos
=
reinterpret_cast
<
VEC3
*>
(
m_vboPos
->
lockPtr
());
memcpy
(
ptrPos
,
&
buffer
[
0
],
buffer
.
size
()
*
sizeof
(
VEC3
));
m_vboPos
->
releasePtr
();
m_shader
->
setAttributePosition
(
m_vboPos
);
buffer
.
clear
();
TraversorCell
<
typename
PFP
::
MAP
>
traEdge
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
EDGE
),
good
);
for
(
Dart
d
=
traEdge
.
begin
();
d
!=
traEdge
.
end
();
d
=
traEdge
.
next
())
{
buffer
.
push_back
(
centerVolumes
[
d
]);
buffer
.
push_back
(
positions
[
d
]);
buffer
.
push_back
(
positions
[
map
.
phi1
(
d
)]);
}
m_nbLines
=
buffer
.
size
()
/
3
;
m_vboPosLine
->
allocate
(
buffer
.
size
());
ptrPos
=
reinterpret_cast
<
VEC3
*>
(
m_vboPosLine
->
lockPtr
());
memcpy
(
ptrPos
,
&
buffer
[
0
],
buffer
.
size
()
*
sizeof
(
VEC3
));
m_vboPosLine
->
releasePtr
();
m_shaderL
->
setAttributePosition
(
m_vboPosLine
);
}
template
<
typename
PFP
>
...
...
include/Topology/generic/traversorCell.h
View file @
ed04faec
...
...
@@ -62,7 +62,7 @@ template <typename MAP>
class
TraversorV
:
public
TraversorCell
<
MAP
>
{
public:
TraversorV
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
VERTEX
,
good
,
thread
)
TraversorV
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
VERTEX
,
good
,
forceDartMarker
,
thread
)
{}
};
...
...
@@ -70,7 +70,7 @@ template <typename MAP>
class
TraversorE
:
public
TraversorCell
<
MAP
>
{
public:
TraversorE
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
EDGE
,
good
,
thread
)
TraversorE
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
EDGE
,
good
,
forceDartMarker
,
thread
)
{}
};
...
...
@@ -79,7 +79,7 @@ template <typename MAP>
class
TraversorF
:
public
TraversorCell
<
MAP
>
{
public:
TraversorF
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
FACE
,
good
,
thread
)
TraversorF
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
FACE
,
good
,
forceDartMarker
,
thread
)
{}
};
...
...
@@ -87,7 +87,7 @@ template <typename MAP>
class
TraversorW
:
public
TraversorCell
<
MAP
>
{
public:
TraversorW
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
VOLUME
,
good
,
thread
)
TraversorW
(
MAP
&
m
,
const
FunctorSelect
&
good
=
allDarts
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
>
(
m
,
VOLUME
,
good
,
forceDartMarker
,
thread
)
{}
};
...
...
include/Topology/map/embeddedMap3.h
View file @
ed04faec
...
...
@@ -68,6 +68,11 @@ public:
*/
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateVolumes
=
true
);
//!
/*!
*/
virtual
bool
collapseDegeneratedFace
(
Dart
d
);
//!
/*!
*/
...
...
include/Topology/map/map3.h
View file @
ed04faec
...
...
@@ -170,6 +170,14 @@ public:
*/
virtual
Dart
collapseEdge
(
Dart
d
,
bool
delDegenerateVolumes
=
true
);
//! Delete a face if and only if it has one or two edges
/*! If the face is sewed to two distinct adjacent faces,
* then those two faces are sewed
* @param d a dart of the face
* @return true if the collapse has been executed, false otherwise
*/
virtual
bool
collapseDegeneratedFace
(
Dart
d
);
//! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct
* @param d dart of first vertex
...
...
src/Algo/ImplicitHierarchicalMesh/ihm3.cpp
View file @
ed04faec
...
...
@@ -155,6 +155,36 @@ void ImplicitHierarchicalMap3::constructSplittingPath(Dart d, std::vector<Dart>&
}
void
ImplicitHierarchicalMap3
::
swapEdges
(
Dart
d
,
Dart
e
)
{
Dart
d2
=
phi2
(
d
);
Dart
e2
=
phi2
(
e
);
Map2
::
unsewFaces
(
d
);
Map2
::
unsewFaces
(
e
);
Map2
::
sewFaces
(
d
,
e
);
Map2
::
sewFaces
(
d2
,
e2
);
if
(
isOrbitEmbedded
(
VERTEX
))
{
copyDartEmbedding
(
VERTEX
,
d
,
phi2
(
phi_1
(
d
)));
copyDartEmbedding
(
VERTEX
,
e
,
phi2
(
phi_1
(
e
)));
copyDartEmbedding
(
VERTEX
,
d2
,
phi2
(
phi_1
(
d2
)));
copyDartEmbedding
(
VERTEX
,
e2
,
phi2
(
phi_1
(
d2
)));
}
if
(
isOrbitEmbedded
(
EDGE
))
{
}
if
(
isOrbitEmbedded
(
VOLUME
))
embedNewCell
(
VOLUME
,
d
);
}
//Dart ImplicitHierarchicalMap3::cutEdge(Dart d)
//{
// Dart resV = EmbeddedMap3::cutEdge(d);
...
...
src/Topology/map/embeddedMap3.cpp
View file @
ed04faec
...
...
@@ -154,6 +154,11 @@ Dart EmbeddedMap3::collapseEdge(Dart d, bool delDegenerateVolumes)
return
resV
;
}
bool
EmbeddedMap3
::
collapseDegeneratedFace
(
Dart
d
)
{
return
Map3
::
collapseDegeneratedFace
(
d
);
}
void
EmbeddedMap3
::
splitFace
(
Dart
d
,
Dart
e
)
{
Dart
dd
=
phi1
(
phi3
(
d
));
...
...
src/Topology/map/map3.cpp
View file @
ed04faec
...
...
@@ -355,7 +355,18 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes)
// }
// }
bool
Map3
::
collapseDegeneratedFace
(
Dart
d
)
{
Dart
d3
=
phi3
(
d
);
Map3
::
unsewVolumes
(
d
);
std
::
cout
<<
Map2
::
collapseDegeneratedFace
(
d
)
<<
std
::
endl
;
std
::
cout
<<
Map2
::
collapseDegeneratedFace
(
d3
)
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
return
true
;
}
void
Map3
::
splitFace
(
Dart
d
,
Dart
e
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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