Esempio n. 1
0
        protected Point3D Smooth(int index, ScanLine prev, ScanLine current, ScanLine next)
        {
            //http://paulbourke.net/geometry/polygonmesh/
            Point3DList nearPoints = new Point3DList();

            if (index > 0)
            {
                Point3D prevP = current[index - 1];
                nearPoints.Add(prevP);
                nearPoints.Add(prev.GetInterpolateByY(prevP.Position.Y));
                nearPoints.Add(next.GetInterpolateByY(prevP.Position.Y));
            }
            Point3D pt = current[index];

            nearPoints.Add(pt);
            nearPoints.Add(prev.GetInterpolateByY(pt.Position.Y));
            nearPoints.Add(next.GetInterpolateByY(pt.Position.Y));

            if (index < current.Count - 1)
            {
                Point3D nextP = current[index + 1];
                nearPoints.Add(nextP);
                nearPoints.Add(prev.GetInterpolateByY(nextP.Position.Y));
                nearPoints.Add(next.GetInterpolateByY(nextP.Position.Y));
            }


            Point3D ret = Smooth(current[index], nearPoints);

            return(ret);
        }
Esempio n. 2
0
		protected Point3D Smooth(int index, ScanLine prev, ScanLine current, ScanLine next)
		{
			//http://paulbourke.net/geometry/polygonmesh/
			Point3DList nearPoints = new Point3DList();
			if (index > 0)
			{
				Point3D prevP = current[index - 1];
				nearPoints.Add(prevP);
				nearPoints.Add(prev.GetInterpolateByY(prevP.Position.Y));
				nearPoints.Add(next.GetInterpolateByY(prevP.Position.Y));
			}
			Point3D pt = current[index];
			nearPoints.Add(pt);
			nearPoints.Add(prev.GetInterpolateByY(pt.Position.Y));
			nearPoints.Add(next.GetInterpolateByY(pt.Position.Y));

			if (index <current.Count-1)
			{
				Point3D nextP = current[index + 1];
				nearPoints.Add(nextP);
				nearPoints.Add(prev.GetInterpolateByY(nextP.Position.Y));
				nearPoints.Add(next.GetInterpolateByY(nextP.Position.Y));
			}


			Point3D ret = Smooth(current[index], nearPoints);
			return ret;
		}