Skip to content
Snippets Groups Projects
Unverified Commit 3e481afd authored by Louis Montaut's avatar Louis Montaut
Browse files

python: expose missing `Transform3s::Random`

parent 7b2e7b35
No related branches found
No related tags found
No related merge requests found
Pipeline #44117 failed
......@@ -202,10 +202,14 @@ class COAL_DLLAPI Transform3s {
}
/// @brief return a random transform
static Transform3s Random() { return Transform3s().setRandom(); }
static Transform3s Random() {
Transform3s tf = Transform3s();
tf.setRandom();
return tf;
}
/// @brief set the transform to a random transform
Transform3s& setRandom();
inline void setRandom();
bool operator==(const Transform3s& other) const {
return (R == other.getRotation()) && (T == other.getTranslation());
......@@ -247,12 +251,10 @@ inline Quatf uniformRandomQuaternion() {
return q;
}
inline Transform3s& Transform3s::setRandom() {
inline void Transform3s::setRandom() {
const Quatf q = uniformRandomQuaternion();
this->rotation() = q.matrix();
this->translation().setRandom();
return *this;
}
/// @brief Construct othonormal basis from vector.
......
......@@ -111,6 +111,10 @@ void exposeMaths() {
.def(dv::member_func("Identity", &Transform3s::Identity))
.staticmethod("Identity")
.def(dv::member_func("setRandom", &Transform3s::setRandom))
.def(dv::member_func("Random", &Transform3s::Random))
.staticmethod("Random")
.def(dv::member_func("transform", &Transform3s::transform<Vec3s>))
.def("inverseInPlace", &Transform3s::inverseInPlace,
return_internal_reference<>(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment