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
S
SocialAgents3D
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
8ae449f5
Commit
8ae449f5
authored
Apr 22, 2015
by
Thomas Pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
c8c30ff7
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
759 additions
and
252 deletions
+759
-252
.qglviewer.xml
.qglviewer.xml
+3
-3
include/ArticulatedObject.h
include/ArticulatedObject.h
+16
-3
include/MovingObject.h
include/MovingObject.h
+1
-1
include/env_map.h
include/env_map.h
+25
-11
include/knife.h
include/knife.h
+1
-1
include/needle.h
include/needle.h
+2
-2
include/surface.h
include/surface.h
+15
-0
src/ArticulatedObject.cpp
src/ArticulatedObject.cpp
+5
-2
src/agent.cpp
src/agent.cpp
+2
-2
src/env_map.cpp
src/env_map.cpp
+629
-201
src/knife.cpp
src/knife.cpp
+12
-11
src/needle.cpp
src/needle.cpp
+33
-13
src/simulator.cpp
src/simulator.cpp
+3
-2
src/surface.cpp
src/surface.cpp
+10
-0
src/tree.cpp
src/tree.cpp
+1
-0
src/viewer.cpp
src/viewer.cpp
+1
-0
No files found.
.qglviewer.xml
View file @
8ae449f5
...
...
@@ -4,7 +4,7 @@
<foregroundColor
red=
"180"
blue=
"180"
green=
"180"
/>
<backgroundColor
red=
"51"
blue=
"51"
green=
"51"
/>
</State>
<Display
axisIsDrawn=
"
fals
e"
gridIsDrawn=
"false"
FPSIsDisplayed=
"false"
cameraIsEdited=
"false"
/>
<Display
axisIsDrawn=
"
tru
e"
gridIsDrawn=
"false"
FPSIsDisplayed=
"false"
cameraIsEdited=
"false"
/>
<Geometry
fullScreen=
"false"
width=
"1198"
posX=
"0"
height=
"800"
posY=
"0"
/>
<Camera>
<Parameters
fieldOfView=
"0.785398"
sceneRadius=
"8.66025"
Type=
"PERSPECTIVE"
zNearCoefficient=
"0.005"
orthoCoef=
"0.414214"
zClippingCoefficient=
"1.73205"
>
...
...
@@ -12,8 +12,8 @@
</Parameters>
<Stereo
focusDistance=
"20.9077"
physScreenWidth=
"0.5"
IODist=
"0.062"
/>
<ManipulatedCameraFrame>
<position
x=
"
0.676359"
y=
"7.84622"
z=
"21.2158
"
/>
<orientation
q0=
"-0.1
76647"
q1=
"0.006936"
q2=
"-0.0459918"
q3=
"0.983175
"
/>
<position
x=
"
4.23345"
y=
"4.40878"
z=
"12.0466
"
/>
<orientation
q0=
"-0.1
63893"
q1=
"0.165076"
q2=
"0.0232247"
q3=
"0.972291
"
/>
<ManipulatedParameters
transSens=
"1"
zoomSens=
"1"
rotSens=
"1"
wheelSens=
"1"
spinSens=
"0.3"
/>
<ManipulatedCameraParameters
zoomsOnPivotPoint=
"false"
flySpeed=
"0.0866025"
rotatesAroundUpVector=
"false"
>
<sceneUpVector
x=
"0"
y=
"1"
z=
"0"
/>
...
...
include/ArticulatedObject.h
View file @
8ae449f5
...
...
@@ -48,6 +48,18 @@ public :
{
partNeedReset
[
index
]
=
b
;
}
inline
const
int
&
getNeedForSimplif
(
int
index
)
const
{
return
partNeedResetSimplif
[
index
];
}
inline
const
int
&
getNeedForSimplif
(
int
index
)
{
return
partNeedResetSimplif
[
index
];
}
inline
void
setNeedForSimplif
(
int
index
,
int
b
)
{
partNeedResetSimplif
[
index
]
=
b
;
}
const
Segment
*
getSegment
(
int
index
)
const
{
return
Segments_
[
index
];
...
...
@@ -65,13 +77,14 @@ public :
void
addGeneralNeighbor
(
Dart
d
);
bool
removeGeneralNeighbor
(
Dart
d
);
void
needResetSegment
(
Segment
*
o
);
void
needResetSimplifSegment
(
Segment
*
o
);
unsigned
int
nbVertices
;
unsigned
int
nbVertices
;
unsigned
int
nbEdges
;
std
::
vector
<
Particule
*>
parts_
;
std
::
vector
<
int
>
partNeedReset
;
std
::
vector
<
int
>
partNeedResetSimplif
;
std
::
vector
<
Segment
*>
Segments_
;
std
::
vector
<
std
::
vector
<
Dart
>
>
belonging_cells
;
...
...
@@ -80,7 +93,7 @@ public :
std
::
vector
<
std
::
pair
<
Dart
,
int
>
>
general_belonging
;
std
::
vector
<
std
::
pair
<
Dart
,
int
>
>
general_neighbors
;
double
width
;
Simulator
*
sim_
;
Simulator
*
sim_
;
unsigned
int
index_articulated
;
virtual
void
changeColor
(
Segment
*
s
,
float
distance
)
=
0
;
float
r
;
...
...
include/MovingObject.h
View file @
8ae449f5
...
...
@@ -16,7 +16,7 @@ public :
virtual
void
updateRegistration
()
=
0
;
virtual
void
color_close
()
=
0
;
virtual
void
unColor_close
(
Dart
oldCell
)
=
0
;
virtual
void
refine
()
=
0
;
virtual
Dart
refine
()
=
0
;
void
changeColor
(
Segment
*
s
,
float
distance
);
bool
Needle_or_knife
;
VEC3
closest_point
;
//temp
...
...
include/env_map.h
View file @
8ae449f5
...
...
@@ -50,15 +50,17 @@ class EnvMap
public:
std
::
chrono
::
duration
<
double
>
duration_pop
,
duration_subdiv
,
duration_push
;
EnvMap
()
;
void
init
(
int
argc
,
char
**
argv
)
;
EnvMap
()
;
void
init
(
int
argc
,
char
**
argv
)
;
bool
checkPointInMap
(
VEC3
pos
,
Dart
neighborhood
);
bool
checkPointInCube
(
VEC3
pos
);
bool
checkFaces
();
// vérifie que tous les points des faces sont bien coplanaires si ce n'eest pas le cas renvoie true
bool
insideVolume
(
VEC3
pos
,
Dart
d
);
void
unStuckCell
(
Dart
cell
);
void
StuckCell
(
Dart
cell
);
REAL
volumeMaxdistance
(
Vol
volume
);
VEC3
normaleFromVolume
(
Dart
volume
,
Dart
face
);
void
open_file
(
std
::
string
filename
);
void
open_file
(
std
::
string
filename
);
float
mapMinX
;
float
mapMaxX
;
float
mapMinY
;
...
...
@@ -66,7 +68,9 @@ public:
float
mapMinZ
;
float
mapMaxZ
;
float
maxCellRay
;
bool
simplifyVolume
(
Dart
d
,
bool
OneLevelDifference
=
true
);
void
resetPartNeighborsFace
(
Dart
neighbor
,
unsigned
int
vLevel
);
void
simplifyNeedle
(
Dart
celltoSimplify
,
Dart
needleCell
);
bool
simplifyVolume
(
Dart
d
,
CellMarkerMemo
<
MAP
,
VOLUME
>&
smallCells
);
bool
subdivideVolume
(
Dart
d
,
bool
OneLevelDifference
=
true
);
void
subdivideToMaxLevel
();
bool
subdivideMap
();
...
...
@@ -77,12 +81,12 @@ public:
unsigned
int
nbAgentsToSimplify
;
PFP
::
MAP
map
;
PFP
::
MAP
map
;
CellMarkerMemo
<
MAP
,
VOLUME
>
refineMark
;
CellMarkerMemo
<
MAP
,
VOLUME
>
simplifyMark
;
VertexAttribute
<
VEC3
,
MAP
>
position
;
VertexAttribute
<
VEC3
,
MAP
>
position
;
FaceAttribute
<
VEC3
,
MAP
>
facecenter
;
VolumeAttribute
<
VEC3
,
MAP
>
color
;
VolumeAttribute
<
VEC3
,
MAP
>
color
;
VolumeAttribute
<
VEC3
,
MAP
>
volumecenter
;
VolumeAttribute
<
AGENTS
,
MAP
>
RegisteredAgents
;
VolumeAttribute
<
AGENTS
,
MAP
>
RegisteredNeighborAgents
;
...
...
@@ -90,8 +94,10 @@ public:
VolumeAttribute
<
ARETES
,
MAP
>
RegisteredNeighborEdges
;
VolumeAttribute
<
TRIANGLES
,
MAP
>
RegisteredTriangles
;
VolumeAttribute
<
TRIANGLES
,
MAP
>
RegisteredNeighborTriangles
;
VolumeAttribute
<
bool
,
MAP
>
CellOnMaxLevel
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
;
VolumeAttribute
<
Dart
,
MAP
>
OldestDart
;
VolumeAttribute
<
bool
,
MAP
>
CellOnMaxLevel
;
// remplacer apr marker ?
VolumeAttribute
<
bool
,
MAP
>
CellStuckCauseOneLevel
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
;
std
::
vector
<
Dart
>
getMemoCross
(
const
VEC3
&
pos
,
const
VEC3
&
dest
,
Dart
&
d1
,
unsigned
int
state
);
void
FindNeighborCells
(
const
std
::
vector
<
Dart
>&
belonging_cells
,
std
::
vector
<
Dart
>
*
nieghbor_cells
);
...
...
@@ -109,6 +115,7 @@ public:
void
pushSegmentInCellAsNeighbor
(
Segment
*
o
,
Dart
d
);
void
popSegmentInCellAsNeighbor
(
Segment
*
o
,
Dart
d
);
void
resetPartSubdiv
(
Segment
*
o
);
void
resetPartSimplif
(
Segment
*
cell
,
Dart
d
);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Enregistrement Surfaces
...
...
@@ -122,6 +129,7 @@ public:
void
pushTriangleInCellAsNeighbor
(
Triangle
*
cell
,
Dart
d
);
void
popTriangleInCellAsNeighbor
(
Triangle
*
cell
,
Dart
d
);
void
resetPartSubdiv
(
Triangle
*
cell
);
void
resetPartSimplif
(
Triangle
*
cell
,
Dart
d
);
/// enregistrement des agents
...
...
@@ -133,7 +141,9 @@ public:
void
popAgentInCell
(
Agent
*
o
,
Dart
d
);
void
pushAgentInCellAsNeighbor
(
Agent
*
cell
,
Dart
d
);
void
popAgentInCellAsNeighbor
(
Agent
*
cell
,
Dart
d
);
#ifndef IHMap
Dart
volumeLowestIndex
(
Dart
v
);
#endif
}
;
/**************************************
...
...
@@ -231,7 +241,11 @@ inline void EnvMap::FindNeighborCells (const std::vector<Dart>& belonging_cells,
if
(
!
map
.
isBoundaryMarked
<
3
>
(
d
)
&&
!
memo_mark
.
isMarked
(
d
)
&&
!
OneRingMark
.
isMarked
(
d
)
)
{
OneRingMark
.
mark
(
d
);
(
*
neighbor_cells
).
push_back
(
map
.
volumeOldestDart
(
d
));
#ifdef IHMap
(
*
neighbor_cells
).
push_back
(
OldestDart
[
d
]);
#else
(
*
neighbor_cells
).
push_back
(
volumeLowestIndex
(
d
));
#endif
}
}
...
...
include/knife.h
View file @
8ae449f5
...
...
@@ -19,7 +19,7 @@ public:
void
color_close
();
void
unColor_close
(
Dart
oldCell
);
void
refine
();
Dart
refine
();
};
...
...
include/needle.h
View file @
8ae449f5
...
...
@@ -21,8 +21,8 @@ public:
void
unColor_close
(
Dart
oldCell
);
float
edgeSize
;
void
refine
();
Dart
oldCell
;
Dart
refine
();
};
...
...
include/surface.h
View file @
8ae449f5
...
...
@@ -58,6 +58,19 @@ public:
return
indexParticule
[
d
];
}
inline
const
int
&
getNeedForSimplif
(
int
index
)
const
{
return
partNeedResetSimplif
[
index
];
}
inline
const
int
&
getNeedForSimplif
(
int
index
)
{
return
partNeedResetSimplif
[
index
];
}
inline
void
setNeedForSimplif
(
int
index
,
int
b
)
{
partNeedResetSimplif
[
index
]
=
b
;
}
inline
const
VEC3
&
getFaceColor
(
Dart
d
)
const
{
return
faceColor
[
d
];
...
...
@@ -97,6 +110,7 @@ public:
bool
subdiveMap
();
//subdivision de la map
void
initOperators
(
SubdivisionType
st
);
// fonction de sélection du type de subdivision pour l'ihm2
void
needResetTriangle
(
Triangle
*
o
);
void
needResetSimplifTriangle
(
Triangle
*
o
);
void
addGeneralCell
(
Dart
d
);
bool
removeGeneralCell
(
Dart
d
);
...
...
@@ -131,6 +145,7 @@ private:
std
::
vector
<
Particule
*>
parts_
;
std
::
vector
<
int
>
partNeedReset
;
std
::
vector
<
int
>
partNeedResetSimplif
;
std
::
vector
<
Triangle
*>
triangles_
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render_map
;
// render de l'objet
...
...
src/ArticulatedObject.cpp
View file @
8ae449f5
...
...
@@ -122,14 +122,17 @@ bool ArticulatedObject::removeGeneralNeighbor (Dart d)
void
ArticulatedObject
::
needResetSegment
(
Segment
*
o
)
{
partNeedReset
[
o
->
indexPart1
]
=
1
;
partNeedReset
[
o
->
indexPart2
]
=
1
;
}
void
ArticulatedObject
::
needResetSimplifSegment
(
Segment
*
o
)
{
partNeedResetSimplif
[
o
->
indexPart1
]
=
1
;
partNeedResetSimplif
[
o
->
indexPart2
]
=
1
;
}
...
...
src/agent.cpp
View file @
8ae449f5
...
...
@@ -21,7 +21,7 @@ void Agent::init(Simulator * sim ,VEC3 startingPoint,std::vector<VEC3> goals,Dar
ag_stiffness
=
1000.0
;
// agent-agent interaction stiffness
ag_damping
=
1.0
;
// agent-agent interaction damping
ag_mass
=
0.
1
;
ag_mass
=
0.
2
;
forces
=
VEC3
(
0
);
maxVelocity_
=
std
::
min
(
averageVelocity
*
ratio
,
sim_
->
envMap_
.
maxCellRay
/
sim_
->
timeStep_
);
...
...
@@ -153,7 +153,7 @@ void Agent::avoidanceAgents()
const
float
distSq
=
pere
.
first
;
const
float
dist
=
sqrt
(
distSq
);
const
float
combinedRadius
=
3
*
(
radius
+
other
->
radius
)
;
const
float
combinedRadius
=
3
.5
*
(
radius
+
other
->
radius
)
;
// const float combinedRadiusSq = combinedRadius * combinedRadius ;
VEC3
other_previous_pos
=
other
->
getPosition
()
-
(
other
->
newVelocity_
*
sim_
->
timeStep_
);
...
...
src/env_map.cpp
View file @
8ae449f5
This diff is collapsed.
Click to expand it.
src/knife.cpp
View file @
8ae449f5
...
...
@@ -2,7 +2,7 @@
//initialisation knife
Knife
::
Knife
(
Simulator
*
sim
,
std
::
vector
<
std
::
pair
<
VEC3
,
Dart
>>
startingPoints
)
{
{
r
=
0.0
f
;
g
=
0.0
f
;
b
=
1.0
f
;
...
...
@@ -17,14 +17,15 @@ Knife::Knife(Simulator* sim,std::vector<std::pair<VEC3, Dart>> startingPoints)
for
(
auto
it
=
startingPoints
.
begin
();
it
!=
startingPoints
.
end
();
++
it
)
{
{
parts_
.
push_back
(
new
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
ParticleCell3D
<
PFP
>
(
sim_
->
envMap_
.
map
,
(
*
it
).
second
,
(
*
it
).
first
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
partNeedReset
.
push_back
(
0
);
}
partNeedResetSimplif
.
push_back
(
0
);
}
for
(
unsigned
int
i
=
0
;
i
<
nbEdges
;
i
++
)
{
{
#ifdef DEBUG_affichage
CGoGNout
<<
" init Segment :"
<<
i
;
CGoGNout
<<
" || nb_segments :"
<<
Segments_
.
size
()
<<
CGoGNendl
;
...
...
@@ -35,7 +36,7 @@ Knife::Knife(Simulator* sim,std::vector<std::pair<VEC3, Dart>> startingPoints)
Segments_
.
push_back
(
o
);
sim_
->
envMap_
.
FirstRegistrationSegment
(
o
);
}
}
}
...
...
@@ -147,7 +148,7 @@ void Knife::updateRegistration()
for
(
unsigned
int
i
=
0
;
i
<
nbEdges
;
++
i
)
{
{
// CGoGNout << "avant une etape : Segment "<< i << CGoGNendl;
Segment
*
o
=
Segments_
[
i
];
o
->
p1
=
getParticule
(
o
->
indexPart1
)
->
getPosition
();
...
...
@@ -166,15 +167,15 @@ void Knife::updateRegistration()
CGoGNout
<<
"p2 : "
<<
o
->
p2
<<
" || "
<<
d2
<<
CGoGNendl
;
#endif
sim_
->
envMap_
.
popAndPushSegment
(
o
);
}
}
}
}
#ifdef DEBUG_affichage
CGoGNout
<<
CGoGNendl
<<
" fin update registration "
<<
CGoGNendl
<<
CGoGNendl
;
#endif
/////affichage du general_belonging
/////affichage du general_belonging
// CGoGNout<< CGoGNendl;
// CGoGNout << "General : ";
// for(std::vector<std::pair<Dart , int> >::iterator ite = general_belonging.begin();ite!=general_belonging.end(); ++ite)
...
...
@@ -185,7 +186,7 @@ void Knife::updateRegistration()
}
void
Knife
::
refine
()
Dart
Knife
::
refine
()
{
// Dart volume = this->getParticule(0)->getCell();
// PFP::VEC3 edge = Algo::Surface::Geometry::vectorOutOfDart<PFP>(sim_->envMap_.map, volume, sim_->envMap_.position) ;
...
...
@@ -195,6 +196,6 @@ void Knife::refine()
//// refine();
// }
return
NIL
;
}
src/needle.cpp
View file @
8ae449f5
...
...
@@ -22,15 +22,20 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint)
index_articulated
=
sim
->
objects
.
size
();
parts_
.
push_back
(
new
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
ParticleCell3D
<
PFP
>
(
sim_
->
envMap_
.
map
,
startingPoint
.
second
,
startingPoint
.
first
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
partNeedReset
.
push_back
(
0
);
// parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, startingPoint.second, startingPoint.first , sim_->envMap_.position/*, &(sim_->envMap_.facecenter),&(sim_->envMap_.volumecenter)*/));
parts_
.
push_back
(
new
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
ParticleCell3D
<
PFP
>
(
sim_
->
envMap_
.
map
,
startingPoint
.
second
,
startingPoint
.
first
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
partNeedReset
.
push_back
(
0
);
partNeedResetSimplif
.
push_back
(
0
);
this
->
color_close
();
createEdge
(
0
);
#ifdef IHMap
refine
();
#endif
oldCell
=
this
->
getParticule
(
0
)
->
getCell
();
}
...
...
@@ -110,8 +115,10 @@ void Needle::unColor_close(Dart volume)
void
Needle
::
createEdge
(
int
index
)
{
// parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, this->getParticule(0)->getCell(), getParticule(0)->getPosition() , sim_->envMap_.position/*,&(sim_->envMap_.facecenter),&(sim_->envMap_.volumecenter)*/));
parts_
.
push_back
(
new
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
ParticleCell3D
<
PFP
>
(
sim_
->
envMap_
.
map
,
this
->
getParticule
(
0
)
->
getCell
(),
getParticule
(
0
)
->
getPosition
()
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
partNeedReset
.
push_back
(
0
);
partNeedResetSimplif
.
push_back
(
0
);
Segment
*
o
=
new
Segment
(
getParticule
(
index
+
1
)
->
getPosition
(),
getParticule
(
0
)
->
getPosition
(),
this
,
index
+
1
,
0
,
index
,
r
,
g
,
b
);
...
...
@@ -132,18 +139,19 @@ void Needle::createEdge(int index)
void
Needle
::
move
(
VEC3
diff
)
{
Dart
oldCell
=
this
->
getParticule
(
0
)
->
getCell
();
if
(
diff
.
norm
()
>
sim_
->
envMap_
.
maxCellRay
)
// on limite la taille du déplacement pour pouvoir vérifier rapidement si l'objectif est dans la carte
Dart
oldDart
=
this
->
getParticule
(
0
)
->
getCell
();
if
(
diff
.
norm
()
>
(
sim_
->
envMap_
.
maxCellRay
/
4
))
// on limite la taille du déplacement pour pouvoir vérifier rapidement si l'objectif est dans la carte
{
// CGoGNout<< "déplacement trop grand, on raccourci "<<CGoGNendl;
diff
.
normalize
();
diff
*=
sim_
->
envMap_
.
maxCellRay
*
0.9
;
diff
*=
(
sim_
->
envMap_
.
maxCellRay
/
4
)
*
0.9
;
}
VEC3
pos
=
getPosition
(
0
)
+
diff
;
if
(
sim_
->
envMap_
.
map
.
isVolumeIncidentToBoundary
(
old
Cell
))
if
(
sim_
->
envMap_
.
map
.
isVolumeIncidentToBoundary
(
old
Dart
))
{
if
(
!
sim_
->
envMap_
.
checkPointInMap
(
pos
,
old
Cell
))
if
(
!
sim_
->
envMap_
.
checkPointInMap
(
pos
,
old
Dart
))
{
pos
=
pos
-
diff
;
...
...
@@ -153,12 +161,21 @@ void Needle::move(VEC3 diff)
this
->
getParticule
(
0
)
->
move
(
pos
);
updateRegistration
();
this
->
unColor_close
(
old
Cell
);
this
->
unColor_close
(
old
Dart
);
#ifdef IHMap
if
(
!
getParticule
(
0
)
->
crossCell
==
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
NO_CROSS
)
/// a rajouter si les cellules sont assez petites
if
(
getParticule
(
0
)
->
newVol
)
{
refine
();
#ifdef DEBUG_affichage
CGoGNout
<<
"
\n\n
on va subdiv : "
<<
this
->
getParticule
(
0
)
->
getCell
()
<<
CGoGNendl
;
#endif
Dart
newOld
=
refine
();
#ifdef DEBUG_affichage
CGoGNout
<<
"on va simplif : "
<<
oldCell
<<
CGoGNendl
;
#endif
sim_
->
envMap_
.
simplifyNeedle
(
oldCell
,
getParticule
(
0
)
->
getCell
());
if
(
newOld
!=
NIL
)
oldCell
=
newOld
;
}
#endif
...
...
@@ -181,7 +198,7 @@ void Needle::updateRegistration()
Dart
d2
=
this
->
getParticule
(
o
->
indexPart2
)
->
getCell
();
if
(
!
(
(
sim_
->
envMap_
.
map
.
sameVolume
(
d1
,
d2
))
&&
(
getParticule
(
o
->
indexPart1
)
->
crossCell
==
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
NO_CROSS
&&
getParticule
(
o
->
indexPart2
)
->
crossCell
==
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
NO_CROSS
)))
&&
(
!
(
getParticule
(
o
->
indexPart1
)
->
newVol
)
&&
!
(
getParticule
(
o
->
indexPart2
)
->
newVol
)
)))
{
sim_
->
envMap_
.
popAndPushSegment
(
o
);
...
...
@@ -201,8 +218,10 @@ void Needle::updateRegistration()
}
void
Needle
::
refine
()
Dart
Needle
::
refine
()
{
Dart
newold
=
NIL
;
#ifdef IHMap
Dart
volume
=
this
->
getParticule
(
0
)
->
getCell
();
...
...
@@ -211,10 +230,11 @@ void Needle::refine()
{
if
(
sim_
->
envMap_
.
subdivideVolume
(
volume
))
{
newold
=
volume
;
refine
();
}
}
#endif
return
newold
;
}
src/simulator.cpp
View file @
8ae449f5
...
...
@@ -25,7 +25,7 @@ void Simulator::init(int argc, char **argv)
Needle_or_knife
=
atoi
(
argv
[
1
])
;
else
Needle_or_knife
=
true
;
initAgents
(
100
00
);
initAgents
(
5
00
);
envMap_
.
subdivideToMaxLevel
();
// initFixedObjects();
// initSurfaces();
...
...
@@ -47,13 +47,14 @@ void Simulator::doStep()
Dart
oldCell
=
ag
->
part_
->
getCell
();
ag
->
updatePosition
();
if
(
ag
->
part_
->
crossCell
!=
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
NO_CROSS
)
if
(
ag
->
part_
->
newVol
)
{
envMap_
.
agentChangeFace
(
ag
,
oldCell
);
}
}
}
envMap_
.
subdivideMap
();
envMap_
.
simplifyMap
();
++
nbSteps_
;
}
...
...
src/surface.cpp
View file @
8ae449f5
...
...
@@ -38,6 +38,7 @@ Surface::Surface(Simulator* sim,VEC3 offset):
parts_
.
push_back
(
new
Particule
(
sim_
->
envMap_
.
map
,
sim_
->
envMap_
.
getBelongingCell
(
positionSurface
[
d
]),
positionSurface
[
d
]
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
nbVertices
++
;
partNeedReset
.
push_back
(
0
);
partNeedResetSimplif
.
push_back
(
0
);
}
// initialisation tableaux de vecteurs qui vont stocker les belonging cells
TraversorE
<
SurfaceMap
>
tF2
(
surfaceMap
);
...
...
@@ -386,3 +387,12 @@ void Surface::needResetTriangle(Triangle * o)
}
}
void
Surface
::
needResetSimplifTriangle
(
Triangle
*
o
)
{
Dart
d
=
o
->
cell
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
partNeedResetSimplif
[
indexParticule
[
d
]]
=
1
;
d
=
surfaceMap
.
phi1
(
d
);
}
}
src/tree.cpp
View file @
8ae449f5
...
...
@@ -22,6 +22,7 @@ Tree::Tree(Simulator* sim, std::vector<std::pair<VEC3, Dart>> startingPoints, st
parts_
.
push_back
(
new
CGoGN
::
Algo
::
Volume
::
MovingObjects
::
ParticleCell3D
<
PFP
>
(
sim_
->
envMap_
.
map
,
(
*
it
).
second
,
(
*
it
).
first
,
sim_
->
envMap_
.
position
,
&
(
sim_
->
envMap_
.
facecenter
),
&
(
sim_
->
envMap_
.
volumecenter
)));
partNeedReset
.
push_back
(
0
);
partNeedResetSimplif
.
push_back
(
0
);
}
for
(
unsigned
int
i
=
0
;
i
<
nbEdges
;
i
++
)
...
...
src/viewer.cpp
View file @
8ae449f5
...
...
@@ -195,6 +195,7 @@ void Volusion::cb_keyPress(int code)
break
;
}
case
'a'
:
if
(
timer
->
isActive
())
{
timer
->
stop
();
...
...
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