Vector4 class
- Inheritance
-
- Object
- IterableMixin
- Vector
- Vector4
- Available extensions
Properties
- direction → dynamic
-
Available on Vector, provided by the VectorOperations extension
Returns the direction (or angle) of the vector, in radians.no setter - elements → Iterable
-
Getter to retrieve an iterable over all elements in the matrix,
regardless of their row or column.
no setterinherited
- first → dynamic
-
The first element.
no setterinherited
- firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnullif the iterable is empty.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter - isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
- iterator → Iterator
-
Overrides the iterator getter to provide a VectorIterator.
This iterator iterates over the elements of the vector.
no setterinherited
- last → dynamic
-
The last element.
no setterinherited
- lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnullif the iterable is empty.no setter - length → int
-
Returns the length (number of elements) of the vector.
no setterinherited
- magnitude → dynamic
-
Available on Vector, provided by the VectorOperations extension
Returns the magnitude (or norm) of the vector.no setter -
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnullelements of this iterable.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → dynamic
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull.no setter - w ↔ dynamic
-
getter/setter pair
-
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures in parallel.Future< , provided by the FutureIterable extensionT> >no setter - x ↔ dynamic
-
getter/setter pair
- y ↔ dynamic
-
getter/setter pair
- z ↔ dynamic
-
getter/setter pair
Methods
-
abs(
) → Vector -
Available on Vector, provided by the VectorOperations extension
Returns a new vector with the absolute values of the original vector's elements. -
addMatrix(
Matrix matrix) → Matrix -
Available on Vector, provided by the VectorMatrixOperations extension
Add a vector and a matrix -
angle(
Vector other) → dynamic -
Returns the angle (in radians) between this vector and
other.inherited -
any(
bool test(dynamic element)) → bool -
Checks whether any element of this iterable satisfies
test.inherited -
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname. -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
Rinstances.inherited -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element.inherited -
cross(
Vector other) → Vector -
Available on Vector, provided by the VectorOperations extension
Calculates the cross product of the vector with another vector. -
distance(
Vector other, {DistanceType distance = DistanceType.frobenius}) → dynamic -
Sets all elements of this vector to
value.inherited -
dot(
Vector other) → dynamic -
Available on Vector, provided by the VectorOperations extension
Calculates the dot product of the vector with another vector. -
elementAt(
int index) → dynamic -
Returns the
indexth element.inherited -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindexof this iterable, ornull. -
every(
bool test(dynamic element)) → bool -
Checks whether every element of this iterable satisfies
test.inherited -
exp(
) → Vector -
Available on Vector, provided by the VectorOperations extension
Returns a new vector with each element being the exponential function of the corresponding element in the original vector. -
expand<
T> (Iterable< T> toElements(dynamic element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(dynamic element), {dynamic orElse()?}) → dynamic -
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, dynamic element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable other) → Iterable -
Creates the lazy concatenation of this iterable and
other.inherited -
forEach(
void action(dynamic element)) → void -
Invokes
actionon 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
-
groupBy<
K> (K keyExtractor(T)) → Map< K, List< T> > -
Available on Iterable<
Groups the elements of the iterable by a key extracted using the providedT> , provided by the GroupingExtension extensionkeyExtractorfunction. -
homogenize(
) → Vector4 -
innerProduct(
Vector other) → dynamic -
Available on Vector, provided by the VectorOperations extension
Computes the inner product of two vectors. -
insertBetween<
T> (T separator) → Iterable< T> -
Available on Iterable<
Extends Iterable with the ability to intersperse an element of typeE> , provided by the IterableExt extensionTbetween each element. -
isParallelTo(
Vector other) → bool -
Available on Vector, provided by the VectorOperations extension
Checks if this Vector is parallel toother. -
isPerpendicularTo(
Vector other) → bool -
Available on Vector, provided by the VectorOperations extension
Checks if this Vector is perpendicular toother. -
isUnit(
) → bool -
Returns
trueif this is a unit vector, i.e., its norm is 1.inherited -
isZero(
) → bool -
Returns
trueif 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(dynamic element), {dynamic orElse()?}) → dynamic -
The last element that satisfies the given predicate
test.inherited -
map<
T> (T toElement(dynamic e)) → Iterable< T> -
The current elements of this iterable modified by
toElement.inherited -
mean(
) → dynamic -
Available on Vector, provided by the VectorOperations extension
Returns the arithmetic mean of the vector. -
median(
) → dynamic -
Available on Vector, provided by the VectorOperations extension
Returns the median value of the vector. If the vector has an even number of elements, the median is calculated as the mean of the two central elements. -
norm(
[Norm normType = Norm.frobenius]) → dynamic -
Available on Vector, provided by the VectorOperations extension
Returns the norm (or length) of this vector. -
normalize(
[Norm normType = Norm.frobenius]) → Vector -
Available on Vector, provided by the VectorOperations extension
Returns this vector normalized. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
outerProduct(
Vector other) → Matrix -
Available on Vector, provided by the VectorOperations extension
Computes the outer product of two vectors. -
pop(
) → dynamic -
Removes the last value in the row.
inherited
-
pow(
num exponent) → Vector -
Available on Vector, provided by the VectorOperations extension
Returns a new vector with each element being raised to the provided exponent. -
product(
) → dynamic -
Available on Vector, provided by the VectorOperations extension
Returns the product of all elements in the vector. -
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(
dynamic combine(dynamic value, dynamic element)) → dynamic -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
rescale(
) → Vector -
Available on Vector, provided by the VectorOperations extension
Rescales the vector to the range 0-1. -
roll(
dynamic shift) → Vector -
Rolls the elements in a 1D list by a certain amount.
inherited
-
rotate(
double angle, {String plane = "xy"}) → Vector4 -
round(
[int decimalPlaces = 0]) → Vector -
Available on Vector, provided by the VectorOperations extension
Rounds each element in the vector to the specified number of decimal places. -
scale(
dynamic scalar) → Vector -
Available on Vector, provided by the VectorOperations extension
Scales a vector by a given scalar. -
shift(
) → dynamic -
Removes the first value in the row.
inherited
-
singleWhere(
bool test(dynamic element), {dynamic orElse()?}) → dynamic -
The single element that satisfies
test.inherited -
skip(
int count) → Iterable -
Creates an Iterable that provides all but the first
countelements.inherited -
skipWhile(
bool test(dynamic value)) → Iterable -
Creates an
Iterablethat skips leading elements whiletestis satisfied.inherited -
splice(
int start, int deleteCount, [List< num> newItems = const []]) → void -
Adds/removes elements at an arbitrary position in the row.
inherited
-
subtractMatrix(
Matrix matrix) → Matrix -
Available on Vector, provided by the VectorMatrixOperations extension
Subtract a matrix from a vector -
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
-
sum(
[dynamic selector(E)?]) → dynamic -
Available on Iterable<
Returns the sum of all elements in this iterable.E> , provided by the IterableExt extension -
sum(
) → dynamic -
Available on Vector, provided by the VectorOperations extension
Returns the sum of all elements in the vector. -
swap(
int index1, int index2) → void -
Swaps two elements in the row.
inherited
-
take(
int count) → Iterable -
Creates a lazy iterable of the
countfirst elements of this iterable.inherited -
takeWhile(
bool test(dynamic value)) → Iterable -
Creates a lazy iterable of the leading elements satisfying
test.inherited -
toCylindrical(
) → List -
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 -
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 -
Converts the Vector from Cartesian to Polar coordinates.
inherited
-
toSet(
) → Set -
Creates a Set containing the same elements as this iterable.
inherited
-
toSpherical(
) → List -
Converts the Vector from Cartesian to Spherical coordinates.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this.inherited -
transform(
Matrix4 matrix) → Vector4 -
unShift(
num value) → void -
Adds a new value at the beginning of the row.
inherited
-
where(
bool test(dynamic element)) → Iterable -
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 *(
dynamic other) → Vector -
Available on Vector, provided by the VectorOperations extension
-
operator +(
dynamic other) → dynamic -
Available on Vector, provided by the VectorOperations extension
-
operator -(
dynamic other) → dynamic -
Available on Vector, provided by the VectorOperations extension
-
operator /(
dynamic other) → Vector -
Available on Vector, provided by the VectorOperations extension
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → dynamic -
Fetches the value at the given index of the vector.
inherited
-
operator []=(
int index, dynamic value) → void -
Sets the value at the given index of the vector.
inherited
-
operator unary-(
) → Vector -
Available on Vector, provided by the VectorOperations extension
Negates this vector element-wise.