Exemple #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());
        }
Exemple #2
0
 public override Subspace IntersectedWith(Subspace other)
 {
     if (other.Project(axis) == axis)
     {
         return(this);
     }
     return(new Subspace0());
 }
Exemple #3
0
 public abstract Subspace IntersectedWith(Subspace other);
Exemple #4
0
 public override Subspace IntersectedWith(Subspace other)
 {
     return(other);
 }
Exemple #5
0
 public override Subspace IntersectedWith(Subspace other)
 {
     return(other.NormalSubspace().JoinedWithVector(normal).NormalSubspace());
 }
Exemple #6
0
 public PointedSubspace(Subspace subspace, Vector3 point0)
 {
     this.subspace = subspace;
     this.point0   = point0;
 }