Module pavpen.geometry_calculator.vector_field_operations¶
- class pavpen.geometry_calculator.vector_field_operations.VectorFieldOperations[Scalar, Vector][source]¶
-
Provides an implementation of vector operations for a given data type which can be interpreted as storing vectors
Having this as a separate object allows decoupling the data type storing vectors from an implementation of vector operations (such as addition, scaling, norm). This, in turn, allows us to treat existing data objects (e.g., tuples) as vectors without having to patch their data type’s algebraic operations (e.g., a tuple multiplied by a scalar is already defined), which may break other code relying on them, or adding a wrapper type, which may introduce the need for marshalling.
- abstractmethod added(addend1: Vector, addend2: Vector) Vector[source]¶
Return the vector sum of addend1, and addend2
- abstract property additive_identity: Vector[source]¶
The ‘zero’ vector, i.e. x, such that for any vector v: x + v = v
- abstractmethod inner_multiplied(multiplicand1: Vector, multiplicand2: Vector) Scalar[source]¶
Returns the inner product of multiplicand1, and multiplicand2
In an orthonormal basis, this is the same as the dot (component-wise) product. In either case, the result of the inner product must be the product of the norms of each multiplicand, and of the orthogonal projection of one multiplicand on the other (the result being negative, if the projeciton endpoint is in the opposite direction of the vector).
- abstract property multiplicative_negator: Scalar[source]¶
The ‘-1’ scalar, i.e. x, such that for any vector (or scalar) v: v * x + v = 0
- abstractmethod projection_length_along(projected: Vector, direction: Vector) Scalar[source]¶
The norm of the component of the projection of projected on direction
We recommend always calling this method with keyword arguments, since projected, and direction can easily be confused when unnamed.