# Position class

An ordered pair representation (point, position, offset).

It differs from the default implementations provided (math.Point and ui.Offset) as it's mutable. Also, it offers helpful converters and a some useful methods for manipulation. It always uses double values to store the coordinates.

## Constructors

Position(double x, )
Basic constructor
Position.empty()
Creates a point at the origin
Position.fromInts(int x, int y)
Creates converting integers to double. [...]
Position.fromOffset(Offset offset)
Creates using an ui.Offset
Position.fromPoint(Point<num> point)
Creates using an math.Point
Position.fromPosition(Position position)
Creates using another Position; i.e., clones this position. [...]
Position.fromSize(Size size)
Creates using an ui.Size
Position.fromVector(Vector2 vector)
Creates using a b2d.Vector2

## Properties

hashCode int
The hash code for this object. [...]
runtimeType Type
A representation of the runtime type of the object.
x
Coordinates
y
Coordinates

## Methods

Adds the coordinates from another vector. [...]
angle()
Returns the angle of this vector from origin in radians.
angleDeg()
Returns the angle of this vector from origin in degrees.
angleFrom(Position other)
Returns the angle of this vector from another Position in radians.
angleFromDeg(Position other)
Returns the angle of this vector from another Position in degrees.
clone()
distance(Position other)
div(double scalar)
dotProduct()
equals() bool
length()
The length (or magnitude) of this vector.
limit(double maxLength)
Limits the length of this vector to the one provided, without changing direction. [...]
minus(Position other)
Substracts the coordinates from another vector. [...]
normalize()
Normalizes this vector, without changing direction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
opposite()
rotate(double angle)
Rotate around origin; `angle` in radians.
rotateDeg(double angle)
Rotate around origin; `angle` in degrees.
Change current rotation by delta angle; angle in radians.
Change current rotation by delta angle; angle in degrees.
scaleTo(double newLength)
Changes the length of this vector to the one provided, without chaning direction. [...]
times(double scalar)
toOffset()
toPoint() Point<num>
toSize() Size
toString()
A string representation of this object. [...]
override
toVector()

## Operators

operator *(double scale)
Scale.
operator +(Position other)
operator -(Position other)
Subtract two vectors.
operator /(double scale)
Scale.
operator ==(dynamic other) bool
The equality operator. [...]
override
operator unary-()
Negate.

## Static Methods

bounds( pts) Rect
rectFrom(Position topLeft, Position size) Rect