Exemplo n.º 1
0
        // Displays the values of the variables
        public void ShowVars()
        {
            Point3D p1 = new Point3D(10, 5, 1);

            Vector3D v1 = new Vector3D(20, 30, 40);
            Size3D s1 = new Size3D(2, 4, 6);
            Size3D s2 = new Size3D(5, 10, 15);

            // Displaying values in Text objects
            txtPoint1.Text = p1.ToString();
            txtVector1.Text = v1.ToString();
            txtSize1.Text = s1.ToString();
            txtSize2.Text = s2.ToString();
        }
Exemplo n.º 2
0
 public void BuildSlice( string imageSrc, double offsetZ )
 {
     Point3D p3D = new Point3D(0, 0, offsetZ);
     for (int x = 0; x < 3; x++)
     {
         for (int y = -1; y < 2; y++)
         {
             Ball ball = new Ball();
             ball.ImageSource = imageSrc;
             p3D.X = (x * 2.0) - 2.0;
             p3D.Y = (y * 2.0);
             ball.Offset = p3D;
             Console.WriteLine(p3D.ToString());
             _mv3D.Children.Add(ball);
         }
     }
 }
        private void SpaceCanvas_FingerUp(object sender, FingerEventArgs e)
        {
            if (grabButton.IsChecked)
            {
                if (e.FingerTracker.OnSurfaceFingers.Count() == 0)
                {
                    if (lastFingerUpPosition.HasValue)
                    {
                        Point3D center = new Point3D((lastFingerUpPosition.Value.X + e.Position.X) / 2, (lastFingerUpPosition.Value.Y + e.Position.Y) / 2, 0);

                        Canvas.SetLeft(highlightRect, Canvas.GetLeft(selectionRect));
                        Canvas.SetTop(highlightRect, Canvas.GetTop(selectionRect));
                        highlightRect.Width = selectionRect.Width;
                        highlightRect.Height = selectionRect.Height;
                        highlightRect.Opacity = 1.0;

                        SpaceProvider.GrabAt(center, (Action)delegate()
                        {
                            Trace.WriteLine("Grabbed image at " + center.ToString());
                            //move to somewhere else!!!
                            byte[] data;
                            string mime;
                            SpaceProvider.GetLastGrabbedImageData(out data, out mime);

                            Dispatcher.BeginInvoke((Action)delegate()
                            {
                                highlightRect.Opacity = 0;
                                gallery.AddImage(data, mime);
                            }, null);
                        });
                        //grabButton.IsChecked = false;
                    }


                    selectionRect.Opacity = 0;
                    lastFingerUpPosition = null;
                }
                else
                {
                    lastFingerUpPosition = e.Position;
                }
            }
            //Trace.WriteLine("FingerUp: " + e.ID.ToString() + " @ " + e.Position.ToString());
        }
        public void addRowTeeth(TeethVisual3D teeth, string type)
        {
            measurement.Type = Smile.TEETH;        
            string modified_date = DateTime.Today.ToString("dd-MM-yyyy");
                
            if (type == "man")
            {
                string[] separators = { ";" };
                string[] _startpoint = teeth.Model.StartPosition.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                string[] _endpoint = teeth.Model.EndPosition.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                //string spoint = String.Concat(String.Format("{0:0.00}", _startpoint[0]), ";", String.Format("{0:0.00}", _startpoint[1]), ";", String.Format("{0:0.00}", _startpoint[2]));
                //string epoint = String.Concat(String.Format("{0:0.00}", _endpoint[0]), ";", String.Format("{0:0.00}", _endpoint[1]), ";", String.Format("{0:0.00}", _endpoint[2]));
                Point3D spoint = new Point3D(Math.Round(Convert.ToDouble(_startpoint[0]), 2), Math.Round(Convert.ToDouble(_startpoint[1]), 2), Math.Round(Convert.ToDouble(_startpoint[2]), 2));
                Point3D epoint = new Point3D(Math.Round(Convert.ToDouble(_endpoint[0]), 2), Math.Round(Convert.ToDouble(_endpoint[1]), 2), Math.Round(Convert.ToDouble(_endpoint[2]), 2));

                MeasurementTeeth m = new MeasurementTeeth(teeth.Id, Math.Round(teeth.Model.Length, 2), spoint.ToString(), epoint.ToString(), type, modified_date, false);

                Mantooth.Add(m);
                resultDataGridMan.ItemsSource = null;
                resultDataGridMan.ItemsSource = Mantooth;
 
                resultDataGridMan.Columns[1].IsReadOnly = false;
            }
            else
            {
                string spoint = null; string epoint = null;
                MeasurementTeeth m = new MeasurementTeeth(teeth.Id, Math.Round(teeth.Model.Length, 2), spoint, epoint, type, modified_date, false);
                Autotooth.Add(m);
                resultDataGridAuto.ItemsSource = null;
                resultDataGridAuto.ItemsSource = Autotooth;
 
           
            }
            this.Show();
            return;

        }
Exemplo n.º 5
0
        // This method performs the Point operations
        public void PerformOperation(object sender, RoutedEventArgs e)
        {
            RadioButton li = (sender as RadioButton);

            // Strings used to display the results
            String syntaxString, resultType, operationString;

            // The local variables point1, point2, vector2, etc are defined in each
            // case block for readability reasons. Each variable is contained within
            // the scope of each case statement.
              switch (li.Name)
            {   //begin switch

                case "rb1":
                    {
                        // Converts a String to a Point using a PointConverter
                        // Returns a Point.

                        PointConverter pConverter = new PointConverter();
                        Point pointResult = new Point();
                        string string1 = "10,20";

                        pointResult = (Point)pConverter.ConvertFromString(string1);
                        // pointResult is equal to (10, 20)

                        // Displaying Results
                        syntaxString = "pointResult = (Point)pConverter1.ConvertFromString(string1);";
                        resultType = "Point";
                        operationString = "Converting a String to a Point";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb2":
                    {
                        // Converts a String to a Vector using a VectorConverter
                        // Returns a Vector.

                        VectorConverter vConverter = new VectorConverter();
                        Vector vectorResult = new Vector();
                        string string1 = "10,20";

                        vectorResult = (Vector)vConverter.ConvertFromString(string1);
                        // vectorResult is equal to (10, 20)

                        // Displaying Results
                        syntaxString = "vectorResult = (Vector)vConverter.ConvertFromString(string1);";
                        resultType = "Vector";
                        operationString = "Converting a String into a Vector";
                        ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb3":
                    {
                        // Converts a String to a Matrix using a MatrixConverter
                        // Returns a Matrix.

                        MatrixConverter mConverter = new MatrixConverter();
                        Matrix matrixResult = new Matrix();
                        string string2 = "10,20,30,40,50,60";

                        matrixResult = (Matrix)mConverter.ConvertFromString(string2);
                        // matrixResult is equal to (10, 20, 30, 40, 50, 60)

                        // Displaying Results
                        syntaxString = "matrixResult = (Vector)mConverter.ConvertFromString(string2);";
                        resultType = "Matrix";
                        operationString = "Converting a String into a Matrix";
                        ShowResults(matrixResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb4":
                    {
                        // Converts a String to a Point3D using a Point3DConverter
                        // Returns a Point3D.

                        Point3DConverter p3DConverter = new Point3DConverter();
                        Point3D point3DResult = new Point3D();
                        string string3 = "10,20,30";

                        point3DResult = (Point3D)p3DConverter.ConvertFromString(string3);
                        // point3DResult is equal to (10, 20, 30)

                        // Displaying Results
                        syntaxString = "point3DResult = (Point3D)p3DConverter.ConvertFromString(string3);";
                        resultType = "Point3D";
                        operationString = "Converting a String into a Point3D";
                        ShowResults(point3DResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb5":
                    {
                        // Converts a String to a Vector3D using a Vector3DConverter
                        // Returns a Vector3D.

                        Vector3DConverter v3DConverter = new Vector3DConverter();
                        Vector3D vector3DResult = new Vector3D();
                        string string3 = "10,20,30";

                        vector3DResult = (Vector3D)v3DConverter.ConvertFromString(string3);
                        // vector3DResult is equal to (10, 20, 30)

                        // Displaying Results
                        syntaxString = "vector3DResult = (Vector3D)v3DConverter.ConvertFromString(string3);";
                        resultType = "Vector3D";
                        operationString = "Converting a String into a Vector3D";
                        ShowResults(vector3DResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb6":
                    {
                        // Converts a String to a Size3D using a Size3DConverter
                        // Returns a Size3D.

                        Size3DConverter s3DConverter = new Size3DConverter();
                        Size3D size3DResult = new Size3D();
                        string string3 = "10,20,30";

                        size3DResult = (Size3D)s3DConverter.ConvertFromString(string3);
                        // size3DResult is equal to (10, 20, 30)

                        // Displaying Results
                        syntaxString = "size3DResult = (Size3D)v3DConverter.ConvertFromString(string3);";
                        resultType = "Size3D";
                        operationString = "Converting a String into a Size3D";
                        ShowResults(size3DResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb7":
                    {
                        // Converts a String to a Point4D using a Point4DConverter
                        // Returns a Point4D.

                        Point4DConverter p4DConverter = new Point4DConverter();
                        Point4D point4DResult = new Point4D();
                        string string4 = "10,20,30,40";

                        point4DResult = (Point4D)p4DConverter.ConvertFromString(string4);
                        // point4DResult is equal to (10, 20, 30)

                        // Displaying Results
                        syntaxString = "point4DResult = (Point4D)v3DConverter.ConvertFromString(string3);";
                        resultType = "Point4D";
                        operationString = "Converting a String into a Point4D";
                        ShowResults(point4DResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                    default:
                    break;

            } //end switch
        }
Exemplo n.º 6
0
        // Displays the values of the variables
        public void ShowVars()
        {
            Point3D p1 = new Point3D(10, 5, 1);
            Point3D p2 = new Point3D(15, 40, 60);

            Vector3D v1 = new Vector3D(20, 30, 40);
            Vector3D v2 = new Vector3D(45, 70, 80);

            Matrix3D m1 = new Matrix3D(10,10,10,0,20,20,20,0,30,30,30,0,5,10,15,1);

            // Displaying values in Text objects
            txtPoint1.Text = p1.ToString();
            txtPoint2.Text = p2.ToString();
            txtVector1.Text = v1.ToString();
            txtVector2.Text = v2.ToString();
            txtMatrix1.Text = m1.ToString();
        }
Exemplo n.º 7
0
        // This method performs the Point3D operations
        private void PerformOperation(object sender, RoutedEventArgs e)
        {
            RadioButton li = (sender as RadioButton);

            // Strings used to display the results
            String syntaxString, resultType, operationString;

            // The local variables point1, point2, vector2, etc are defined in each
            // case block for readability reasons. Each variable is contained within
            // the scope of each case statement.
            switch (li.Name)
            {   //begin switch

                case "rb1":
                    {
                        // Translates a Point3D by a Vector3D using the overloaded + operator.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Point3D pointResult = new Point3D();

                        pointResult = point1 + vector1;
                        // point3DResult is equal to (30, 35, 41)

                        // Displaying Results
                        syntaxString = "pointResult = point1 + vector1;";
                        resultType = "Point3D";
                        operationString = "Adding a 3D Point and a 3D Vector";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb2":
                    {
                        // Translates a Point3D by a Vector3D using the static Add method.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Point3D pointResult = new Point3D();

                        pointResult = Point3D.Add(point1, vector1);
                        // pointResult is equal to (30, 35, 41)

                        // Displaying Results
                        syntaxString = "pointResult = Point3D.Add(point1, vector1);";
                        resultType = "Point3D";
                        operationString = "Adding a 3D Point and a 3D Vector";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb3":
                    {
                        // Subtracts a Vector3D from a Point3D using the overloaded - operator.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Point3D pointResult = new Point3D();

                        pointResult = point1 - vector1;
                        // pointResult is equal to (-10, -25, -39)

                        // Displaying Results
                        syntaxString = "pointResult = point1 - vector1;";
                        resultType = "Point3D";
                        operationString = "Subtracting a Vector3D from a Point3D";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb4":
                    {
                        // Subtracts a Vector3D from a Point3D using the static Subtract method.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Point3D pointResult = new Point3D();

                        pointResult = Point3D.Subtract(point1, vector1);
                        // pointResult is equal to (-10, -25, -39)

                        // Displaying Results
                        syntaxString = "pointResult = Point3D.Subtract(point1, vector1);";
                        resultType = "Point3D";
                        operationString = "Subtracting a Vector3D from a Point3D";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb5":
                    {
                        // Subtracts a Point3D from a Point3D using the overloaded - operator.
                        // Returns a Vector3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Vector3D vectorResult = new Vector3D();

                        vectorResult = point1 - point2;
                        // vectorResult is equal to (-5, -35, -59)

                        // Displaying Results
                        syntaxString = " vectorResult = point1 - point2;";
                        resultType = "Vector3D";
                        operationString = "Subtracting a Point3D from a Point3D";
                        ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb6":
                    {
                        // Subtracts a Point3D from a Point3D using the static Subtract method.
                        // Returns a Vector3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Vector3D vectorResult = new Vector3D();

                        vectorResult = Point3D.Subtract(point1, point2);
                        // vectorResult is equal to (-5, -35, -59)

                        // Displaying Results
                        syntaxString = "vectorResult = Point3D.Subtract(point1, point2);";
                        resultType = "Vector3D";
                        operationString = "Subtracting a Point3D from a Point3D";
                        ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb7":
                    {
                        // Offsets the X, Y and Z values of a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);

                        point1.Offset(20, 30, 40);
                        // point1 is equal to (30, 35, 41)

                        // Note: This operation is equivalent to adding a point
                        // to vector with the corresponding X,Y, Z values.

                        // Displaying Results
                        syntaxString = "point1.Offset(20, 30, 40);";
                        resultType = "Point3D";
                        operationString = "Offsetting a Point3D";
                        ShowResults(point1.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb8":
                    {
                        // Multiplies a Point3D by a Matrix.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D pointResult = new Point3D();
                        Matrix3D matrix1 = new Matrix3D(10, 10, 10, 0, 20, 20, 20, 0, 30, 30, 30, 0, 5, 10, 15, 1);

                        pointResult = point1 * matrix1;
                        // pointResult is equal to (235, 240, 245)

                        // Displaying Results
                        resultType = "Point3D";
                        syntaxString = "pointResult = point1 * matrix1;";
                        operationString = "Multiplying a Point3D by a Matrix3D";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb9":
                    {
                        // Multiplies a Point3D by a Matrix.
                        // Returns a Point3D.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D pointResult = new Point3D();
                        Matrix3D matrix1 = new Matrix3D(10, 10, 10, 0, 20, 20, 20, 0, 30, 30, 30, 0, 5, 10, 15, 1);

                        pointResult = Point3D.Multiply(point1, matrix1);
                        // pointResult is equal to (235, 240, 245)

                        // Displaying Results
                        resultType = "Point3D";
                        syntaxString = "pointResult = Point3D.Multiply(point1, matrix1);";
                        operationString = "Multiplying a Point3D by a Matrix";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb10":
                    {
                        // Checks if two Point3Ds are equal using the overloaded equality operator.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Boolean areEqual;

                        areEqual = (point1 == point2);
                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = (point1 == point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two 3D points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb11":
                    {
                        // Checks if two Point3D structures are equal using the static Equals method.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Boolean areEqual;

                        areEqual = Point3D.Equals(point1, point2);
                        // areEqual is False

                        //Displaying Results
                        syntaxString = "areEqual = Point3D.Equals(point1, point2);";
                        resultType = "Boolean";
                        operationString = "Checking if 3D two points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }
                case "rb12":
                    {
                        // Compares an Object and a Point3D for equality using the non-static Equals method.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Boolean areEqual;

                        areEqual = point1.Equals(point2);
                        // areEqual is False.  point2 is a Point3D structure, but it is not equal to point1.

                        // Displaying Results
                        syntaxString = "areEqual = point1.Equals(point2);;";
                        resultType = "Boolean";
                        operationString = "Checking if two 3D points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb13":
                    {
                        // Converts a string representation of a 3-D point into a Point3D structure.

                        Point3D pointResult = new Point3D();

                        pointResult = Point3D.Parse("1,3,5");
                        // pointResult is equal to (1,3,5)

                        // Displaying Results
                        syntaxString = "ointResult = Point3D.Parse(\"1,3,5\");";
                        resultType = "Matrix";
                        operationString = "Converting a string into a Point3D structure.";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb14":
                    {
                        // Checks if two Point3Ds are not equal using the overloaded inequality operator.

                        Point3D point1 = new Point3D(10, 5, 1);
                        Point3D point2 = new Point3D(15, 40, 60);
                        Boolean areNotEqual;

                        areNotEqual = (point1 != point2);
                        // areNotEqual is True

                        // Displaying Results
                        syntaxString = "areNotEqual = (point1 != point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two 3D points are not equal";
                        ShowResults(areNotEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb15":
                    {
                        // Point3D Subtraction
                        // instantiate variables
                        Point3D point1 = new Point3D();
                        Point3D point2 = new Point3D(15, 40, 60);
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Point3D pointResult = new Point3D();
                        Vector3D vectorResult = new Vector3D();

                        // defining x,y,z of point1
                        point1.X = 10;
                        point1.Y = 5;
                        point1.Z = 1;

                        vectorResult = Point3D.Subtract(point1, point2);
                        // vectorResult is equal to (-5, -35, -39)

                        vectorResult = point2 - point1;
                        // vectorResult is equal to (5, 35, 59)

                        //pointResult = Point3D.Subtract(point1, vector1);
                        //  pointResult is equal to (-10, -25, -39)

                        pointResult = vector1 - point1;
                        //  pointResult is equal to (10, 25, 39)

                        // Displaying Results
                        syntaxString = "areNotEqual = (point1 != point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two 3D points are not equal";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                default:
                    break;
            } //end switch
        }
Exemplo n.º 8
0
        private void PerformOperation(object sender, RoutedEventArgs e)
        {
            RadioButton li = (sender as RadioButton);

            // Strings used to display the results
            String syntaxString, resultType, operationString;

            // The local variables point1, point2, vector2, etc are defined in each
            // case block for readability reasons. Each variable is contained within
            // the scope of each case statement.
            switch (li.Name)
            {   //begin switch

                case "rb1":
                    {
                        // Checks if two Size3D structures are equal using the static Equals method.
                        // Returns a Boolean.

                        // Declaring Size3D structure without initializing x,y,z values
                        Size3D size1 = new Size3D();

                        // Declaring Size3D structure and initializing x,y,z values
                        Size3D size2 = new Size3D(5, 10, 15);
                        Boolean areEqual;

                        // Assigning values to size1
                        size1.X = 2;
                        size1.Y = 4;
                        size1.Z = 6;

                        // checking for equality
                        areEqual = Size3D.Equals(size1, size2);

                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = Size3D.Equals(size1, size2);";
                        resultType = "Boolean";
                        operationString = "Checking if two Size3D structures are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }
                case "rb2":
                    {
                        // Checks if an Object and a Size3D structure are equal using the non-static Equals method.
                        // Returns a Boolean.

                        // Declaring Size3D structure without initializing x,y,z values
                        Size3D size1 = new Size3D();

                        // Declaring Size3D structure and initializing x,y,z values
                        Size3D size2 = new Size3D(5, 10, 15);
                        Boolean areEqual;

                        // Assigning values to size1
                        size1.X = 2;
                        size1.Y = 4;
                        size1.Z = 6;

                        areEqual = size1.Equals(size2);
                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = Size3D.Equals(size1, size2);";
                        resultType = "Boolean";
                        operationString = "Checking if an object and a Size3D structure are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb3":
                    {
                        // Checks if two Size3D structures are equal using the overloaded == operator.
                        // Returns a Boolean.

                        // Declaring Size3D structure without initializing x,y,z values
                        Size3D size1 = new Size3D();

                        // Declaring Size3D structure and initializing x,y,z values
                        Size3D size2 = new Size3D(5, 10, 15);
                        Boolean areEqual;

                        // Assigning values to size1
                        size1.X = 2;
                        size1.Y = 4;
                        size1.Z = 6;

                        // Checking for equality
                        areEqual = size1 == size2;

                        // areEqual is False

                        // Displaying Results
                        syntaxString = " areEqual = size1 == size2;";
                        resultType = "Boolean";
                        operationString = "Checking if two Size3D structures are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb4":
                    {
                        // Checks if two Size3D structures are not equal using the overloaded != operator.
                        // Returns a Boolean.

                        Size3D size1 = new Size3D(2, 4, 6);
                        Size3D size2 = new Size3D(5, 10, 15);
                        Boolean areNotEqual;

                        areNotEqual = size1 != size2;
                        // areNotEqual is True

                        // Displaying Results
                        syntaxString = "areNotEqual = size1 != size2;";
                        resultType = "Boolean";
                        operationString = "Checking if two Size3D structures are not equal";
                        ShowResults(areNotEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb5":
                    {
                        // Converts a string representation of a 3-D size into a Size3D structure.

                        Size3D sizeResult = new Size3D();

                        sizeResult = Size3D.Parse("10,20,30");
                        // sizeResult is equal to (10,20,30)

                        // Displaying Results
                        syntaxString = "sizeResult = Size3D.Parse(\"10,20,30\");";
                        resultType = "Size3D";
                        operationString = "Converting a string into a Size3D structure";
                        ShowResults(sizeResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb6":
                    {
                        // Explicitly converts a Size3D structure into a Vector3D structure
                        // Returns a Vector3D.

                        Size3D size1 = new Size3D(2, 4, 6);
                        Vector3D vector1 = new Vector3D();

                        vector1 = (Vector3D)size1;
                        // vector1 is equal to (2, 4, 6)

                        // Displaying Results
                        syntaxString = "vector1 = (Vector3D)size1;";
                        resultType = "Vector3D";
                        operationString = "Expliciting casting a Size3D into a Vector3D";
                        ShowResults(vector1.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb7":
                    {
                        // Explicitly converts a Size3D structure into a Point3D structure
                        // Returns a Vector3D.

                        Size3D size1 = new Size3D(2, 4, 6);
                        Point3D point1 = new Point3D();

                        point1 = (Point3D)size1;
                        // point1 is equal to (2, 4, 6)

                        // Displaying Results
                        syntaxString = "point1 = (Point3D)size1;";
                        resultType = "Point3D";
                        operationString = "Expliciting casting a Size3D into a Point3D";
                        ShowResults(point1.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb8":
                    {
                        // Checks if a Size3D structure is empty
                        // Returns Boolean

                        Size3D size1 = new Size3D(0, 0, 0);
                        Boolean isEmpty;

                        isEmpty = size1.IsEmpty;
                        // isEmpty is False

                        // Displaying Results
                        syntaxString = "isEmpty = size1.IsEmpty;";
                        resultType = "Boolean";
                        operationString = "Checking if a Size3D structure is empty";
                        ShowResults(isEmpty.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb9":
                    {
                        // Gets an empty Size3D structure
                        Size3D size1 = new Size3D(2, 4, 6);

                        size1 = Size3D.Empty;
                        // size1 is now empty

                        // Displaying Results
                        syntaxString = "size1 = Size3D.Empty;";
                        resultType = "Size3D";
                        operationString = "Getting an empty Size3D structure";
                        ShowResults(size1.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb10":
                    {
                        // Gets a string representation of a Size3D Structure

                        Size3D size1 = new Size3D(2,4,6);
                        String sizeString;

                        sizeString = size1.ToString();
                        // sizeString is equal to "2,4,6"

                        // Displaying Results
                        resultType = "String";
                        syntaxString = "sizeString = size1.ToString();";
                        operationString = "Getting the ToString of size1";
                        ShowResults(sizeString.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb11":
                    {
                        // Gets the hashcode of a Size3D Structure

                        Size3D size1 = new Size3D(2, 4, 6);
                        int sizeHashcode;

                        sizeHashcode = size1.GetHashCode();

                        // Displaying Results
                        resultType = "int";
                        syntaxString = "sizeHashcode = size1.GetHashCode;";
                        operationString = "Getting the hashcode of size1";
                        ShowResults(sizeHashcode.ToString(), syntaxString, resultType, operationString);
                        break;
                    }
                default:
                    break;

            } //end switch
        }
Exemplo n.º 9
0
 /// <summary>
 /// XmlWriterに要素を書き出します。
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="localName"></param>
 /// <param name="value"></param>
 public static void Write(XmlWriter writer, string localName, Point3D value)
 {
   if (value.X == double.NaN) return;
   writer.WriteAttributeString(localName, value.ToString());
 }
        private void BuildTree(Point3D currentPoint)
        {
            ++_CurrentDepth;

            Point3D startPoint = currentPoint;
            foreach (MovingDirection direction in Directions)
            {
                if (MovingActions[direction](ref currentPoint))
                {
                    _CurrentNode.Nodes.Add(new TreeNode(direction.ToString()) { Tag = currentPoint.ToString() });

                    lock (SynchronizationObject)
                    {
                        if (_CurrentDepth < MaxDepth)
                        {
                            _CurrentNode = _CurrentNode.LastNode;
                            BuildTree(currentPoint);
                            _CurrentNode = _CurrentNode.Parent;
                            --_CurrentDepth;
                        }
                        else if (IsCanseRequested) return;
                    }
                }
                currentPoint = startPoint;
            }
        }
        private void LoadMeasurementGrid(string measurement_id)
        {
            List<MeasurementTeeth> t = DB.SelectTeethById(measurement_id);

            MainWindow mw = new MainWindow();
            for (int i = 0; i < t.Count; i++)
            {

               
                
                if (t[i].Type == "man")
                {
                    string[] separators = { ";" };
                    string[] _startpoint = t[i].SPoint.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    string[] _endpoint = t[i].EPoint.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                    Point3D spoint = new Point3D(Convert.ToDouble(_startpoint[0]), Convert.ToDouble(_startpoint[1]), Convert.ToDouble(_startpoint[2]));
                    Point3D epoint = new Point3D(Convert.ToDouble(_endpoint[0]), Convert.ToDouble(_endpoint[1]), Convert.ToDouble(_endpoint[2]));

                    Mantooth.Add(new MeasurementTeeth(t[i].Identity, Math.Round(t[i].Length, 2), spoint.ToString(), epoint.ToString(), t[i].Type,t[i].ModifiedDate.ToString(),true));

                }
                else 
                {
                    string spoint = null; string epoint = null;
                    Autotooth.Add(new MeasurementTeeth(t[i].Identity, Math.Round(t[i].Length, 2), spoint, epoint, t[i].Type, t[i].ModifiedDate.ToString(), true));
                }
                
                //mw.createLine(spoint,epoint);
            }

            resultDataGridMan.ItemsSource = null;
            resultDataGridMan.ItemsSource = Mantooth;

            resultDataGridAuto.ItemsSource = null;
            resultDataGridAuto.ItemsSource = Autotooth;

        }
Exemplo n.º 12
0
        /// <summary> 
        /// Calculates the value this animation believes should be the current value for the property.
        /// </summary>
        /// <param name="defaultOriginValue">
        /// This value is the suggested origin value provided to the animation 
        /// to be used if the animation does not have its own concept of a
        /// start value. If this animation is the first in a composition chain 
        /// this value will be the snapshot value if one is available or the 
        /// base property value if it is not; otherise this value will be the
        /// value returned by the previous animation in the chain with an 
        /// animationClock that is not Stopped.
        /// </param>
        /// <param name="defaultDestinationValue">
        /// This value is the suggested destination value provided to the animation 
        /// to be used if the animation does not have its own concept of an
        /// end value. This value will be the base value if the animation is 
        /// in the first composition layer of animations on a property; 
        /// otherwise this value will be the output value from the previous
        /// composition layer of animations for the property. 
        /// </param>
        /// <param name="animationClock">
        /// This is the animationClock which can generate the CurrentTime or
        /// CurrentProgress value to be used by the animation to generate its 
        /// output value.
        /// </param> 
        /// <returns> 
        /// The value this animation believes should be the current value for the property.
        /// </returns> 
        protected override Point3D GetCurrentValueCore(Point3D defaultOriginValue, Point3D defaultDestinationValue, AnimationClock animationClock)
        {
            Debug.Assert(animationClock.CurrentState != ClockState.Stopped);
 
            if (!_isAnimationFunctionValid)
            { 
                ValidateAnimationFunction(); 
            }
 
            double progress = animationClock.CurrentProgress.Value;

            IEasingFunction easingFunction = EasingFunction;
            if (easingFunction != null) 
            {
                progress = easingFunction.Ease(progress); 
            } 

            Point3D   from        = new Point3D(); 
            Point3D   to          = new Point3D();
            Point3D   accumulated = new Point3D();
            Point3D   foundation  = new Point3D();
 
            // need to validate the default origin and destination values if
            // the animation uses them as the from, to, or foundation values 
            bool validateOrigin = false; 
            bool validateDestination = false;
 
            switch(_animationType)
            {
                case AnimationType.Automatic:
 
                    from    = defaultOriginValue;
                    to      = defaultDestinationValue; 
 
                    validateOrigin = true;
                    validateDestination = true; 

                    break;

                case AnimationType.From: 

                    from    = _keyValues[0]; 
                    to      = defaultDestinationValue; 

                    validateDestination = true; 

                    break;

                case AnimationType.To: 

                    from = defaultOriginValue; 
                    to = _keyValues[0]; 

                    validateOrigin = true; 

                    break;

                case AnimationType.By: 

                    // According to the SMIL specification, a By animation is 
                    // always additive.  But we don't force this so that a 
                    // user can re-use a By animation and have it replace the
                    // animations that precede it in the list without having 
                    // to manually set the From value to the base value.

                    to          = _keyValues[0];
                    foundation  = defaultOriginValue; 

                    validateOrigin = true; 
 
                    break;
 
                case AnimationType.FromTo:

                    from    = _keyValues[0];
                    to      = _keyValues[1]; 

                    if (IsAdditive) 
                    { 
                        foundation = defaultOriginValue;
                        validateOrigin = true; 
                    }

                    break;
 
                case AnimationType.FromBy:
 
                    from    = _keyValues[0]; 
                    to      = AnimatedTypeHelpers.AddPoint3D(_keyValues[0], _keyValues[1]);
 
                    if (IsAdditive)
                    {
                        foundation = defaultOriginValue;
                        validateOrigin = true; 
                    }
 
                    break; 

                default: 

                    Debug.Fail("Unknown animation type.");

                    break; 
            }
 
            if (validateOrigin 
                && !AnimatedTypeHelpers.IsValidAnimationValuePoint3D(defaultOriginValue))
            { 
                throw new InvalidOperationException(
                    SR.Get(
                        SRID.Animation_Invalid_DefaultValue,
                        this.GetType(), 
                        "origin",
                        defaultOriginValue.ToString(CultureInfo.InvariantCulture))); 
            } 

            if (validateDestination 
                && !AnimatedTypeHelpers.IsValidAnimationValuePoint3D(defaultDestinationValue))
            {
                throw new InvalidOperationException(
                    SR.Get( 
                        SRID.Animation_Invalid_DefaultValue,
                        this.GetType(), 
                        "destination", 
                        defaultDestinationValue.ToString(CultureInfo.InvariantCulture)));
            } 


            if (IsCumulative)
            { 
                double currentRepeat = (double)(animationClock.CurrentIteration - 1);
 
                if (currentRepeat > 0.0) 
                {
                    Point3D accumulator = AnimatedTypeHelpers.SubtractPoint3D(to, from); 

                    accumulated = AnimatedTypeHelpers.ScalePoint3D(accumulator, currentRepeat);
                }
            } 

            // return foundation + accumulated + from + ((to - from) * progress) 
 
            return AnimatedTypeHelpers.AddPoint3D(
                foundation, 
                AnimatedTypeHelpers.AddPoint3D(
                    accumulated,
                    AnimatedTypeHelpers.InterpolatePoint3D(from, to, progress)));
        }