1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
8
Include="Base/Vector3D.h"
9
FatherInclude="Base/PyObjectBase.h"
15
FatherNamespace="Base">
17
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
18
<DeveloperDocu>This is the Vector export class</DeveloperDocu>
19
<UserDocu>Base.Vector class.
21
This class represents a 3D float vector.
22
Useful to represent points in the 3D space.
24
The following constructors are supported:
36
Define from a sequence of float.
37
seq : sequence of float.</UserDocu>
39
<Methode Name="__reduce__" Const="true">
41
<UserDocu>__reduce__() -> tuple
43
Serialization of Vector objects.</UserDocu>
46
<Methode Name="add" Const="true">
48
<UserDocu>add(vector2) -> Base.Vector
50
Returns the sum of this vector and `vector2`.
52
vector2 : Base.Vector</UserDocu>
55
<Methode Name="sub" Const="true">
57
<UserDocu>sub(vector2) -> Base.Vector
59
Returns the difference of this vector and `vector2`.
61
vector2 : Base.Vector</UserDocu>
64
<Methode Name="negative" Const="true">
66
<UserDocu>negative() -> Base.Vector
68
Returns the negative (opposite) of this vector.</UserDocu>
71
<Methode Name="scale">
73
<UserDocu>scale(x, y, z) -> Base.Vector
75
Scales in-place this vector by the given factor in each component.
78
x-component factor scale.
80
y-component factor scale.
82
z-component factor scale.</UserDocu>
85
<Methode Name="multiply">
87
<UserDocu>multiply(factor) -> Base.Vector
89
Multiplies in-place each component of this vector by a single factor.
90
Equivalent to scale(factor, factor, factor).
92
factor : float</UserDocu>
95
<Methode Name="dot" Const="true">
97
<UserDocu>dot(vector2) -> float
99
Returns the scalar product (dot product) between this vector and `vector2`.
101
vector2 : Base.Vector</UserDocu>
104
<Methode Name="cross" Const="true">
106
<UserDocu>cross(vector2) -> Base.Vector
108
Returns the vector product (cross product) between this vector and `vector2`.
110
vector2 : Base.Vector</UserDocu>
113
<Methode Name="isOnLineSegment" Const="true">
115
<UserDocu>isOnLineSegment(vector1, vector2) -> bool
117
Checks if this vector is on the line segment generated by `vector1` and `vector2`.
120
vector2 : Base.Vector</UserDocu>
123
<Methode Name="getAngle" Const="true">
125
<UserDocu>getAngle(vector2) -> float
127
Returns the angle in radians between this vector and `vector2`.
129
vector2 : Base.Vector</UserDocu>
132
<Methode Name="normalize">
134
<UserDocu>normalize() -> Base.Vector
136
Normalizes in-place this vector to the length of 1.0.</UserDocu>
139
<Methode Name="isEqual" Const="true">
141
<UserDocu>isEqual(vector2, tol=0) -> bool
143
Checks if the distance between the points represented by this vector
144
and `vector2` is less or equal to the given tolerance.
147
tol : float</UserDocu>
150
<Methode Name="isParallel" Const="true">
152
<UserDocu>isParallel(vector2, tol=0) -> bool
154
Checks if this vector and `vector2` are
155
parallel less or equal to the given tolerance.
158
tol : float</UserDocu>
161
<Methode Name="isNormal" Const="true">
163
<UserDocu>isNormal(vector2, tol=0) -> bool
165
Checks if this vector and `vector2` are
166
normal less or equal to the given tolerance.
169
tol : float</UserDocu>
172
<Methode Name="projectToLine">
174
<UserDocu>projectToLine(point, dir) -> Base.Vector
176
Projects `point` on a line that goes through the origin with the direction `dir`.
177
The result is the vector from `point` to the projected point.
178
The operation is equivalent to dir_n.cross(dir_n.cross(point)), where `dir_n` is
179
the vector `dir` normalized.
180
The method modifies this vector instance according to result and does not
181
depend on the vector itself.
184
dir : Base.Vector</UserDocu>
187
<Methode Name="projectToPlane">
189
<UserDocu>projectToPlane(base, normal) -> Base.Vector
191
Projects in-place this vector on a plane defined by a base point
192
represented by `base` and a normal defined by `normal`.
195
normal : Base.Vector</UserDocu>
198
<Methode Name="distanceToPoint" Const="true">
200
<UserDocu>distanceToPoint(point2) -> float
202
Returns the distance to another point represented by `point2`.
204
point : Base.Vector</UserDocu>
207
<Methode Name="distanceToLine" Const="true">
209
<UserDocu>distanceToLine(base, dir) -> float
211
Returns the distance between the point represented by this vector
212
and a line defined by a base point represented by `base` and a
216
dir : Base.Vector</UserDocu>
219
<Methode Name="distanceToLineSegment" Const="true">
221
<UserDocu>distanceToLineSegment(point1, point2) -> Base.Vector
223
Returns the vector between the point represented by this vector and the point
224
on the line segment with the shortest distance. The line segment is defined by
225
`point1` and `point2`.
228
point2 : Base.Vector</UserDocu>
231
<Methode Name="distanceToPlane" Const="true">
233
<UserDocu>distanceToPlane(base, normal) -> float
235
Returns the distance between this vector and a plane defined by a
236
base point represented by `base` and a normal defined by `normal`.
239
normal : Base.Vector</UserDocu>
242
<Attribute Name="Length" ReadOnly="false">
244
<UserDocu>Gets or sets the length of this vector.</UserDocu>
246
<Parameter Name="Type" Type="Float" />
248
<Attribute Name="x" ReadOnly="false">
250
<UserDocu>Gets or sets the X component of this vector.</UserDocu>
252
<Parameter Name="x" Type="Float"/>
254
<Attribute Name="y" ReadOnly="false">
256
<UserDocu>Gets or sets the Y component of this vector.</UserDocu>
258
<Parameter Name="y" Type="Float"/>
260
<Attribute Name="z" ReadOnly="false">
262
<UserDocu>Gets or sets the Z component of this vector.</UserDocu>
264
<Parameter Name="z" Type="Float"/>
273
mp_ass_subscript="false"
275
sq_inplace_concat="false"
276
sq_inplace_repeat="false">
278
<ClassDeclarations>public:
279
VectorPy(const Vector3d & vec, PyTypeObject *T = &Type)
280
:PyObjectBase(new Vector3d(vec),T){}
281
VectorPy(const Vector3f & vec, PyTypeObject *T = &Type)
282
:PyObjectBase(new Vector3d(vec.x,vec.y,vec.z),T){}
283
Vector3d value() const
284
{ return *(getVectorPtr()); }