Interface Vector2D
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
Vector2D.Companion
Utility functions for Vector2D.
-
Method Summary
Modifier and Type Method Description Double
dot(P other)
Dot product between bidimensional vectors. Boolean
isInRectangle(Vector2D<?> origin, Double width, Double height)
Checks whether the given point is inside a rectangular region described by an origin point and width and height values (only positive). abstract P
newFrom(Double x, Double y)
Creates a new Vector2D with the same type of the current one with different x and y. P
minus(Pair<Double, Double> other)
Allows subtraction with a Pair. P
normalized()
Normalizes the vector. P
plus(Pair<Double, Double> other)
Allows summaction with a Pair. P
surroundingPointAt(Double angle, Double distance)
Computes a point which is at a certain distance and angle (in radians) from this one. P
surroundingPointAt(P versor, Double distance)
Computes a point which is at a certain distance and angle (expressed as a versor centered in this node) from this one. List<P>
surrounding(Double radius, Integer count)
Creates a list of count points equally spaced in the circle of given radius with center in this vector. Double
getX()
Double
getY()
Double
getAsAngle()
-
Methods inherited from class it.unibo.alchemist.model.geometry.Vector
angleBetween, coerceAtLeast, coerceAtMost, coerceIn, distanceTo, div, fromCoordinates, get, getCoordinates, getDimensions, getMagnitude, getZero, minus, normal, plus, resized, times
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
isInRectangle
Boolean isInRectangle(Vector2D<?> origin, Double width, Double height)
Checks whether the given point is inside a rectangular region described by an origin point and width and height values (only positive).
-
normalized
P normalized()
Normalizes the vector.
-
surroundingPointAt
P surroundingPointAt(Double angle, Double distance)
-
surroundingPointAt
P surroundingPointAt(P versor, Double distance)
Computes a point which is at a certain distance and angle (expressed as a versor centered in this node) from this one.
-
surrounding
List<P> surrounding(Double radius, Integer count)
Creates a list of count points equally spaced in the circle of given radius with center in this vector.
- Parameters:
radius
-the distance each generated position must have from this.
count
-the number of positions to generate.
-
getAsAngle
Double getAsAngle()
-
-
-
-