Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/core/modules/mathlib/mathlib.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class VectorExt
vecCopy -= val;
return vecCopy;
}

static inline Vector __neg__(Vector vecCopy)
{
vecCopy.Negate();
return vecCopy;
}
};


Expand Down
19 changes: 19 additions & 0 deletions src/core/modules/mathlib/mathlib_wrap.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ void export_vector(scope _mathlib)
.def("__radd__", &VectorExt::__add__)
.def(float() * self)

.def("__neg__", &VectorExt::__neg__)

.def("negate",
&Vector::Negate,
"Negates the vector."
Expand Down Expand Up @@ -211,6 +213,23 @@ void export_vector(scope _mathlib)
"Returns True if the vector is within the given box coordinates."
)

.def("get_vector_vectors",
&VectorVectors,
(arg("right"), arg("up"))
)

.def("get_vector_angles",
GET_FUNCTION(void, VectorAngles, const Vector &, QAngle &),
arg("angles"),
"Forward direction vector -> Euler angles."
)

.def("get_vector_angles",
GET_FUNCTION(void, VectorAngles, const Vector &, const Vector &, QAngle &),
(arg("pseudoup"), arg("angles")),
"Forward direction vector with a reference up vector -> Euler angles."
)

.def("get_distance",
&Vector::DistTo,
args("other"),
Expand Down