Class OBBViewportTransform

java.lang.Object
org.jbox2d.common.OBBViewportTransform
All Implemented Interfaces:
IViewportTransform

public class OBBViewportTransform extends Object implements IViewportTransform
Orientated bounding box viewport transform
Author:
Daniel Murphy
  • Field Details

  • Constructor Details

    • OBBViewportTransform

      public OBBViewportTransform()
  • Method Details

    • set

      public void set(OBBViewportTransform vpt)
    • setCamera

      public void setCamera(float x, float y, float scale)
      Description copied from interface: IViewportTransform
      Sets the transform's center to the given x and y coordinates, and using the given scale.
      Specified by:
      setCamera in interface IViewportTransform
    • getExtents

      public Vec2 getExtents()
      Description copied from interface: IViewportTransform
      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.
      Specified by:
      getExtents in interface IViewportTransform
    • getMat22Representation

      public Mat22 getMat22Representation()
      Specified by:
      getMat22Representation in interface IViewportTransform
    • setExtents

      public void setExtents(Vec2 argExtents)
      Description copied from interface: IViewportTransform
      This sets the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled.
      Specified by:
      setExtents in interface IViewportTransform
    • setExtents

      public void setExtents(float halfWidth, float halfHeight)
      Description copied from interface: IViewportTransform
      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.
      Specified by:
      setExtents in interface IViewportTransform
    • getCenter

      public Vec2 getCenter()
      Description copied from interface: IViewportTransform
      center of the viewport. Not a copy.
      Specified by:
      getCenter in interface IViewportTransform
    • setCenter

      public void setCenter(Vec2 argPos)
      Description copied from interface: IViewportTransform
      sets the center of the viewport.
      Specified by:
      setCenter in interface IViewportTransform
    • setCenter

      public void setCenter(float x, float y)
      Description copied from interface: IViewportTransform
      sets the center of the viewport.
      Specified by:
      setCenter in interface IViewportTransform
    • getTransform

      public Mat22 getTransform()
      Gets the transform of the viewport, transforms around the center. Not a copy.
    • setTransform

      public void setTransform(Mat22 transform)
      Sets the transform of the viewport. Transforms about the center.
    • mulByTransform

      public void mulByTransform(Mat22 transform)
      Multiplies the obb transform by the given transform
      Specified by:
      mulByTransform in interface IViewportTransform
    • isYFlip

      public boolean isYFlip()
      Specified by:
      isYFlip in interface IViewportTransform
      Returns:
      If the transform flips the y-axis.
    • setYFlip

      public void setYFlip(boolean yFlip)
      Specified by:
      setYFlip in interface IViewportTransform
      Parameters:
      yFlip - If we flip the y-axis when transforming.
    • getScreenVectorToWorld

      public void getScreenVectorToWorld(Vec2 screen, Vec2 world)
      Description copied from interface: IViewportTransform
      Transforms the given directional screen vector back to the world direction.
      Specified by:
      getScreenVectorToWorld in interface IViewportTransform
    • getWorldVectorToScreen

      public void getWorldVectorToScreen(Vec2 world, Vec2 screen)
      Description copied from interface: IViewportTransform
      Transforms the given directional vector by the viewport transform (not positional)
      Specified by:
      getWorldVectorToScreen in interface IViewportTransform
    • getWorldToScreen

      public void getWorldToScreen(Vec2 world, Vec2 screen)
      Description copied from interface: IViewportTransform
      takes the world coordinate (world) puts the corresponding screen coordinate in screen. It should be safe to give the same object as both parameters.
      Specified by:
      getWorldToScreen in interface IViewportTransform
    • getScreenToWorld

      public void getScreenToWorld(Vec2 screen, Vec2 world)
      Description copied from interface: IViewportTransform
      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.
      Specified by:
      getScreenToWorld in interface IViewportTransform