Module pavpen.geometry_calculator.orthonormal_basis_calculator¶
- class pavpen.geometry_calculator.orthonormal_basis_calculator.OrthonormalBasisCalculator[Vector](vector_field_operations: FloatVectorFieldOperations, points: list[Vector], float_tolerance: float = 1e-09)[source]¶
Bases:
GenericCalculates an orthonormal basis of a space that spans a given set of points
Example:
>>> import math >>> from pavpen.geometry_calculator import OrthonormalBasisCalculator >>> from pavpen.geometry_calculator.vector_field_implementations import ( ... TupleFloatVectorFieldOperations, ... ) >>> >>> OrthonormalBasisCalculator( ... vector_field_operations=TupleFloatVectorFieldOperations.for_3d(), ... float_tolerance=1e-8, ... points=((0, 0, 0), (0, 2, 0), (0, 0, -2)), ... ).calculate().basis_vectors [(0.0, 1.0, 0.0), (0.0, 0.0, -1.0)]
- calculate(*, require_points_are_non_redundant: bool = False) Self[source]¶
Calculates, and sets self.basis_vectors: List[Vector]
The values in basis_vectors are orthonormal vectors spanning the space that contains the points passed in during construction. Two non-redundant points define a line, three points define a plane, etc.
Setting require_points_are_non_redundant to True makes it an exception for points to be spanned by less than len(points) - 1 basis vectors. In this case [CalculationPrecisionExceededError] is raised, if two points are too close to each other, or if two different pairs of points define directions that are close to colinear, or if a computation’s maximum tolerance exceeds float_tolerance (specified during object construction) for any other reason.