コード例 #1
0
 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));
 }
コード例 #2
0
 /// <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"));
     }
 }
コード例 #3
0
 public bool Intersects(IConvexSolid solid1, IConvexSolid solid2)
 {
     return(solid1.Intersects(solid2));
 }
コード例 #4
0
 public double GetIntersectionVolume(IConvexSolid solid1, IConvexSolid solid2)
 {
     return(solid1.GetIntersectionVolume(solid2));
 }
コード例 #5
0
 public virtual double GetIntersectionVolume(IConvexSolid solid)
 {
     return(GetIntersectionCalculator().GetIntersectionVolume(solid));
 }
コード例 #6
0
 public abstract IIntersectionCalculator GetIntersectionCalculator(IConvexSolid solid);
コード例 #7
0
 public override IIntersectionCalculator GetIntersectionCalculator(IConvexSolid cube)
 {
     return(new CubeIntersectionCalculator(cube as Cube));
 }