Пример #1
0
        /// CompositeCutter can not use the base-class facetDrop, instead we here
        /// call facetDrop() on each cutter in turn, and pick the valid CC/CL point
        /// as the result for the CompositeCutter

        //********   facetDrop  ********************** */

        // call facetDrop on each cutter and pick a valid cc-point
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: bool facetDrop(CLPoint &cl, const Triangle &t) const
        public new bool facetDrop(CLPoint cl, Triangle t)
        {
            bool result = false;

            for (int n = 0; n < cutter.Count; ++n)
            {             // loop through cutters
                CLPoint cl_tmp = cl + new CLPoint(0, 0, zoffset[n]);
                CCPoint cc_tmp;
                if (cutter[n].facetDrop(cl_tmp, t))
                {
                    Debug.Assert(cl_tmp.cc != null);
                    if (ccValidRadius(n, cl_tmp))
                    {                     // cc-point is valid
                        cc_tmp = new CCPoint(cl_tmp.cc);
                        if (cl.liftZ(cl_tmp.z - zoffset[n]))
                        {                         // we need to lift the cutter
                            cc_tmp.type = CCType.FACET;
                            cl.cc       = cc_tmp;
                            result      = true;
                        }
                        else
                        {
                            if (cc_tmp != null)
                            {
                                cc_tmp.Dispose();
                            }
                        }
                    }
                }
            }
            return(result);
        }
Пример #2
0
        /// call edgeDrop on each cutter and pick the correct (highest valid CL-point) result

        //********   edge **************************************************** */
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: bool edgeDrop(CLPoint &cl, const Triangle &t) const
        public new bool edgeDrop(CLPoint cl, Triangle t)
        {
            bool result = false;

            for (int n = 0; n < cutter.Count; ++n)
            {             // loop through cutters
                CLPoint cl_tmp = cl + new Point(0, 0, zoffset[n]);
                CCPoint cc_tmp;
                if (cutter[n].edgeDrop(cl_tmp, t))
                {                 // drop sub-cutter against edge
                    if (ccValidRadius(n, cl_tmp))
                    {             // check if cc-point is valid
                        cc_tmp = new CCPoint(cl_tmp.cc);
                        if (cl.liftZ(cl_tmp.z - zoffset[n]))
                        {                         // we need to lift the cutter
                            cc_tmp.type = CCType.EDGE;
                            cl.cc       = cc_tmp;
                            result      = true;
                        }
                        else
                        {
                            if (cc_tmp != null)
                            {
                                cc_tmp.Dispose();
                            }
                        }
                    }
                }
            }
            return(result);
        }
Пример #3
0
 /// update upper with t, and corresponding cc-point p
 public void updateUpper(double t, CCPoint p)
 {
     if (upper_cc.type == CCType.NONE)
     {
         upper = t;
         lower = t;
         CCPoint tmp = new CCPoint(p);
         upper_cc.CopyFrom(tmp);
         lower_cc.CopyFrom(tmp);
         if (tmp != null)
         {
             tmp.Dispose();
         }
     }
     if (t > upper)
     {
         upper = t;
         CCPoint tmp = new CCPoint(p);
         upper_cc.CopyFrom(tmp);
         if (tmp != null)
         {
             tmp.Dispose();
         }
     }
 }