Package com.treemap

# Class RectangularTransform

java.lang.Object
com.treemap.RectangularTransform

public class RectangularTransform extends Object
This is a transform that only scales and translates. It is a subset of an `AffineTransform`, except with no rotation/shearing.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RectangularTransform()`
  Creates an identity transform.
  `RectangularTransform(double sx, double sy, double tx, double ty)`
  Creates a `RectangularTransform`.
  `RectangularTransform(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)`
  Creates a `RectangularTransform` that transforms from one rectangle to another.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static com.macrofocus.geom.AffineTransform`
  `create(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)`
  Creates an `AffineTransform` that maps one argument to another.
  `com.macrofocus.geom.AffineTransform`
  `createAffineTransform()`
  Converts this to an `AffineTransform`.
  `RectangularTransform`
  `createInverse()`
  Creates a transform that is the inverse of this one.
  `double`
  `getScaleX()`
  `double`
  `getScaleY()`
  `double`
  `getTranslateX()`
  `double`
  `getTranslateY()`
  `void`
  `scale(double sx, double sy)`
  Scales this transform.
  `void`
  `setTransform(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)`
  Defines this transform.
  `com.macrofocus.geom.Point2D`
  `transform(com.macrofocus.geom.Point2D src)`
  Transforms the source argument.
  `com.macrofocus.geom.Rectangle2D`
  `transform(com.macrofocus.geom.Rectangle2D src)`
  Transforms the source argument.
  `void`
  `translate(double tx, double ty)`
  Translates this transform.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RectangularTransform

    public RectangularTransform()
    Creates an identity transform.

  - ### RectangularTransform

    public RectangularTransform(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)
    Creates a `RectangularTransform` that transforms from one rectangle to another.
    Parameters:
      `oldRect` - the initial rectangle.
      `newRect` - the final (transformed) rectangle.

  - ### RectangularTransform

    public RectangularTransform(double sx, double sy, double tx, double ty)
    Creates a `RectangularTransform`.
    Parameters:
      `sx` - the scaleX factor
      `sy` - the scaleY factor
      `tx` - the x-translation
      `ty` - the y-translation

- ## Method Details

  - ### transform

    public com.macrofocus.geom.Rectangle2D transform(com.macrofocus.geom.Rectangle2D src)
    Transforms the source argument.
    Parameters:
      `src` - the initial rectangle.
    Returns:
      the Rectangle2D to store the results in.

  - ### transform

    public com.macrofocus.geom.Point2D transform(com.macrofocus.geom.Point2D src)
    Transforms the source argument.
    Parameters:
      `src` - the initial point.
    Returns:
      the Point2D to store the results in.

  - ### create

    public static com.macrofocus.geom.AffineTransform create(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)
    Creates an `AffineTransform` that maps one argument to another.
    Parameters:
      `oldRect` - the initial rectangle.
      `newRect` - the final (transformed) rectangle.
    Returns:
      an `AffineTransform` that maps from the old to the new rectangle.

  - ### setTransform

    public void setTransform(com.macrofocus.geom.Rectangle2D oldRect, com.macrofocus.geom.Rectangle2D newRect)
    Defines this transform.
    Parameters:
      `oldRect` - the initial rect.
      `newRect` - what this transform should turn the initial rectangle into.

  - ### translate

    public void translate(double tx, double ty)
    Translates this transform.
    Parameters:
      `tx` - the x-translation.
      `ty` - the y-translation.

  - ### getScaleX

    public double getScaleX()

  - ### getScaleY

    public double getScaleY()

  - ### getTranslateX

    public double getTranslateX()

  - ### getTranslateY

    public double getTranslateY()

  - ### scale

    public void scale(double sx, double sy)
    Scales this transform.
    Parameters:
      `sx` - the factor to scale X-values by.
      `sy` - the factor to scale Y-values by.

  - ### createAffineTransform

    public com.macrofocus.geom.AffineTransform createAffineTransform()
    Converts this to an `AffineTransform`.

  - ### createInverse

    public RectangularTransform createInverse()
    Creates a transform that is the inverse of this one.