Convert floats / vector / sequence of vectors to numpy array. Note that `float` argument type also allows passing ints, which will be converted to floats (a double type) as IfcOpenShell is strict about setting int/float attributes.
(*args: Union[float, int, VectorType, SequenceOfVectors])
| 52 | |
| 53 | |
| 54 | def V(*args: Union[float, int, VectorType, SequenceOfVectors]) -> npt.NDArray[np.float64]: |
| 55 | """Convert floats / vector / sequence of vectors to numpy array. |
| 56 | |
| 57 | Note that `float` argument type also allows passing ints, |
| 58 | which will be converted to floats (a double type) as IfcOpenShell is strict |
| 59 | about setting int/float attributes. |
| 60 | """ |
| 61 | if isinstance(args[0], (float, int)): |
| 62 | return np.array(args, dtype="d") |
| 63 | |
| 64 | assert len(args) == 1, "Only single argument is supported if providing a vector or a sequence of them." |
| 65 | return np.array(args[0], dtype="d") |
| 66 | |
| 67 | |
| 68 | def ifc_safe_vector_type(v: Union[VectorType, SequenceOfVectors]) -> Any: |
no outgoing calls