Package Map
Class TransformUtilities
java.lang.Object
Map.TransformUtilities
- Author:
- David McLaren
Coordinate transform utilites
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCoordinate3d2XyArrays(int[] x, int[] y, Coordinate3d[] c) Convert an array of 3D coordinates to arrays of x and y integers.voiddoPerspective(Coordinate3d panelPos, double panelHeight) Add perspective to a point.doubledoublegetCameraHeight(double panelHeight) get the camera height for a given panel height.doubledoublevoidRotate about the X axis.voidRotate a point about the Z axis.static voidrotateDegreesZ(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.static voidrotatePolygon(Polygon polygon, double angleRadians) Rotate a polygon about the Z axis.voidsetRotateXDegrees(double rotateXDegrees) voidsetRotateZDegrees(double rotateZDegrees) voidunDoPerspective(Coordinate3d panelPos, double panelHeight) Remove perspective from a point.voidRotate about the X axis in the opposite direction.voidRotate a point about the Z axis in the opposite direction.
-
Constructor Details
-
TransformUtilities
public TransformUtilities()
-
-
Method Details
-
rotateDegreesZ
Rotate a point about the Z axis.- Parameters:
c- point to rotaterotateZDegrees- rotation angle in degrees
-
unRotateDegreesZ
Rotate a point about the Z axis in the opposite direction.- Parameters:
c- point to rotaterotateZDegrees- rotation angle in degrees
-
rotateDegreesZ
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 rotatedegrees- rotation angle in degrees
-
rotateDegreesX
Rotate about the X axis. i.e. x is unchanged, but y and z change.- Parameters:
c-rotateXDegrees-
-
unRotateDegreesX
Rotate about the X axis in the opposite direction. i.e. x is unchanged, but y and z change.- Parameters:
c-rotateXDegrees-
-
doPerspective
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 canvaspanelHeight- height of panel.
-
unDoPerspective
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 canvaspanelHeight- 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
Convert an array of 3D coordinates to arrays of x and y integers.- Parameters:
x- preallocated array of x coordinatesy- preallocated array of y coordinatesc- 3d coordinates.
-
rotatePolygon
Rotate a polygon about the Z axis. Used by ship. May need to replace with a more complete rotation system- Parameters:
polygon- polygon to rotateangleRadians- 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
-