oursin.utils
Sanitizing inputs to send through API
Functions
Converts a color, either a hex or list of floats, to a Color object |
|
Convert a list of floats to a Vector2 |
|
Convert a list of floats to a Vector3 |
|
Convert a list of lists to a list of Vector3 objects |
|
Convert input color to a list of r/g/b/a values in the range 0->1. |
|
Guarantee that a list is of at least size length, or try to broadcast to that size |
|
Guarantee that a vector is a vector 3, or raise an exception |
Classes
An enumeration. |
- sanitize_vector3(vector)[source]
Guarantee that a vector is a vector 3, or raise an exception
Parameters
- inputany
arbitrary input parameter
Returns
- list
vector3 as a list [x,y,z]
Raises
- Exception
Failed to coerce input to a length 3 list
- sanitize_color(color)[source]
Convert input color to a list of r/g/b/a values in the range 0->1.
Parameters
- colorstr or list
Hex code or list of floats representing color values.
Returns
- list
List of r/g/b/a values in the range 0->1.
- sanitize_list(input, length=0)[source]
Guarantee that a list is of at least size length, or try to broadcast to that size
Parameters
input : list length : int, optional
length to broadcast to, by default 0
Returns
list
- list_of_list2vector3(list_of_list)[source]
Convert a list of lists to a list of Vector3 objects
Parameters
- list_of_listlist of length 3 lists
_description_
- formatted_vector3(list_of_float)[source]
Convert a list of floats to a Vector3
Parameters
list_of_float : list