FreeCAD

Форк
0
/
VectorPy.xml 
289 строк · 9.4 Кб
1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
3
    <PythonExport
4
        Father="PyObjectBase"
5
        Name="VectorPy"
6
        Twin="Vector"
7
        TwinPointer="Vector3d"
8
        Include="Base/Vector3D.h"
9
        FatherInclude="Base/PyObjectBase.h"
10
        Namespace="Base"
11
        Constructor="true"
12
        Delete="true"
13
        NumberProtocol="true"
14
        RichCompare="true"
15
        FatherNamespace="Base">
16
    <Documentation>
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.
20

21
This class represents a 3D float vector.
22
Useful to represent points in the 3D space.
23

24
The following constructors are supported:
25

26
Vector(x=0, y=0, z=0)
27
x : float
28
y : float
29
z : float
30

31
Vector(vector)
32
Copy constructor.
33
vector : Base.Vector
34

35
Vector(seq)
36
Define from a sequence of float.
37
seq : sequence of float.</UserDocu>
38
    </Documentation>
39
    <Methode Name="__reduce__" Const="true">
40
        <Documentation>
41
            <UserDocu>__reduce__() -> tuple
42

43
Serialization of Vector objects.</UserDocu>
44
        </Documentation>
45
    </Methode>
46
        <Methode Name="add" Const="true">
47
            <Documentation>
48
                <UserDocu>add(vector2) -> Base.Vector
49

50
Returns the sum of this vector and `vector2`.
51

52
vector2 : Base.Vector</UserDocu>
53
            </Documentation>
54
        </Methode>
55
        <Methode Name="sub" Const="true">
56
            <Documentation>
57
                <UserDocu>sub(vector2) -> Base.Vector
58

59
Returns the difference of this vector and `vector2`.
60

61
vector2 : Base.Vector</UserDocu>
62
            </Documentation>
63
        </Methode>
64
        <Methode Name="negative" Const="true">
65
            <Documentation>
66
                <UserDocu>negative() -> Base.Vector
67

68
Returns the negative (opposite) of this vector.</UserDocu>
69
            </Documentation>
70
        </Methode>
71
        <Methode Name="scale">
72
            <Documentation>
73
                <UserDocu>scale(x, y, z) -> Base.Vector
74

75
Scales in-place this vector by the given factor in each component.
76

77
x : float
78
    x-component factor scale.
79
y : float
80
    y-component factor scale.
81
z : float
82
    z-component factor scale.</UserDocu>
83
            </Documentation>
84
        </Methode>
85
        <Methode Name="multiply">
86
            <Documentation>
87
                <UserDocu>multiply(factor) -> Base.Vector
88

89
Multiplies in-place each component of this vector by a single factor.
90
Equivalent to scale(factor, factor, factor).
91

92
factor : float</UserDocu>
93
            </Documentation>
94
        </Methode>
95
        <Methode Name="dot" Const="true">
96
            <Documentation>
97
                <UserDocu>dot(vector2) -> float
98

99
Returns the scalar product (dot product) between this vector and `vector2`.
100

101
vector2 : Base.Vector</UserDocu>
102
            </Documentation>
103
        </Methode>
104
        <Methode Name="cross" Const="true">
105
            <Documentation>
106
                <UserDocu>cross(vector2) -> Base.Vector
107

108
Returns the vector product (cross product) between this vector and `vector2`.
109

110
vector2 : Base.Vector</UserDocu>
111
            </Documentation>
112
        </Methode>
113
        <Methode Name="isOnLineSegment" Const="true">
114
            <Documentation>
115
                <UserDocu>isOnLineSegment(vector1, vector2) -> bool
116

117
Checks if this vector is on the line segment generated by `vector1` and `vector2`.
118

119
vector1 : Base.Vector
120
vector2 : Base.Vector</UserDocu>
121
            </Documentation>
122
        </Methode>
123
        <Methode Name="getAngle" Const="true">
124
            <Documentation>
125
                <UserDocu>getAngle(vector2) -> float
126

127
Returns the angle in radians between this vector and `vector2`.
128

129
vector2 : Base.Vector</UserDocu>
130
            </Documentation>
131
        </Methode>
132
        <Methode Name="normalize">
133
            <Documentation>
134
                <UserDocu>normalize() -> Base.Vector
135

136
Normalizes in-place this vector to the length of 1.0.</UserDocu>
137
            </Documentation>
138
        </Methode>
139
        <Methode Name="isEqual" Const="true">
140
            <Documentation>
141
                <UserDocu>isEqual(vector2, tol=0) -> bool
142

143
Checks if the distance between the points represented by this vector
144
and `vector2` is less or equal to the given tolerance.
145

146
vector2 : Base.Vector
147
tol : float</UserDocu>
148
            </Documentation>
149
        </Methode>
150
        <Methode Name="isParallel" Const="true">
151
            <Documentation>
152
                <UserDocu>isParallel(vector2, tol=0) -> bool
153

154
Checks if this vector and `vector2` are
155
parallel less or equal to the given tolerance.
156

157
vector2 : Base.Vector
158
tol : float</UserDocu>
159
            </Documentation>
160
        </Methode>
161
        <Methode Name="isNormal" Const="true">
162
            <Documentation>
163
                <UserDocu>isNormal(vector2, tol=0) -> bool
164

165
Checks if this vector and `vector2` are
166
normal less or equal to the given tolerance.
167

168
vector2 : Base.Vector
169
tol : float</UserDocu>
170
            </Documentation>
171
        </Methode>
172
        <Methode Name="projectToLine">
173
            <Documentation>
174
                <UserDocu>projectToLine(point, dir) -> Base.Vector
175

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.
182

183
point : Base.Vector
184
dir : Base.Vector</UserDocu>
185
            </Documentation>
186
        </Methode>
187
        <Methode Name="projectToPlane">
188
            <Documentation>
189
                <UserDocu>projectToPlane(base, normal) -> Base.Vector
190

191
Projects in-place this vector on a plane defined by a base point
192
represented by `base` and a normal defined by `normal`.
193

194
base : Base.Vector
195
normal : Base.Vector</UserDocu>
196
            </Documentation>
197
        </Methode>
198
        <Methode Name="distanceToPoint" Const="true">
199
            <Documentation>
200
                <UserDocu>distanceToPoint(point2) -> float
201

202
Returns the distance to another point represented by `point2`.
203
.
204
point : Base.Vector</UserDocu>
205
            </Documentation>
206
        </Methode>
207
        <Methode Name="distanceToLine" Const="true">
208
            <Documentation>
209
                <UserDocu>distanceToLine(base, dir) -> float
210

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
213
direction `dir`.
214

215
base : Base.Vector
216
dir : Base.Vector</UserDocu>
217
            </Documentation>
218
        </Methode>
219
        <Methode Name="distanceToLineSegment" Const="true">
220
            <Documentation>
221
                <UserDocu>distanceToLineSegment(point1, point2) -> Base.Vector
222

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`.
226

227
point1 : Base.Vector
228
point2 : Base.Vector</UserDocu>
229
            </Documentation>
230
        </Methode>
231
        <Methode Name="distanceToPlane" Const="true">
232
            <Documentation>
233
                <UserDocu>distanceToPlane(base, normal) -> float
234

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`.
237

238
base : Base.Vector
239
normal : Base.Vector</UserDocu>
240
            </Documentation>
241
        </Methode>
242
        <Attribute Name="Length" ReadOnly="false">
243
            <Documentation>
244
                <UserDocu>Gets or sets the length of this vector.</UserDocu>
245
            </Documentation>
246
            <Parameter Name="Type" Type="Float" />
247
        </Attribute>
248
        <Attribute Name="x" ReadOnly="false">
249
            <Documentation>
250
                <UserDocu>Gets or sets the X component of this vector.</UserDocu>
251
            </Documentation>
252
            <Parameter Name="x" Type="Float"/>
253
        </Attribute>
254
        <Attribute Name="y" ReadOnly="false">
255
            <Documentation>
256
                <UserDocu>Gets or sets the Y component of this vector.</UserDocu>
257
            </Documentation>
258
            <Parameter Name="y" Type="Float"/>
259
        </Attribute>
260
        <Attribute Name="z" ReadOnly="false">
261
            <Documentation>
262
                <UserDocu>Gets or sets the Z component of this vector.</UserDocu>
263
            </Documentation>
264
            <Parameter Name="z" Type="Float"/>
265
        </Attribute>
266
        <Sequence
267
            sq_length="true"
268
            sq_concat="false"
269
            sq_repeat="false"
270
            sq_item="true"
271
            mp_subscript="true"
272
            sq_ass_item="true"
273
            mp_ass_subscript="false"
274
            sq_contains="false"
275
            sq_inplace_concat="false"
276
            sq_inplace_repeat="false">
277
        </Sequence>
278
        <ClassDeclarations>public:
279
    VectorPy(const Vector3d &amp; vec, PyTypeObject *T = &amp;Type)
280
    :PyObjectBase(new Vector3d(vec),T){}
281
    VectorPy(const Vector3f &amp; vec, PyTypeObject *T = &amp;Type)
282
    :PyObjectBase(new Vector3d(vec.x,vec.y,vec.z),T){}
283
    Vector3d value() const
284
    { return *(getVectorPtr()); }
285
private:
286
    Py::List sequence;
287
        </ClassDeclarations>
288
    </PythonExport>
289
</GenerateModel>
290

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.