python/gtsam/__init__.py
Go to the documentation of this file.
1 from . import utils
2 from .gtsam import *
3 from .utils import findExampleDataFile
4 
5 
6 def _init():
7  """This function is to add shims for the long-gone Point2 and Point3 types"""
8 
9  import numpy as np
10 
11  global Point2 # export function
12 
13  def Point2(x=np.nan, y=np.nan):
14  """Shim for the deleted Point2 type."""
15  if isinstance(x, np.ndarray):
16  assert x.shape == (2,), "Point2 takes 2-vector"
17  return x # "copy constructor"
18  return np.array([x, y], dtype=float)
19 
20  global Point3 # export function
21 
22  def Point3(x=np.nan, y=np.nan, z=np.nan):
23  """Shim for the deleted Point3 type."""
24  if isinstance(x, np.ndarray):
25  assert x.shape == (3,), "Point3 takes 3-vector"
26  return x # "copy constructor"
27  return np.array([x, y, z], dtype=float)
28 
29  # for interactive debugging
30  if __name__ == "__main__":
31  # we want all definitions accessible
32  globals().update(locals())
33 
34 
35 _init()
def update(text)
Definition: relicense.py:46
Vector2 Point2
Definition: Point2.h:27
bool isinstance(handle obj)
Definition: pytypes.h:384
Vector3 Point3
Definition: Point3.h:35
dict globals()
Definition: pybind11.h:948


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:36