Package Map

Class TransformUtilities

java.lang.Object
Map.TransformUtilities

public class TransformUtilities extends Object
Author:
David McLaren

Coordinate transform utilites

  • Constructor Details

    • TransformUtilities

      public TransformUtilities()
  • Method Details

    • rotateDegreesZ

      public void rotateDegreesZ(PamCoordinate c)
      Rotate a point about the Z axis.
      Parameters:
      c - point to rotate
      rotateZDegrees - rotation angle in degrees
    • unRotateDegreesZ

      public void unRotateDegreesZ(PamCoordinate c)
      Rotate a point about the Z axis in the opposite direction.
      Parameters:
      c - point to rotate
      rotateZDegrees - rotation angle in degrees
    • rotateDegreesZ

      public static void rotateDegreesZ(PamCoordinate c, double degrees)
      Rotate a point using a static method which doesn't alter the main underlying rotation information set from the map projector.
      Parameters:
      c - point to rotate
      degrees - rotation angle in degrees
    • rotateDegreesX

      public void rotateDegreesX(PamCoordinate c)
      Rotate about the X axis. i.e. x is unchanged, but y and z change.
      Parameters:
      c -
      rotateXDegrees -
    • unRotateDegreesX

      public void unRotateDegreesX(PamCoordinate c)
      Rotate about the X axis in the opposite direction. i.e. x is unchanged, but y and z change.
      Parameters:
      c -
      rotateXDegrees -
    • doPerspective

      public void doPerspective(Coordinate3d panelPos, double panelHeight)
      Add perspective to a point. Camera automatically set at a height which will perfectly match the canvas height with a 30 degree field of view.
      Parameters:
      panelPos - xyz position on the canvas
      panelHeight - height of panel.
    • unDoPerspective

      public void unDoPerspective(Coordinate3d panelPos, double panelHeight)
      Remove perspective from a point. Camera automatically set at a height which will perfectly match the canvas height with a 30 degree field of view.
      Parameters:
      panelPos - xyz position on the canvas
      panelHeight - height of panel.
    • getCameraHeight

      public double getCameraHeight(double panelHeight)
      get the camera height for a given panel height.
      Parameters:
      panelHeight - display panel height
      Returns:
      camera height
    • getCameraFieldOfView

      public double getCameraFieldOfView()
      Returns:
      The camera field of view in degrees
    • Coordinate3d2XyArrays

      public static void Coordinate3d2XyArrays(int[] x, int[] y, Coordinate3d[] c)
      Convert an array of 3D coordinates to arrays of x and y integers.
      Parameters:
      x - preallocated array of x coordinates
      y - preallocated array of y coordinates
      c - 3d coordinates.
    • rotatePolygon

      public static void rotatePolygon(Polygon polygon, double angleRadians)
      Rotate a polygon about the Z axis. Used by ship. May need to replace with a more complete rotation system
      Parameters:
      polygon - polygon to rotate
      angleRadians - angle in radians
    • getRotateZDegrees

      public double getRotateZDegrees()
      Returns:
      the rotateZDegrees
    • setRotateZDegrees

      public void setRotateZDegrees(double rotateZDegrees)
      Parameters:
      rotateZDegrees - the rotateZDegrees to set
    • getRotateXDegrees

      public double getRotateXDegrees()
      Returns:
      the rotateXDegrees
    • setRotateXDegrees

      public void setRotateXDegrees(double rotateXDegrees)
      Parameters:
      rotateXDegrees - the rotateXDegrees to set