Package org.anchoranalysis.spatial.point
Class Point3i
- All Implemented Interfaces:
Serializable
,Comparable<ReadableTuple3i>
,ReadableTuple3i
A three-dimensional point of int values.
We consider a point to be a tuple representing a single physical point in space.
- Author:
- Owen Feehan
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPoint3i()
Creates the points with a 0 in each dimension.Point3i
(int valueForAllDimensions) Create with an identical value in each dimension.Point3i
(int x, int y, int z) Create with values for each dimension.Point3i
(ReadableTuple3i point) Creates with the same values as an existingReadableTuple3i
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
double
The Euclidean distance between this point and another.int
distanceMax
(Point3i point) The maximum distance across any individual axis to another point.double
distanceSquared
(Point3d point) The square of the Euclidean distance between this point and anotherPoint3d
.int
distanceSquared
(Point3i point) The square of the Euclidean distance between this point and anotherPoint3i
.duplicateChangeZ
(int zValueToAssign) Creates a copy of the current tuple, but with a different Z-component value.static Point3i
elementwiseOperation
(ReadableTuple3i tuple1, ReadableTuple3i tuple2, IntBinaryOperator operator) Creates a new point by applying a pairwise operation to each dimension's values for two tuples.boolean
int
hashCode()
static Point3i
immutableAdd
(ReadableTuple3i tuple, int x, int y, int z) Adds values to a tuple immutably.static Point3i
immutableAdd
(ReadableTuple3i tuple1, ReadableTuple3i tuple2) Adds two tuples immutably.static Point3i
immutableAdd
(ReadableTuple3i tuple1, ReadableTuple3i tuple2, ReadableTuple3i tuple3) Adds three tuples immutably.static Point3i
immutableScale
(ReadableTuple3i point, int factor) Multiplies each component byfactor
without changing any values in an existing point.static Point3i
immutableSubtract
(ReadableTuple3i tuple, ReadableTuple3i toSubtract) Subtracts two tuples immutably.Methods inherited from class org.anchoranalysis.spatial.point.Tuple3i
add, decrementX, decrementX, decrementY, decrementY, decrementZ, decrementZ, divideBy, incrementX, incrementX, incrementY, incrementY, incrementZ, incrementZ, max, max, min, scale, scale, scaleX, scaleXY, scaleY, setX, setY, setZ, subtract, subtract, toString, valueByDimension, valueByDimension, x, y, z
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.anchoranalysis.spatial.point.ReadableTuple3i
compareTo, matchAllDimensions, matchAllDimensions
-
Field Details
-
ORIGIN
A constantPoint3i
where all dimensions are zero.
-
-
Constructor Details
-
Point3i
public Point3i()Creates the points with a 0 in each dimension. -
Point3i
public Point3i(int valueForAllDimensions) Create with an identical value in each dimension.- Parameters:
valueForAllDimensions
- the value for each dimension.
-
Point3i
public Point3i(int x, int y, int 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.
-
Point3i
Creates with the same values as an existingReadableTuple3i
.- Parameters:
point
- to copy values from.
-
-
Method Details
-
distance
The Euclidean distance between this point and another.- Parameters:
point
- the other point to a measure a distance to.- Returns:
- the distance.
-
distanceSquared
The square of the Euclidean distance between this point and anotherPoint3i
.- Parameters:
point
- the other point to a measure a distance to.- Returns:
- the distance squared.
-
distanceSquared
The square of the Euclidean distance between this point and anotherPoint3d
.- Parameters:
point
- the other point to a measure a distance to.- Returns:
- the distance squared.
-
distanceMax
The maximum distance across any individual axis to another point.- Parameters:
point
- the point to consider distances to, across each axis.- Returns:
- the maximal distance along any one particular axis.
-
duplicateChangeZ
Description copied from interface:ReadableTuple3i
Creates a copy of the current tuple, but with a different Z-component value.- Parameters:
zValueToAssign
- the value to assign in the Z-axis.- Returns:
- a copy of the current object with changed Z-component value.
-
immutableAdd
Adds two tuples immutably.- 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.
-
immutableAdd
public static Point3i immutableAdd(ReadableTuple3i tuple1, ReadableTuple3i tuple2, ReadableTuple3i tuple3) Adds three tuples immutably.- Parameters:
tuple1
- the first tuple to add.tuple2
- the second tuple to add.tuple3
- the third tuple to add.- Returns:
- a newly created point, where each dimension is the sum of the corresponding dimensions in the points.
-
immutableAdd
Adds values to a tuple immutably.- Parameters:
tuple
- the tuple 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
Subtracts two tuples 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
Multiplies each component byfactor
without changing any values in an existing point.This is an immutable operation that produces a new point.
- Parameters:
point
- the point whose component's will be scaled.factor
- the factor to scale by.- Returns:
- a newly created point with scaled values.
-
elementwiseOperation
public static Point3i elementwiseOperation(ReadableTuple3i tuple1, ReadableTuple3i tuple2, IntBinaryOperator operator) Creates a new point by applying a pairwise operation to each dimension's values for two tuples.- Parameters:
tuple1
- the first tuple.tuple2
- the second tuple.operator
- the operator to apply to each dimension of the tuples to produce the corresponding dimension in the returned tuple.- Returns:
- a newly-created point arising from applying
operator
to the components of each tuple.
-
equals
-
canEqual
-
hashCode
public int hashCode()
-