Sp3dV2D class

(en)A class for handling 2D vectors. This class acts as Final and cannot change its value.

(ja)二次元ベクトルを扱うためのクラスです。このクラスはFinalとして機能し、値を変更できません。

Author Masahide Mori

First edition creation date 2021-09-30 12:18:31

Annotations

Constructors

Sp3dV2D(double x, double y)
Constructor
const

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x double
final
y double
final

Methods

angleTo(Sp3dV2D other, {Sp3dV2D origin = const Sp3dV2D(0, 0)}) double
(en)Computes and returns the angle between this vector and the specified vector. The unit of the return value is radians.
copyWith({double? x, double? y}) Sp3dV2D
Creates a copy with only the specified values rewritten.
deepCopy() Sp3dV2D
Deep copy this object.
direction() double
(en)Returns the clockwise angle of this vector. The unit of the return value is radians.
distTo(Sp3dV2D other) double
(en)Computes and returns the Euclidean distance between this vector and the specified vector.
dotTo(Sp3dV2D other) double
(en)Return dot product.
equals(Sp3dV2D other, double eRange) bool
(en)Compare while considering the error. Returns true if x, y are all within the e_range.
exchangedXY() Sp3dV2D
(en)Returns a vector with x and y swapped.
len() double
(en)Return vector length.
nor() Sp3dV2D
(en)Return Normalized Vector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotated(Sp3dV2D origin, double radian) Sp3dV2D
(en)Returns a new vector that rotates this vector.
toDict() Map<String, dynamic>
Convert to Map.
toOffset() Offset
(en)Converts this vector to an offset and returns it.
toString() String
A string representation of this object.
override
toV3D() → Sp3dV3D
(en)Converts this vector to a three-dimensional vector and returns it. The z-axis value is initialized to 0.

Operators

operator *(num scalar) Sp3dV2D
operator +(Sp3dV2D v) Sp3dV2D
operator -(Sp3dV2D v) Sp3dV2D
operator /(num scalar) Sp3dV2D
operator ==(Object other) bool
The equality operator.
override

Static Methods

angle(Sp3dV2D a, Sp3dV2D b, {Sp3dV2D origin = const Sp3dV2D(0, 0)}) double
(en)Computes and returns the angle between vectorA and the vectorB. The unit of the return value is radians.
angleFromLine(Sp3dV2D sp, Sp3dV2D ep) double
(en)Returns the angle of the line from 0 to 360 degrees.
dist(Sp3dV2D a, Sp3dV2D b) double
(en)Return euclidean distance.
dot(Sp3dV2D a, Sp3dV2D b) double
(en)Return dot product.
errorTolerance(double v, double c, double eRange) bool
(en)This function considers the error in the comparison. Returns true if v is within error e_range with respect to c.
fromDict(Map<String, dynamic> src) Sp3dV2D
convert from Map.
fromOffset(Offset offset) Sp3dV2D
(en)Convert from offset to vector.

Constants

className → const String
version → const String