Geometry3D.utils package

Submodules

Geometry3D.utils.constant module

Constant module

EPS and significant numbers for comparing float point numbers.

Two float numbers are deemed equal if they equal with each other within significant numbers.

Significant numbers = log(1 / eps) all the time

Geometry3D.utils.constant.set_eps(eps=1e-10)[source]

Input:

  • eps: floating number with 1e-10 the default

Output:

No output but set EPS to eps

Signigicant numbers is also changed.

Geometry3D.utils.constant.get_eps()[source]

Input:

no input

Output:

  • current eps: float

Geometry3D.utils.constant.get_sig_figures()[source]

Input:

no input

Output:

  • current significant numbers: int

Geometry3D.utils.constant.set_sig_figures(sig_figures=10)[source]

Input:

  • sig_figures: int with 10 the default

Output:

No output but set signigicant numbers to sig_figures

EPS is also changed.

Geometry3D.utils.logger module

Logger Module

Geometry3D.utils.logger.change_main_logger()[source]
Geometry3D.utils.logger.get_main_logger()[source]

Input:

No Input

Output:

main_logger: The logger instance

Geometry3D.utils.logger.set_log_level(level='WARNING')[source]

Input:

  • level: a string of log level among ‘DEBUG’, ‘INFO’, ‘WARNING’, ‘ERROR’, ‘CRITICAL’.

    ‘WARNING’ is the default.

Output:

No output but setup the log level for the logger

Geometry3D.utils.solver module

Solver Module, An Auxilary Module

class Geometry3D.utils.solver.Solution(s)[source]

Bases: object

Holds a solution to a system of equations.

Geometry3D.utils.solver.count(f, l)[source]
Geometry3D.utils.solver.find_pivot_row(m)[source]
Geometry3D.utils.solver.first_nonzero(r)[source]
Geometry3D.utils.solver.gaussian_elimination(m)[source]

Return the row echelon form of m by applying the gaussian elimination

Geometry3D.utils.solver.index(f, l)[source]
Geometry3D.utils.solver.null(f)[source]
Geometry3D.utils.solver.nullrow(r)[source]
Geometry3D.utils.solver.shape(m)[source]
Geometry3D.utils.solver.solve(matrix)[source]

Geometry3D.utils.util module

Util Module

Geometry3D.utils.util.unify_types(items)[source]

Promote all items to the same type. The resulting type is the “most valueable” that an item already has as defined by the list (top = least valueable):

  • int

  • float

  • decimal.Decimal

  • fractions.Fraction

  • user defined

Geometry3D.utils.vector module

Vector Module

class Geometry3D.utils.vector.Vector(*args)[source]

Bases: object

Vector Class

angle(other)[source]

Returns the angle (in radians) enclosed by both vectors.

cross(other)[source]

Calculates the cross product of two vectors, defined as _ _ / x2y3 - x3y2 x × y = | x3y1 - x1y3 |

x1y2 - x2y1 /

The cross product is orthogonal to both vectors and its length is the area of the parallelogram given by x and y.

length()[source]

Returns |v|, the length of the vector.

normalized()[source]

Return the normalized version of the vector, that is a vector pointing in the same direction but with length 1.

orthogonal(other)[source]

Returns true if the two vectors are orthogonal

parallel(other)[source]

Returns true if both vectors are parallel.

unit()

Return the normalized version of the vector, that is a vector pointing in the same direction but with length 1.

classmethod x_unit_vector()[source]

Returns the unit vector (1 | 0 | 0)

classmethod y_unit_vector()[source]

Returns the unit vector (0 | 1 | 0)

classmethod z_unit_vector()[source]

Returns the unit vector (0 | 0 | 1)

classmethod zero()[source]

Returns the zero vector (0 | 0 | 0)

Geometry3D.utils.vector.x_unit_vector()

Returns the unit vector (1 | 0 | 0)

Geometry3D.utils.vector.y_unit_vector()

Returns the unit vector (0 | 1 | 0)

Geometry3D.utils.vector.z_unit_vector()

Returns the unit vector (0 | 0 | 1)

Module contents

Geometry3D.utils.solve(matrix)[source]
class Geometry3D.utils.Vector(*args)[source]

Bases: object

Vector Class

angle(other)[source]

Returns the angle (in radians) enclosed by both vectors.

cross(other)[source]

Calculates the cross product of two vectors, defined as _ _ / x2y3 - x3y2 x × y = | x3y1 - x1y3 |

x1y2 - x2y1 /

The cross product is orthogonal to both vectors and its length is the area of the parallelogram given by x and y.

length()[source]

Returns |v|, the length of the vector.

normalized()[source]

Return the normalized version of the vector, that is a vector pointing in the same direction but with length 1.

orthogonal(other)[source]

Returns true if the two vectors are orthogonal

parallel(other)[source]

Returns true if both vectors are parallel.

unit()

Return the normalized version of the vector, that is a vector pointing in the same direction but with length 1.

classmethod x_unit_vector()[source]

Returns the unit vector (1 | 0 | 0)

classmethod y_unit_vector()[source]

Returns the unit vector (0 | 1 | 0)

classmethod z_unit_vector()[source]

Returns the unit vector (0 | 0 | 1)

classmethod zero()[source]

Returns the zero vector (0 | 0 | 0)

Geometry3D.utils.x_unit_vector()

Returns the unit vector (1 | 0 | 0)

Geometry3D.utils.y_unit_vector()

Returns the unit vector (0 | 1 | 0)

Geometry3D.utils.z_unit_vector()

Returns the unit vector (0 | 0 | 1)

Geometry3D.utils.set_eps(eps=1e-10)[source]

Input:

  • eps: floating number with 1e-10 the default

Output:

No output but set EPS to eps

Signigicant numbers is also changed.

Geometry3D.utils.get_eps()[source]

Input:

no input

Output:

  • current eps: float

Geometry3D.utils.get_sig_figures()[source]

Input:

no input

Output:

  • current significant numbers: int

Geometry3D.utils.set_sig_figures(sig_figures=10)[source]

Input:

  • sig_figures: int with 10 the default

Output:

No output but set signigicant numbers to sig_figures

EPS is also changed.

Geometry3D.utils.set_log_level(level='WARNING')[source]

Input:

  • level: a string of log level among ‘DEBUG’, ‘INFO’, ‘WARNING’, ‘ERROR’, ‘CRITICAL’.

    ‘WARNING’ is the default.

Output:

No output but setup the log level for the logger

Geometry3D.utils.get_main_logger()[source]

Input:

No Input

Output:

main_logger: The logger instance