Create a 3-dimensional vector :param args: a 3D vector, with x-y-z parts. you can either provide: * nothing (in which case the null vector is return) * a gp_Vec * a vector ( in which case it is copied ) * a 3-tuple * a 2-tuple (z assumed to be 0)
| 35 | |
| 36 | |
| 37 | class Vector(object): |
| 38 | """Create a 3-dimensional vector |
| 39 | |
| 40 | :param args: a 3D vector, with x-y-z parts. |
| 41 | |
| 42 | you can either provide: |
| 43 | * nothing (in which case the null vector is return) |
| 44 | * a gp_Vec |
| 45 | * a vector ( in which case it is copied ) |
| 46 | * a 3-tuple |
| 47 | * a 2-tuple (z assumed to be 0) |
| 48 | * three float values: x, y, and z |
| 49 | * two float values: x,y |
| 50 | """ |
| 51 | |
| 52 | _wrapped: gp_Vec |
| 53 | |
| 54 | @overload |
| 55 | def __init__(self, x: float, y: float, z: float) -> None: |
| 56 | ... |
| 57 | |
| 58 | @overload |
| 59 | def __init__(self, x: float, y: float) -> None: |
| 60 | ... |
| 61 | |
| 62 | @overload |
| 63 | def __init__(self, v: "Vector") -> None: |
| 64 | ... |
| 65 | |
| 66 | @overload |
| 67 | def __init__(self, v: Sequence[float]) -> None: |
| 68 | ... |
| 69 | |
| 70 | @overload |
| 71 | def __init__(self, v: Union[gp_Vec, gp_Pnt, gp_Dir, gp_XYZ]) -> None: |
| 72 | ... |
| 73 | |
| 74 | @overload |
| 75 | def __init__(self) -> None: |
| 76 | ... |
| 77 | |
| 78 | def __init__(self, *args): |
| 79 | if len(args) == 3: |
| 80 | fV = gp_Vec(*args) |
| 81 | elif len(args) == 2: |
| 82 | fV = gp_Vec(*args, 0) |
| 83 | elif len(args) == 1: |
| 84 | if isinstance(args[0], Vector): |
| 85 | fV = gp_Vec(args[0].wrapped.XYZ()) |
| 86 | elif isinstance(args[0], (tuple, list)): |
| 87 | arg = args[0] |
| 88 | if len(arg) == 3: |
| 89 | fV = gp_Vec(*arg) |
| 90 | elif len(arg) == 2: |
| 91 | fV = gp_Vec(*arg, 0) |
| 92 | elif isinstance(args[0], (gp_Vec, gp_Pnt, gp_Dir)): |
| 93 | fV = gp_Vec(args[0].XYZ()) |
| 94 | elif isinstance(args[0], gp_XYZ): |
no outgoing calls