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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
0f35dc93
Commit
0f35dc93
authored
Jan 14, 2013
by
Thomas Jund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding new type of particle for safe vertices tracking
parent
412ec0b9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
285 additions
and
8 deletions
+285
-8
include/Algo/Import/importSvg.hpp
include/Algo/Import/importSvg.hpp
+4
-1
include/Algo/MovingObjects/particle_cell_2D.h
include/Algo/MovingObjects/particle_cell_2D.h
+3
-3
include/Algo/MovingObjects/particle_cell_2D_memo.h
include/Algo/MovingObjects/particle_cell_2D_memo.h
+3
-3
include/Algo/MovingObjects/particle_cell_2D_secured.h
include/Algo/MovingObjects/particle_cell_2D_secured.h
+62
-0
include/Algo/MovingObjects/particle_cell_2D_secured.hpp
include/Algo/MovingObjects/particle_cell_2D_secured.hpp
+212
-0
include/Geometry/orientation.hpp
include/Geometry/orientation.hpp
+1
-1
No files found.
include/Algo/Import/importSvg.hpp
View file @
0f35dc93
...
...
@@ -273,6 +273,9 @@ void readCoordAndStyle(xmlNode* cur_path,
template
<
typename
PFP
>
bool
importSVG
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
CellMarker
<
EDGE
>&
obstacleMark
,
CellMarker
<
FACE
>&
buildingMark
)
{
//TODO : remove auto-intersecting faces
//TODO : handling polygons with holes
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
std
::
vector
<
VEC3
>
POLYGON
;
...
...
@@ -437,7 +440,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
if
(
!
buildingMark
.
isMarked
(
d
))
{
bool
canSimplify
=
true
;
while
(
canSimplify
&&
(
(
position
[
map
.
phi1
(
d
)]
-
position
[
d
]).
norm
(
)
<
edgeWidth
[
d
])
)
while
(
canSimplify
&&
(
Geometry
::
edgeLength
<
PFP
>
(
map
,
d
,
position
)
<
edgeWidth
[
d
])
)
{
if
(
map
.
vertexDegree
(
map
.
phi1
(
d
))
==
2
)
{
...
...
include/Algo/MovingObjects/particle_cell_2D.h
View file @
0f35dc93
...
...
@@ -70,14 +70,14 @@ public:
Geom
::
Orientation2D
getOrientationFace
(
VEC3
sourcePoint
,
Dart
d
)
;
void
vertexState
(
const
VEC3
&
current
)
;
v
irtual
v
oid
vertexState
(
const
VEC3
&
current
)
;
void
edgeState
(
const
VEC3
&
current
,
Geom
::
Orientation2D
sideOfEdge
=
Geom
::
ALIGNED
)
;
v
irtual
v
oid
edgeState
(
const
VEC3
&
current
,
Geom
::
Orientation2D
sideOfEdge
=
Geom
::
ALIGNED
)
;
//just an orientation test : check which dart is aimed to leave the current face to reach an other position
Dart
faceOrientationState
(
const
VEC3
&
toward
)
;
void
faceState
(
const
VEC3
&
current
)
;
v
irtual
v
oid
faceState
(
const
VEC3
&
current
)
;
void
move
(
const
VEC3
&
goal
)
{
...
...
include/Algo/MovingObjects/particle_cell_2D_memo.h
View file @
0f35dc93
...
...
@@ -42,11 +42,11 @@ public:
}
void
vertexState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
v
irtual
v
oid
vertexState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
void
edgeState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
,
Geom
::
Orientation2D
sideOfEdge
=
Geom
::
ALIGNED
)
;
v
irtual
v
oid
edgeState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
,
Geom
::
Orientation2D
sideOfEdge
=
Geom
::
ALIGNED
)
;
void
faceState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
v
irtual
v
oid
faceState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
std
::
vector
<
Dart
>
move
(
const
VEC3
&
goal
)
;
std
::
vector
<
Dart
>
move
(
const
VEC3
&
goal
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
...
...
include/Algo/MovingObjects/particle_cell_2D_secured.h
0 → 100644
View file @
0f35dc93
#ifndef PARTCELL2DMEMOSECURED_H
#define PARTCELL2DMEMOSECURED_H
//#define DEBUG
#include "particle_cell_2D_memo.h"
#include "Algo/Geometry/inclusion.h"
#include "Geometry/intersection.h"
#include "Geometry/orientation.h"
#include <iostream>
/* A particle cell secured : version of particle cell-memo where particles might go outside the navigation map
* this class should be used for debug mode only */
namespace
CGoGN
{
namespace
Algo
{
namespace
MovingObjects
{
template
<
typename
PFP
>
class
ParticleCell2DSecured
:
public
ParticleCell2DMemo
<
PFP
>
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
VertexAttribute
<
typename
PFP
::
VEC3
>
TAB_POS
;
private:
ParticleCell2DSecured
(){
std
::
cout
<<
"Particle Secured : for debugging (unoptimized)"
<<
std
::
endl
;
}
public:
ParticleCell2DSecured
(
MAP
&
map
,
Dart
belonging_cell
,
VEC3
pos
,
const
TAB_POS
&
tabPos
)
:
ParticleCell2DMemo
<
PFP
>
(
map
,
belonging_cell
,
pos
,
tabPos
)
{
std
::
cout
<<
"Particle Memo : for debugging (unoptimized)"
<<
std
::
endl
;
}
virtual
void
vertexState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
virtual
void
edgeState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
,
Geom
::
Orientation2D
sideOfEdge
=
Geom
::
ALIGNED
)
;
virtual
void
faceState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
std
::
vector
<
Dart
>
move
(
const
VEC3
&
goal
)
;
std
::
vector
<
Dart
>
move
(
const
VEC3
&
goal
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
;
}
;
#include "particle_cell_2D_secured.hpp"
}
//MovingObject
}
//Algo
}
//CGoGN
#endif
include/Algo/MovingObjects/particle_cell_2D_secured.hpp
0 → 100644
View file @
0f35dc93
template
<
typename
PFP
>
std
::
vector
<
Dart
>
ParticleCell2DSecured
<
PFP
>::
move
(
const
VEC3
&
goal
)
{
this
->
crossCell
=
NO_CROSS
;
if
(
!
Geom
::
arePointsEquals
(
goal
,
this
->
getPosition
()))
{
CellMarkerMemo
<
FACE
>
memo_cross
(
this
->
m
);
// memo_cross.mark(this->d);
switch
(
this
->
getState
())
{
case
VERTEX
:
vertexState
(
goal
,
memo_cross
)
;
break
;
case
EDGE
:
edgeState
(
goal
,
memo_cross
)
;
break
;
case
FACE
:
faceState
(
goal
,
memo_cross
)
;
break
;
}
return
memo_cross
.
get_markedCells
();
}
else
this
->
ParticleBase
<
PFP
>::
move
(
goal
)
;
std
::
vector
<
Dart
>
res
;
res
.
push_back
(
this
->
d
);
return
res
;
}
template
<
typename
PFP
>
void
ParticleCell2DSecured
<
PFP
>::
vertexState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
{
#ifdef DEBUG
CGoGNout
<<
"vertexState"
<<
this
->
d
<<
CGoGNendl
;
#endif
// std::vector<Dart> mc = memo_cross.get_markedCells();
// if(std::find(mc.begin(),mc.end(),this->d)!=mc.end())
// {
// std::cout << "Error : particle outside map (vertex) " << std::endl;
// return;
// }
// else
{
assert
(
std
::
isfinite
(
current
[
0
])
&&
std
::
isfinite
(
current
[
1
])
&&
std
::
isfinite
(
current
[
2
]))
;
this
->
crossCell
=
CROSS_OTHER
;
if
(
Algo
::
Geometry
::
isPointOnVertex
<
PFP
>
(
this
->
m
,
this
->
d
,
this
->
positionAttribut
,
current
))
{
this
->
setState
(
VERTEX
)
;
this
->
ParticleBase
<
PFP
>::
move
(
current
)
;
return
;
}
else
{
//orientation step
if
(
this
->
positionAttribut
[
this
->
d
][
0
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
0
]
&&
this
->
positionAttribut
[
this
->
d
][
1
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
1
])
this
->
d
=
this
->
m
.
phi2_1
(
this
->
d
)
;
if
(
this
->
getOrientationEdge
(
current
,
this
->
m
.
phi2_1
(
this
->
d
))
!=
Geom
::
RIGHT
)
{
Dart
dd_vert
=
this
->
d
;
do
{
this
->
d
=
this
->
m
.
phi2_1
(
this
->
d
)
;
if
(
this
->
positionAttribut
[
this
->
d
][
0
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
0
]
&&
this
->
positionAttribut
[
this
->
d
][
1
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
1
])
this
->
d
=
this
->
m
.
phi2_1
(
this
->
d
)
;
}
while
(
this
->
getOrientationEdge
(
current
,
this
->
m
.
phi2_1
(
this
->
d
))
!=
Geom
::
RIGHT
&&
dd_vert
!=
this
->
d
)
;
if
(
dd_vert
==
this
->
d
)
{
//orbit with 2 edges : point on one edge
if
(
this
->
m
.
phi2_1
(
this
->
m
.
phi2_1
(
this
->
d
))
==
this
->
d
)
{
if
(
!
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
d
,
this
->
positionAttribut
,
current
))
this
->
d
=
this
->
m
.
phi2_1
(
this
->
d
)
;
}
else
{
//checking : case with 3 orthogonal darts and point on an edge
do
{
if
(
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
d
,
this
->
positionAttribut
,
current
)
&&
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
m
.
phi2
(
this
->
d
),
this
->
positionAttribut
,
current
)
&&
this
->
getOrientationEdge
(
current
,
this
->
d
)
==
Geom
::
ALIGNED
)
{
this
->
edgeState
(
current
,
memo_cross
)
;
return
;
}
this
->
d
=
this
->
m
.
phi2_1
(
this
->
d
)
;
}
while
(
this
->
getOrientationEdge
(
current
,
this
->
m
.
phi2_1
(
this
->
d
))
!=
Geom
::
RIGHT
&&
dd_vert
!=
this
->
d
)
;
this
->
ParticleBase
<
PFP
>::
move
(
current
)
;
this
->
setState
(
VERTEX
)
;
return
;
}
}
}
else
{
Dart
dd_vert
=
this
->
m
.
phi2_1
(
this
->
d
)
;
while
(
this
->
getOrientationEdge
(
current
,
this
->
d
)
==
Geom
::
RIGHT
&&
dd_vert
!=
this
->
d
)
{
this
->
d
=
this
->
m
.
phi12
(
this
->
d
)
;
if
(
this
->
positionAttribut
[
this
->
d
][
0
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
0
]
&&
this
->
positionAttribut
[
this
->
d
][
1
]
==
this
->
positionAttribut
[
this
->
m
.
phi1
(
this
->
d
)][
1
])
this
->
d
=
this
->
m
.
phi12
(
this
->
d
)
;
}
}
//displacement step
if
(
this
->
getOrientationEdge
(
current
,
this
->
d
)
==
Geom
::
ALIGNED
&&
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
d
,
this
->
positionAttribut
,
current
))
edgeState
(
current
,
memo_cross
)
;
else
{
this
->
d
=
this
->
m
.
phi1
(
this
->
d
)
;
faceState
(
current
,
memo_cross
)
;
}
}
}
}
template
<
typename
PFP
>
void
ParticleCell2DSecured
<
PFP
>::
edgeState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
,
Geom
::
Orientation2D
sideOfEdge
)
{
#ifdef DEBUG
CGoGNout
<<
"edgeState"
<<
this
->
d
<<
CGoGNendl
;
#endif
// std::vector<Dart> mc = memo_cross.get_markedCells();
// if(std::find(mc.begin(),mc.end(),this->d)!=mc.end())
// {
// std::cout << "Error : particle outside map (edge)" << std::endl;
// return;
// }
// else
{
assert
(
std
::
isfinite
(
current
[
0
])
&&
std
::
isfinite
(
current
[
1
])
&&
std
::
isfinite
(
current
[
2
]))
;
// assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
if
(
this
->
crossCell
==
NO_CROSS
)
{
this
->
crossCell
=
CROSS_EDGE
;
this
->
lastCrossed
=
this
->
d
;
}
else
this
->
crossCell
=
CROSS_OTHER
;
if
(
sideOfEdge
==
Geom
::
ALIGNED
)
sideOfEdge
=
this
->
getOrientationEdge
(
current
,
this
->
d
)
;
switch
(
sideOfEdge
)
{
case
Geom
::
LEFT
:
this
->
d
=
this
->
m
.
phi1
(
this
->
d
)
;
faceState
(
current
,
memo_cross
)
;
return
;
case
Geom
::
RIGHT
:
this
->
d
=
this
->
m
.
phi1
(
this
->
m
.
phi2
(
this
->
d
))
;
faceState
(
current
,
memo_cross
)
;
return
;
default
:
this
->
setState
(
EDGE
)
;
break
;
}
if
(
!
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
d
,
this
->
positionAttribut
,
current
))
{
this
->
ParticleBase
<
PFP
>::
move
(
this
->
positionAttribut
[
this
->
d
])
;
vertexState
(
current
,
memo_cross
)
;
return
;
}
else
if
(
!
Algo
::
Geometry
::
isPointOnHalfEdge
<
PFP
>
(
this
->
m
,
this
->
m
.
phi2
(
this
->
d
),
this
->
positionAttribut
,
current
))
{
this
->
d
=
this
->
m
.
phi2
(
this
->
d
)
;
this
->
ParticleBase
<
PFP
>::
move
(
this
->
positionAttribut
[
this
->
d
])
;
vertexState
(
current
,
memo_cross
)
;
return
;
}
this
->
ParticleBase
<
PFP
>::
move
(
current
)
;
}
}
template
<
typename
PFP
>
void
ParticleCell2DSecured
<
PFP
>::
faceState
(
const
VEC3
&
current
,
CellMarkerMemo
<
FACE
>&
memo_cross
)
{
#ifdef DEBUG
CGoGNout
<<
"faceState"
<<
this
->
d
<<
CGoGNendl
;
#endif
std
::
vector
<
Dart
>
mc
=
memo_cross
.
get_markedCells
();
if
(
std
::
find
(
mc
.
begin
(),
mc
.
end
(),
this
->
d
)
!=
mc
.
end
())
{
std
::
cout
<<
"Error : particle outside map (face)"
<<
std
::
endl
;
return
;
}
else
{
ParticleCell2DMemo
<
PFP
>::
faceState
(
current
,
memo_cross
);
}
}
include/Geometry/orientation.hpp
View file @
0f35dc93
...
...
@@ -35,7 +35,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb)
{
typedef
typename
VEC3
::
DATA_TYPE
T
;
const
T
zero
=
0.0001
;
const
T
zero
=
0.000
0
1
;
T
p
=
(
P
[
0
]
-
Pa
[
0
])
*
(
Pb
[
1
]
-
Pa
[
1
])
-
(
Pb
[
0
]
-
Pa
[
0
])
*
(
P
[
1
]
-
Pa
[
1
])
;
...
...
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