org.openimaj.math.geometry

## Interface GeometricObject2d

• ### Method Summary

All Methods
Modifier and Type Method and Description
`Point2d` `calculateCentroid()`
Calculate the centroid of the shape
`Rectangle` `calculateRegularBoundingBox()`
Compute the regular (oriented to the axes) bounding box of the shape.
`double` `getHeight()`
`double` `getWidth()`
`double` `maxX()`
`double` `maxY()`
`double` `minX()`
`double` `minY()`
`void` `scale(float sc)`
Scale the shape by the given amount about (0,0).
`void` ```scale(Point2d centre, float sc)```
Scale the shape by the given amount about the given point.
`void` `scaleCentroid(float sc)`
Scale the shape about its centroid.
`GeometricObject2d` `transform(Jama.Matrix transform)`
Apply a 3x3 transform matrix to a copy of the `GeometricObject2d` and return it
`void` ```translate(float x, float y)```
Translate the shapes position
• ### Method Detail

• #### calculateRegularBoundingBox

`Rectangle calculateRegularBoundingBox()`
Compute the regular (oriented to the axes) bounding box of the shape.
Returns:
the regular bounding box as [x,y,width,height]
• #### translate

```void translate(float x,
float y)```
Translate the shapes position
Parameters:
`x` - x-translation
`y` - y-translation
• #### scale

`void scale(float sc)`
Scale the shape by the given amount about (0,0). Scalefactors between 0 and 1 shrink the shape.
Parameters:
`sc` - the scale factor.
• #### scale

```void scale(Point2d centre,
float sc)```
Scale the shape by the given amount about the given point. Scalefactors between 0 and 1 shrink the shape.
Parameters:
`centre` - the centre of the scaling operation
`sc` - the scale factor
• #### scaleCentroid

`void scaleCentroid(float sc)`
Scale the shape about its centroid. Scalefactors between 0 and 1 shrink the shape.
Parameters:
`sc` - the scale factor
• #### calculateCentroid

`Point2d calculateCentroid()`
Calculate the centroid of the shape
Returns:
the centroid of the shape
• #### minX

`double minX()`
Returns:
the minimum x-ordinate
• #### minY

`double minY()`
Returns:
the minimum y-ordinate
• #### maxX

`double maxX()`
Returns:
the maximum x-ordinate
• #### maxY

`double maxY()`
Returns:
the maximum y-ordinate
• #### getWidth

`double getWidth()`
Returns:
the width of the regular bounding box
• #### getHeight

`double getHeight()`
Returns:
the height of the regular bounding box
• #### transform

`GeometricObject2d transform(Jama.Matrix transform)`
Apply a 3x3 transform matrix to a copy of the `GeometricObject2d` and return it
Parameters:
`transform` - 3x3 transform matrix
Returns:
the transformed shape