File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,16 @@ class VectorExt
7272
7373 static str __repr__ (Vector* pVector)
7474 { return str (" Vector" + str (tuple (pVector))); }
75+
76+ static Vector Copy (Vector* pVec)
77+ { return *pVec; }
78+
79+ static Vector Normalized (Vector* pVec)
80+ {
81+ Vector copy = *pVec;
82+ copy.NormalizeInPlace ();
83+ return copy;
84+ }
7585};
7686
7787
Original file line number Diff line number Diff line change @@ -165,7 +165,17 @@ void export_vector(scope _mathlib)
165165
166166 .def (" normalize" ,
167167 &Vector::NormalizeInPlace,
168- " Normalizes the vector."
168+ " Normalize the vector inplace and return its length before normalization."
169+ )
170+
171+ .def (" normalized" ,
172+ &VectorExt::Normalized,
173+ " Return a normalized copy of the vector."
174+ )
175+
176+ .def (" copy" ,
177+ &VectorExt::Copy,
178+ " Return a copy of the vector."
169179 )
170180
171181 .def (" is_length_greater_than" ,
You can’t perform that action at this time.
0 commit comments