Пример #1
0
        public override PointedSubspace IntersectedWith(PointedSubspace other)
        {
            if (other.Snap(Vector3.zero) == Vector3.zero)
            {
                return(new PointedSubspace(IntersectedWith(other.subspace), Vector3.zero));
            }

            if (other.subspace is Subspace1)
            {
                Vector3?intersect = _intersect_plane_line(
                    normal, Vector3.zero,
                    other.point0, ((Subspace1)other.subspace).axis);
                if (intersect.HasValue)
                {
                    return(new PointedSubspace(new Subspace0(), intersect.Value));
                }
            }
            else if (other.subspace is Subspace2)
            {
                Subspace ss = other.subspace.NormalSubspace().JoinedWithVector(normal);
                if (ss is Subspace2)
                {
                    Vector3         intersect_normal = ((Subspace2)ss).normal;
                    Subspace        ss2  = IntersectedWithPlane(intersect_normal); /* a Subspace1 */
                    PointedSubspace pss2 = ss2.IntersectedWith(other);
                    return(new PointedSubspace(ss.NormalSubspace(), pss2.point0));
                }
            }
            return(PointedSubspace.Void());
        }
Пример #2
0
 public override PointedSubspace IntersectedWith(PointedSubspace other)
 {
     if (other.Snap(Vector3.zero) == Vector3.zero)
     {
         return(new PointedSubspace(this, Vector3.zero));
     }
     else
     {
         return(PointedSubspace.Void());
     }
 }
Пример #3
0
        public override PointedSubspace IntersectedWith(PointedSubspace other)
        {
            if (other.Snap(Vector3.zero) == Vector3.zero)
            {
                return(new PointedSubspace(IntersectedWith(other.subspace), Vector3.zero));
            }

            if (other.subspace is Subspace2)
            {
                Vector3?intersect = _intersect_plane_line(
                    ((Subspace2)other.subspace).normal, other.point0,
                    Vector3.zero, axis);
                if (intersect.HasValue)
                {
                    return(new PointedSubspace(new Subspace0(), intersect.Value));
                }
            }
            /* XXX missing special case if other.subspace is a specially aligned Subspace1 */
            return(PointedSubspace.Void());
        }