Beispiel #1
0
        public static void Main()
        {
            IGeometryUtils geometryUtils = new GeometryUtils();
            IFileUtils fileUtils = new FileUtils();

            string[] fileNames = { "example", "example.pdf", "example.new.pdf" };

            foreach (string fileName in fileNames)
            {
                try
                {
                    Console.WriteLine(fileUtils.GetFileExtension(fileName));
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            foreach (string fileName in fileNames)
            {
                try
                {
                    Console.WriteLine(fileUtils.GetFileNameWithoutExtension(fileName));
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            Point2D firstPoint2D = new Point2D(1, -2);
            Point2D secondPoint2D = new Point2D(3, 4);
            Console.WriteLine(
                "Distance in the 2D space = {0:f2}",
                geometryUtils.CalcDistance2D(firstPoint2D, secondPoint2D));

            Point3D firstPoint3D = new Point3D(5, 2, -1);
            Point3D secondPoint3D = new Point3D(3, -6, 4);
            Console.WriteLine(
                "Distance in the 3D space = {0:f2}",
                geometryUtils.CalcDistance3D(firstPoint3D, secondPoint3D));

            double width = 3;
            double height = 4;
            double depth = 5;
            Volume volume = new Volume(width, height, depth);

            Console.WriteLine("Volume = {0:f2}", volume.CalcVolume());
            Console.WriteLine("Diagonal XYZ = {0:f2}", volume.CalcDiagonalXYZ(geometryUtils));
            Console.WriteLine("Diagonal XY = {0:f2}", volume.CalcDiagonalXY(geometryUtils));
            Console.WriteLine("Diagonal XZ = {0:f2}", volume.CalcDiagonalXZ(geometryUtils));
            Console.WriteLine("Diagonal YZ = {0:f2}", volume.CalcDiagonalYZ(geometryUtils));
        }
Beispiel #2
0
        public static double GetDiagonalBetweenSides(double sideA, double sideB, double sideC)
        {
            double distance = GeometryUtils.CalcDistance3D(0, 0, 0, sideA, sideB, sideC);

            return(distance);
        }
Beispiel #3
0
        public static double CalcDiagonalXZ()
        {
            double distance = GeometryUtils.CalcDistance2D(0, 0, Width, Depth);

            return(distance);
        }
Beispiel #4
0
        public static double CalcDiagonalYZ()
        {
            double distance = GeometryUtils.CalcDistance2D(0, 0, Height, Depth);

            return(distance);
        }
Beispiel #5
0
 public double CalcDiagonalXYZ()
 {
     return(GeometryUtils.CalcDistance3D(0, 0, 0, this.Width, this.Height, this.Depth));
 }
Beispiel #6
0
        public static double CalcDiagonalXY()
        {
            double distance = GeometryUtils.CalcDistance2D(0, 0, Width, Height);

            return(distance);
        }
Beispiel #7
0
 public double CalcDiagonalZX()
 {
     return(GeometryUtils.CalcDistance2D(0, 0, this.Depth, this.Width));
 }
Beispiel #8
0
 public double CalcDiagonalXY()
 {
     return(GeometryUtils.CalcDistance2D(0, 0, this.Width, this.Height));
 }
        public double CalcDiagonalXZ()
        {
            double diagonal = GeometryUtils.CalcDistance2D(0, 0, this.Width, this.Depth);

            return(diagonal);
        }
        public double CalcDiagonalXY()
        {
            double diagonal = GeometryUtils.CalcDistance2D(0, 0, this.Width, this.Height);

            return(diagonal);
        }
        public double CalcDiagonalYZ()
        {
            double diagonal = GeometryUtils.CalcDistance2D(0, 0, this.Height, this.Depth);

            return(diagonal);
        }