Ejemplo n.º 1
0
        /* Create a Point at 10,10,10
         * then Add a Reference AxisSystem
         * then then Update the Values to 12,23,34
         * then Remove the Reference AxisSystem*/
        public void PointByCoordinatesTest8()
        {
            // Create an instance of the IPointByCoordinates
            IPointByCoordinates PointByCoordinates = this._WireframeFactory.AddNewPointCoord(10, 10, 10);

            // Create ReferenceAxisSystem
            IAxisSystemBase3D RefAxisSystem = new AxisSystemBase3D();

            RefAxisSystem.Origin = this._WireframeFactory.AddNewPointCoord(20, 20, 20);
            RefAxisSystem.XAxis  = new VectorBase3D(0.707106, 0.707106, 0);
            RefAxisSystem.YAxis  = new VectorBase3D(-0.707106, 0.707106, 0);
            RefAxisSystem.ZAxis  = new VectorBase3D(0, 0, 1);

            // Set the ReferenceAxisSystem
            PointByCoordinates.AddRefAxisSystem(RefAxisSystem);

            // Update Point Locations
            PointByCoordinates.SetCoordinates(new double[] { 12, 23, 34 });


            // Remove the Referene AxisSystem
            PointByCoordinates.RemoveRefAxisSystem();

            // Test the Point X,Y,Z Values
            PointByCoordinates.X.Should().Be(12);
            PointByCoordinates.Y.Should().Be(23);
            PointByCoordinates.Z.Should().Be(34);
        }
Ejemplo n.º 2
0
        /* Create a Point at 10,10,10
         * then Add a Reference AxisSystem*/
        public void PointByCoordinatesTest6()
        {
            // Create an instance of the IPointByCoordinates
            IPointByCoordinates PointByCoordinates = this._WireframeFactory.AddNewPointCoord(10, 10, 10);

            // Create ReferenceAxisSystem
            IAxisSystemBase3D RefAxisSystem = new AxisSystemBase3D();

            RefAxisSystem.Origin = this._WireframeFactory.AddNewPointCoord(20, 20, 20);
            RefAxisSystem.XAxis  = new VectorBase3D(0.707106, 0.707106, 0);
            RefAxisSystem.YAxis  = new VectorBase3D(-0.707106, 0.707106, 0);
            RefAxisSystem.ZAxis  = new VectorBase3D(0, 0, 1);

            // Set the ReferenceAxisSystem
            PointByCoordinates.AddRefAxisSystem(RefAxisSystem);

            // Test the Point X,Y,Z Values
            PointByCoordinates.X.Should().Be(20);
            Math.Round(PointByCoordinates.Y, 3).Should().Be(34.142);
            PointByCoordinates.Z.Should().Be(30);
        }
Ejemplo n.º 3
0
        /* Create a Point at 10,10,10
         * then Add a Reference AxisSystem
         * then Add a Reference Point at 20,20,20, to Throw Exception
         */
        public void PointByCoordinatesTest10()
        {
            // Create an instance of the IPointByCoordinates
            IPointByCoordinates PointByCoordinates = this._WireframeFactory.AddNewPointCoord(10, 10, 10);

            // Create ReferenceAxisSystem
            IAxisSystemBase3D RefAxisSystem = new AxisSystemBase3D();

            RefAxisSystem.Origin = this._WireframeFactory.AddNewPointCoord(20, 20, 20);
            RefAxisSystem.XAxis  = new VectorBase3D(0.707106, 0.707106, 0);
            RefAxisSystem.YAxis  = new VectorBase3D(-0.707106, 0.707106, 0);
            RefAxisSystem.ZAxis  = new VectorBase3D(0, 0, 1);

            // Set the ReferenceAxisSystem
            PointByCoordinates.AddRefAxisSystem(RefAxisSystem);

            // Create ReferencePoint
            IPointByCoordinates RefPointByCoordinates = this._WireframeFactory.AddNewPointCoord(20, 20, 20);

            //Set the ReferencePoint
            Action comparison = () => { PointByCoordinates.AddRefPoint(RefPointByCoordinates); };

            comparison.Should().Throw <Exception>();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // Create an Instance of the Factory
            WireframeFactory WireframeFactory = new WireframeFactory();

            // Create an instance of the IPointByCoordinates
            IPointByCoordinates PointByCoordinates = WireframeFactory.AddNewPointCoord(10, 10, 10);

            // Create ReferencePoint
            IPointByCoordinates RefPointByCoordinates = WireframeFactory.AddNewPointCoord(20, 20, 20);

            //Set the ReferencePoint
            PointByCoordinates.AddRefPoint(RefPointByCoordinates);

            // Update Point Locations
            PointByCoordinates.SetCoordinates(new double[] { 12, 23, 34 });

            // Remove Reference Point
            PointByCoordinates.RemoveRefPoint();

            // Update Point Locations
            PointByCoordinates.SetCoordinates(new double[] { 10, 10, 10 });

            // Create ReferenceAxisSystem
            IAxisSystemBase3D RefAxisSystem = new AxisSystemBase3D();

            RefAxisSystem.Origin = WireframeFactory.AddNewPointCoord(20, 20, 20);
            RefAxisSystem.XAxis  = new VectorBase3D(0.707106781, 0.707106781, 0);
            RefAxisSystem.YAxis  = new VectorBase3D(-0.707106781, 0.707106781, 0);
            RefAxisSystem.ZAxis  = new VectorBase3D(0, 0, 1);

            // Set the ReferenceAxisSystem
            PointByCoordinates.AddRefAxisSystem(RefAxisSystem);

            // Update Point Locations
            PointByCoordinates.SetCoordinates(new double[] { 12, 23, 34 });

            try
            {
                //Set the ReferencePoint
                PointByCoordinates.AddRefPoint(RefPointByCoordinates);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }

            // Remove the Referene AxisSystem
            PointByCoordinates.RemoveRefAxisSystem();

            //Set the ReferencePoint
            PointByCoordinates.AddRefPoint(RefPointByCoordinates);

            try
            {
                // Set the ReferenceAxisSystem
                PointByCoordinates.AddRefAxisSystem(RefAxisSystem);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }