fibomat.linalg.vectors.vector module¶
- class fibomat.linalg.vectors.vector.Vector(*args, **kwargs)[source]¶
Bases:
fibomat.linalg.vectors.vector_base.VectorBase[float]- property angle_about_x_axis: float¶
Angle between vector and positive x axis (angle will be in [0, 2pi]).
- Access:
get
- Returns:
float
- Raises:
RuntimeError: Raised if self is null vector.
- close_to(other: Iterable[fibomat.linalg.vectors.vector_base.T]) bool¶
Checks if other is close to self component wise.
- Args:
other (Vector, Iterable[float]): other vector(like)
- Returns:
bool
- count(value) integer – return number of occurrences of value¶
- cross(other: Iterable[fibomat.linalg.vectors.vector_base.T]) fibomat.linalg.vectors.vector_base.T¶
Cross product in 2d.
a x b = a.x * b.y - a.y * b.x
a = self, b = other
- Args:
other(VectorLike): other vector
- Returns:
T
- dot(other: Iterable[fibomat.linalg.vectors.vector_base.T]) fibomat.linalg.vectors.vector_base.T¶
Calculate dot product with other vector.
- Args:
other(VectorLike): other vector
- Returns:
float
- index(value[, start[, stop]]) integer – return first index of value.¶
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- property length: fibomat.linalg.vectors.vector_base.T¶
Length (magnitude) of vector.
- Access:
get
- Returns:
T
- property mag: fibomat.linalg.vectors.vector_base.T¶
Magnitude of vector (short form of
VectorBase.magnitude).- Access:
get
- Returns:
T
- property magnitude: fibomat.linalg.vectors.vector_base.T¶
Magnitude of vector.
- Access:
get
- Returns:
T
- mirrored(mirror_axis: Iterable[fibomat.linalg.vectors.vector_base.T]) fibomat.linalg.vectors.vector_base.SelfT¶
Return a mirrored version of the vector.
- Args:
mirror_axis (VectorLike): mirror axis
- Returns:
Vector
- normalized() fibomat.linalg.vectors.vector_base.SelfT¶
Create a new vector with same
Vector.phibutVector.r= 1.- Returns:
SelfT
- normalized_to(length: fibomat.linalg.vectors.vector_base.T) fibomat.linalg.vectors.vector_base.SelfT¶
Create a new vector
Vector.phibutVector.r= length.- Args:
length (float): new length of vector
- Returns:
Vector
- property phi: float¶
Angular component of vector (angle between vector and x axis in radiant between -pi and pi).
- Access:
get
- Returns:
float
- projected(other: Iterable[fibomat.linalg.vectors.vector_base.T]) fibomat.linalg.vectors.vector_base.SelfT¶
Project other onto self. https://en.wikibooks.org/wiki/Linear_Algebra/Orthogonal_Projection_Onto_a_Line
- Args:
other:
- Returns:
Vector
- property r: fibomat.linalg.vectors.vector_base.T¶
Radial component the vector.
- Access:
get
- Returns:
float
- rotated(theta: float, origin: Optional[Iterable[fibomat.linalg.vectors.vector_base.T]] = None) fibomat.linalg.vectors.vector_base.SelfT¶
Return a rotated copy the vector around center with angle theta in math. positive direction.
- Args:
theta (float): rotation angle in rad origin (VectorLike): rotation center, default to [0., 0.]
- Returns:
Vector
- property x: fibomat.linalg.vectors.vector_base.T¶
X component the vector
- Access:
get
- Returns:
T
- property y: fibomat.linalg.vectors.vector_base.T¶
X component the vector
- Access:
get
- Returns:
T