示例#1
0
        private static Point[] GetChainAtV(double v, FaceToolPath toolPath)
        {
#if false
            return(GetChainAtV(v, p => true));
#else
            return(GetChainAtVWhere(v, p => {
                if (!toolPath.Face.ContainsParam(p))
                {
                    return false;
                }

                ToolEvaluation eval = Evaluate(p, toolPath);
                Face[] adjacentFaces = toolPath.Face.Edges
                                       .Where(e => e.Faces.Count == 2 && e.GetAngle() < 0) // TBD handle surface bodies correctly
                                       .Select(e => toolPath.Face.GetAdjacentFace(e))
                                       .Where(f => f != null)
                                       .ToArray();

                foreach (Face adjacentFace in adjacentFaces)
                {
                    if ((eval.CenterPoint - adjacentFace.Geometry.ProjectPoint(eval.CenterPoint).Point).MagnitudeSquared() < Math.Pow(toolPath.CuttingTool.Radius, 2))
                    {
                        return false;
                    }
                }

                return true;
            }, toolPath));
#endif
        }
示例#2
0
        private static Point[] GetChainAtVWhere(double v, Func <PointUV, bool> condition, FaceToolPath toolPath)
        {
            List <Point> points = new List <Point>();

            double u = toolPath.StartU;

            while (u <= toolPath.EndU)
            {
                PointUV pointUV;
                if (!toolPath.Surface.TryOffsetParam(PointUV.Create(u, v), DirectionUV.DirU, toolPath.CuttingParameters.Increment, out pointUV))
                {
                    break;
                }

                u = pointUV.U;

                if (!condition(pointUV))
                {
                    continue;
                }

                ToolEvaluation eval = Evaluate(pointUV, toolPath);
                points.Add(eval.CenterPoint);
            }

            return(points.ToArray());
        }