Vec2 class

Constructors

Vec2(double x, double y)
Vec2.copy(Vec2 other)
Vec2.fromAngle(double angle, [double magnitude = 1.0])
Vec2.fromJson(Map<String, dynamic> json)
factory
Vec2.one()
Vec2.zero()

Properties

angle double
no setter
hashCode int
The hash code for this object.
no setteroverride
isZero bool
no setter
magnitude double
no setter
magnitudeSquared double
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x double
getter/setter pair
y double
getter/setter pair

Methods

add(Vec2 other) → void
clamp(double maxLength) → void
clamped(double maxLength) Vec2
clone() Vec2
cross(Vec2 other) double
distanceSquaredTo(Vec2 other) double
distanceTo(Vec2 other) double
divide(Vec2 other) → void
dot(Vec2 other) double
lerp(Vec2 other, double t) Vec2
mult(Vec2 other) → void
normalize() → void
normalized() Vec2
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset({double dx = 0, double dy = 0}) Offset
reflect(Vec2 normal) → void
reflected(Vec2 normal) Vec2
rotate(double angle) → void
rotated(double angle) Vec2
scale(double scalar) → void
set(double newX, double newY) → void
setFrom(Vec2 other) → void
setMag(double mag) → void
sub(Vec2 other) → void
toJson() Map<String, double>
toString() String
A string representation of this object.
override

Operators

operator *(Object other) Vec2
operator +(Object other) Vec2
operator -(Object other) Vec2
operator /(Object other) Vec2
operator ==(Object other) bool
The equality operator.
override
operator [](int index) double
operator []=(int index, double value) → void
operator unary-() Vec2

Static Methods

angleBetween(Vec2 a, Vec2 b) double
max(Vec2 a, Vec2 b) Vec2
min(Vec2 a, Vec2 b) Vec2
reflectBetween(Vec2 direction, Vec2 normal) Vec2