Example #1
0
        private static void FixSegmentDirection(seg3d s1, Face f1, Face f2, bool reverse)
        {
            xyz n1 = f1.UnitNormal();
            xyz n2 = f2.UnitNormal();
            xyz k  = xyz.cross(n2, n1).normalize_in_place();

            if (reverse)
            {
                k.negate_in_place();
            }

            xyz vab = (s1.b - s1.a).normalize_in_place();

            if (!fp.eq_unitvec(vab, k))
            {
                xyz t = s1.a;
                s1.a = s1.b;
                s1.b = t;
            }
        }