Package org.jbox2d.common
Interface IViewportTransform
- All Known Implementing Classes:
OBBViewportTransform
public interface IViewportTransform
This is the viewport transform used from drawing. Use yFlip if you are
drawing from the top-left corner.
- Author:
- Daniel Murphy
-
Method Summary
Modifier and TypeMethodDescriptioncenter of the viewport.This is the half-width and half-height.voidgetScreenToWorld(Vec2 screen, Vec2 world) takes the screen coordinates (screen) and puts the corresponding world coordinates in world.voidgetScreenVectorToWorld(Vec2 screen, Vec2 world) Transforms the given directional screen vector back to the world direction.voidgetWorldToScreen(Vec2 world, Vec2 screen) takes the world coordinate (world) puts the corresponding screen coordinate in screen.voidgetWorldVectorToScreen(Vec2 world, Vec2 screen) Transforms the given directional vector by the viewport transform (not positional)booleanisYFlip()voidmulByTransform(Mat22 transform) Multiplies the viewport transform by the given Mat22voidsetCamera(float x, float y, float scale) Sets the transform's center to the given x and y coordinates, and using the given scale.voidsetCenter(float x, float y) sets the center of the viewport.voidsets the center of the viewport.voidsetExtents(float halfWidth, float halfHeight) This sets the half-width and half-height of the viewport.voidsetExtents(Vec2 extents) This sets the half-width and half-height.voidsetYFlip(boolean yFlip)
-
Method Details
-
isYFlip
boolean isYFlip()- Returns:
- If the transform flips the y-axis.
-
setYFlip
void setYFlip(boolean yFlip) - Parameters:
yFlip- If we flip the y-axis when transforming.
-
getExtents
Vec2 getExtents()This is the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled. Not a copy. -
setExtents
This sets the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled. -
setExtents
void setExtents(float halfWidth, float halfHeight) This sets the half-width and half-height of the viewport. This should be the actual half-width and half-height, not anything transformed or scaled. -
getCenter
Vec2 getCenter()center of the viewport. Not a copy. -
setCenter
sets the center of the viewport. -
setCenter
void setCenter(float x, float y) sets the center of the viewport. -
setCamera
void setCamera(float x, float y, float scale) Sets the transform's center to the given x and y coordinates, and using the given scale. -
getWorldVectorToScreen
Transforms the given directional vector by the viewport transform (not positional) -
getScreenVectorToWorld
Transforms the given directional screen vector back to the world direction. -
getMat22Representation
Mat22 getMat22Representation() -
getWorldToScreen
takes the world coordinate (world) puts the corresponding screen coordinate in screen. It should be safe to give the same object as both parameters. -
getScreenToWorld
takes the screen coordinates (screen) and puts the corresponding world coordinates in world. It should be safe to give the same object as both parameters. -
mulByTransform
Multiplies the viewport transform by the given Mat22
-