public bool Intersects(IConvexSolid solid) { // We apply the Seperating Axis Theorem in the case of 3-dimension space return(XAxisProjection.Intersects(solid.XAxisProjection) && YAxisProjection.Intersects(solid.YAxisProjection) && ZAxisProjection.Intersects(solid.ZAxisProjection)); }
/// <summary> /// Calculates the Volume of the intersection of Cube with another Convex Solid /// </summary> /// <param name="solid"></param> /// <returns></returns> public double GetIntersectionVolume(IConvexSolid solid) { //Extend this method to get the intersection volume of Cube with other types of Convex Solids. if (solid is Cube) { return(GetIntersectionVolumeWithCube((Cube)solid)); } else { throw new IntersectionNotCalculatedYetException(string.Format($"The calculation of the volume of the intesection of a Cube with {solid.GetType().Name} is not implemented yet")); } }
public bool Intersects(IConvexSolid solid1, IConvexSolid solid2) { return(solid1.Intersects(solid2)); }
public double GetIntersectionVolume(IConvexSolid solid1, IConvexSolid solid2) { return(solid1.GetIntersectionVolume(solid2)); }
public virtual double GetIntersectionVolume(IConvexSolid solid) { return(GetIntersectionCalculator().GetIntersectionVolume(solid)); }
public abstract IIntersectionCalculator GetIntersectionCalculator(IConvexSolid solid);
public override IIntersectionCalculator GetIntersectionCalculator(IConvexSolid cube) { return(new CubeIntersectionCalculator(cube as Cube)); }