コード例 #1
0
        public double Hor(DrawingContext dc, Target TargetA, Target TargetB, bool show)
        {
            //3D
            Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, TargetA.point3D().Z - TargetB.point3D().Z);
            Vector3D vectorB = new Vector3D(0, 1, 0);

            //2D
            //Vector3D vectorA = new Vector3D(TargetA.point2D().X - TargetB.point2D().X, TargetA.point2D().Y - TargetB.point2D().Y, 0);
            //Vector3D vectorB = new Vector3D(1, 0, 0);

            double theta = Math.Abs(Vector3D.AngleBetween(vectorA, vectorB));
            theta = 90 - theta;
            //if (TargetA.point3D().Y < TargetB.point3D().Y) theta = -theta;

            if (show)       //show angle text
            {
                dc.DrawText(new FormattedText(theta.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushDeepSkyBlue),
                new Point(TargetB.point2D().X - 35, TargetB.point2D().Y - 35));

                dc.DrawLine(PenDeepSkyBlue, TargetA.point2D(), TargetB.point2D());    //show angle line 
                dc.DrawLine(PenDeepSkyBlue, new Point(TargetA.point2D().X, TargetB.point2D().Y), TargetB.point2D());
            }
            return theta;
        }
コード例 #2
0
        public double Ver(DrawingContext dc, Target TargetA, Target TargetB, bool show)
        {
            //3D
            Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, 0);// TargetA.point3D().Z - TargetB.point3D().Z);
            Vector3D vectorB = new Vector3D(0, 1, 0);

            //2D
            //Vector3D vectorA = new Vector3D(TargetA.point2D().X - TargetB.point2D().X, TargetA.point2D().Y - TargetB.point2D().Y, 0);
            //Vector3D vectorB = new Vector3D(0, TargetA.point2D().Y - TargetB.point2D().Y, 0);

            double theta = Math.Abs(Vector3D.AngleBetween(vectorA, vectorB));
            if (TargetA.point3D().X < TargetB.point3D().X) theta = -theta;

            if (show)       //show angle text
            {
                dc.DrawText(new FormattedText(theta.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushLemonChiffon),
                new Point(TargetB.point2D().X - 35, TargetB.point2D().Y - 35));

                dc.DrawLine(PenLemonChiffon, TargetA.point2D(), TargetB.point2D());    //show angle line 
                //dc.DrawLine(PenLemonChiffon, new Point(TargetB.point2D().X, TargetA.point2D().Y), new Point(TargetB.point2D().X, TargetB.point2D().Y));  //show Vertical line
            }
            return theta;
        }
コード例 #3
0
 public Vector3D TwoPointVector(Target TargetA, Target TargetB, DrawingContext dc, bool show)
 {
     Vector3D vectorC = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, TargetA.point3D().Z - TargetB.point3D().Z);
     if (show)
     {
         dc.DrawText(new FormattedText(vectorC.X.ToString("f2") + ", " + vectorC.Y.ToString("f2") + ", " + vectorC.Z.ToString("f2"),
            CultureInfo.GetCultureInfo("en-us"),
            FlowDirection.LeftToRight,
            new Typeface("Verdana"),
            25, brushDeepSkyBlue),
            new Point(TargetB.point2D().X + 20, TargetB.point2D().Y + 20));
     }
     return vectorC;
     //dc.DrawLine(PenDeepSkyBlue, TargetB.point2D(), TargetA.point2D());    //show angle line 
     //dc.DrawLine(PenDeepSkyBlue, TargetB.point2D(), TargetC.point2D());
 }
コード例 #4
0
        public double TrunkSpin(DrawingContext dc, Target TargetA, Target TargetB)
        {
            Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, 0, TargetA.point3D().Z - TargetB.point3D().Z);
            Vector3D vectorB = new Vector3D(-1, 0, 0);

            double theta = Vector3D.AngleBetween(vectorA, vectorB);

            if (TargetA.point3D().Z > TargetB.point3D().Z)
                theta = -theta;

            dc.DrawText(new FormattedText(theta.ToString("f0"),
            CultureInfo.GetCultureInfo("en-us"),
            FlowDirection.LeftToRight,
            new Typeface("Verdana"),
            25, brushGreenYellow),
            new Point(TargetB.point2D().X - 35, TargetB.point2D().Y - 35));

            return theta;

        }
コード例 #5
0
        public VerticalData VerticalDistance(DrawingContext dc, Target TargetA, Target TargetB, double FootCenter3DX, double FootCenter2DX, bool show)
        {
            double AC = Math.Ceiling(Math.Sqrt(Math.Pow(TargetA.point3D().X - FootCenter3DX, 2)) * 100);
            double BC = Math.Ceiling(Math.Sqrt(Math.Pow(TargetB.point3D().X - FootCenter3DX, 2)) * 100);
            double CC = (TargetA.point3D().Y - TargetB.point3D().Y) * 100;
            VerticalData abc = new VerticalData();
            abc.Right = AC;
            abc.Left = BC;
            abc.Mid = CC;

            if (show)       //show angle text
            {
                dc.DrawText(new FormattedText(AC.ToString("f0"), //AC
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushLightGreen),
                new Point(TargetA.point2D().X - 35, TargetA.point2D().Y - 25));

                dc.DrawText(new FormattedText(BC.ToString("f0"), //BC
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushLightGreen),
                new Point(TargetB.point2D().X, TargetB.point2D().Y - 25));

                dc.DrawText(new FormattedText(CC.ToString("f0"), //CC
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushLightGreen),
                new Point(FootCenter2DX - 10, TargetB.point2D().Y / 2 + TargetA.point2D().Y / 2));

                dc.DrawLine(PenLightGreen, TargetA.point2D(), new Point(FootCenter2DX, TargetA.point2D().Y)); //AC 
                dc.DrawLine(PenLightGreen, TargetB.point2D(), new Point(FootCenter2DX, TargetB.point2D().Y)); //BC 
                dc.DrawLine(PenLightGreen, new Point(FootCenter2DX, TargetA.point2D().Y), new Point(FootCenter2DX, TargetB.point2D().Y));  //CC

            }
            return abc;
        }
コード例 #6
0
        public double Length(DrawingContext dc, Target TargetA, Target TargetB)
        {
            double AA = Math.Ceiling(Math.Sqrt((Math.Pow(TargetA.point3D().X - TargetB.point3D().X, 2) + Math.Pow(TargetA.point3D().Y - TargetB.point3D().Y, 2) + Math.Pow(TargetA.point3D().Z - TargetB.point3D().Z, 2))) * 100);
            dc.DrawLine(PenYellow, TargetA.point2D(), TargetB.point2D());
            dc.DrawText(new FormattedText(AA.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushYellow),
                new Point(TargetB.point2D().X - 55, TargetB.point2D().Y - 15));
            return AA;

        }
コード例 #7
0
        public double threePts(DrawingContext dc, Target TargetA, Target TargetB, Target TargetC, bool show)
        {
            //Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, TargetA.point3D().Z - TargetB.point3D().Z);
            //Vector3D vectorB = new Vector3D(TargetB.point3D().X - TargetC.point3D().X, TargetB.point3D().Y - TargetC.point3D().Y, TargetB.point3D().Z - TargetC.point3D().Z);

            Vector3D vectorA = new Vector3D(TargetA.point2D().X - TargetB.point2D().X, TargetA.point2D().Y - TargetB.point2D().Y, 0);
            Vector3D vectorB = new Vector3D(TargetB.point2D().X - TargetC.point2D().X, TargetB.point2D().Y - TargetC.point2D().Y, 0);


            double theta = Math.Abs(180 - Vector3D.AngleBetween(vectorA, vectorB));


            if (show)       //show angle text
            {
                dc.DrawText(new FormattedText(theta.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushYellow),
                new Point(TargetB.point2D().X - 55, TargetB.point2D().Y - 15));

                dc.DrawLine(PenYellow, TargetA.point2D(), TargetB.point2D());    //show angle line 
                dc.DrawLine(PenYellow, TargetB.point2D(), TargetC.point2D());
            }
            return theta;
        }
コード例 #8
0
        public double twoLines(DrawingContext dc, Target TargetA, Target TargetB, Target TargetC, Target TargetD, bool show)
        {
            //3D
            //Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, TargetA.point3D().Z - TargetB.point3D().Z);
            //Vector3D vectorB = new Vector3D(TargetC.point3D().X - TargetD.point3D().X, TargetC.point3D().Y - TargetD.point3D().Y, TargetC.point3D().Z - TargetD.point3D().Z);

            //2D
            Vector3D vectorA = new Vector3D(TargetA.point2D().X - TargetB.point2D().X, TargetA.point2D().Y - TargetB.point2D().Y, 0);
            Vector3D vectorB = new Vector3D(TargetC.point2D().X - TargetD.point2D().X, TargetC.point2D().Y - TargetD.point2D().Y, 0);

            double theta = Math.Abs(Vector3D.AngleBetween(vectorA, vectorB));


            if (show)
            {
                dc.DrawText(new FormattedText(theta.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushOrange),
                new Point((TargetA.point2D().X + TargetB.point2D().X) / 2, (TargetA.point2D().Y + TargetC.point2D().Y - 40) / 2));

                dc.DrawLine(PenOrange, TargetA.point2D(), TargetB.point2D());    //show angle line 
                dc.DrawLine(PenOrange, TargetC.point2D(), TargetD.point2D());
            }
            return theta;
        }