public double DistanceSquared(Bounds3D b) { double dx = Math.Max(0.0, Math.Max(b.MinPoint.X - X, X - b.MaxPoint.X)); double dy = Math.Max(0.0, Math.Max(b.MinPoint.Y - Y, Y - b.MaxPoint.Y)); double dz = Math.Max(0.0, Math.Max(b.MinPoint.Z - Z, Z - b.MaxPoint.Z)); return(dx * dx + dy * dy + dz * dz); }
public bool Overlaps(Bounds3D b2) { bool x = (MaxPoint.X >= b2.MinPoint.X) && (MinPoint.X <= b2.MaxPoint.X); bool y = (MaxPoint.Y >= b2.MinPoint.Y) && (MinPoint.Y <= b2.MaxPoint.Y); bool z = (MaxPoint.Z >= b2.MinPoint.Z) && (MinPoint.Z <= b2.MaxPoint.Z); return(x && y && z); }
public Bounds3D Intersect(Bounds3D b2) { return(new Bounds3D(Point3D.Max(MinPoint, b2.MinPoint), Point3D.Min(MaxPoint, b2.MaxPoint))); }
public Bounds3D Union(Bounds3D b2) { return(new Bounds3D(Point3D.Min(MinPoint, b2.MinPoint), Point3D.Max(MaxPoint, b2.MaxPoint))); }
public bool IsInsideExclusive(Bounds3D b) { return(X >= b.MinPoint.X && X < b.MaxPoint.X && Y >= b.MinPoint.Y && Y < b.MaxPoint.Y && Z >= b.MinPoint.Z && Z < b.MaxPoint.Z); }
public bool IsInside(Bounds3D b) { return(X >= b.MinPoint.X && X <= b.MaxPoint.X && Y >= b.MinPoint.Y && Y <= b.MaxPoint.Y && Z >= b.MinPoint.Z && Z <= b.MaxPoint.Z); }
public double Distance(Bounds3D b) { return(Math.Sqrt(DistanceSquared(b))); }