org.anchoranalysis.spatial.point

## Class Point3d

• All Implemented Interfaces:
Serializable

```public final class Point3d
extends Tuple3d```
A three-dimensional point of double values.

We consider a point to be a tuple representing a single physical point in space.

Author:
Owen Feehan
Serialized Form

• ### Fields inherited from class Tuple3d

`x, y, z`
• ### Constructor Summary

Constructors
Constructor and Description
`Point3d()`
```Point3d(double x, double y, double z)```
Create with values for each dimension.
`Point3d(Point3f point)`
Creates with the same values as an existing `Point3d`.
`Point3d(Tuple3d point)`
Creates with the same values as an existing `Tuple3d`.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`protected boolean` `canEqual(Object other)`
`double` `distance(Point3d point)`
The Euclidean distance between this point and another `Point3d`.
`double` `distanceSquared(Point3d point)`
The square of the Euclidean distance between this point and another `Point3d`.
`double` `distanceSquared(Point3i point)`
The square of the Euclidean distance between this point and another `Point3i`.
`Point3d` `dropZ()`
Creates a new point with identical x and y values, but with z set to 0.
`boolean` `equals(Object o)`
`boolean` ```equalsTolerance(Point3d other, double delta)```
Checks if this point is equal to another `Point3d` accepting a tolerance between double values.
`int` `hashCode()`
`static Point3d` ```immutableAdd(Point3d point, int x, int y, int z)```
Adds values to a point immutably.
`static Point3d` ```immutableAdd(Tuple3d tuple1, Tuple3d tuple2)```
`static Point3d` ```immutableScale(Tuple3d tuple, int factor)```
Scales a tuple immutably.
`static Point3d` ```immutableSubtract(Tuple3d tuple, Tuple3d toSubtract)```
Subtracts a `Tuple3d` from a `Tuple3d` immutably.
`static Point3d` ```immutableSubtract(Tuple3i tuple, Tuple3d toSubtract)```
Subtracts a `Tuple3d` from a `Tuple3i` immutably.
`Point3d` `max(double val)`
Element-wise maximum between this point and a scalar.
`Point3d` `max(Tuple3d point)`
Element-wise maximum between this point and another.
`Point3d` `min(ReadableTuple3i point)`
Element-wise minimum between this point and another.
`Point3d` `min(Tuple3d point)`
Element-wise minimum between this point and another.
`double[]` `toArray()`
Converts the point to an array.
`double[]` `toArrayXY()`
Converts the X and Y dimensions of the point to an array.
• ### Methods inherited from class Tuple3d

`absolute, add, add, add, divideBy, divideBy, dotProduct, increment, incrementX, incrementY, incrementZ, length, normalize, scale, scaleXY, setValueByDimension, setX, setX, setY, setY, setZ, setZ, subtract, toString, valueByDimension, valueByDimension, x, y, z`
• ### Methods inherited from class Object

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

• #### Point3d

`public Point3d(Point3f point)`
Creates with the same values as an existing `Point3d`.
Parameters:
`point` - to copy values from.
• #### Point3d

`public Point3d(Tuple3d point)`
Creates with the same values as an existing `Tuple3d`.
Parameters:
`point` - to copy values from.
• #### Point3d

```public Point3d(double x,
double y,
double z)```
Create with values for each dimension.
Parameters:
`x` - the value for the X-dimension.
`y` - the value for the Y-dimension.
`z` - the value for the Z-dimension.
• #### Point3d

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

• #### distance

`public double distance(Point3d point)`
The Euclidean distance between this point and another `Point3d`.
Parameters:
`point` - the other point to a measure a distance to.
Returns:
the distance.
• #### distanceSquared

`public double distanceSquared(Point3d point)`
The square of the Euclidean distance between this point and another `Point3d`.
Parameters:
`point` - the other point to a measure a distance to.
Returns:
the distance squared.
• #### distanceSquared

`public double distanceSquared(Point3i point)`
The square of the Euclidean distance between this point and another `Point3i`.
Parameters:
`point` - the other point to a measure a distance to.
Returns:
the distance squared.
• #### dropZ

`public Point3d dropZ()`
Creates a new point with identical x and y values, but with z set to 0.

This is an immutable operation that does not affect current state.

Returns:
the new point.
• #### min

`public Point3d min(Tuple3d point)`
Element-wise minimum between this point and another.
Parameters:
`point` - the other point.
Returns:
a new point containing the minimum of the x, y, z components.
• #### min

`public Point3d min(ReadableTuple3i point)`
Element-wise minimum between this point and another.
Parameters:
`point` - the other point.
Returns:
a new point containing the minimum of the x, y, z components.
• #### max

`public Point3d max(double val)`
Element-wise maximum between this point and a scalar.
Parameters:
`val` - the scalar.
Returns:
a new point containing the minimum of the x, y, z components.
• #### equalsTolerance

```public boolean equalsTolerance(Point3d other,
double delta)```
Checks if this point is equal to another `Point3d` accepting a tolerance between double values.
Parameters:
`other` - the other point to check for equality with.
`delta` - the maximum difference before two double values are considered to be unequal.
Returns:
true iff all dimensions of the point are equal (within the tolerance).
• #### toArray

`public double[] toArray()`
Converts the point to an array.
Returns:
a newly created array with three elements, respectively for x, y and z components.
• #### toArrayXY

`public double[] toArrayXY()`
Converts the X and Y dimensions of the point to an array.
Returns:
a newly created array with two elements, respectively for x and y components.
• #### max

`public Point3d max(Tuple3d point)`
Element-wise maximum between this point and another.
Parameters:
`point` - the other point.
Returns:
a new point containing the minimum of the x, y, z components.

```public static Point3d immutableAdd(Tuple3d tuple1,
Tuple3d tuple2)```
Parameters:
`tuple1` - the first tuple to add.
`tuple2` - the second tuple to add.
Returns:
a newly created point, where each dimension is the sum of the corresponding dimensions in the points.

```public static Point3d immutableAdd(Point3d point,
int x,
int y,
int z)```
Adds values to a point immutably.
Parameters:
`point` - the point to add.
`x` - the value to add to the X-component.
`y` - the value to add to the Y-component.
`z` - the value to add to the Z-component.
Returns:
a newly created point, where each dimension is the sum of the corresponding dimensions in the points.
• #### immutableSubtract

```public static Point3d immutableSubtract(Tuple3d tuple,
Tuple3d toSubtract)```
Subtracts a `Tuple3d` from a `Tuple3d` immutably.
Parameters:
`tuple` - the tuple to subtract from.
`toSubtract` - the tuple to subtract.
Returns:
a newly created point, where each dimension is the subtraction of the corresponding dimensions in the points.
• #### immutableSubtract

```public static Point3d immutableSubtract(Tuple3i tuple,
Tuple3d toSubtract)```
Subtracts a `Tuple3d` from a `Tuple3i` immutably.
Parameters:
`tuple` - the tuple to subtract from.
`toSubtract` - the tuple to subtract.
Returns:
a newly created point, where each dimension is the subtraction of the corresponding dimensions in the points.
• #### immutableScale

```public static Point3d immutableScale(Tuple3d tuple,
int factor)```
Scales a tuple immutably.
Parameters:
`tuple` - the tuple to scale.
`factor` - what to multiply each dimension by.
Returns:
a newly created point, where each component is scaled by `factor`.
• #### equals

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

`protected boolean canEqual(Object other)`
Overrides:
`canEqual` in class `Tuple3d`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Tuple3d`