Ejemplo n.º 1
0
        public static void FindActualEdge(HalfEdge he, out HalfEdge he1, out double length)
        {
            EdgeLoop el  = he.face.GetEdgeLoopFor(he);
            int      ndx = el.IndexOf(he);

            while (true)
            {
                HalfEdge h = el[el.FixIndex(ndx - 1)];
                if (ut.PointsAreCollinear3d(h.from, h.to, he.to))
                {
                    ndx--;
                }
                else
                {
                    break;
                }
            }
            he1 = el[ndx];
            double len = he1.Length();

            while (true)
            {
                HalfEdge h = el[++ndx];
                if (ut.PointsAreCollinear3d(he1.from, he1.to, h.to))
                {
                    len += h.Length();
                }
                else
                {
                    break;
                }
            }
            length = len;
        }
Ejemplo n.º 2
0
        public static CompoundSolid Tenon(CompoundSolid sol, HalfEdge he, xy pos, xyz size, string id)
        {
            Face f = he.face;

            EdgeLoop el  = he.face.GetEdgeLoopFor(he);
            int      ndx = el.IndexOf(he);

            ndx--;
            if (ndx < 0)
            {
                ndx += el.Count;
            }
            HalfEdge prevHe = el[ndx];

            if (!fp.eq_inches(pos.y, 0))
            {
                Solid cut = CreateCutter_Box(id, he, new xy(0, 0), new xyz(he.Length(), pos.y, size.z),
                                             new string[] { "NA_1", "NA_2", "NA_3", "frontshoulder", "NA_4", "front" });
                sol = bool3d.Subtract(sol, cut);
            }
            if (!fp.eq_inches(pos.x, 0))
            {
                Solid cut = CreateCutter_Box(id, he, new xy(0, pos.y), new xyz(pos.x, size.y, size.z),
                                             new string[] { "NA_1", "left", "NA_2", "leftshoulder", "NA_3", "NA_4" });
                sol = bool3d.Subtract(sol, cut);
            }
            if ((pos.y + size.y) < prevHe.Length())
            {
                Solid cut = CreateCutter_Box(id, he, new xy(0, pos.y + size.y), new xyz(he.Length(), prevHe.Length() - (pos.y + size.y), size.z),
                                             new string[] { "NA_1", "NA_2", "NA_3", "backshoulder", "back", "NA_4" });
                sol = bool3d.Subtract(sol, cut);
            }
            if ((pos.x + size.x) < he.Length())
            {
                Solid cut = CreateCutter_Box(id, he, new xy((pos.x + size.x), pos.y), new xyz(he.Length() - (pos.x + size.x), size.y, size.z),
                                             new string[] { "NA_1", "NA_2", "right", "rightshoulder", "NA_3", "NA_4" });
                sol = bool3d.Subtract(sol, cut);
            }
            return(sol);
        }