Class OBBViewportTransform
java.lang.Object
org.jbox2d.common.OBBViewportTransform
- All Implemented Interfaces:
IViewportTransform
Orientated bounding box viewport transform
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncenter of the viewport.This is the half-width and half-height.voidgetScreenToWorld(Vec2 argScreen, Vec2 argWorld) takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld.voidgetScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld) Transforms the given directional screen vector back to the world direction.gets the transform of the viewport, transforms around the center.voidgetWorldToScreen(Vec2 argWorld, Vec2 argScreen) takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen.voidgetWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen) Transforms the given directional vector by the viewport transform (not positional)booleanisYFlip()voidmulByTransform(Mat22 argTransform) Multiplies the obb transform by the given transformvoidset(OBBViewportTransform vpt) voidsetCamera(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 argHalfWidth, float argHalfHeight) This sets the half-width and half-height of the viewport.voidsetExtents(Vec2 argExtents) This sets the half-width and half-height.voidsetTransform(Mat22 transform) Sets the transform of the viewport.voidsetYFlip(boolean yFlip) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
box
-
yFlip
private boolean yFlip -
yFlipMat
-
yFlipMatInv
-
inv
-
inv2
-
-
Constructor Details
-
OBBViewportTransform
public OBBViewportTransform()
-
-
Method Details
-
set
-
setCamera
public void setCamera(float x, float y, float scale) Description copied from interface:IViewportTransformSets the transform's center to the given x and y coordinates, and using the given scale.- Specified by:
setCamerain interfaceIViewportTransform- Parameters:
x-y-scale-- See Also:
-
getExtents
Description copied from interface:IViewportTransformThis 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.- Specified by:
getExtentsin interfaceIViewportTransform- Returns:
- See Also:
-
setExtents
Description copied from interface:IViewportTransformThis sets the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled.- Specified by:
setExtentsin interfaceIViewportTransform- Parameters:
argExtents-- See Also:
-
setExtents
public void setExtents(float argHalfWidth, float argHalfHeight) Description copied from interface:IViewportTransformThis 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.- Specified by:
setExtentsin interfaceIViewportTransform- Parameters:
argHalfWidth-argHalfHeight-- See Also:
-
getCenter
Description copied from interface:IViewportTransformcenter of the viewport. Not a copy.- Specified by:
getCenterin interfaceIViewportTransform- Returns:
- See Also:
-
setCenter
Description copied from interface:IViewportTransformsets the center of the viewport.- Specified by:
setCenterin interfaceIViewportTransform- Parameters:
argPos-- See Also:
-
setCenter
public void setCenter(float x, float y) Description copied from interface:IViewportTransformsets the center of the viewport.- Specified by:
setCenterin interfaceIViewportTransform- Parameters:
x-y-- See Also:
-
getTransform
gets the transform of the viewport, transforms around the center. Not a copy.- Returns:
-
setTransform
Sets the transform of the viewport. Transforms about the center.- Parameters:
transform-
-
mulByTransform
Multiplies the obb transform by the given transform- Parameters:
argTransform-
-
isYFlip
public boolean isYFlip()- Specified by:
isYFlipin interfaceIViewportTransform- Returns:
- if the transform flips the y axis
- See Also:
-
setYFlip
public void setYFlip(boolean yFlip) - Specified by:
setYFlipin interfaceIViewportTransform- Parameters:
yFlip- if we flip the y axis when transforming- See Also:
-
getScreenVectorToWorld
Description copied from interface:IViewportTransformTransforms the given directional screen vector back to the world direction.- Specified by:
getScreenVectorToWorldin interfaceIViewportTransform- See Also:
-
getWorldVectorToScreen
Description copied from interface:IViewportTransformTransforms the given directional vector by the viewport transform (not positional)- Specified by:
getWorldVectorToScreenin interfaceIViewportTransform- See Also:
-
getWorldToScreen
Description copied from interface:IViewportTransformtakes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen. It should be safe to give the same object as both parameters.- Specified by:
getWorldToScreenin interfaceIViewportTransform- Parameters:
argWorld-argScreen-
-
getScreenToWorld
Description copied from interface:IViewportTransformtakes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld. It should be safe to give the same object as both parameters.- Specified by:
getScreenToWorldin interfaceIViewportTransform- Parameters:
argScreen-argWorld-- See Also:
-