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
824c4141
Commit
824c4141
authored
Jul 01, 2011
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ptit commit
parent
ed431beb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
138 deletions
+161
-138
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
+19
-16
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
+75
-39
include/Algo/Import/importSvg.hpp
include/Algo/Import/importSvg.hpp
+2
-1
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+3
-14
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+53
-63
include/Topology/generic/embeddedMap3.hpp
include/Topology/generic/embeddedMap3.hpp
+6
-3
include/Topology/map/map3.h
include/Topology/map/map3.h
+2
-2
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+1
-0
No files found.
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
824c4141
...
...
@@ -240,34 +240,37 @@ inline void ImplicitHierarchicalMap3::next(Dart& d)
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
{
DartMarkerStore mv(*this); // Lock a marker
DartMarkerStore mv(*this
,thread
); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> darts_list; //Darts that are traversed
darts_list.push_back(d); //Start with the dart d
std::list<Dart>::iterator darts;
std::vector<Dart> darts_list; //Darts that are traversed
darts_list.reserve(50);
darts_list.push_back(d); //Start with the dart d
mv.mark(d);
for(darts = darts_list.begin(); !found && darts != darts_list.end() ; ++darts)
for(
std::vector<Dart>::iterator
darts = darts_list.begin(); !found && darts != darts_list.end() ; ++darts)
{
Dart dc = *darts;
//add phi21 and phi23 successor if they are not marked yet
Dart d2 = phi2(dc);
Dart d21 = phi1(d2); // turn in volume
Dart d23 = phi3(d2); // change volume
if(!mv.isMarked(d21))
if(d2 != dc)
{
darts_list.push_back(d21);
mv.mark(d21);
}
Dart d21 = phi1(d2); // turn in volume
Dart d23 = phi3(d2); // change volume
if((d23!=d2) && !mv.isMarked(d23))
{
darts_list.push_back(d23);
mv.mark(d23);
if(!mv.isMarked(d21))
{
darts_list.push_back(d21);
mv.mark(d21);
}
if((d23!=d2) && !mv.isMarked(d23))
{
darts_list.push_back(d23);
mv.mark(d23);
}
}
found = f(dc);
...
...
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
View file @
824c4141
...
...
@@ -85,7 +85,9 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
++degree;
p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
{
Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
}
it = map.phi1(it) ;
} while(it != old) ;
p /= typename PFP::REAL(degree) ;
...
...
@@ -94,38 +96,38 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
Dart res;
if(degree == 3 && sType == S_TRI) //subdiviser une face triangulaire
{
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; // insert a new edge
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
unsigned int idface = map.getFaceId(old);
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
}
else
{
//
if(degree == 3 && sType == S_TRI) //subdiviser une face triangulaire
//
{
//
Dart dd = map.phi1(old) ;
//
Dart e = map.phi1(map.phi1(dd)) ;
//
map.splitFace(dd, e) ; // insert a new edge
//
unsigned int id = map.getNewEdgeId() ;
//
map.setEdgeId(map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
//
//
unsigned int idface = map.getFaceId(old);
//
map.setFaceId(dd, idface, FACE) ;
//
map.setFaceId(e, idface, FACE) ;
//
//
dd = e ;
//
e = map.phi1(map.phi1(dd)) ;
//
map.splitFace(dd, e) ;
//
id = map.getNewEdgeId() ;
//
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//
//
map.setFaceId(dd, idface, FACE) ;
//
map.setFaceId(e, idface, FACE) ;
//
//
dd = e ;
//
e = map.phi1(map.phi1(dd)) ;
//
map.splitFace(dd, e) ;
//
id = map.getNewEdgeId() ;
//
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//
//
map.setFaceId(dd, idface, FACE) ;
//
map.setFaceId(e, idface, FACE) ;
//
}
//
else
//
{
Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ;
...
...
@@ -162,7 +164,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
dd = map.phi2(map.phi1(dd));
}
while(dd != ne);
}
//
}
map.setCurrentLevel(cur) ;
}
...
...
@@ -179,6 +181,9 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
unsigned int cur = map.getCurrentLevel();
map.setCurrentLevel(vLevel);
std::cout << "vLevel = " << vLevel << std::endl;
/*
* au niveau du volume courant i
* stockage d'un brin de chaque face de celui-ci
...
...
@@ -186,7 +191,8 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
*/
DartMarkerStore mf(map); // Lock a face marker to save one dart per face
DartMarkerStore mv(map); // Lock a vertex marker to compute volume center
//DartMarkerStore mv(map); // Lock a vertex marker to compute volume center
CellMarker mv(map, VERTEX);
typename PFP::VEC3 volCenter;
unsigned count = 0 ;
...
...
@@ -211,9 +217,10 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
//compute volume centroid
if(!mv.isMarked(e))
{
//mv.markOrbit(VERTEX, e);
mv.mark(e);
volCenter += position[e];
++count;
mv.markOrbit(VERTEX, e);
oldEdges.push_back(e);
}
...
...
@@ -239,6 +246,7 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
std::vector<std::pair<Dart,Dart> > subdividedfaces;
subdividedfaces.reserve(25);
int i = 0;
//First step : subdivide edges and faces
//creates a i+1 edge level and i+1 face level
for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
...
...
@@ -247,12 +255,24 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
//if needed subdivide face
if(!map.faceIsSubdivided(d))
{
++i;
Algo::IHM::subdivideFace<PFP>(map, d, position);
}
std::cout << "CHECK FACES " << std::endl;
map.check();
//save a dart from the subdivided face
unsigned int cur = map.getCurrentLevel() ;
unsigned int fLevel = map.faceLevel(d) + 1; //puisque dans tous les cas, la face est subdivisee
map.setCurrentLevel(map.getMaxLevel());
Dart old = map.faceOldestDart(d);
std::cout << " Oldest dart Face = " << old << std::endl;
unsigned int fLevel = map.faceLevel(old); //puisque dans tous les cas, la face est subdivisee
std::cout << "FACE LEVEL = " << fLevel << std::endl;
map.setCurrentLevel(fLevel) ;
...
...
@@ -268,6 +288,8 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
map.setCurrentLevel(cur);
}
map.setCurrentLevel(vLevel + 1) ; // go to the next level to perform volume subdivision
std::vector<Dart> newEdges; //save darts from inner edges
...
...
@@ -279,21 +301,33 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
Dart e = *edge;
Dart f1 = map.phi1(*edge);
int i = 0;
do
{
map.unsewFaces(map.phi1(map.phi1(e)));
std::cout << "corner #" << i << " degree = " << map.faceDegree(e) << std::endl;
if(map.phi2(map.phi1(map.phi1(e))) != map.phi1(map.phi1(e)))
map.unsewFaces(map.phi1(map.phi1(e)));
//TODO utile ?
//
if(map.phi2(map.phi1(e)) != map.phi1(e))
if(map.phi2(map.phi1(e)) != map.phi1(e))
map.unsewFaces(map.phi1(e));
++i;
e = map.phi2(map.phi_1(e));
}
while(e != *edge);
map.closeHole(f1);
std::cout << "CHECK CLOSE HOLE " << std::endl;
map.check();
std::cout << "corner degree = " << i << std::endl;
std::cout << "face degree = " << map.faceDegree(map.phi2(f1)) << std::endl;
// if(map.faceDegree(map.phi2(f1)) > 6)
// return Dart::nil();
Dart old = map.phi2(map.phi1(e));
Dart dd = map.phi1(map.phi1(old)) ;
map.splitFace(old,dd) ;
...
...
@@ -361,6 +395,8 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
map.setCurrentLevel(cur) ;
std::cout << std::endl;
return subdividedfaces.begin()->first;
}
...
...
include/Algo/Import/importSvg.hpp
View file @
824c4141
...
...
@@ -2,6 +2,7 @@
#include "Geometry/bounding_box.h"
#include "Geometry/plane_3d.h"
#include "Algo/BooleanOperator/mergeVertices.h"
#include "Container/fakeAttribute.h"
#include <limits>
namespace CGoGN
...
...
@@ -124,7 +125,7 @@ void getPolygonFromSVG(std::string allcoords, std::vector<VEC3>& curPoly, bool&
valueOf(yS,y);
typename
PFP
::
VEC3
previous
=
(
curPoly
)[(
curPoly
).
size
()
-
1
];
VEC3 previous = (curPoly)[(curPoly).size()-1];
x = previous[0];
push_point=true;
...
...
include/Algo/Modelisation/subdivision.h
View file @
824c4141
...
...
@@ -122,26 +122,15 @@ void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, con
/*
*
TODO quadrangule volu
me
*
volume subdivision sche
me
*/
/**
* Quadrangule all the faces of the mesh
*/
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
quadranguleFacesVolume
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
,
const
FunctorSelect
&
selected
=
SelectorTrue
())
;
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
hexaCutVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
EMBV
&
attributs
);
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
dooSabinVolume
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
EMBV
&
attributs
);
/*
* Quadrangule a Volume
*/
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
quadranguleVolumes
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
,
const
FunctorSelect
&
selected
=
SelectorTrue
());
template
<
typename
PFP
>
void
splitVolumes
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
typename
PFP
::
TVEC3
&
position
);
// TODO a mettre ailleurs ?
...
...
include/Algo/Modelisation/subdivision.hpp
View file @
824c4141
...
...
@@ -642,11 +642,6 @@ void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, con
}
}
template <typename PFP, typename EMBV, typename EMB>
void quadranguleFacesVolume(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
{
}
template <typename PFP, typename EMBV, typename EMB>
void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
...
...
@@ -826,83 +821,78 @@ void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
// }
}
template <typename PFP, typename EMBV, typename EMB>
void dooSabinVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
{
DartMarker mf(map) ; //mark face
DartMarker me(map) ; //mark edge
DartMarkerStore mark(map); // Lock a marker
//Store faces that are traversed and start with the face of d
std::vector<Dart> visitedFaces;
visitedFaces.reserve(100);
visitedFaces.push_back(d);
std::vector<Dart>::iterator face;
//Store a dart from a each face
std::vector<Dart> faces;
faces.reserve(100);
// First pass : for every face added to the list save a dart
for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
template <typename PFP>
void splitVolumes(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
{
//Cut the edges
DartMarker me(map, EDGE);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if
(!mark.isMarked(*face)) // Face has not been visited yet
if
(!me.isMarked(d))
{
// Cut the edge
Dart dd = map.phi2(d) ;
typename PFP::VEC3 p1 = position[d] ;
typename PFP::VEC3 p2 = position[map.phi1(d)] ;
map.cutEdge(d) ;
faces.push_back(*face)
;
position[map.phi1(d)] = (p1 + p2) * typename PFP::REAL(0.5)
;
Dart dNext = *face ;
do
{
mark.mark(dNext); // Mark
Dart adj = map.phi2(dNext); // Get adjacent face
if (adj != dNext && !mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
dNext = map.phi1(dNext);
} while(dNext != *face);
me.markOrbit(EDGE, d);
me.markOrbit(EDGE, map.phi1(d));
}
}
// Second pass : for every edges insert a face
for(
face = faces.begin() ; face != faces.end() ; ++face
)
DartMarker mf(map, FACE);
for(
Dart d = map.begin(); d != map.end(); map.next(d)
)
{
Dart e = *face;
do
if(!mf.isMarked(d))
{
if(!me.isMarked(e))
{
//insertion d'une face dans l'arete
Dart e2 = map.phi2(e);
map.unsewFaces(e);
Dart ne = map.newOrientedFace(4);
map.sewFaces(e,ne);
map.sewFaces(e2, map.phi1(map.phi1(ne)));
//marquage de l'orbite arete
me.markOrbit(EDGE,e);
}
e = map.phi1(e
);
}
while (e != *face);
mf.markOrbit(FACE, d
);
}
}
// Dart f = map.phi1(d);
// map.cutEdge(d);
// Dart e = map.phi1(d);
// attributs[e] = attributs[d];
// attributs[e] += attributs[f];
// attributs[e] *= 0.5;
// //and split the faces
//
// Dart dPrev = d;
// Dart ePrev = map.phi2(d);
// map.splitFace(dPrev,ePrev);
// //Insert the middleFaces
//
// attributs[map.phi_1(d)] = attributs[map.phi1(ePrev)];
// // first cut the edges (if they are not already)
// Dart t = d;
// do
// {
// if(!map.edgeIsSubdivided(map.phi1(map.phi2(t))))
// Algo::IHM::subdivideEdge<PFP>(map, map.phi1(map.phi2(t)), position) ;
// t = map.phi1(t);
// }
// while(t != d);
//
// Dart neighboordVolume = map.phi1(map.phi1(map.phi2(d)));
//
// //Split the faces and open the midlle
// do
// {
// Dart t2 = map.phi2(t);
//
// Dart face2 = map.phi1(map.phi1(t2));
// map.splitFace(map.phi_1(t2), face2);
// map.unsewFaces(map.phi1(map.phi1(t2)));
//
// t = map.phi1(t);
// }
// while(t != d);
//
//
// map.closeHole(map.phi1(map.phi1(map.phi2(d))));
// map.closeHole(map.phi_1(neighboordVolume));
// map.sewVolumes(map.phi2(map.phi1(map.phi1(map.phi2(d)))), map.phi2(map.phi_1(neighboordVolume)));
}
} // namespace Modelisation
} // namespace Algo
...
...
include/Topology/generic/embeddedMap3.hpp
View file @
824c4141
...
...
@@ -41,8 +41,8 @@ void EmbeddedMap3<MAP3>::sewVolumes(Dart d, Dart e)
unsigned
int
vEmb1
=
EMBNULL
;
Dart
dd
=
d
;
do
{
vEmb1
=
MAP3
::
getEmbedding
(
VERTEX
,
d
);
MAP3
::
embedOrbit
(
VERTEX
,
d
,
vEmb1
)
;
vEmb1
=
MAP3
::
getEmbedding
(
VERTEX
,
d
d
);
MAP3
::
embedOrbit
(
VERTEX
,
d
d
,
vEmb1
)
;
dd
=
MAP3
::
phi1
(
dd
)
;
}
while
(
dd
!=
d
)
;
}
...
...
@@ -328,9 +328,12 @@ bool EmbeddedMap3<MAP3>::check()
return
false
;
}
if
(
MAP3
::
phi3
(
d
)
!=
d
&&
MAP3
::
getEmbedding
(
VERTEX
,
d
)
!=
MAP3
::
getEmbedding
(
VERTEX
,
MAP3
::
phi
3
(
MAP3
::
phi2
(
d
))))
if
(
MAP3
::
phi3
(
d
)
!=
d
&&
MAP3
::
getEmbedding
(
VERTEX
,
d
)
!=
MAP3
::
getEmbedding
(
VERTEX
,
MAP3
::
phi
1
(
MAP3
::
phi3
(
d
))))
{
CGoGNout
<<
"Check: different embeddings on vertex in the 2 oriented faces"
<<
CGoGNendl
;
std
::
cout
<<
"Dart #"
<<
d
<<
std
::
endl
;
std
::
cout
<<
"Emb(d) = "
<<
MAP3
::
getEmbedding
(
VERTEX
,
d
)
<<
std
::
endl
;
std
::
cout
<<
"Emb(phi32(d)) = "
<<
MAP3
::
getEmbedding
(
VERTEX
,
MAP3
::
phi3
(
MAP3
::
phi2
(
d
)))
<<
std
::
endl
;
return
false
;
}
...
...
include/Topology/map/map3.h
View file @
824c4141
...
...
@@ -308,7 +308,7 @@ public:
* @param f the functor
* @param s the selector
*/
bool
foreach_connex_volume
(
Dart
d
,
int
degree
,
FunctorType
&
f
,
FunctorSelect
&
s
,
unsigned
int
thread
=
0
);
bool
foreach_connex_volume
(
Dart
d
,
int
degree
,
FunctorType
&
f
,
FunctorSelect
&
s
,
unsigned
int
thread
=
0
);
//@}
// template<typename TMAP>
...
...
@@ -345,7 +345,7 @@ public:
//@{
// TODO devrait disparaitre
// pour les mêmes raisons que dans map2
bool
check
();
virtual
bool
check
();
//@}
};
...
...
src/Topology/map/map3.cpp
View file @
824c4141
...
...
@@ -1148,6 +1148,7 @@ bool Map3::check()
{
CGoGNout << "Check: topology begin" << CGoGNendl;
DartMarker m(*this);
m.unmarkAll();
for(Dart d = this->begin(); d != this->end(); this->next(d))
{
Dart d3 = phi3(d);
...
...
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