org.jsfml.graphics

## Class Transform

• All Implemented Interfaces:
Serializable

```public final class Transform
extends Object
implements Serializable```
Defines a 3x3 transformation matrix for 2D transformations.
See Also:
Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`static Transform` `IDENTITY`
The identity transformation, maps any vector to itself and therefore "does nothing".
• ### Constructor Summary

Constructors
Constructor and Description
`Transform()`
Constructs an identity transformation.
```Transform(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)```
Constructs a new transformation from a 3x3 matrix of the following format:
`Transform(Transform t)`
Constructs a new transformation by copying another transformation.
• ### Method Summary

Methods
Modifier and Type Method and Description
`static Transform` ```combine(Transform t1, Transform t2)```
Combines two transformation matrices by multiplying them.
`boolean` `equals(Object o)`
`Transform` `getInverse()`
Returns the inverse transformation.
`float[]` `getMatrix()`
Gets a copy of the underlying 4x4 3D transformation matrix.
`int` `hashCode()`
`static Transform` ```rotate(Transform t, float angle)```
Adds a rotation around the origin to a transformation.
`static Transform` ```rotate(Transform t, float angle, float centerX, float centerY)```
Adds a rotation around an arbitrary center to this transformation.
`static Transform` ```rotate(Transform t, float angle, Vector2f center)```
Adds a rotation around an arbitrary center to this transformation.
`static Transform` ```scale(Transform t, float scaleX, float scaleY)```
Adds a scaling operation from the origin to a transformation.
`static Transform` ```scale(Transform t, float scaleX, float scaleY, float centerX, float centerY)```
Adds a scaling operation from an arbitrary center to a transformation.
`static Transform` ```scale(Transform t, Vector2f factors)```
Adds a scaling operation from the origin to a transformation.
`static Transform` ```scale(Transform t, Vector2f factors, Vector2f center)```
Adds a scaling operation from an arbitrary center to a transformation.
`String` `toString()`
`Vector2f` ```transformPoint(float x, float y)```
Transforms a 2D point using the transformation matrix.
`Vector2f` `transformPoint(Vector2f v)`
Transforms a 2D point using the transformation matrix.
`FloatRect` `transformRect(FloatRect rectangle)`
Transforms a rectangle and returns the axis-aligned bounding rectangle.
`static Transform` ```translate(Transform t, float x, float y)```
Adds a translation by a 2D vector to a transformation.
`static Transform` ```translate(Transform t, Vector2f v)```
Adds a translation by a 2D vector to a transformation.
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### IDENTITY

`public static final Transform IDENTITY`
The identity transformation, maps any vector to itself and therefore "does nothing".
• ### Constructor Detail

• #### Transform

`public Transform()`
Constructs an identity transformation.
• #### Transform

```public Transform(float a00,
float a01,
float a02,
float a10,
float a11,
float a12,
float a20,
float a21,
float a22)```
Constructs a new transformation from a 3x3 matrix of the following format:
```a00, a01, a02,
a10, a11, a12,
a20, a21, a22```
Parameters:
`a00` - Matrix component.
`a01` - Matrix component.
`a02` - Matrix component.
`a10` - Matrix component.
`a11` - Matrix component.
`a12` - Matrix component.
`a20` - Matrix component.
`a21` - Matrix component.
`a22` - Matrix component.
• #### Transform

`public Transform(Transform t)`
Constructs a new transformation by copying another transformation.
Parameters:
`t` - the transformation to copy.
• ### Method Detail

• #### combine

```public static Transform combine(Transform t1,
Transform t2)```
Combines two transformation matrices by multiplying them.
Parameters:
`t1` - the first transformation matrix.
`t2` - the second transformation matrix.
Returns:
the product of the two given matrices.
• #### translate

```public static Transform translate(Transform t,
float x,
float y)```
Adds a translation by a 2D vector to a transformation.
Parameters:
`t` - the transformation to apply the translation on.
`x` - the X coordinate of the translation vector.
`y` - the Y coordinate of the translation vector.
Returns:
a new transformation matrix with the translation applied.
• #### translate

```public static Transform translate(Transform t,
Vector2f v)```
Adds a translation by a 2D vector to a transformation.
Parameters:
`t` - the transformation to apply the translation to.
`v` - the translation vector.
Returns:
a new transformation matrix with the translation applied.
• #### rotate

```public static Transform rotate(Transform t,
float angle)```
Adds a rotation around the origin to a transformation.
Parameters:
`t` - the transformation to apply the rotation on.
`angle` - the rotation angle in degrees.
Returns:
a new transformation with the rotation applied
• #### rotate

```public static Transform rotate(Transform t,
float angle,
float centerX,
float centerY)```
Adds a rotation around an arbitrary center to this transformation.
Parameters:
`t` - the transformation to apply the rotation on.
`angle` - the rotation angle in degrees.
`centerX` - the X coordinate of the rotation center.
`centerY` - the Y coordinate of the rotation center.
Returns:
a new transformation with the rotation applied.
• #### rotate

```public static Transform rotate(Transform t,
float angle,
Vector2f center)```
Adds a rotation around an arbitrary center to this transformation.
Parameters:
`t` - the transformation to apply the rotation on.
`angle` - the rotation angle in degrees.
`center` - the rotation center.
Returns:
a new transformation with the rotation applied.
• #### scale

```public static Transform scale(Transform t,
float scaleX,
float scaleY)```
Adds a scaling operation from the origin to a transformation.
Parameters:
`t` - the transform to apply the scaling on.
`scaleX` - the X factor of the scaling operation.
`scaleY` - the Y factor of the scaling operation.
Returns:
a new transformation with the scaling applied.
• #### scale

```public static Transform scale(Transform t,
Vector2f factors)```
Adds a scaling operation from the origin to a transformation.
Parameters:
`t` - the transform to apply the scaling on.
`factors` - the factors of the scaling operation.
Returns:
a new transformation with the scaling applied.
• #### scale

```public static Transform scale(Transform t,
float scaleX,
float scaleY,
float centerX,
float centerY)```
Adds a scaling operation from an arbitrary center to a transformation.
Parameters:
`t` - the transform to apply the scaling on.
`scaleX` - the X factor of the scaling operation.
`scaleY` - the Y factor of the scaling operation.
`centerX` - the X coordinate of the scaling center.
`centerY` - the Y coordinate of the scaling center.
Returns:
a new transformation with the scaling applied.
• #### scale

```public static Transform scale(Transform t,
Vector2f factors,
Vector2f center)```
Adds a scaling operation from an arbitrary center to a transformation.
Parameters:
`t` - the transform to apply the scaling on.
`factors` - the factors of the scaling operation.
`center` - the scaling center.
Returns:
a new transformation with the scaling applied.
• #### getMatrix

`public float[] getMatrix()`
Gets a copy of the underlying 4x4 3D transformation matrix.
Returns:
a copy of the underlying 4x4 3D transformation matrix.
• #### getInverse

`public Transform getInverse()`
Returns the inverse transformation.
Returns:
the inverse transformation, or the identity transformation if the matrix cannot be inverted.
• #### transformPoint

```public Vector2f transformPoint(float x,
float y)```
Transforms a 2D point using the transformation matrix.
Parameters:
`x` - the X coordinate of the point.
`y` - the Y coordinate of the point.
Returns:
a new 2D vector, representing the transformed point.
• #### transformPoint

`public final Vector2f transformPoint(Vector2f v)`
Transforms a 2D point using the transformation matrix.
Parameters:
`v` - the point to transform.
Returns:
a new 2D vector, representing the transformed point.
• #### transformRect

`public FloatRect transformRect(FloatRect rectangle)`
Transforms a rectangle and returns the axis-aligned bounding rectangle.
Parameters:
`rectangle` - the rectangle to transform.
Returns:
the axis-aligned bounding rectangle of the rotated rectangle.
• #### equals

`public boolean equals(Object o)`
Overrides:
`equals` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`
{"ft_lang_label":"__label__en","ft_lang_prob":0.5280895,"math_prob":0.9742384,"size":5269,"snap":"2021-21-2021-25","text_gpt3_token_len":1162,"char_repetition_ratio":0.2765432,"word_repetition_ratio":0.44589308,"special_character_ratio":0.22281268,"punctuation_ratio":0.14301802,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9963251,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-06-12T22:40:09Z\",\"WARC-Record-ID\":\"<urn:uuid:9f9732ae-1219-42d9-9894-ce4771ed739e>\",\"Content-Length\":\"38636\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:22c45236-d1e1-4253-8ba8-9e9285c3dc67>\",\"WARC-Concurrent-To\":\"<urn:uuid:a0912743-0c21-44bf-a655-5b570f0a47d2>\",\"WARC-IP-Address\":\"192.71.233.12\",\"WARC-Target-URI\":\"https://jsfml.sfmlprojects.org/javadoc/org/jsfml/graphics/Transform.html\",\"WARC-Payload-Digest\":\"sha1:UOQWKBFTVB5RFABSLWGLR47V64PDX6AA\",\"WARC-Block-Digest\":\"sha1:GK3ZQOX4I53XMRWLJ6XEBOIAZPS7GUX5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-25/CC-MAIN-2021-25_segments_1623487586465.3_warc_CC-MAIN-20210612222407-20210613012407-00111.warc.gz\"}"}