Example #1
0
        public xy copy()
        {
            xy p = new xy(x, y);

            // TODO is the following correct?
            if (orig != null)
            {
                p.orig = orig.copy();
            }
            return(p);
        }
Example #2
0
File: tri.cs Project: thild/sawdust
        internal Triangle3d(xyz _a, xyz _b, xyz _c)
        {
#if true // we need this so triangles can share xyz instances so we can share them in wpf so wpf can shade them properly
            a = _a;
            b = _b;
            c = _c;
#else
            a = _a.copy();
            b = _b.copy();
            c = _c.copy();
#endif

            n  = xyz.normal(a, b, c).normalize_in_place();
            iv = (b - a).normalize_in_place();
            jv = xyz.cross(n, iv).normalize_in_place();

            Debug.Assert(!ut.PointsAreCollinear3d(a, b, c));
#if not
            if (ut.PointsAreCollinear3d(a, b, c))
            {
                throw new GeomCheckException("Attempt to create triangle with 3 collinear points.");
            }
#endif
        }
Example #3
0
 public Line3d(xyz a1, xyz a2)
 {
     p1 = a1.copy();
     p2 = a2.copy();
 }