particle_cell_2D.hpp 11.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*******************************************************************************
* 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                                        *
*                                                                              *
*******************************************************************************/
namespace CGoGN
{

namespace Algo
{

namespace Surface
{

namespace MovingObjects
{


Pierre Kraemer's avatar
Pierre Kraemer committed
37 38 39
template <typename PFP>
void ParticleCell2D<PFP>::display()
{
40 41 42
// 	CGoGNout << "pos : " << this->m_position << CGoGNendl;
// 	CGoGNout << "d : " << this->d << CGoGNendl;
// 	CGoGNout << "state : " << this->state << CGoGNendl;
Pierre Kraemer's avatar
Pierre Kraemer committed
43 44 45 46 47
}

template <typename PFP>
typename PFP::VEC3 ParticleCell2D<PFP>::pointInFace(Dart d)
{
David Cazier's avatar
-  
David Cazier committed
48 49 50 51 52 53 54 55 56 57
	const VEC3& p1(positionAttribut[d]) ;
	Dart dd = m.phi1(d) ;
	const VEC3& p2(positionAttribut[dd]) ;
	dd = m.phi1(dd) ;
	VEC3& p3(positionAttribut[dd]) ;

	while (Geom::testOrientation2D(p3, p1, p2) == Geom::ALIGNED)
	{
		dd = m.phi1(dd) ;
		p3 = positionAttribut[dd] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
58 59
	}

David Cazier's avatar
-  
David Cazier committed
60
	CGoGNout << "pointInFace " << (p1 + p3) * 0.5f << CGoGNendl ;
Pierre Kraemer's avatar
Pierre Kraemer committed
61

David Cazier's avatar
-  
David Cazier committed
62
	return (p1 + p3) * 0.5f ;
Pierre Kraemer's avatar
Pierre Kraemer committed
63 64 65 66 67
}

template <typename PFP>
Geom::Orientation2D ParticleCell2D<PFP>::getOrientationEdge(const VEC3& point, Dart d)
{
David Cazier's avatar
-  
David Cazier committed
68 69
	const VEC3& endPoint = positionAttribut[m.phi2(d)] ;
	const VEC3& vertexPoint = positionAttribut[d] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
70

David Cazier's avatar
-  
David Cazier committed
71
	return Geom::testOrientation2D(point, vertexPoint, endPoint) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
72 73 74 75 76
}

template <typename PFP>
typename PFP::VEC3 ParticleCell2D<PFP>::intersectLineEdge(const VEC3& pA, const VEC3& pB, Dart d)
{
David Cazier's avatar
-  
David Cazier committed
77 78 79
	VEC3 q1 = positionAttribut[d] ;
	VEC3 q2 = positionAttribut[m.phi2(d)] ;
	VEC3 Inter ;
Pierre Kraemer's avatar
Pierre Kraemer committed
80

David Cazier's avatar
-  
David Cazier committed
81
	Geom::intersection2DSegmentSegment(pA, pB, q1, q2, Inter) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
82

David Cazier's avatar
-  
David Cazier committed
83
	return Inter ;
Pierre Kraemer's avatar
Pierre Kraemer committed
84 85 86
}

template <typename PFP>
David Cazier's avatar
David Cazier committed
87
Geom::Orientation2D ParticleCell2D<PFP>::getOrientationFace(VEC3 goal, Dart d)
Pierre Kraemer's avatar
Pierre Kraemer committed
88
{
David Cazier's avatar
David Cazier committed
89 90 91
	const VEC3& p1 = this->getPosition() ;
	const VEC3& p2 = positionAttribut[d] ;
	return Geom::testOrientation2D(goal, p1, p2) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
92 93 94
}

template <typename PFP>
David Cazier's avatar
-  
David Cazier committed
95
void ParticleCell2D<PFP>::vertexState(const VEC3& goal)
Pierre Kraemer's avatar
Pierre Kraemer committed
96
{
David Cazier's avatar
-  
David Cazier committed
97 98 99
#ifdef DEBUG
	CGoGNout << "vertexState" << d << CGoGNendl ;
#endif
David Cazier's avatar
David Cazier committed
100
	assert(goal.isFinite()) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
101

David Cazier's avatar
-  
David Cazier committed
102
	crossCell = CROSS_OTHER ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
103

104
	if (Geometry::isPointOnVertex < PFP > (m, d, positionAttribut, goal))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
105
	{
David Cazier's avatar
-  
David Cazier committed
106
		this->setState(VERTEX) ;
Thomas Jund's avatar
Thomas Jund committed
107
		this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
108
		return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
109
	}
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
110 111
	else
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
112
		//orientation step
David Cazier's avatar
David Cazier committed
113
		if(positionAttribut[d][0] == positionAttribut[m.phi1(d)][0] && positionAttribut[d][1] == positionAttribut[m.phi1(d)][1])
114
			d = m.phi2_1(d);
David Cazier's avatar
David Cazier committed
115
		if(getOrientationEdge(goal,m.phi2_1(d)) != Geom::RIGHT)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
116
		{
David Cazier's avatar
-  
David Cazier committed
117
			Dart dd_vert = d ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
118 119
			do
			{
120
				d = m.phi2_1(d);
David Cazier's avatar
David Cazier committed
121
				if(positionAttribut[d][0] == positionAttribut[m.phi1(d)][0] && positionAttribut[d][1] == positionAttribut[m.phi1(d)][1])
122
					d = m.phi2_1(d);
David Cazier's avatar
David Cazier committed
123
			} while(getOrientationEdge(goal, m.phi2_1(d)) != Geom::RIGHT && dd_vert != d);
Pierre Kraemer's avatar
Pierre Kraemer committed
124

David Cazier's avatar
-  
David Cazier committed
125
			if (dd_vert == d)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
126
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
127
				//orbit with 2 edges : point on one edge
128
				if(m.phi2_1(m.phi2_1(d)) == d)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
129
				{
130
					if(!Geometry::isPointOnHalfEdge<PFP>(m,d,positionAttribut,goal))
131
						d = m.phi2_1(d);
Pierre Kraemer's avatar
Pierre Kraemer committed
132
				}
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
133 134
				else
				{
135 136 137
					//checking : case with 3 orthogonal darts and point on an edge
					do
					{
138 139
						if(Geometry::isPointOnHalfEdge<PFP>(m,d,positionAttribut,goal)
								&& Geometry::isPointOnHalfEdge<PFP>(m,this->m.phi2(d),positionAttribut,goal)
Jund Thomas's avatar
Jund Thomas committed
140
								&& this->getOrientationEdge(goal, this->d) == Geom::ALIGNED)
141 142 143 144 145 146 147 148
						{
							edgeState(goal) ;
							return;
						}
						this->d = this->m.phi2_1(this->d) ;
					} while (this->getOrientationEdge(goal, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ;


David Cazier's avatar
-  
David Cazier committed
149
					this->setState(VERTEX) ;
Thomas Jund's avatar
Thomas Jund committed
150
					this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
151
					return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
152 153 154
				}
			}
		}
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
155 156
		else
		{
157
			Dart dd_vert = m.phi2_1(d);
David Cazier's avatar
David Cazier committed
158
			while(getOrientationEdge(goal, d) == Geom::RIGHT && dd_vert != d)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
159
			{
160
				d = m.phi12(d);
David Cazier's avatar
David Cazier committed
161
				if(positionAttribut[d][0] == positionAttribut[m.phi1(d)][0] && positionAttribut[d][1] == positionAttribut[m.phi1(d)][1])
162
					d = m.phi12(d);
Pierre Kraemer's avatar
Pierre Kraemer committed
163 164 165 166
			}
		}

		//displacement step
David Cazier's avatar
-  
David Cazier committed
167
		if (getOrientationEdge(goal, d) == Geom::ALIGNED
168
		    && Geometry::isPointOnHalfEdge < PFP > (m, d, positionAttribut, goal))
David Cazier's avatar
-  
David Cazier committed
169
			edgeState(goal) ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
170 171
		else
		{
David Cazier's avatar
-  
David Cazier committed
172 173
			d = m.phi1(d) ;
			faceState(goal) ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
174
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
175 176 177 178
	}
}

template <typename PFP>
David Cazier's avatar
-  
David Cazier committed
179
void ParticleCell2D<PFP>::edgeState(const VEC3& goal, Geom::Orientation2D sideOfEdge)
Pierre Kraemer's avatar
Pierre Kraemer committed
180
{
David Cazier's avatar
-  
David Cazier committed
181 182 183
#ifdef DEBUG
	CGoGNout << "edgeState" << d << CGoGNendl ;
#endif
Pierre Kraemer's avatar
Pierre Kraemer committed
184

David Cazier's avatar
David Cazier committed
185
	assert(goal.isFinite()) ;
186
// 	assert(Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
Pierre Kraemer's avatar
Pierre Kraemer committed
187

David Cazier's avatar
-  
David Cazier committed
188
	if (crossCell == NO_CROSS)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
189
	{
David Cazier's avatar
-  
David Cazier committed
190 191
		crossCell = CROSS_EDGE ;
		lastCrossed = d ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
192 193
	}
	else
David Cazier's avatar
-  
David Cazier committed
194
		crossCell = CROSS_OTHER ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
195

David Cazier's avatar
-  
David Cazier committed
196
	if (sideOfEdge == Geom::ALIGNED) sideOfEdge = getOrientationEdge(goal, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
197

David Cazier's avatar
-  
David Cazier committed
198
	switch (sideOfEdge)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
199
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
200
		case Geom::LEFT :
David Cazier's avatar
-  
David Cazier committed
201 202 203 204 205 206 207
			d = m.phi1(d) ;
			faceState(goal) ;
			return ;
		case Geom::RIGHT :
			d = m.phi1(m.phi2(d)) ;
			faceState(goal) ;
			return ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
208
		default :
David Cazier's avatar
-  
David Cazier committed
209 210
			this->setState(EDGE) ;
			break ;
Pierre Kraemer's avatar
Pierre Kraemer committed
211 212
	}

213
	if (!Geometry::isPointOnHalfEdge < PFP > (m, d, positionAttribut, goal))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
214
	{
Thomas Jund's avatar
Thomas Jund committed
215
		this->Algo::MovingObjects::ParticleBase < PFP > ::move(positionAttribut[d]) ;
David Cazier's avatar
-  
David Cazier committed
216 217
		vertexState(goal) ;
		return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
218
	}
219
	else if (!Geometry::isPointOnHalfEdge < PFP > (m, m.phi2(d), positionAttribut, goal))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
220
	{
David Cazier's avatar
-  
David Cazier committed
221
		d = m.phi2(d) ;
Thomas Jund's avatar
Thomas Jund committed
222
		this->Algo::MovingObjects::ParticleBase < PFP > ::move(positionAttribut[d]) ;
David Cazier's avatar
-  
David Cazier committed
223 224
		vertexState(goal) ;
		return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
225
	}
226

Thomas Jund's avatar
Thomas Jund committed
227
	this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ;
228 229 230 231 232
}

template <typename PFP>
Dart ParticleCell2D<PFP>::faceOrientationState(const VEC3& toward)
{
David Cazier's avatar
-  
David Cazier committed
233 234 235
#ifdef DEBUG
	CGoGNout << "faceOrientationState" << d << CGoGNendl ;
#endif
236

David Cazier's avatar
-  
David Cazier committed
237 238
	assert(this->getPosition().isnormal());
	assert(toward.isnormal());
239

David Cazier's avatar
-  
David Cazier committed
240 241
	Dart res = d ;
	Dart dd = d ;
David Cazier's avatar
David Cazier committed
242
	float wsoe = getOrientationFace(toward, m.phi1(res)) ;
243 244

	// orientation step
David Cazier's avatar
-  
David Cazier committed
245
	if (wsoe != Geom::RIGHT)
246
	{
David Cazier's avatar
-  
David Cazier committed
247
		res = m.phi1(res) ;
David Cazier's avatar
David Cazier committed
248
		wsoe = getOrientationFace(toward, m.phi1(res)) ;
David Cazier's avatar
-  
David Cazier committed
249
		while (wsoe != Geom::RIGHT && dd != res)
250
		{
David Cazier's avatar
-  
David Cazier committed
251
			res = m.phi1(res) ;
David Cazier's avatar
David Cazier committed
252
			wsoe = getOrientationFace(toward, m.phi1(res)) ;
253 254
		}

David Cazier's avatar
-  
David Cazier committed
255 256
		// source and position to reach are the same : verify if no edge is crossed due to numerical approximation
		if (dd == res)
257 258 259 260 261
		{
			do
			{
				switch (getOrientationEdge(toward, res))
				{
David Cazier's avatar
-  
David Cazier committed
262 263 264 265 266 267 268
					case Geom::LEFT :
						res = m.phi1(res) ;
						break ;
					case Geom::ALIGNED :
						return res ;
					case Geom::RIGHT :
						return res ;
269
				}
David Cazier's avatar
-  
David Cazier committed
270 271
			} while (res != dd) ;
			return res ;
272 273 274 275
		}
	}
	else
	{
David Cazier's avatar
David Cazier committed
276
		wsoe = getOrientationFace(toward, d) ;
David Cazier's avatar
-  
David Cazier committed
277
		while (wsoe == Geom::RIGHT && m.phi_1(res) != dd)
278
		{
David Cazier's avatar
-  
David Cazier committed
279
			res = m.phi_1(res) ;
David Cazier's avatar
David Cazier committed
280
			wsoe = getOrientationFace(toward, res) ;
281 282 283
		}

		// in case of numerical incoherence
David Cazier's avatar
-  
David Cazier committed
284
		if (m.phi_1(res) == dd && wsoe == Geom::RIGHT)
285
		{
David Cazier's avatar
-  
David Cazier committed
286
			res = m.phi_1(res) ;
287 288 289 290
			do
			{
				switch (getOrientationEdge(toward, res))
				{
David Cazier's avatar
-  
David Cazier committed
291 292 293 294 295 296 297
					case Geom::LEFT :
						res = m.phi1(res) ;
						break ;
					case Geom::ALIGNED :
						return res ;
					case Geom::RIGHT :
						return res ;
298
				}
David Cazier's avatar
-  
David Cazier committed
299
			} while (res != dd) ;
300

David Cazier's avatar
-  
David Cazier committed
301
			return res ;
302 303 304
		}
	}

David Cazier's avatar
-  
David Cazier committed
305
	return res ;
Pierre Kraemer's avatar
Pierre Kraemer committed
306 307 308
}

template <typename PFP>
David Cazier's avatar
-  
David Cazier committed
309
void ParticleCell2D<PFP>::faceState(const VEC3& goal)
Pierre Kraemer's avatar
Pierre Kraemer committed
310
{
David Cazier's avatar
-  
David Cazier committed
311 312 313
#ifdef DEBUG
	CGoGNout << "faceState" << d << CGoGNendl ;
#endif
Pierre Kraemer's avatar
Pierre Kraemer committed
314

David Cazier's avatar
David Cazier committed
315 316
	assert(this->getPosition().isFinite());
	assert(goal.isFinite()) ;
317
// 	assert(Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
Pierre Kraemer's avatar
Pierre Kraemer committed
318

David Cazier's avatar
-  
David Cazier committed
319
	Dart dd = d ;
David Cazier's avatar
David Cazier committed
320
	float wsoe = getOrientationFace(goal, m.phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
321

Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
322
	// orientation step
David Cazier's avatar
-  
David Cazier committed
323
	if (wsoe != Geom::RIGHT)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
324
	{
David Cazier's avatar
-  
David Cazier committed
325
		d = m.phi1(d) ;
David Cazier's avatar
David Cazier committed
326
		wsoe = getOrientationFace(goal, m.phi1(d)) ;
David Cazier's avatar
-  
David Cazier committed
327
		while (wsoe != Geom::RIGHT && dd != d)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
328
		{
David Cazier's avatar
-  
David Cazier committed
329
			d = m.phi1(d) ;
David Cazier's avatar
David Cazier committed
330
			wsoe = getOrientationFace(goal, m.phi1(d)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
331 332
		}

David Cazier's avatar
-  
David Cazier committed
333 334
		// source and position to reach are the same : verify if no edge is crossed due to numerical approximation
		if (dd == d)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
335 336 337
		{
			do
			{
David Cazier's avatar
-  
David Cazier committed
338
				switch (getOrientationEdge(goal, d))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
339
				{
David Cazier's avatar
-  
David Cazier committed
340 341 342 343
					case Geom::LEFT :
						d = m.phi1(d) ;
						break ;
					case Geom::ALIGNED :
Thomas Jund's avatar
Thomas Jund committed
344
						this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
345 346 347
						edgeState(goal) ;
						return ;
					case Geom::RIGHT :
Thomas Jund's avatar
Thomas Jund committed
348
						this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(goal, this->getPosition(), d)) ;
David Cazier's avatar
-  
David Cazier committed
349 350
						edgeState(goal, Geom::RIGHT) ;
						return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
351
				}
David Cazier's avatar
-  
David Cazier committed
352
			} while (d != dd) ;
Thomas Jund's avatar
Thomas Jund committed
353
			this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
354
			this->setState(FACE) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
355

356
// 			m_position = Geometry::faceCentroid<PFP>(m,d,m_positions);
Pierre Kraemer's avatar
Pierre Kraemer committed
357 358 359 360 361 362
// 			d = m.phi1(d);
// 			m_position = pointInFace(d);
// 			faceState(current);

// 			m_position = m_positions[d];
// 			vertexState(current);
David Cazier's avatar
-  
David Cazier committed
363
			return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
364
		}
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
365
		// take the orientation with d1 : in case we are going through a vertex
David Cazier's avatar
David Cazier committed
366
		wsoe = getOrientationFace(goal, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
367
	}
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
368 369
	else
	{
David Cazier's avatar
David Cazier committed
370
		wsoe = getOrientationFace(goal, d) ;
David Cazier's avatar
-  
David Cazier committed
371
		while (wsoe == Geom::RIGHT && m.phi_1(d) != dd)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
372
		{
David Cazier's avatar
-  
David Cazier committed
373
			d = m.phi_1(d) ;
David Cazier's avatar
David Cazier committed
374
			wsoe = getOrientationFace(goal, d) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
375 376
		}

Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
377
		// in case of numerical incoherence
David Cazier's avatar
-  
David Cazier committed
378
		if (m.phi_1(d) == dd && wsoe == Geom::RIGHT)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
379
		{
David Cazier's avatar
-  
David Cazier committed
380
			d = m.phi_1(d) ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
381 382
			do
			{
David Cazier's avatar
-  
David Cazier committed
383
				switch (getOrientationEdge(goal, d))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
384
				{
David Cazier's avatar
-  
David Cazier committed
385 386 387 388
					case Geom::LEFT :
						d = m.phi1(d) ;
						break ;
					case Geom::ALIGNED :
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
389
// 					CGoGNout << "pic" << CGoGNendl;
Thomas Jund's avatar
Thomas Jund committed
390
						this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
391 392 393
						edgeState(goal) ;
						return ;
					case Geom::RIGHT :
394
//					CGoGNout << "smthg went bad(2) " << m_position << CGoGNendl;
Thomas Jund's avatar
Thomas Jund committed
395
						this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(goal, this->getPosition(), d)) ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
396
// 					CGoGNout << " " << m_position << CGoGNendl;
David Cazier's avatar
-  
David Cazier committed
397 398
						edgeState(goal, Geom::RIGHT) ;
						return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
399
				}
David Cazier's avatar
-  
David Cazier committed
400
			} while (d != dd) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
401

Thomas Jund's avatar
Thomas Jund committed
402
			this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
403 404
			this->setState(FACE) ;
			return ;
Pierre Kraemer's avatar
Pierre Kraemer committed
405 406 407 408
		}
	}

	//displacement step
David Cazier's avatar
-  
David Cazier committed
409
	switch (getOrientationEdge(goal, d))
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
410
	{
David Cazier's avatar
-  
David Cazier committed
411
		case Geom::LEFT :
Thomas Jund's avatar
Thomas Jund committed
412
			this->Algo::MovingObjects::ParticleBase<PFP>::move(goal) ;
David Cazier's avatar
-  
David Cazier committed
413 414 415
			this->setState(FACE) ;
			;
			break ;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
416 417 418
// 	case Geom::ALIGNED :
//		if(wsoe==Geom::ALIGNED) {
// 			m_position = m_positions[d];
David Cazier's avatar
-  
David Cazier committed
419
// 			vertexState(curgoalrent);
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
420 421 422 423
// 		}
// 		else {
// 			CGoGNout << "poc" << CGoGNendl;
// 			m_position = current;
424
// 			state = EDGE;
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
425 426
// 		}
// 		break;
David Cazier's avatar
-  
David Cazier committed
427 428 429 430
		default :
			if (wsoe == Geom::ALIGNED)
			{
				d = m.phi1(d) ; //to check
Thomas Jund's avatar
Thomas Jund committed
431
				this->Algo::MovingObjects::ParticleBase<PFP>::move(positionAttribut[d]) ;
David Cazier's avatar
-  
David Cazier committed
432 433 434 435
				vertexState(goal) ;
			}
			else
			{
Thomas Jund's avatar
Thomas Jund committed
436
				this->Algo::MovingObjects::ParticleBase<PFP>::move(intersectLineEdge(goal, this->getPosition(), d)) ;
David Cazier's avatar
-  
David Cazier committed
437 438 439
				edgeState(goal, Geom::RIGHT) ;
			}
			break ;
Pierre Kraemer's avatar
Pierre Kraemer committed
440 441
	}
}
442 443 444 445 446

}
}
} //namespaces
}