示例#1
0
		Point3DList CreateListFromScanData(ScanData source)
		{
			Point3DList ret = new Point3DList();
			IqrFilter filter = new IqrFilter();
			filter.Factor = 0.5f;
			ScanData data = filter.Run(source);
			for (int i = 0; i < data.Count; i++)
				ret.AddRange(data[i]);
			return ret;
		}
示例#2
0
        Point3DList CreateListFromScanData(ScanData source)
        {
            Point3DList ret    = new Point3DList();
            IqrFilter   filter = new IqrFilter();

            filter.Factor = 0.5f;
            ScanData data = filter.Run(source);

            for (int i = 0; i < data.Count; i++)
            {
                ret.AddRange(data[i]);
            }
            return(ret);
        }
示例#3
0
        protected override StripResult CreateStrip(ScanLine previous, ScanLine current)
        {
            ScanLine ret1 = new ScanLine(previous.LaserID);
            ScanLine ret2 = new ScanLine(current.LaserID);

            Point3DList all = new Point3DList();

            all.AddRange(previous);
            all.AddRange(current.Where(p2 => previous.All(p1 => p1.Position.Y != p2.Position.Y)));
            all.Sort();
            all.Reverse();
            //            all.AddRange(list1.Union(list2, ));


            for (int i = 0; i < all.Count; i++)
            {
                double  y  = all[i].Position.Y;
                Point3D p1 = previous.GetNearestY(y);
                Point3D p2 = current.GetNearestY(y);
                ret1.Add(p1);
                ret2.Add(p2);
            }
            return(new StripResult(ret1, ret2));
        }
        protected override StripResult CreateStrip(ScanLine previous, ScanLine current)
        {
            ScanLine ret1 = new ScanLine(previous.LaserID);
            ScanLine ret2 = new ScanLine(current.LaserID);

            Point3DList all = new Point3DList();
            all.AddRange(previous);
            all.AddRange(current.Where(p2 => previous.All(p1 => p1.Position.Y != p2.Position.Y)));
            all.Sort();
            all.Reverse();
            //            all.AddRange(list1.Union(list2, ));


            for (int i = 0; i < all.Count; i++)
            {
                double y = all[i].Position.Y;
                Point3D p1 = previous.GetNearestY(y);
                Point3D p2 = current.GetNearestY(y);
                ret1.Add(p1);
                ret2.Add(p2);
            }
            return new StripResult(ret1, ret2);

        }
示例#5
0
        /**
            This gets the drawing points of a bezier curve, using recursive division,
            which results in less points for the same accuracy as the above implementation.
        */
        public Point3DList GetDrawingPoints2()
        {
            Point3DList drawingPoints = new Point3DList();

            for (int curveIndex = 0; curveIndex < curveCount; curveIndex++)
            {
                Point3DList bezierCurveDrawingPoints = FindDrawingPoints(curveIndex);

                if (curveIndex != 0)
                {
                    //remove the fist point, as it coincides with the last point of the previous Bezier curve.
                    bezierCurveDrawingPoints.RemoveAt(0);
                }

                drawingPoints.AddRange(bezierCurveDrawingPoints);
            }

            return drawingPoints;
        }
示例#6
0
        /**
            Sample the given points as a Bezier path.
        */
        public void SamplePoints(Point3DList sourcePoints, double minSqrDistance, double maxSqrDistance, double scale)
        {
            if (sourcePoints.Count < 2)
            {
                return;
            }

            Stack<Point3D> samplePoints = new Stack<Point3D>();

            samplePoints.Push(sourcePoints[0]);

            Point3D potentialSamplePoint = sourcePoints[1];

            int i = 2;

            for (i = 2; i < sourcePoints.Count; i++)
            {
                if (
                    ((potentialSamplePoint.Position - sourcePoints[i].Position).LengthSquared > minSqrDistance) &&
                    ((samplePoints.Peek().Position - sourcePoints[i].Position).LengthSquared > maxSqrDistance))
                {
                    samplePoints.Push(potentialSamplePoint);
                }

                potentialSamplePoint = sourcePoints[i];
            }

            //now handle last bit of curve
            Point3D p1 = samplePoints.Pop(); //last sample point
            Point3D p0 = samplePoints.Peek(); //second last sample point


            Vector3d posT = (p0.Position - potentialSamplePoint.Position).Normalized();
            double pos_d2 = (potentialSamplePoint.Position - p1.Position).Length;
            double pos_d1 = (p1.Position - p0.Position).Length;
            double pos_scale =((pos_d1 - pos_d2) / 2f);
            Vector3d pos_ = p1.Position + posT * pos_scale;

            Vector3d normT = (p0.Normal - potentialSamplePoint.Normal).Normalized();
            double norm_d2 = (potentialSamplePoint.Normal - p1.Normal).Length;
            double norm_d1 = (p1.Normal - p0.Normal).Length;
            Vector3d norm_ = p1.Normal + normT * ((norm_d1 - norm_d2) / 2);

            
            samplePoints.Push(new Point3D(pos_,norm_,p1.Color.GetStepColor(p0.Color,pos_scale)));
            samplePoints.Push(potentialSamplePoint);
            Point3DList l = new Point3DList(samplePoints.Count);
            l.AddRange(samplePoints);
            Interpolate(l, scale);
        }