File tree Expand file tree Collapse file tree 2 files changed +29
-9
lines changed Expand file tree Collapse file tree 2 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,18 @@ class VectorExt
82
82
copy.NormalizeInPlace ();
83
83
return copy;
84
84
}
85
+
86
+ static inline Vector __add__ (Vector vecCopy, float val)
87
+ {
88
+ vecCopy += val;
89
+ return vecCopy;
90
+ }
91
+
92
+ static inline Vector __sub__ (Vector vecCopy, float val)
93
+ {
94
+ vecCopy -= val;
95
+ return vecCopy;
96
+ }
85
97
};
86
98
87
99
Original file line number Diff line number Diff line change @@ -132,14 +132,29 @@ void export_vector(scope _mathlib)
132
132
133
133
.def (self == self)
134
134
.def (self != self)
135
+
135
136
.def (self += self)
136
137
.def (self -= self)
137
138
.def (self *= self)
138
- .def (self *= float ())
139
139
.def (self /= self)
140
- . def (self /= float ())
140
+
141
141
.def (self += float ())
142
142
.def (self -= float ())
143
+ .def (self *= float ())
144
+ .def (self /= float ())
145
+
146
+ .def (self + self)
147
+ .def (self - self)
148
+ .def (self * self)
149
+ .def (self / self)
150
+
151
+ .def (" __add__" , &VectorExt::__add__)
152
+ .def (" __sub__" , &VectorExt::__sub__)
153
+ .def (self * float ())
154
+ .def (self / float ())
155
+
156
+ .def (" __radd__" , &VectorExt::__add__)
157
+ .def (float () * self)
143
158
144
159
.def (" negate" ,
145
160
&Vector::Negate,
@@ -228,13 +243,6 @@ void export_vector(scope _mathlib)
228
243
" Returns the vector's 2D length as a square product."
229
244
)
230
245
231
- .def (self + self)
232
- .def (self - self)
233
- .def (self * self)
234
- .def (self / self)
235
- .def (self * float ())
236
- .def (self / float ())
237
-
238
246
.def (" cross" ,
239
247
&Vector::Cross,
240
248
" Returns the cross product between two vectors." ,
You can’t perform that action at this time.
0 commit comments