Vector2 class

Inheritance
Available Extensions

Constructors

Vector2(num x, num y)

Properties

elements Iterable
Getter to retrieve an iterable over all elements in the matrix, regardless of their row or column.
no setterinherited
first num
The first element.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<num>
Overrides the iterator getter to provide a VectorIterator. This iterator iterates over the elements of the vector.
no setterinherited
last num
The last element.
no setterinherited
length int
Returns the length (number of elements) of the vector.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single num
Checks that this iterable has only one element, and returns that element.
no setterinherited
x num
getter/setter pair
y num
getter/setter pair

Methods

angle(Vector other) double
Returns the angle (in radians) between this vector and other.
inherited
any(bool test(num element)) bool
Checks whether any element of this iterable satisfies test.
inherited
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
distance(Vector other, {DistanceType distance = DistanceType.frobenius}) num
Sets all elements of this vector to value.
inherited
elementAt(int index) num
Returns the indexth element.
inherited
every(bool test(num element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(num element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(num element), {num orElse()?}) num
The first element that satisfies the given predicate test.
inherited
flip() Vector
Flips elements of the vector.
inherited
fold<T>(T initialValue, T combine(T previousValue, num element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<num> other) Iterable<num>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(num element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
getVector(List<String> mapping) Vector
Generates a new Vector (Vector2, Vector3, Vector4) based on the mapping provided.
inherited
isUnit() bool
Returns true if this is a unit vector, i.e., its norm is 1.
inherited
isZero() bool
Returns true if this is a zero vector, i.e., all its elements are zero.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(num element), {num orElse()?}) num
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(num e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perpendicular() Vector2
pop() num
Removes the last value in the row.
inherited
projection(Vector other) Vector
Returns the projection of this vector onto other.
inherited
push(num value) → void
Adds a new value at the end of the row.
inherited
reduce(num combine(num value, num element)) num
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
roll(dynamic shift) Vector
Rolls the elements in a 1D list by a certain amount.
inherited
rotate(double angle) Vector2
shift() → dynamic
Removes the first value in the row.
inherited
singleWhere(bool test(num element), {num orElse()?}) num
The single element that satisfies test.
inherited
skip(int count) Iterable<num>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(num value)) Iterable<num>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
splice(int start, int deleteCount, [List<num> newItems = const []]) → void
Adds/removes elements at an arbitrary position in the row.
inherited
subVector({List<int>? indices, String range = '', int? start, int? end}) Vector
Extracts a subVector from the given vector using the specified indices or range.
inherited
swap(int index1, int index2) → void
Swaps two elements in the row.
inherited
take(int count) Iterable<num>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(num value)) Iterable<num>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toCylindrical() List<double>
Converts the Vector from Cartesian to Cylindrical coordinates.
inherited
toDiagonal() Matrix
Returns the leading diagonal matrix from a vector.
inherited
toList({bool growable = true}) List<num>
Creates a List containing the elements of this Iterable.
inherited
toMatrix(int rows, int cols, {bool fillWithZeros = true}) Matrix
Constructs a new Matrix from a vector.
inherited
toPoint() Point
inherited
toPolar() List<double>
Converts the Vector from Cartesian to Polar coordinates.
inherited
toSet() Set<num>
Creates a Set containing the same elements as this iterable.
inherited
toSpherical() List<double>
Converts the Vector from Cartesian to Spherical coordinates.
inherited
toString() String
Returns a string representation of (some of) the elements of this.
inherited
transform(Matrix2 matrix) Vector2
unShift(num value) → void
Adds a new value at the beginning of the row.
inherited
where(bool test(num element)) Iterable<num>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) num
Fetches the value at the given index of the vector.
inherited
operator []=(int index, num value) → void
Sets the value at the given index of the vector.
inherited