Beispiel #1
0
        internal double Area()
        {
            // TODO is this calculation the same as something else, like the normal?
            xyz    v1  = b - a;
            xyz    v2  = c - a;
            xyz    cr  = xyz.cross(v1, v2);
            double mag = cr.magnitude();

            return(mag / 2);
        }
Beispiel #2
0
        public void test_measure()
        {
            Solid    s  = wood.CreateBoard(BoardMaterial.Find(BoardMaterial.SOLID_OAK_RED), "a", 10, 24, 1);
            Face     f  = s.FindFace("top");
            HalfEdge he = f.FindLongestEdge();

            Assert.IsTrue(fp.eq_inches(24, he.Length()));
            xyz p1 = he.Center();
            xyz p2 = f.Measure(he, p1);
            xyz q  = p2 - p1;

            Assert.IsTrue(fp.eq_inches(10, q.magnitude()));

            CompoundSolid cs = wood.Mortise(s.ToCompoundSolid(), he, new xy(3, 3), new xyz(18, 4, 2), "m1");

            f = cs.FindFace("a.top");
            Assert.AreEqual(2, f.loops.Count);
            he = f.FindLongestEdge();
            Assert.IsTrue(fp.eq_inches(24, he.Length()));
            p1 = he.Center();
            p2 = f.Measure(he, p1);
            q  = p2 - p1;
            Assert.IsTrue(fp.eq_inches(3, q.magnitude()));
        }