Пример #1
0
        /// return true if cl.cc is within the radial range of cutter n
        /// for cutter n the valid radial distance from cl is
        /// between radiusvec[n-1] and radiusvec[n]
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: bool ccValidRadius(uint n, CLPoint& cl) const
        protected bool ccValidRadius(int n, CLPoint cl)
        {
            if (cl.cc.type == CCType.NONE)
            {
                return(false);
            }
            double d = cl.xyDistance(cl.cc);
            double lolimit;
            double hilimit;

            if (n == 0)
            {
                lolimit = -1E-6;
            }
            else
            {
                lolimit = radiusvec[n - 1] - 1E-6;
            }
            hilimit = radiusvec[n] + 1e-6;             // FIXME: really ugly solution this one...
            if (d < lolimit)
            {
                return(false);
            }
            else if (d > hilimit)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #2
0
        /// \brief drop cutter at (cl.x, cl.y) against the three vertices of Triangle t.
        /// calls this->height(r) on the subclass of MillingCutter we are using.
        /// if cl.z is too low, updates cl.z so that cutter does not cut any vertex.

        // general purpose vertex-drop which delegates to this->height(r) of subclass
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: bool vertexDrop(CLPoint &cl, const Triangle &t) const
        public bool vertexDrop(CLPoint cl, Triangle t)
        {
            bool result = false;

            foreach (Point p in t.p)
            {                                // test each vertex of triangle
                double q = cl.xyDistance(p); // distance in XY-plane from cl to p
                if (q <= radius)
                {                            // p is inside the cutter
                    CCPoint cc_tmp = new CCPoint(p, CCType.VERTEX);
                    if (cl.liftZ(p.z - this.height(q), cc_tmp))
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }