Skip to content

geometry

Cross(l, r) dataclass

Bases: _BinaryMixin, VectorExpr

Cross product of two 3-vectors → vector.

Source code in geomech/core/operations/geometry.py
def __init__(self, l, r):
    if l.type == ExprType.VECTOR and r.type == ExprType.VECTOR:
        ls = getattr(l, "size", None)
        rs = getattr(r, "size", None)
        if ls is not None and rs is not None and ls != rs:
            raise SizeMismatchError("Cross", ls, rs)
        self.nodes = [l, r]
    else:
        raise ExpressionMismatchError("Cross", l.type, r.type)

Dot(l, r) dataclass

Bases: _BinaryMixin, ScalarExpr

Dot product of two vectors → scalar.

Source code in geomech/core/operations/geometry.py
def __init__(self, l, r):
    if l.type == ExprType.VECTOR and r.type == ExprType.VECTOR:
        ls = getattr(l, "size", None)
        rs = getattr(r, "size", None)
        if ls is not None and rs is not None and ls != rs:
            raise SizeMismatchError("Dot", ls, rs)
        self.nodes = [l, r]
    else:
        raise ExpressionMismatchError("Dot", l.type, r.type)

Hat(expr) dataclass

Bases: _UnaryMixin, MatrixExpr

Hat map: R^3 → so(3).

Source code in geomech/core/operations/geometry.py
def __init__(self, expr):
    if expr.type == ExprType.VECTOR:
        self.nodes = [expr]
    else:
        raise ExpressionMismatchError("Hat", ExprType.VECTOR, expr.type)

Transpose(expr=None) dataclass

Bases: _BaseMixin, Expr

Transpose operator. Preserves the type of its inner expression.

Source code in geomech/core/operations/geometry.py
def __init__(self, expr=None):
    if expr is not None:
        self.nodes = [expr]
    else:
        self.nodes = []

Vee(expr) dataclass

Bases: _UnaryMixin, VectorExpr

Vee map: so(3) → R^3.

Source code in geomech/core/operations/geometry.py
def __init__(self, expr):
    if expr.type == ExprType.MATRIX:
        self.nodes = [expr]
    else:
        raise ExpressionMismatchError("Vee", ExprType.MATRIX, expr.type)