- java.lang.Object
-
- org.arakhne.afc.math.geometry.d1.d.Tuple1d<Vector1d>
-
- org.arakhne.afc.math.geometry.d1.d.Vector1d
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Vector1D<?,?,?>>
,Vector1D<Vector1d,Point1d,Segment1D<?,?>>
,Tuple2D<Vector1d>
,JsonableObject
public class Vector1d extends Tuple1d<Vector1d> implements Vector1D<Vector1d,Point1d,Segment1D<?,?>>
1.5D Vector with 2 double precision floating-point numbers.- Since:
- 14.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 Vector1d()
Construct a zero vector.Vector1d(Point1D<?,?,?> tuple)
Construct a zero vector.Vector1d(Segment1D<?,?> segment)
Construct a zero vector.Vector1d(Segment1D<?,?> segment, double[] tuple)
Constructor by copy.Vector1d(Segment1D<?,?> segment, double x, double y)
Construct a vector with the given coordinates.Vector1d(Segment1D<?,?> segment, float x, float y)
Construct a vector with the given coordinates.Vector1d(Segment1D<?,?> segment, int[] tuple)
Constructor by copy.Vector1d(Segment1D<?,?> segment, int x, int y)
Construct a vector with the given coordinates.Vector1d(Segment1D<?,?> segment, long x, long y)
Construct a vector with the given coordinates.Vector1d(Segment1D<?,?> segment, Tuple2D<?> tuple)
Constructor by copy.Vector1d(Vector1D<?,?,?> tuple)
Construct a zero vector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Vector1D<?,?,?> vector)
Sets the value of this tuple to the sum of itself and the given vector.void
add(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the sum of tuples vector1 and vector2.static Vector1d
convert(Tuple1d<?> tuple)
Convert the given tuple to a real Vector1d.double
getLength()
Returns the length of this vector.double
getLengthSquared()
Returns the squared length of this vector.void
scaleAdd(double scale, Vector1D<?,?,?> vector)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).void
scaleAdd(double scale, Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the scalar multiplication of the tuple vector1 plus the tuple vector2 (this = s*vector1 + vector2).void
scaleAdd(int scale, Vector1D<?,?,?> vector)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).void
scaleAdd(int scale, Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).void
setLength(double newLength)
Change the length of the vector.void
sub(Point1D<?,?,?> point1, Point1D<?,?,?> point2)
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).void
sub(Vector1D<?,?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).void
sub(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).UnmodifiableVector1D<Vector1d,Point1d,Segment1D<?,?>>
toUnmodifiable()
Replies an unmodifiable copy of this vector.-
Methods inherited from class org.arakhne.afc.math.geometry.d1.d.Tuple1d
absolute, absolute, add, add, addX, addX, addY, addY, clone, equals, getGeomFactory, getSegment, getX, getY, hashCode, ix, iy, negate, negate, scale, scale, scale, scale, set, set, set, set, set, set, setSegment, setX, setX, setY, setY, sub, sub, subX, subX, subY, subY, toJson, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Tuple2D
absolute, absolute, add, add, addX, addX, addY, addY, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, get, get, get, getX, getY, hashCode, interpolate, interpolate, ix, iy, negate, negate, scale, scale, scale, scale, set, set, set, set, set, setX, setX, setY, setY, sub, sub, subX, subX, subY, subY
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.Vector1D
$div, $minus, $minus, $minus, $minus, $plus, $plus, $plus, $times, compareTo, equals, equals, getGeomFactory, getSegment, isUnitVector, normalize, normalize, operator_add, operator_divide, operator_elvis, operator_equals, operator_minus, operator_minus, operator_minus, operator_minus, operator_multiply, operator_notEquals, operator_plus, operator_plus, operator_plus, operator_remove, toUnitVector
-
-
-
-
Constructor Detail
-
Vector1d
public Vector1d(Vector1D<?,?,?> tuple)
Construct a zero vector.- Parameters:
tuple
- the tuple to copy.
-
Vector1d
public Vector1d(Point1D<?,?,?> tuple)
Construct a zero vector.- Parameters:
tuple
- the tuple to copy.
-
Vector1d
public Vector1d(Segment1D<?,?> segment)
Construct a zero vector.- Parameters:
segment
- the segment associated to the vector.
-
Vector1d
public Vector1d()
Construct a zero vector.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, Tuple2D<?> tuple)
Constructor by copy.- Parameters:
segment
- the segment associated to the vector.tuple
- is the tuple to copy.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, int[] tuple)
Constructor by copy.- Parameters:
segment
- the segment associated to the vector.tuple
- is the tuple to copy.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, double[] tuple)
Constructor by copy.- Parameters:
segment
- the segment associated to the vector.tuple
- is the tuple to copy.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, int x, int y)
Construct a vector with the given coordinates.- Parameters:
segment
- the segment associated to the vector.x
- x coordinate.y
- y coordinate.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, float x, float y)
Construct a vector with the given coordinates.- Parameters:
segment
- the segment associated to the vector.x
- x coordinate.y
- y coordinate.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, double x, double y)
Construct a vector with the given coordinates.- Parameters:
segment
- the segment associated to the vector.x
- x coordinate.y
- y coordinate.
-
Vector1d
public Vector1d(Segment1D<?,?> segment, long x, long y)
Construct a vector with the given coordinates.- Parameters:
segment
- the segment associated to the vector.x
- x coordinate.y
- y coordinate.
-
-
Method Detail
-
convert
public static Vector1d convert(Tuple1d<?> tuple)
Convert the given tuple to a real Vector1d.If the given tuple is already a Vector1d, it is replied.
- Parameters:
tuple
- the tuple.- Returns:
- the Vector1d.
- Since:
- 14.0
-
getLength
@Pure public double getLength()
Description copied from interface:Vector1D
Returns the length of this vector.
-
getLengthSquared
@Pure public double getLengthSquared()
Description copied from interface:Vector1D
Returns the squared length of this vector.- Specified by:
getLengthSquared
in interfaceVector1D<Vector1d,Point1d,Segment1D<?,?>>
- Returns:
- the squared length of this vector
-
add
public void add(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Description copied from interface:Vector1D
Sets the value of this tuple to the sum of tuples vector1 and vector2.
-
add
public void add(Vector1D<?,?,?> vector)
Description copied from interface:Vector1D
Sets the value of this tuple to the sum of itself and the given vector.
-
scaleAdd
public void scaleAdd(int scale, Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Description copied from interface:Vector1D
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).
-
scaleAdd
public void scaleAdd(double scale, Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Description copied from interface:Vector1D
Sets the value of this tuple to the scalar multiplication of the tuple vector1 plus the tuple vector2 (this = s*vector1 + vector2).
-
scaleAdd
public void scaleAdd(int scale, Vector1D<?,?,?> vector)
Description copied from interface:Vector1D
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).
-
scaleAdd
public void scaleAdd(double scale, Vector1D<?,?,?> vector)
Description copied from interface:Vector1D
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).
-
sub
public void sub(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Description copied from interface:Vector1D
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).
-
sub
public void sub(Point1D<?,?,?> point1, Point1D<?,?,?> point2)
Description copied from interface:Vector1D
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).
-
sub
public void sub(Vector1D<?,?,?> vector)
Description copied from interface:Vector1D
Sets the value of this tuple to the difference of itself and vector (this = this - vector).
-
setLength
public void setLength(double newLength)
Description copied from interface:Vector1D
Change the length of the vector. The direction of the vector is unchanged.
-
toUnmodifiable
public UnmodifiableVector1D<Vector1d,Point1d,Segment1D<?,?>> toUnmodifiable()
Description copied from interface:Vector1D
Replies an unmodifiable copy of this vector.- Specified by:
toUnmodifiable
in interfaceVector1D<Vector1d,Point1d,Segment1D<?,?>>
- Returns:
- an unmodifiable copy.
-
-