mt.geo.approximation
Registry to store all the approximations functions to approximate a geometric object from type A to type B.
Functions
approx(): Approximates an object to a target type.approximable(): Checks if an object can be approximated to a target type.register_approx(): Registers a function to approximate an object from type A to type B.register_approximable(): Registers a function to check if we can approximate an object from type A to type B.
- mt.geo.approximation.approx(obj, dst_type)
Approximates an object to a target type.
- Parameters:
obj (object) – object to approximate
dst_type (type) – type or class to approx to
- Returns:
the approx version of obj
- Return type:
object
- Raises:
NotImplementedError – if the approx function has not been registered using function register_approx
- mt.geo.approximation.approximable(obj, dst_type)
Checks if an object can be approximated to a target type.
- Parameters:
obj (object) – object to approximate
dst_type (type) – type or class to approx to
- Returns:
whether or not the object is approximable to dst_type
- Return type:
bool
- Raises:
NotImplementedError – if the approximable function has not been registered using functions register_approximable or register_approx
- mt.geo.approximation.register_approx(src_type, dst_type, func)
Registers a function to approximate an object from type A to type B.
- Parameters:
src_type (type) – type or class to approximate from
dst_type (type) – type or class to approximate to
func (function) – approx function to register
- mt.geo.approximation.register_approximable(src_type, dst_type, func)
Registers a function to check if we can approximate an object from type A to type B.
- Parameters:
src_type (type) – type or class to approximate from
dst_type (type) – type or class to approximate to
func (function) – approximable function to register