internal GeoCoordinate getGPSforTest(GeoCoordinate old, int forward, DirectionY dirY, int side, DirectionX dirX)
        {
            double lat = old.Latitude;
            double lon = old.Longitude;

            if (dirY == DirectionY.North)
            {
                lat += ((double)forward / (100000.0));
                if (dirX == DirectionX.West)
                {
                    lon = lon - ((double)side / (100000.0));
                }
                else
                {
                    lon = lon + ((double)side / (100000.0));
                }
            }
            else  //South
            {
                lat = lat - ((double)forward / (100000.0));

                if (dirX == DirectionX.West)
                {
                    lon = lon + ((double)side / (100000.0));
                }
                else
                {
                    lon = lon - ((double)side / (100000.0));
                }
            }

            return(new GeoCoordinate(lat, lon));  // Return new location
        }
        internal double calc360Angle(DirectionX xDir, DirectionY yDir, double theta)
        {
            double angle;

            if (xDir == DirectionX.East)
            {
                angle = 90 - theta;   // North or south since eastSouth = neg Tan theta
                if (angle < 0)
                {
                    angle += 360;
                }
            }
            else
            {
                if (yDir == DirectionY.North)
                {
                    angle = 270 + theta;
                }
                else
                {
                    angle = 270 - theta;    // South
                }
            }
            return(angle);
        }
Пример #3
0
 internal void Write(EndianBinaryWriter writer)
 {
     AnchorZ.Write(writer);
     PositionZ.Write(writer);
     DirectionX.Write(writer);
     DirectionY.Write(writer);
     DirectionZ.Write(writer);
     RotationX.Write(writer);
     RotationY.Write(writer);
     ScaleZ.Write(writer);
 }
Пример #4
0
        public YanagisawaPicLoader(byte[] bytesImageCompressed, PixelOrder orderPixelExtracted = PixelOrder.ARGB, DirectionY directionY = DirectionY.BottomToTop)
        {
            this.bytesImageCompressed = bytesImageCompressed;
            bool result = this.parseHeader();

            this.bytesImageExtracted = new byte[this.width * this.height * 4];
//			this.bytesImageExtracted = new byte[this.width * 4];

            this.orderPixel = orderPixelExtracted;
            this.directionY = directionY;
        }
Пример #5
0
 internal void Read(EndianBinaryReader reader)
 {
     AnchorZ.Read(reader);
     PositionZ.Read(reader);
     DirectionX.Read(reader);
     DirectionY.Read(reader);
     DirectionZ.Read(reader);
     RotationX.Read(reader);
     RotationY.Read(reader);
     ScaleZ.Read(reader);
 }
Пример #6
0
            internal List <Tuple <String, String> > GetAttributes()
            {
                var res = new List <Tuple <String, String> >();

                res.Add(new Tuple <String, String>("pole", Pole == PoleType.Left ? "left" : "right"));
                res.Add(new Tuple <String, String>("direction_x", DirectionX.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("direction_y", DirectionY.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("direction_z", DirectionZ.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("length", Length.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("state", State == MTState.Polymerization
                                                            ? "polymerization"
                                                            : "depolymerization"));
                return(res);
            }
Пример #7
0
 public void SetDirectionY()
 {
     if (incrementY < 0)
     {
         directionY = DirectionY.Up;
     }
     else if (incrementY > 0)
     {
         directionY = DirectionY.Down;
     }
     else
     {
         directionY = DirectionY.Neutral;
     }
 }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        if (directionY != DirectionY.none)
        {
            Vector3 target = transform.position;
            if (directionY == DirectionY.up)
            {
                target = new Vector3(transform.position.x, transform.position.y, startY + offsetY);
                if (Vector3.Distance(transform.position, target) < 0.1f)
                {
                    directionY = DirectionY.down;
                }
            }
            else
            if (directionY == DirectionY.down)
            {
                target = new Vector3(transform.position.x, transform.position.y, startY - offsetY);
                if (Vector3.Distance(transform.position, target) < 0.1f)
                {
                    directionY = DirectionY.up;
                }
            }
            transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed);
        }

        if (directionX != DirectionX.none)
        {
            Vector3 target = transform.position;
            if (directionX == DirectionX.left)
            {
                target = new Vector3(startX - offsetX, transform.position.y, transform.position.z);
                if (Vector3.Distance(transform.position, target) < 0.1f)
                {
                    directionX = DirectionX.right;
                }
            }
            else
            if (directionX == DirectionX.right)
            {
                target = new Vector3(startX + offsetX, transform.position.y, transform.position.z);
                if (Vector3.Distance(transform.position, target) < 0.1f)
                {
                    directionX = DirectionX.left;
                }
            }
            transform.position = Vector3.MoveTowards(transform.position, target, Time.deltaTime * speed);
        }
    }
Пример #9
0
 internal void Read(EndianBinaryReader reader)
 {
     EyeX.Read(reader);
     EyeY.Read(reader);
     EyeZ.Read(reader);
     PositionX.Read(reader);
     PositionY.Read(reader);
     PositionZ.Read(reader);
     DirectionX.Read(reader);
     DirectionY.Read(reader);
     DirectionZ.Read(reader);
     RotationX.Read(reader);
     RotationY.Read(reader);
     RotationZ.Read(reader);
     Zoom.Read(reader);
 }
Пример #10
0
 internal void Write(EndianBinaryWriter writer)
 {
     EyeX.Write(writer);
     EyeY.Write(writer);
     EyeZ.Write(writer);
     PositionX.Write(writer);
     PositionY.Write(writer);
     PositionZ.Write(writer);
     DirectionX.Write(writer);
     DirectionY.Write(writer);
     DirectionZ.Write(writer);
     RotationX.Write(writer);
     RotationY.Write(writer);
     RotationZ.Write(writer);
     Zoom.Write(writer);
 }
        /// <summary>
        /// Gets the smallest correction required to resolve collisions along the Y axis.
        /// </summary>
        /// <param name="directionY">The direction along the Y axis to resolve.</param>
        /// <param name="correctionVectors">A list of CollisionVector2's detailing the resolutions required for all collisions that are occurring.</param>
        /// <returns>A CorrectionVector2 containing the smallest correction required.</returns>
        private CorrectionVector2 GetSmallestCorrectionY(DirectionY directionY, List <CorrectionVector2> correctionVectors)
        {
            CorrectionVector2 smallest = new CorrectionVector2();
            int i;

            smallest.Y = int.MaxValue;

            for (i = 0; i < correctionVectors.Count; i++)
            {
                if (correctionVectors[i].DirectionY == directionY && correctionVectors[i].Y != 0f && correctionVectors[i].Y < smallest.Y)
                {
                    smallest = correctionVectors[i];
                }
            }

            return(smallest);
        }
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                ComponentWithDirectionLogic comp = Owner as ComponentWithDirectionLogic;

                if (DirectionX.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.X)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction X");
                    comp.Direction = FaceDirection.X;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }

                if (DirectionY.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.Y)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction Y");
                    comp.Direction = FaceDirection.Y;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }

                if (DirectionZ.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.Z)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction Z");
                    comp.Direction = FaceDirection.Z;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
            }
            return(base.RespondToMouseDown(sender, e));
        }
Пример #13
0
        /// <summary>
        /// Gets the smallest correction required to resolve collisions along the Y axis.
        /// </summary>
        /// <param name="directionY">The direction along the Y axis to resolve.</param>
        /// <param name="correctionVectors">A list of CollisionVector2's detailing the resolutions required for all collisions that are occurring.</param>
        /// <returns>A CorrectionVector2 containing the smallest correction required.</returns>
        private CorrectionVector2 GetSmallestCorrectionY(DirectionY directionY, List<CorrectionVector2> correctionVectors)
        {
            CorrectionVector2 smallest = new CorrectionVector2();
            int i;

            smallest.Y = int.MaxValue;

            for (i = 0; i < correctionVectors.Count; i++)
            {
                if (correctionVectors[i].DirectionY == directionY && correctionVectors[i].Y != 0f && correctionVectors[i].Y < smallest.Y)
                    smallest = correctionVectors[i];
            }

            return smallest;
        }
Пример #14
0
 internal double calc360Angle(DirectionX xDir, DirectionY yDir, double theta)
 {
     double angle;
     if (xDir == DirectionX.East)
     {
         angle = 90 - theta;   // North or south since eastSouth = neg Tan theta
         if (angle < 0)
             angle += 360;
     }
     else
     {
         if (yDir == DirectionY.North)
             angle = 270 + theta;
         else
             angle = 270 - theta;    // South
     }
     return angle;
 }
        private static void getDirAngles(double latDiff, double lonDiff, out DirectionX dirTravelX, out DirectionY dirTravelY)
        {
            // ---- Y direction of travel ----
            if (latDiff >= 0)
            {
                dirTravelY = DirectionY.North;
            }
            else
            {
                dirTravelY = DirectionY.South;
            }

            // ---- X direction of travel ----
            if (lonDiff >= 0)
            {
                dirTravelX = DirectionX.West;
            }
            else
            {
                dirTravelX = DirectionX.East;
            }
            // Might need a turn?? not sure?
        }
Пример #16
0
 public override string ToString()
 {
     return("PlaneSurface: " + "loc: " + Location.ToString() + "dirx: " + DirectionX.ToString() + "diry: " + DirectionY.ToString());
 }
Пример #17
0
        internal GeoCoordinate getGPSforTest(GeoCoordinate old, int forward, DirectionY dirY, int side, DirectionX dirX)
        {
            double lat = old.Latitude;
            double lon = old.Longitude;

            if (dirY == DirectionY.North)
            {
                lat += ((double)forward / (100000.0 ));
                if (dirX == DirectionX.West)
                    lon = lon - ((double)side / (100000.0 ));
                else
                    lon = lon + ((double)side / (100000.0 ));
            }
            else  //South
            {
                lat = lat - ((double)forward / (100000.0 ));

                if (dirX == DirectionX.West)
                    lon = lon + ((double)side / (100000.0));
                else
                    lon = lon - ((double)side / (100000.0 ));
            }

            return new GeoCoordinate(lat, lon);  // Return new location
        }
Пример #18
0
    // Update is called once per frame
    void Update()
    {
        Vector3 currPosition = gameObject.transform.position;



        if (currPosition.x < -1)
        {
            go.GetComponent <textBehaviour>().IncrementCounter();
            d = Direction.Right;
        }
        if (currPosition.x > 1)
        {
            d = Direction.Left;
        }
        if (d == Direction.Right)
        {
            currPosition.x += Time.deltaTime;
        }
        if (d == Direction.Left)
        {
            currPosition.x -= Time.deltaTime;
        }

        if (currPosition.y < -0.5)
        {
            dy = DirectionY.Up;
        }
        if (currPosition.y > 0.5)
        {
            dy = DirectionY.Down;
        }
        if (dy == DirectionY.Up)
        {
            currPosition.y += Time.deltaTime * 2;
        }
        if (dy == DirectionY.Down)
        {
            currPosition.y -= Time.deltaTime * 2;
        }

        if (currPosition.z < -1.5)
        {
            dz = DirectionZ.In;
        }
        if (currPosition.z > 1.5)
        {
            dz = DirectionZ.Out;
        }
        if (dz == DirectionZ.In)
        {
            currPosition.z += Time.deltaTime * 2;
        }
        if (dz == DirectionZ.Out)
        {
            currPosition.z -= Time.deltaTime * 2;
        }


        gameObject.transform.position = currPosition;
    }
        /// <summary>
        /// Returns a CorrectionVector2 containing the directions on the X and Y axis that the collision response is to be resolved.
        /// </summary>
        /// <param name="correctionVectors">A list of CorrectionVector2's, one for each of the collisions that need to be resolved.</param>
        /// <returns>A CorrectionVector2 with the DirectionX and DirectionY components set in the direction to perform the resolution.</returns>
        private CorrectionVector2 GetDirections(List <CorrectionVector2> correctionVectors)
        {
            CorrectionVector2 directions = new CorrectionVector2();
            int horizontalSum            = SumHorizontal(correctionVectors);
            int verticalSum = SumVertical(correctionVectors);

            DirectionX dirX = DirectionX.None;
            DirectionY dirY = DirectionY.None;

            if (horizontalSum <= (int)DirectionX.Left)
            {
                dirX = DirectionX.Left;
            }
            else if (horizontalSum >= (int)DirectionX.Right)
            {
                dirX = DirectionX.Right;
            }
            else
            {
                dirX = DirectionX.None; //If they cancel each other out, i.e 2 Left and 2 Right
            }
            if (verticalSum <= (int)DirectionY.Up)
            {
                dirY = DirectionY.Up;
            }
            else if (verticalSum >= (int)DirectionY.Down)
            {
                dirY = DirectionY.Down;
            }
            else
            {
                dirY = DirectionY.None; //If they cancel each other out, i.e 1 Up and 1 Down
            }
            directions.DirectionX = dirX;
            directions.DirectionY = dirY;

            //If both directions are None, then push out along the smallest for each
            if (directions.DirectionX == DirectionX.None && directions.DirectionY == DirectionY.None)
            {
                float smallestX = float.MaxValue;
                float smallestY = float.MaxValue;

                //Find the smallest X-axis and Y-axis correction...
                for (int i = 0; i < correctionVectors.Count; i++)
                {
                    if (correctionVectors[i].X < smallestX)
                    {
                        smallestX             = correctionVectors[i].X;
                        directions.DirectionX = correctionVectors[i].DirectionX;
                    }

                    if (correctionVectors[i].Y < smallestY)
                    {
                        smallestY             = correctionVectors[i].Y;
                        directions.DirectionY = correctionVectors[i].DirectionY;
                    }
                }
            }

            return(directions);
        }
Пример #20
0
        private static void getDirAngles(double latDiff, double lonDiff, out DirectionX dirTravelX, out DirectionY dirTravelY)
        {
            // ---- Y direction of travel ----
            if (latDiff >= 0)
                dirTravelY = DirectionY.North;
            else
                dirTravelY = DirectionY.South;

            // ---- X direction of travel ----
            if (lonDiff >= 0)
                dirTravelX = DirectionX.West;
            else
                dirTravelX = DirectionX.East;
                // Might need a turn?? not sure?
        }