Commit 0a35e4d2 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'vectort-python-compat'

parents d8d641b9 b081460c
Pipeline #153 failed with stage
......@@ -66,31 +66,27 @@ struct Factory {
};
}
template<class Scalar, int N>
void defInitMod(class_< OpenMesh::VectorT<Scalar, N> > &classVector);
template<class Scalar>
void defInitMod(class_< OpenMesh::VectorT<Scalar, 2> > &classVector) {
classVector
.def("__init__", make_constructor(&Factory<Scalar>::vec2_default))
.def("__init__", make_constructor(&Factory<Scalar>::vec2_user_defined))
;
typedef OpenMesh::VectorT<Scalar, 2> Vector;
def("dot", &Vector::operator|);
}
template<class Scalar>
void defInitMod(class_< OpenMesh::VectorT<Scalar, 3> > &classVector) {
classVector
.def("__init__", make_constructor(&Factory<Scalar>::vec3_default))
.def("__init__", make_constructor(&Factory<Scalar>::vec3_user_defined))
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY)
.def("__mod__", &Factory<Scalar>::Vector3::template operator%<Scalar>)
;
def("cross", &Factory<Scalar>::Vector3::template operator%<Scalar>);
#else
.def("__mod__", &Factory<Scalar>::Vector3::operator%)
;
def("cross", &Factory<Scalar>::Vector3::operator%);
typedef OpenMesh::VectorT<Scalar, 3> Vector;
def("dot", &Vector::operator|);
#endif
}
template<class Scalar>
void defInitMod(class_< OpenMesh::VectorT<Scalar, 4> > &classVector) {
......@@ -98,9 +94,6 @@ void defInitMod(class_< OpenMesh::VectorT<Scalar, 4> > &classVector) {
.def("__init__", make_constructor(&Factory<Scalar>::vec4_default))
.def("__init__", make_constructor(&Factory<Scalar>::vec4_user_defined))
;
typedef OpenMesh::VectorT<Scalar, 4> Vector;
def("dot", &Vector::operator|);
}
/**
......@@ -151,12 +144,23 @@ void expose_vec(const char *_name) {
.def("vectorize", &Vector::vectorize, return_internal_reference<>())
.def(self < self)
.def("norm", &Vector::template norm<Scalar>)
.def("length", &Vector::template length<Scalar>)
.def("sqrnorm", &Vector::template sqrnorm<Scalar>)
.def("normalize", &Vector::template normalize<Scalar>, return_internal_reference<>())
.def("normalized", &Vector::template normalized<Scalar>)
.def("normalize_cond", &Vector::template normalize_cond<Scalar>, return_internal_reference<>())
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY)
.def("dot", &Vector::template operator|<Scalar>)
.def("norm", &Vector::template norm<Scalar>)
.def("length", &Vector::template length<Scalar>)
.def("sqrnorm", &Vector::template sqrnorm<Scalar>)
.def("normalize", &Vector::template normalize<Scalar>, return_internal_reference<>())
.def("normalized", &Vector::template normalized<Scalar>)
.def("normalize_cond", &Vector::template normalize_cond<Scalar>, return_internal_reference<>())
#else
.def("dot", &Vector::operator|)
.def("norm", &Vector::norm)
.def("length", &Vector::length)
.def("sqrnorm", &Vector::sqrnorm)
.def("normalize", &Vector::normalize, return_internal_reference<>())
.def("normalized", &Vector::normalized)
.def("normalize_cond", &Vector::normalize_cond, return_internal_reference<>())
#endif
.def("l1_norm", &Vector::l1_norm)
.def("l8_norm", &Vector::l8_norm)
......@@ -180,7 +184,7 @@ void expose_vec(const char *_name) {
.staticmethod("vectorized")
;
defInitMod<Scalar, N>(classVector);
defInitMod<Scalar>(classVector);
}
} // namespace OpenMesh
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment