Esempio n. 1
0
		public static void Remove(IList<sFace> list,sFace face)
		{
			//if(face->l[1]) face->l[1]->l[0]=face->l[0];
			//if(face->l[0]) face->l[0]->l[1]=face->l[1];
			//if(face==list.root) list.root=face->l[1];
			//--list.count;
			list.Remove(face);
		}
Esempio n. 2
0
		public static void Append(IList<sFace> list,sFace face)
		{
			//face.l[0]	=	null;
			//face.l[1]	=	list[0];
			//if(list.Count > 0)
			//{
			//    list[0].l[0]=face;
			//}
			//list.root	=	face;
			//++list.count;
			list.Add(face);
		}
Esempio n. 3
0
		public void Initialize()
		{
			m_status = eStatus.Failed;
			m_normal = Vector3.Zero;
			m_depth = 0;
			m_nextsv = 0;
			m_result = new sSimplex();

			for (int i = 0; i < m_sv_store.Length; ++i)
			{
				m_sv_store[i] = new sSV();
			}

			for (int i = 0; i < m_fc_store.Length; ++i)
			{
				m_fc_store[i] = new sFace();
			}

			for (int i = 0; i < GjkEpaSolver2.EPA_MAX_FACES; ++i)
			{
				Append(m_stock, m_fc_store[GjkEpaSolver2.EPA_MAX_FACES - i - 1]);
			}
		}
Esempio n. 4
0
		public static void Bind(sFace fa,uint ea,sFace fb,uint eb)
		{
			fa.e[ea]=(uint)eb;fa.f[ea]=fb;
			fb.e[eb]=(uint)ea;fb.f[eb]=fa;
		}
Esempio n. 5
0
		public bool	Expand(uint pass,sSV w,sFace f,uint e,sHorizon horizon)
		{
			uint[]	i1m3 = {1,2,0};
			uint[]  i2m3 = {2,0,1};
			if(f.pass!=pass)
			{
				uint e1 = i1m3[e];
				if ((Vector3.Dot(f.n, w.w) - f.d) < -GjkEpaSolver2.EPA_PLANE_EPS)
				{
					sFace nf = NewFace(f.c[e1],f.c[e],w,false);
					if(nf != null)
					{
						Bind(nf,0,f,e);
						if(horizon.cf != null)
						{
							Bind(horizon.cf,1,nf,2);
						}
						else 
						{
							horizon.ff=nf;
						}
						horizon.cf=nf;
						++horizon.nf;
						return(true);
					}
				}
				else
				{
					uint e2=i2m3[e];
					f.pass = (uint)pass;
					if(	Expand(pass,w,f.f[e1],f.e[e1],horizon)&&
					   	Expand(pass,w,f.f[e2],f.e[e2],horizon))
					{
						Remove(m_hull,f);
						Append(m_stock,f);
						return(true);
					}
				}
			}
			return(false);
		}