org.dayflower.pathtracer.math

## Class Point3F

• java.lang.Object
• org.dayflower.pathtracer.math.Point3F

• ```public final class Point3F
extends java.lang.Object```
A `Point3` denotes a point in 3D-space.

This class is immutable and therefore thread-safe.

Since:
1.0.0
Author:
Jörgen Lundgren
• ### Field Summary

Fields
Modifier and Type Field and Description
`static Point3F` `MAXIMUM`
The maximum `Point3F`.
`static Point3F` `MINIMUM`
The minimum `Point3F`.
`float` `x`
The X-coordinate.
`float` `y`
The Y-coordinate.
`float` `z`
The Z-coordinate.
• ### Constructor Summary

Constructors
Constructor and Description
`Point3F()`
Constructs a new `Point3F` instance.
```Point3F(float x, float y, float z)```
Constructs a new `Point3F` instance given its coordinates.
`Point3F(Vector3F v)`
Constructs a new `Point3F` instance given a `Vector3F`.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static Point3F` ```center(Point3F a, Point3F b)```
Returns the center `Point3F` given the bounds represented by `a` and `b`.
`float` `distanceTo(Point3F p)`
Returns the distance from this `Point3F` to `p`.
`float` `distanceToSquared(Point3F p)`
Returns the distance from this `Point3F` to `p` in squared form.
`boolean` `equals(java.lang.Object object)`
Compares `object` to this `Point3F` instance for equality.
`int` `hashCode()`
Returns a hash code for this `Point3F` instance.
`boolean` ```isWithinSphereRadius(Point3F p, float radius)```
Returns `true` if, and only if, `p` is contained in the sphere defined with the center as this `Point3F` instance and a radius of `radius`, `false` otherwise.
`static Point3F` `maximum()`
Returns the maximum `Point3F`.
`static Point3F` ```maximum(Point3F a, Point3F b)```
Returns the maximum `Point3F` given the bounds represented by `a` and `b`.
`static Point3F` ```maximum(Point3F a, Point3F b, Point3F c)```
Returns the maximum `Point3F` given the bounds represented by `a`, `b` and `c`.
`static float` ```maximumX(Point3F a, Point3F b, Point3F c)```
Returns the maximum X-coordinate given the bounds represented by `a`, `b` and `c`.
`static float` ```maximumY(Point3F a, Point3F b, Point3F c)```
Returns the maximum Y-coordinate given the bounds represented by `a`, `b` and `c`.
`static float` ```maximumZ(Point3F a, Point3F b, Point3F c)```
Returns the maximum Z-coordinate given the bounds represented by `a`, `b` and `c`.
`static Point3F` `minimum()`
Returns the minimum `Point3F`.
`static Point3F` ```minimum(Point3F a, Point3F b)```
Returns the minimum `Point3F` given the bounds represented by `a` and `b`.
`static Point3F` ```minimum(Point3F a, Point3F b, Point3F c)```
Returns the minimum `Point3F` given the bounds represented by `a`, `b` and `c`.
`static float` ```minimumX(Point3F a, Point3F b, Point3F c)```
Returns the minimum X-coordinate given the bounds represented by `a`, `b` and `c`.
`static float` ```minimumY(Point3F a, Point3F b, Point3F c)```
Returns the minimum Y-coordinate given the bounds represented by `a`, `b` and `c`.
`static float` ```minimumZ(Point3F a, Point3F b, Point3F c)```
Returns the minimum Z-coordinate given the bounds represented by `a`, `b` and `c`.
`Point3F` ```pointAt(Vector3F v, float t)```
Returns a `Point3F` offset from this `Point3F` in the direction of `v` and with the distance of `t`.
`java.lang.String` `toString()`
Returns a `String` representation of this `Point3F` instance.
`Point3F` `transform(Matrix44F m)`
Performs a transformation.
`Point3F` `transformAndDivide(Matrix44F m)`
Performs a transformation and a divide.
`Point3F` `translateX(float x)`
Performs a translation on the X-axis.
`Point3F` `translateY(float y)`
Performs a translation on the Y-axis.
`Point3F` `translateZ(float z)`
Performs a translation on the Z-axis.
• ### Methods inherited from class java.lang.Object

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

• #### MAXIMUM

`public static final Point3F MAXIMUM`
The maximum `Point3F`.
• #### MINIMUM

`public static final Point3F MINIMUM`
The minimum `Point3F`.
• #### x

`public final float x`
The X-coordinate.
• #### y

`public final float y`
The Y-coordinate.
• #### z

`public final float z`
The Z-coordinate.
• ### Constructor Detail

• #### Point3F

`public Point3F()`
Constructs a new `Point3F` instance.

Calling this constructor is equivalent to the following:

``` ```
new Point3F(0.0F, 0.0F, 0.0F)
```
```
• #### Point3F

```public Point3F(float x,
float y,
float z)```
Constructs a new `Point3F` instance given its coordinates.
Parameters:
`x` - the X-coordinate
`y` - the Y-coordinate
`z` - the Z-coordinate
• #### Point3F

`public Point3F(Vector3F v)`
Constructs a new `Point3F` instance given a `Vector3F`.

Calling this constructor is equivalent to the following:

``` ```
new Point3F(v.x, v.y, v.z)
```
```
If `v` is `null`, a `NullPointerException` will be thrown.
Parameters:
`v` - a `Vector3`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `v` is `null`
• ### Method Detail

• #### pointAt

```public Point3F pointAt(Vector3F v,
float t)```
Returns a `Point3F` offset from this `Point3F` in the direction of `v` and with the distance of `t`.

If `v` is `null`, a `NullPointerException` will be thrown.

Parameters:
`v` - a `Vector3F` with the direction of the `Point3F` to return
`t` - the distance to the `Point3F` to return
Returns:
a `Point3F` offset from this `Point3F` in the direction of `v` and with the distance of `t`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `v` is `null`
• #### transform

`public Point3F transform(Matrix44F m)`
Performs a transformation.

Returns a new `Point3F` with the result of the transformation.

If `m` is `null`, a `NullPointerException` will be thrown.

Parameters:
`m` - the `Matrix44F` to perform the transformation with
Returns:
a new `Point3F` with the result of the transformation
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `m` is `null`
• #### transformAndDivide

`public Point3F transformAndDivide(Matrix44F m)`
Performs a transformation and a divide.

Returns a new `Point3F` with the result of the transformation and division.

If `m` is `null`, a `NullPointerException` will be thrown.

Parameters:
`m` - the `Matrix44F` to perform the transformation with
Returns:
a new `Point3F` with the result of the transformation and division
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `m` is `null`
• #### translateX

`public Point3F translateX(float x)`
Performs a translation on the X-axis.

Returns a new `Point3F` with the result of the translation.

Parameters:
`x` - a delta value to add to the value of the X-coordinate
Returns:
a new `Point3F` with the result of the translation
• #### translateY

`public Point3F translateY(float y)`
Performs a translation on the Y-axis.

Returns a new `Point3F` with the result of the translation.

Parameters:
`y` - a delta value to add to the value of the Y-coordinate
Returns:
a new `Point3F` with the result of the translation
• #### translateZ

`public Point3F translateZ(float z)`
Performs a translation on the Z-axis.

Returns a new `Point3F` with the result of the translation.

Parameters:
`z` - a delta value to add to the value of the Z-coordinate
Returns:
a new `Point3F` with the result of the translation
• #### toString

`public java.lang.String toString()`
Returns a `String` representation of this `Point3F` instance.
Overrides:
`toString` in class `java.lang.Object`
Returns:
a `String` representation of this `Point3F` instance
• #### equals

`public boolean equals(java.lang.Object object)`
Compares `object` to this `Point3F` instance for equality.

Returns `true` if, and only if, `object` is an instance of `Point3F`, and their respective values are equal, `false` otherwise.

Overrides:
`equals` in class `java.lang.Object`
Parameters:
`object` - the `Object` to compare to this `Point3F` instance for equality
Returns:
`true` if, and only if, `object` is an instance of `Point3F`, and their respective values are equal, `false` otherwise

```public boolean isWithinSphereRadius(Point3F p,
Returns `true` if, and only if, `p` is contained in the sphere defined with the center as this `Point3F` instance and a radius of `radius`, `false` otherwise.

If `p` is `null`, a `NullPointerException` will be thrown.

Parameters:
`p` - the `Point3F` instance to check
`radius` - the radius to use
Returns:
`true` if, and only if, `p` is contained in the sphere defined with the center as this `Point3F` instance and a radius of `radius`, `false` otherwise
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `p` is `null`
• #### distanceTo

`public float distanceTo(Point3F p)`
Returns the distance from this `Point3F` to `p`.

If `p` is `null`, a `NullPointerException` will be thrown.

Parameters:
`p` - a `Point3F` instance
Returns:
the distance from this `Point3F` to `p`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `p` is `null`
• #### distanceToSquared

`public float distanceToSquared(Point3F p)`
Returns the distance from this `Point3F` to `p` in squared form.

If `p` is `null`, a `NullPointerException` will be thrown.

Parameters:
`p` - a `Point3F` instance
Returns:
the distance from this `Point3` to `p` in squared form
Throws:
`java.lang.NullPointerException` - thrown if, and only if, `p` is `null`
• #### hashCode

`public int hashCode()`
Returns a hash code for this `Point3F` instance.
Overrides:
`hashCode` in class `java.lang.Object`
Returns:
a hash code for this `Point3F` instance
• #### center

```public static Point3F center(Point3F a,
Point3F b)```
Returns the center `Point3F` given the bounds represented by `a` and `b`.

If either `a` or `b` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
Returns:
the center `Point3F` given the bounds represented by `a` and `b`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a` or `b` are `null`
• #### maximum

`public static Point3F maximum()`
Returns the maximum `Point3F`.
Returns:
the maximum `Point3F`
• #### maximum

```public static Point3F maximum(Point3F a,
Point3F b)```
Returns the maximum `Point3F` given the bounds represented by `a` and `b`.

If either `a` or `b` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
Returns:
the maximum `Point3F` given the bounds represented by `a` and `b`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a` or `b` are `null`
• #### maximum

```public static Point3F maximum(Point3F a,
Point3F b,
Point3F c)```
Returns the maximum `Point3F` given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the maximum `Point3F` given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### minimum

`public static Point3F minimum()`
Returns the minimum `Point3F`.
Returns:
the minimum `Point3F`
• #### minimum

```public static Point3F minimum(Point3F a,
Point3F b)```
Returns the minimum `Point3F` given the bounds represented by `a` and `b`.

If either `a` or `b` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
Returns:
the minimum `Point3F` given the bounds represented by `a` and `b`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a` or `b` are `null`
• #### minimum

```public static Point3F minimum(Point3F a,
Point3F b,
Point3F c)```
Returns the minimum `Point3F` given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the minimum `Point3F` given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### maximumX

```public static float maximumX(Point3F a,
Point3F b,
Point3F c)```
Returns the maximum X-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the maximum X-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### maximumY

```public static float maximumY(Point3F a,
Point3F b,
Point3F c)```
Returns the maximum Y-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the maximum Y-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### maximumZ

```public static float maximumZ(Point3F a,
Point3F b,
Point3F c)```
Returns the maximum Z-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the maximum Z-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### minimumX

```public static float minimumX(Point3F a,
Point3F b,
Point3F c)```
Returns the minimum X-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the minimum X-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### minimumY

```public static float minimumY(Point3F a,
Point3F b,
Point3F c)```
Returns the minimum Y-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the minimum Y-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`
• #### minimumZ

```public static float minimumZ(Point3F a,
Point3F b,
Point3F c)```
Returns the minimum Z-coordinate given the bounds represented by `a`, `b` and `c`.

If either `a`, `b` or `c` are `null`, a `NullPointerException` will be thrown.

Parameters:
`a` - one of the `Point3F`s defining the bounds
`b` - one of the `Point3F`s defining the bounds
`c` - one of the `Point3F`s defining the bounds
Returns:
the minimum Z-coordinate given the bounds represented by `a`, `b` and `c`
Throws:
`java.lang.NullPointerException` - thrown if, and only if, either `a`, `b` or `c` are `null`