# -----------------------------------------------------------------------------
# This file was autogenerated by symforce from template:
# ops/CLASS/lie_group_ops.py.jinja
# Do NOT modify by hand.
# -----------------------------------------------------------------------------
# ruff: noqa: PLR0915, F401, PLW0211, PLR0914
from __future__ import annotations
import math
import typing as T
import numpy
import sym
[docs]class LieGroupOps(object):
"""
Python LieGroupOps implementation for :py:class:`symforce.cam.spherical_camera_cal.SphericalCameraCal`.
"""
[docs] @staticmethod
def from_tangent(vec: numpy.ndarray, epsilon: float) -> sym.SphericalCameraCal:
# Total ops: 0
# Input arrays
if vec.shape == (11,):
vec = vec.reshape((11, 1))
elif vec.shape != (11, 1):
raise IndexError(
"vec is expected to have shape (11, 1) or (11,); instead had shape {}".format(
vec.shape
)
)
# Intermediate terms (0)
# Output terms
_res = sym.SphericalCameraCal.from_storage(
[
vec[0, 0],
vec[1, 0],
vec[2, 0],
vec[3, 0],
vec[4, 0],
vec[5, 0],
vec[6, 0],
vec[7, 0],
vec[8, 0],
vec[9, 0],
vec[10, 0],
]
)
return _res
[docs] @staticmethod
def to_tangent(a: sym.SphericalCameraCal, epsilon: float) -> numpy.ndarray:
# Total ops: 0
# Input arrays
_a = a.data
# Intermediate terms (0)
# Output terms
_res = numpy.zeros(11)
_res[0] = _a[0]
_res[1] = _a[1]
_res[2] = _a[2]
_res[3] = _a[3]
_res[4] = _a[4]
_res[5] = _a[5]
_res[6] = _a[6]
_res[7] = _a[7]
_res[8] = _a[8]
_res[9] = _a[9]
_res[10] = _a[10]
return _res
[docs] @staticmethod
def retract(
a: sym.SphericalCameraCal, vec: numpy.ndarray, epsilon: float
) -> sym.SphericalCameraCal:
# Total ops: 11
# Input arrays
_a = a.data
if vec.shape == (11,):
vec = vec.reshape((11, 1))
elif vec.shape != (11, 1):
raise IndexError(
"vec is expected to have shape (11, 1) or (11,); instead had shape {}".format(
vec.shape
)
)
# Intermediate terms (0)
# Output terms
_res = sym.SphericalCameraCal.from_storage(
[
_a[0] + vec[0, 0],
_a[1] + vec[1, 0],
_a[2] + vec[2, 0],
_a[3] + vec[3, 0],
_a[4] + vec[4, 0],
_a[5] + vec[5, 0],
_a[6] + vec[6, 0],
_a[7] + vec[7, 0],
_a[8] + vec[8, 0],
_a[9] + vec[9, 0],
_a[10] + vec[10, 0],
]
)
return _res
[docs] @staticmethod
def local_coordinates(
a: sym.SphericalCameraCal, b: sym.SphericalCameraCal, epsilon: float
) -> numpy.ndarray:
# Total ops: 11
# Input arrays
_a = a.data
_b = b.data
# Intermediate terms (0)
# Output terms
_res = numpy.zeros(11)
_res[0] = -_a[0] + _b[0]
_res[1] = -_a[1] + _b[1]
_res[2] = -_a[2] + _b[2]
_res[3] = -_a[3] + _b[3]
_res[4] = -_a[4] + _b[4]
_res[5] = -_a[5] + _b[5]
_res[6] = -_a[6] + _b[6]
_res[7] = -_a[7] + _b[7]
_res[8] = -_a[8] + _b[8]
_res[9] = -_a[9] + _b[9]
_res[10] = -_a[10] + _b[10]
return _res
[docs] @staticmethod
def interpolate(
a: sym.SphericalCameraCal, b: sym.SphericalCameraCal, alpha: float, epsilon: float
) -> sym.SphericalCameraCal:
# Total ops: 33
# Input arrays
_a = a.data
_b = b.data
# Intermediate terms (0)
# Output terms
_res = sym.SphericalCameraCal.from_storage(
[
_a[0] + alpha * (-_a[0] + _b[0]),
_a[1] + alpha * (-_a[1] + _b[1]),
_a[2] + alpha * (-_a[2] + _b[2]),
_a[3] + alpha * (-_a[3] + _b[3]),
_a[4] + alpha * (-_a[4] + _b[4]),
_a[5] + alpha * (-_a[5] + _b[5]),
_a[6] + alpha * (-_a[6] + _b[6]),
_a[7] + alpha * (-_a[7] + _b[7]),
_a[8] + alpha * (-_a[8] + _b[8]),
_a[9] + alpha * (-_a[9] + _b[9]),
_a[10] + alpha * (-_a[10] + _b[10]),
]
)
return _res