Package org.arakhne.afc.math.geometry.d2
Interface Tuple2D<RT extends Tuple2D<? super RT>>
-
- Type Parameters:
RT
- is the type of data that can be returned by this tuple.
- All Superinterfaces:
Cloneable
,JsonableObject
,Serializable
- All Known Subinterfaces:
OrientedPoint2D<RP,RV>
,Point1D<RP,RV,RS>
,Point2D<RP,RV>
,UnmodifiablePoint1D<RP,RV,RS>
,UnmodifiablePoint2D<RP,RV>
,UnmodifiableTuple2D<RT>
,UnmodifiableVector1D<RV,RP,RS>
,UnmodifiableVector2D<RV,RP>
,Vector1D<RV,RP,RS>
,Vector2D<RV,RP>
- All Known Implementing Classes:
ImmutablePoint1D
,ImmutablePoint2D
,ImmutableVector1D
,ImmutableVector2D
,InnerComputationPoint1afp
,InnerComputationPoint2afp
,InnerComputationPoint2ai
,InnerComputationVector1afp
,InnerComputationVector2afp
,InnerComputationVector2ai
,OrientedPoint2d
,OrientedPoint2dfx
,OrientedPoint2i
,OrientedPoint2ifx
,Point1d
,Point1dfx
,Point2d
,Point2dfx
,Point2i
,Point2ifx
,Tuple1d
,Tuple1dfx
,Tuple2d
,Tuple2dfx
,Tuple2i
,Tuple2ifx
,Vector1d
,Vector1dfx
,Vector2d
,Vector2dfx
,Vector2i
,Vector2ifx
public interface Tuple2D<RT extends Tuple2D<? super RT>> extends Cloneable, Serializable, JsonableObject
2D tuple.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
absolute()
Sets each component of this tuple to its absolute value.default void
absolute(Tuple2D<?> tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.default void
add(double x, double y)
Sets the value of this tuple to the sum of itself and x and y.default void
add(int x, int y)
Sets the value of this tuple to the sum of itself and x and y.default void
addX(double x)
Sets the x value of this tuple to the sum of itself and x.default void
addX(int x)
Sets the x value of this tuple to the sum of itself and x.default void
addY(double y)
Sets the y value of this tuple to the sum of itself and y.default void
addY(int y)
Sets the y value of this tuple to the sum of itself and y.default void
clamp(double min, double max)
Clamps this tuple to the range [low, high].default void
clamp(double min, double max, Tuple2D<?> tuple)
Clamps the tuple parameter to the range [low, high] and places the values into this tuple.default void
clamp(int min, int max)
Clamps this tuple to the range [low, high].default void
clamp(int min, int max, Tuple2D<?> tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple.default void
clampMax(double max)
Clamps the maximum value of this tuple to the max parameter.default void
clampMax(double max, Tuple2D<?> tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.default void
clampMax(int max)
Clamps the maximum value of this tuple to the max parameter.default void
clampMax(int max, Tuple2D<?> tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.default void
clampMin(double min)
Clamps the minimum value of this tuple to the min parameter.default void
clampMin(double min, Tuple2D<?> tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.default void
clampMin(int min)
Clamps the minimum value of this tuple to the min parameter.default void
clampMin(int min, Tuple2D<?> tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.RT
clone()
Clone this point.default boolean
epsilonEquals(Tuple2D<?> tuple, double epsilon)
Returns true if the Euclidian distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false.boolean
equals(Object object)
Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.default boolean
equals(Tuple2D<?> tuple)
Returns true if all of the data members of Tuple2D t1 are equal to the corresponding data members in this Tuple2D.default void
get(double[] tuple)
Copies the value of the elements of this tuple into the array t.default void
get(int[] tuple)
Copies the value of the elements of this tuple into the array t.default void
get(Tuple2D<?> tuple)
Copies the values of this tuple into the tuple t.double
getX()
Get the x coordinate.double
getY()
Get the y coordinate.int
hashCode()
Returns a hash code value based on the data values in this object.default void
interpolate(Tuple2D<?> tuple, double alpha)
Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.default void
interpolate(Tuple2D<?> tuple1, Tuple2D<?> tuple2, double alpha)
Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.int
ix()
Get the x coordinate.int
iy()
Get the y coordinate.default void
negate()
Negates the value of this tuple in place.default void
negate(Tuple2D<?> tuple)
Sets the value of this tuple to the negation of tuple t1.default void
scale(double scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.default void
scale(double scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.default void
scale(int scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.default void
scale(int scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.default void
set(double[] tuple)
Sets the value of this tuple from the 2 values specified in the array.default void
set(double x, double y)
Sets the value of this tuple to the specified x and y coordinates.default void
set(int[] tuple)
Sets the value of this tuple from the 2 values specified in the array.default void
set(int x, int y)
Sets the value of this tuple to the specified x and y coordinates.default void
set(Tuple2D<?> tuple)
Sets the value of this tuple to the value of tuple t1.void
setX(double x)
Set the x coordinate.void
setX(int x)
Set the x coordinate.void
setY(double y)
Set the y coordinate.void
setY(int y)
Set the y coordinate.default void
sub(double x, double y)
Sets the value of this tuple to the difference of itself and x and y.default void
sub(int x, int y)
Sets the value of this tuple to the difference of itself and x and y.default void
subX(double x)
Sets the x value of this tuple to the difference of itself and x.default void
subX(int x)
Sets the x value of this tuple to the difference of itself and x.default void
subY(double y)
Sets the y value of this tuple to the difference of itself and y.default void
subY(int y)
Sets the y value of this tuple to the difference of itself and y.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
-
-
-
Method Detail
-
clone
@Pure RT clone()
Clone this point.- Returns:
- the clone.
-
absolute
default void absolute()
Sets each component of this tuple to its absolute value.
-
absolute
default void absolute(Tuple2D<?> tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.- Parameters:
tuple
- the source tuple, which will not be modified
-
add
default void add(int x, int y)
Sets the value of this tuple to the sum of itself and x and y.- Parameters:
x
- x coordinate to add.y
- y coordinate to add.
-
add
default void add(double x, double y)
Sets the value of this tuple to the sum of itself and x and y.- Parameters:
x
- x coordinate to add.y
- y coordinate to add.
-
addX
default void addX(int x)
Sets the x value of this tuple to the sum of itself and x.- Parameters:
x
- x coordinate to add.
-
addX
default void addX(double x)
Sets the x value of this tuple to the sum of itself and x.- Parameters:
x
- x coordinate to add.
-
addY
default void addY(int y)
Sets the y value of this tuple to the sum of itself and y.- Parameters:
y
- y coordinate to add.
-
addY
default void addY(double y)
Sets the y value of this tuple to the sum of itself and y.- Parameters:
y
- y coordinate to add.
-
clamp
default void clamp(int min, int max)
Clamps this tuple to the range [low, high].- Parameters:
min
- the lowest value in this tuple after clampingmax
- the highest value in this tuple after clamping
-
clamp
default void clamp(double min, double max)
Clamps this tuple to the range [low, high].- Parameters:
min
- the lowest value in this tuple after clampingmax
- the highest value in this tuple after clamping
-
clamp
default void clamp(int min, int max, Tuple2D<?> tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple.- Parameters:
min
- the lowest value in the tuple after clampingmax
- the highest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
clamp
default void clamp(double min, double max, Tuple2D<?> tuple)
Clamps the tuple parameter to the range [low, high] and places the values into this tuple.- Parameters:
min
- the lowest value in the tuple after clampingmax
- the highest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
clampMin
default void clampMin(int min)
Clamps the minimum value of this tuple to the min parameter.- Parameters:
min
- the lowest value in this tuple after clamping
-
clampMin
default void clampMin(double min)
Clamps the minimum value of this tuple to the min parameter.- Parameters:
min
- the lowest value in this tuple after clamping
-
clampMin
default void clampMin(int min, Tuple2D<?> tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.- Parameters:
min
- the lowest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
clampMin
default void clampMin(double min, Tuple2D<?> tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.- Parameters:
min
- the lowest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
clampMax
default void clampMax(int max)
Clamps the maximum value of this tuple to the max parameter.- Parameters:
max
- the highest value in the tuple after clamping
-
clampMax
default void clampMax(double max)
Clamps the maximum value of this tuple to the max parameter.- Parameters:
max
- the highest value in the tuple after clamping
-
clampMax
default void clampMax(int max, Tuple2D<?> tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.- Parameters:
max
- the highest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
clampMax
default void clampMax(double max, Tuple2D<?> tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.- Parameters:
max
- the highest value in the tuple after clampingtuple
- the source tuple, which will not be modified
-
get
default void get(Tuple2D<?> tuple)
Copies the values of this tuple into the tuple t.- Parameters:
tuple
- is the target tuple
-
get
default void get(int[] tuple)
Copies the value of the elements of this tuple into the array t.- Parameters:
tuple
- the array that will contain the values of the vector
-
get
default void get(double[] tuple)
Copies the value of the elements of this tuple into the array t.- Parameters:
tuple
- the array that will contain the values of the vector
-
negate
default void negate(Tuple2D<?> tuple)
Sets the value of this tuple to the negation of tuple t1.- Parameters:
tuple
- the source tuple
-
negate
default void negate()
Negates the value of this tuple in place.
-
scale
default void scale(int scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.- Parameters:
scale
- the scalar valuetuple
- the source tuple
-
scale
default void scale(double scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.- Parameters:
scale
- the scalar valuetuple
- the source tuple
-
scale
default void scale(int scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.- Parameters:
scale
- the scalar value
-
scale
default void scale(double scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.- Parameters:
scale
- the scalar value
-
set
default void set(Tuple2D<?> tuple)
Sets the value of this tuple to the value of tuple t1.- Parameters:
tuple
- the tuple to be copied
-
set
default void set(int x, int y)
Sets the value of this tuple to the specified x and y coordinates.- Parameters:
x
- the x coordinatey
- the y coordinate
-
set
default void set(double x, double y)
Sets the value of this tuple to the specified x and y coordinates.- Parameters:
x
- the x coordinatey
- the y coordinate
-
set
default void set(int[] tuple)
Sets the value of this tuple from the 2 values specified in the array.- Parameters:
tuple
- the array of length 2 containing xy in order
-
set
default void set(double[] tuple)
Sets the value of this tuple from the 2 values specified in the array.- Parameters:
tuple
- the array of length 2 containing xy in order
-
getX
@Pure double getX()
Get the x coordinate.- Returns:
- the x coordinate.
-
ix
@Pure int ix()
Get the x coordinate.- Returns:
- the x coordinate.
-
setX
void setX(int x)
Set the x coordinate.- Parameters:
x
- value to x coordinate.
-
setX
void setX(double x)
Set the x coordinate.- Parameters:
x
- value to x coordinate.
-
getY
@Pure double getY()
Get the y coordinate.- Returns:
- the y coordinate.
-
iy
@Pure int iy()
Get the y coordinate.- Returns:
- the y coordinate.
-
setY
void setY(int y)
Set the y coordinate.- Parameters:
y
- value to y coordinate.
-
setY
void setY(double y)
Set the y coordinate.- Parameters:
y
- value to y coordinate.
-
sub
default void sub(int x, int y)
Sets the value of this tuple to the difference of itself and x and y.- Parameters:
x
- x coordinate to substract.y
- y coordinate to substract.
-
sub
default void sub(double x, double y)
Sets the value of this tuple to the difference of itself and x and y.- Parameters:
x
- x coordinate to substract.y
- y coordinate to substract.
-
subX
default void subX(int x)
Sets the x value of this tuple to the difference of itself and x.- Parameters:
x
- x coordinate to substract.
-
subX
default void subX(double x)
Sets the x value of this tuple to the difference of itself and x.- Parameters:
x
- x coordinate to substract.
-
subY
default void subY(int y)
Sets the y value of this tuple to the difference of itself and y.- Parameters:
y
- y coordinate to substract.
-
subY
default void subY(double y)
Sets the y value of this tuple to the difference of itself and y.- Parameters:
y
- y coordinate to substract.
-
interpolate
default void interpolate(Tuple2D<?> tuple1, Tuple2D<?> tuple2, double alpha)
Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.- Parameters:
tuple1
- the first tupletuple2
- the second tuplealpha
- the alpha interpolation parameter (value in [0;1]).
-
interpolate
default void interpolate(Tuple2D<?> tuple, double alpha)
Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.- Parameters:
tuple
- the first tuplealpha
- the alpha interpolation parameter
-
equals
@Pure default boolean equals(Tuple2D<?> tuple)
Returns true if all of the data members of Tuple2D t1 are equal to the corresponding data members in this Tuple2D.- Parameters:
tuple
- the vector with which the comparison is made- Returns:
- true or false
-
equals
@Pure boolean equals(Object object)
Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.
-
epsilonEquals
@Pure default boolean epsilonEquals(Tuple2D<?> tuple, double epsilon)
Returns true if the Euclidian distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false.- Parameters:
tuple
- the tuple to be compared to this tupleepsilon
- the threshold value- Returns:
- true or false
-
hashCode
@Pure int hashCode()
Returns a hash code value based on the data values in this object. Two differentTuple2D
objects with identical data values (i.e.,equals(Object)
returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely.
-
-