MCPcopy
hub / github.com/CadQuery/cadquery / Vector

Class Vector

cadquery/occ_impl/geom.py:37–270  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

35
36
37class 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):

Callers 15

showablesFunction · 0.90
test_figFunction · 0.90
test_curveFunction · 0.90
test_showFunction · 0.90
test_Plane_from_LocationFunction · 0.90
test_assy_vtk_rotationFunction · 0.90
finalize_hullFunction · 0.85
distMethod · 0.85
__init__Method · 0.85
filterMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 15

showablesFunction · 0.72
test_figFunction · 0.72
test_curveFunction · 0.72
test_showFunction · 0.72
test_Plane_from_LocationFunction · 0.72
test_assy_vtk_rotationFunction · 0.72
testYZPlaneOriginsMethod · 0.68
testXYPlaneOriginsMethod · 0.68
testXZPlaneOriginsMethod · 0.68
testPlaneBasicsMethod · 0.68
testOffsetPlanesMethod · 0.68