Beispiel #1
0
        //calculate edgepoints from state position and radius
        public static EdgePoints GetEdgePoints(Point A, Point B, int Radius, int Radius2, double winkel)
        {
            var PointA = new Vector3D(A.X, A.Y, 0);
            var PointB = new Vector3D(B.X, B.Y, 0);

            Vector3D TempA;
            Vector3D TempB;
            Vector3D TempC;

            var tempVector = new Vector3D(VMath.PolarVVVV(PointA - PointB));                           //get Polar Values

            if (tempVector.y > 0)                                                                      // depending which quadrant of rotation
            {
                TempA = VMath.CartesianVVVV(tempVector.x + winkel, tempVector.y, 0 - Radius) + PointA; //minus Radius from Length > into Cartesian
                TempB = VMath.CartesianVVVV(tempVector.x - winkel, tempVector.y, Radius2) + PointB;    //Radius is Length > into Cartesian
            }
            else
            {
                TempA = VMath.CartesianVVVV(tempVector.x - winkel, tempVector.y, 0 - Radius) + PointA; //minus Radius from Length > into Cartesian
                TempB = VMath.CartesianVVVV(tempVector.x + winkel, tempVector.y, Radius2) + PointB;    //Radius is Length > into Cartesian
            }

            TempC = VMath.CartesianVVVV(VMath.PolarVVVV(TempA - TempB).x, VMath.PolarVVVV(TempA - TempB).y, 0 - VMath.PolarVVVV(TempA - TempB).z / 2.75) + TempA; // calculate center

            var myEdgeCoords = new EdgePoints
            {
                A      = new Point(Convert.ToInt16(TempA.x), Convert.ToInt16(TempA.y)), // create Point from Vector
                B      = new Point(Convert.ToInt16(TempB.x), Convert.ToInt16(TempB.y)), // create Point from Vector
                Center = new Point(Convert.ToInt16(TempC.x), Convert.ToInt16(TempC.y))
            };                                                                          // edgepoint definition

            return(myEdgeCoords);
        }