pythagoras.f

## Class Rectangles

• ```public class Rectangles
extends Object```
Rectangle-related utility methods.
• ### Constructor Summary

Constructors
Constructor and Description
`Rectangles()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static Point` ```closestInteriorPoint(IRectangle r, IPoint p)```
Computes and returns the point inside the bounds of the rectangle that's closest to the given point.
`static Point` ```closestInteriorPoint(IRectangle r, IPoint p, Point out)```
Computes the point inside the bounds of the rectangle that's closest to the given point, writing the result into `out`.
`static void` ```intersect(IRectangle src1, IRectangle src2, Rectangle dst)```
Intersects the supplied two rectangles, writing the result into `dst`.
`static float` ```pointRectDistance(IRectangle r, IPoint p)```
Returns the Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle.
`static float` ```pointRectDistanceSq(IRectangle r, IPoint p)```
Returns the squared Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle.
`static void` ```union(IRectangle src1, IRectangle src2, Rectangle dst)```
Unions the supplied two rectangles, writing the result into `dst`.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Rectangles

`public Rectangles()`
• ### Method Detail

• #### intersect

```public static void intersect(IRectangle src1,
IRectangle src2,
Rectangle dst)```
Intersects the supplied two rectangles, writing the result into `dst`.
• #### union

```public static void union(IRectangle src1,
IRectangle src2,
Rectangle dst)```
Unions the supplied two rectangles, writing the result into `dst`.
• #### closestInteriorPoint

```public static Point closestInteriorPoint(IRectangle r,
IPoint p,
Point out)```
Computes the point inside the bounds of the rectangle that's closest to the given point, writing the result into `out`.
Returns:
`out` for call chaining convenience.
• #### closestInteriorPoint

```public static Point closestInteriorPoint(IRectangle r,
IPoint p)```
Computes and returns the point inside the bounds of the rectangle that's closest to the given point.
• #### pointRectDistanceSq

```public static float pointRectDistanceSq(IRectangle r,
IPoint p)```
Returns the squared Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle. If the supplied point is inside the rectangle, the distance will be zero.
• #### pointRectDistance

```public static float pointRectDistance(IRectangle r,
IPoint p)```
Returns the Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle. If the supplied point is inside the rectangle, the distance will be zero.