Class Tuple2d<RT extends Tuple2d<? super RT>>
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.Tuple2d<RT>
-
- Type Parameters:
RT
- is the type of the data returned by the tuple.
- All Implemented Interfaces:
Serializable
,Cloneable
,Tuple2D<RT>
,JsonableObject
public class Tuple2d<RT extends Tuple2d<? super RT>> extends Object implements Tuple2D<RT>
2D tuple with 2 double precision floating-point numbers.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Constructor Summary
Constructors Constructor Description Tuple2d()
Construct a zero tuple.Tuple2d(double[] tuple)
Constructor.Tuple2d(double x, double y)
Construct a tuple with the given coordinates.Tuple2d(int[] tuple)
Constructor.Tuple2d(int x, int y)
Construct a tuple with the given coordinates.Tuple2d(Tuple2D<?> tuple)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
absolute()
Sets each component of this tuple to its absolute value.void
absolute(Tuple2D<?> tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.void
add(double x, double y)
Sets the value of this tuple to the sum of itself and x and y.void
add(int x, int y)
Sets the value of this tuple to the sum of itself and x and y.void
addX(double x)
Sets the x value of this tuple to the sum of itself and x.void
addX(int x)
Sets the x value of this tuple to the sum of itself and x.void
addY(double y)
Sets the y value of this tuple to the sum of itself and y.void
addY(int y)
Sets the y value of this tuple to the sum of itself and y.RT
clone()
Clone this point.boolean
equals(Object t1)
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.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.int
ix()
Get the x coordinate.int
iy()
Get the y coordinate.void
negate()
Negates the value of this tuple in place.void
negate(Tuple2D<?> tuple)
Sets the value of this tuple to the negation of tuple t1.void
scale(double scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.void
scale(double scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.void
scale(int scale)
Sets the value of this tuple to the scalar multiplication of the scale factor with this.void
scale(int scale, Tuple2D<?> tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.void
set(double[] tuple)
Sets the value of this tuple from the 2 values specified in the array.void
set(double x, double y)
Sets the value of this tuple to the specified x and y coordinates.void
set(int[] tuple)
Sets the value of this tuple from the 2 values specified in the array.void
set(int x, int y)
Sets the value of this tuple to the specified x and y coordinates.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.void
sub(double x, double y)
Sets the value of this tuple to the difference of itself and x and y.void
sub(int x, int y)
Sets the value of this tuple to the difference of itself and x and y.void
subX(double x)
Sets the x value of this tuple to the difference of itself and x.void
subX(int x)
Sets the x value of this tuple to the difference of itself and x.void
subY(double y)
Sets the y value of this tuple to the difference of itself and y.void
subY(int y)
Sets the y value of this tuple to the difference of itself and y.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.String
toString()
-
-
-
Constructor Detail
-
Tuple2d
public Tuple2d()
Construct a zero tuple.
-
Tuple2d
public Tuple2d(Tuple2D<?> tuple)
Constructor.- Parameters:
tuple
- is the tuple to copy.
-
Tuple2d
public Tuple2d(int[] tuple)
Constructor.- Parameters:
tuple
- is the tuple to copy.
-
Tuple2d
public Tuple2d(double[] tuple)
Constructor.- Parameters:
tuple
- is the tuple to copy.
-
Tuple2d
public Tuple2d(int x, int y)
Construct a tuple with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
Tuple2d
public Tuple2d(double x, double y)
Construct a tuple with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
-
Method Detail
-
absolute
public void absolute()
Description copied from interface:Tuple2D
Sets each component of this tuple to its absolute value.
-
absolute
public void absolute(Tuple2D<?> tuple)
Description copied from interface:Tuple2D
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
-
add
public void add(int x, int y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the sum of itself and x and y.
-
add
public void add(double x, double y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the sum of itself and x and y.
-
addX
public void addX(int x)
Description copied from interface:Tuple2D
Sets the x value of this tuple to the sum of itself and x.
-
addX
public void addX(double x)
Description copied from interface:Tuple2D
Sets the x value of this tuple to the sum of itself and x.
-
addY
public void addY(int y)
Description copied from interface:Tuple2D
Sets the y value of this tuple to the sum of itself and y.
-
addY
public void addY(double y)
Description copied from interface:Tuple2D
Sets the y value of this tuple to the sum of itself and y.
-
negate
public void negate(Tuple2D<?> tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple to the negation of tuple t1.
-
negate
public void negate()
Description copied from interface:Tuple2D
Negates the value of this tuple in place.
-
scale
public void scale(int scale, Tuple2D<?> tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple to the scalar multiplication of tuple t1.
-
scale
public void scale(double scale, Tuple2D<?> tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple to the scalar multiplication of tuple t1.
-
scale
public void scale(int scale)
Description copied from interface:Tuple2D
Sets the value of this tuple to the scalar multiplication of the scale factor with this.
-
scale
public void scale(double scale)
Description copied from interface:Tuple2D
Sets the value of this tuple to the scalar multiplication of the scale factor with this.
-
set
public void set(Tuple2D<?> tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple to the value of tuple t1.
-
set
public void set(int x, int y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the specified x and y coordinates.
-
set
public void set(double x, double y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the specified x and y coordinates.
-
set
public void set(int[] tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple from the 2 values specified in the array.
-
set
public void set(double[] tuple)
Description copied from interface:Tuple2D
Sets the value of this tuple from the 2 values specified in the array.
-
getX
@Pure public double getX()
Description copied from interface:Tuple2D
Get the x coordinate.
-
ix
@Pure public int ix()
Description copied from interface:Tuple2D
Get the x coordinate.
-
setX
public void setX(int x)
Description copied from interface:Tuple2D
Set the x coordinate.
-
setX
public void setX(double x)
Description copied from interface:Tuple2D
Set the x coordinate.
-
getY
@Pure public double getY()
Description copied from interface:Tuple2D
Get the y coordinate.
-
iy
@Pure public int iy()
Description copied from interface:Tuple2D
Get the y coordinate.
-
setY
public void setY(int y)
Description copied from interface:Tuple2D
Set the y coordinate.
-
setY
public void setY(double y)
Description copied from interface:Tuple2D
Set the y coordinate.
-
sub
public void sub(int x, int y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the difference of itself and x and y.
-
sub
public void sub(double x, double y)
Description copied from interface:Tuple2D
Sets the value of this tuple to the difference of itself and x and y.
-
subX
public void subX(int x)
Description copied from interface:Tuple2D
Sets the x value of this tuple to the difference of itself and x.
-
subX
public void subX(double x)
Description copied from interface:Tuple2D
Sets the x value of this tuple to the difference of itself and x.
-
subY
public void subY(int y)
Description copied from interface:Tuple2D
Sets the y value of this tuple to the difference of itself and y.
-
subY
public void subY(double y)
Description copied from interface:Tuple2D
Sets the y value of this tuple to the difference of itself and y.
-
equals
@Pure public boolean equals(Object t1)
Description copied from interface:Tuple2D
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.
-
hashCode
@Pure public int hashCode()
Description copied from interface:Tuple2D
Returns a hash code value based on the data values in this object. Two differentTuple2D
objects with identical data values (i.e.,Tuple2D.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.
-
toJson
public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Parameters:
buffer
- the Json buffer.
-
-