static void Main(string[] args) { // Create instances from namespace Geometry2D Point2D point2D = new Point2D(); Circle circle = new Circle(); DistanceCalculator2D distance2D = new DistanceCalculator2D(); Ellipse ellipse = new Ellipse(); Figure2D figure2D = new Figure2D(); Polygon polygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); // Create instances from namespace Geometry3D DistanceCalculator3D distance3D = new DistanceCalculator3D(); Path3D path3D = new Path3D(); Point3D point3D = new Point3D(); // Create instances from namespace Storage GeometryBinaryStorage binaryStorage = new GeometryBinaryStorage(); GeometrySVGStorage svgStorage = new GeometrySVGStorage(); GeometryXMLStorage xmlStorage = new GeometryXMLStorage(); // Create instances from namespace UI Screen2D screen2D = new Screen2D(); Screen3D screen3D = new Screen3D(); }
static void Main(string[] args) { Circle circle = new Circle(); DistanceCalculator2D dist = new DistanceCalculator2D(); Elipse elipse = new Elipse(); Figure2D figure = new Figure2D(); Point2D point = new Point2D(); Polygon plygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); Console.WriteLine(); Point3D point3D = new Point3D(); Path3D path = new Path3D(); DistanceCalculator3D dist3D = new DistanceCalculator3D(); Console.WriteLine(); GeometryBinaryStorage gbStorage = new GeometryBinaryStorage(); GeometrySVGStorage gsStorage = new GeometrySVGStorage(); GeometryXMLStorage gxStorage = new GeometryXMLStorage(); Console.WriteLine(); Screen2D sc2D = new Screen2D(); Screen3D sc3D = new Screen3D(); }
static void Main(string[] args) { Point3D firstPoint = new Point3D(2, 3.4, 8); Point3D secondPoint = new Point3D(4.4, 25, 1); Point3D thirdPoint = new Point3D(3.3, 3.4, 5.5); double distanceBetweenTwoPoints = DistanceCalculator3D.CalculateDistanceIn3D(firstPoint, secondPoint); Console.WriteLine("The distance between the points in Euclid 3d space is : " + distanceBetweenTwoPoints); List <Point3D> pointsList = new List <Point3D>(); pointsList.Add(firstPoint); pointsList.Add(secondPoint); pointsList.Add(thirdPoint); Path3D pathToSave = new Path3D(pointsList); string operationResult = Storage.Save3dPoints(pathToSave); Console.WriteLine(operationResult); Path3D pathToLoad = Storage.Load3dPoints(); List <Point3D> loadedPoints = new List <Point3D>(); loadedPoints = pathToLoad.SequenceOfPoints; foreach (Point3D currentPoint in loadedPoints) { Console.WriteLine(currentPoint); } }
public void Setup() { m_AllPositive = new Point3D(1, 1.0, 1.0, 1.0, "X,Y,Z are positve"); m_AllPositiveOther = new Point3D(2, 11.0, 11.0, 11.0, "X,Y,Z are positve"); m_AllNegative = new Point3D(1, -1.0, -1.0, -1.0, "X,Y,Z are negative"); m_AllNegativeOther = new Point3D(2, -11.0, -11.0, -11.0, "X,Y,Z are negative"); m_Sut = new DistanceCalculator3D(); }
public void Setup() { m_FromPoint = new Point3D(0, 0.0, 0.0, 0.0, "From Point"); m_PointOne = new Point3D(1, 1.0, 1.0, 1.0, "Point One"); m_PointTwo = new Point3D(2, 2.0, 2.0, 2.0, "Point Two"); m_PointThree = new Point3D(3, 3.0, 3.0, 3.0, "Point Three"); m_PointFour = new Point3D(4, -1.0, -1.0, -1.0, "Same distance as Point One"); m_Points = new[] // not sorted by distance by default { m_PointThree, m_PointTwo, m_PointOne, m_PointFour }; m_Manager = Substitute.For <IPointsManager>(); m_Manager.All().Returns(m_Points); m_Calculator = new DistanceCalculator3D(); m_Sut = new PointToPointsCalculator(m_Manager, m_Calculator); }
static void Main(string[] args) { Circle circle = new Circle(); Ellipse ellipse = new Ellipse(); Figure2D figure2D = new Figure2D(); Point2D point = new Point2D(); DistanceCalcualtor2D distanceCalcualtor = new DistanceCalcualtor2D(); Polygon polygon = new Polygon(); Rectangle rectangle = new Rectangle(); Square square = new Square(); DistanceCalculator3D distanceCalculator3D = new DistanceCalculator3D(); Point3D path3D = new Point3D(); Point3D point3D = new Point3D(); Screen2D screen2D = new Screen2D(); Screen3D screen3D = new Screen3D(); }
static void Main() { Point2D a = new Point2D(); Figure2D b = new Figure2D(); Square c = new Square(); Rectangle d = new Rectangle(); Circle e = new Circle(); Elipse f = new Elipse(); DistanceCalculator2D g = new DistanceCalculator2D(); Point3D h = new Point3D(); Path3D i = new Path3D(); DistanceCalculator3D j = new DistanceCalculator3D(); GeometryBinaryStorage k = new GeometryBinaryStorage(); GeometrySVGStorage l = new GeometrySVGStorage(); GeometryXMLStorage m = new GeometryXMLStorage(); Screen2D n = new Screen2D(); Screen3D o = new Screen3D(); }
static void Main() { Circle circle = new Circle(); Ellipse ellipse = new Ellipse(); DistanceCalculator2D calc2D = new DistanceCalculator2D(); Figure2D figure2D = new Figure2D(); Point2D p2D = new Point2D(); Polygon polygon = new Polygon(); Rectangle rect = new Rectangle(); Square square = new Square(); Console.WriteLine(); DistanceCalculator3D calc3D = new DistanceCalculator3D(); Path3D path = new Path3D(); Point3D p3D = new Point3D(); GeometrySVGStorage geometrySVGStorage = new GeometrySVGStorage(); GeometryXMLStorage geometryXMLStorage = new GeometryXMLStorage(); GeometryBinaryStorage geometryBinaryStorage = new GeometryBinaryStorage(); Screen2D scr2D = new Screen2D(); Screen3D scr3D = new Screen3D(); }
static void Main() { // POINTS, PATH, PATHSTORAGE DEMO Console.WriteLine("POINTS:"); Point3D r = new Point3D(3, 3, 3); Console.WriteLine(DistanceCalculator3D.CalculateDistanceBetween(r, Point3D.PointO)); Console.WriteLine(Point3D.PointO + "\n" + r); Console.WriteLine("\nPATH AND STORAGE"); // path Path p = new Path(new Point3D(1, 2, 3), new Point3D(0, 2, 2), new Point3D(4, -4, 4)); Console.WriteLine(p); // store Console.WriteLine("{0}", PathStorage.TryStore(p) ? string.Format("Path stored successfully in {0}", PathStorage.LastPath) : "Path couldn't be stored."); // LIST DEMO Console.WriteLine("\n\nGENERICLIST DEMO"); GenericList <Point3D> path = new GenericList <Point3D>(); // add some lots of stuff inside Console.WriteLine("Adding some elements:"); for (int i = 0; i < 1000000; i++) { path.Add(new Point3D(i, i % 5, Math.Sqrt(i * i * i))); } // Remove some elements at random Console.WriteLine("Removing some stuff."); Random rng = new Random(); for (int i = 700000; i >= 0; i--) { path.RemoveAt(rng.Next(0, 300000 + i), false); // don't keep the order, its gonna take forever! } // version test Console.WriteLine("Version of GenericList class is {0}", typeof(GenericList <Point3D>).GetCustomAttribute <Version>()); //test min/max Console.WriteLine("\nCreating new list with some numbers:"); GenericList <int> numbers = new GenericList <int>(); for (int i = 0; i < 20; i++) { numbers.Add(i % 2 == 0 ? i + 1 : (-i)); } for (int i = 0; i < numbers.Count; i++) { Console.Write(numbers[i] + ","); } numbers.RemoveAt(5, false); for (int i = 0; i < numbers.Count; i++) { Console.Write(numbers[i] + ","); } Console.WriteLine("Min:{0} , Max:{1}", numbers.Min(), numbers.Max()); // MATRICES DEMO Console.WriteLine("\nMATRICES DEMO"); var arr = new int[, ] { { -1, 2, -3, -4, -5, 6 }, { 1, -2, 3, 4, -5, 6 }, { 1, 2, 3, 4, 5, 6 }, { 1, -2, 3, 4, -5, 6 }, { 1, 2, -3, 4, 5, 6 }, }; var zero = new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, }; var arr2 = new double[, ] { { 1.3, 1.2, -1.7, 1, 1.9, 1 }, { 1.3, 1.2, -1.7, 1, 1.9, 1 }, { 1.3, 1.2, -1.7, 1, 1.9, 1 }, { 1.3, 1.2, -1.7, 1, 1.9, 1 }, { 1.3, 1.2, -1.7, 1, 1, 1.1 }, { 1.3, 1.2, -1.7, 1, 1, 1.1 }, }; // creating matrices Matrix <int> n = new Matrix <int>(zero); Matrix <int> m = new Matrix <int>(arr); // true and false var ismtrue = m ? true : false; var isntrue = n ? true : false; // print true and false Console.WriteLine(ismtrue); Console.WriteLine(isntrue); // test operations Console.WriteLine("Addition \n{0}", m + m); Console.WriteLine("Substraction \n{0}", m - m); Console.WriteLine("Multiplication \n{0}", new Matrix <double>(arr2) * new Matrix <double>(arr2)); }