1
/***************************************************************************
2
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
24
#include "PreCompiled.h"
26
// inclusion of the generated files (generated out of MatrixPy.xml)
27
#include "RotationPy.h"
29
#include "GeometryPyCXX.h"
30
#include "QuantityPy.h"
32
#include "MatrixPy.cpp"
37
// returns a string which represents the object e.g. when printed in python
38
std::string MatrixPy::representation() const
40
const Base::Matrix4D& m = *(this->getMatrixPtr());
41
std::stringstream str;
43
str << "(" << m[0][0] << "," << m[0][1] << "," << m[0][2] << "," << m[0][3] << ")"
45
str << "(" << m[1][0] << "," << m[1][1] << "," << m[1][2] << "," << m[1][3] << ")"
47
str << "(" << m[2][0] << "," << m[2][1] << "," << m[2][2] << "," << m[2][3] << ")"
49
str << "(" << m[3][0] << "," << m[3][1] << "," << m[3][2] << "," << m[3][3] << ")";
55
PyObject* MatrixPy::PyMake(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/)
57
// create a new instance of MatrixPy and the Twin object
58
return new MatrixPy(new Matrix4D);
62
int MatrixPy::PyInit(PyObject* args, PyObject* /*kwd*/)
65
double a11 = 1.0, a12 = 0.0, a13 = 0.0, a14 = 0.0;
66
double a21 = 0.0, a22 = 1.0, a23 = 0.0, a24 = 0.0;
67
double a31 = 0.0, a32 = 0.0, a33 = 1.0, a34 = 0.0;
68
double a41 = 0.0, a42 = 0.0, a43 = 0.0, a44 = 1.0;
72
if (PyArg_ParseTuple(args,
74
&a11, &a12, &a13, &a14,
75
&a21, &a22, &a23, &a24,
76
&a31, &a32, &a33, &a34,
77
&a41, &a42, &a43, &a44)) {
78
MatrixPy::PointerType ptr = getMatrixPtr();
79
(*ptr) = Matrix4D(a11, a12, a13, a14,
88
if (PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type), &o)) {
89
MatrixPy::PointerType ptr = getMatrixPtr();
90
(*ptr) = static_cast<MatrixPy*>(o)->value();
99
if (PyArg_ParseTuple(args, "O!O!O!|O!",
100
&(Base::VectorPy::Type), &o1,
101
&(Base::VectorPy::Type), &o2,
102
&(Base::VectorPy::Type), &o3,
103
&(Base::VectorPy::Type), &o4)) {
104
Base::Vector3d v1 = Py::Vector(o1, false).toVector();
105
Base::Vector3d v2 = Py::Vector(o2, false).toVector();
106
Base::Vector3d v3 = Py::Vector(o3, false).toVector();
109
v4 = Py::Vector(o4, false).toVector();
111
MatrixPy::PointerType ptr = this->getMatrixPtr();
133
PyErr_SetString(PyExc_TypeError, "Base.Matrix, four Base.Vector or up to 16 floats expected");
137
PyObject* MatrixPy::number_add_handler(PyObject* self, PyObject* other)
139
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
140
PyErr_SetString(PyExc_TypeError, "First arg must be Matrix");
143
if (!PyObject_TypeCheck(other, &(MatrixPy::Type))) {
144
PyErr_SetString(PyExc_TypeError, "Second arg must be Matrix");
147
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
148
Base::Matrix4D b = static_cast<MatrixPy*>(other)->value();
149
return new MatrixPy(a + b);
152
PyObject* MatrixPy::number_subtract_handler(PyObject* self, PyObject* other)
154
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
155
PyErr_SetString(PyExc_TypeError, "First arg must be Matrix");
158
if (!PyObject_TypeCheck(other, &(MatrixPy::Type))) {
159
PyErr_SetString(PyExc_TypeError, "Second arg must be Matrix");
162
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
163
Base::Matrix4D b = static_cast<MatrixPy*>(other)->value();
164
return new MatrixPy(a - b);
167
PyObject* MatrixPy::number_multiply_handler(PyObject* self, PyObject* other)
169
if (PyObject_TypeCheck(self, &(MatrixPy::Type))) {
170
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
172
if (PyObject_TypeCheck(other, &(VectorPy::Type))) {
173
auto b = static_cast<VectorPy*>(other)->value();
174
return new VectorPy(a * b);
177
if (PyObject_TypeCheck(other, &(RotationPy::Type))) {
178
auto r = static_cast<RotationPy*>(other)->value();
181
return new MatrixPy(a * b);
184
if (PyObject_TypeCheck(other, &(PlacementPy::Type))) {
185
auto b = static_cast<PlacementPy*>(other)->value();
186
return new MatrixPy(a * b.toMatrix());
189
if (PyObject_TypeCheck(other, &(MatrixPy::Type))) {
190
Base::Matrix4D b = static_cast<MatrixPy*>(other)->value();
191
return new MatrixPy(a * b);
194
if (PyNumber_Check(other)) {
195
double v = PyFloat_AsDouble(other);
196
return new MatrixPy(a * v);
200
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
204
PyObject* MatrixPy::number_power_handler(PyObject* self, PyObject* other, PyObject* arg)
206
if (!PyObject_TypeCheck(self, &(MatrixPy::Type)) ||
208
!PyLong_Check(other) || arg != Py_None) {
209
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
213
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
215
long b = Py::Int(other);
217
return new MatrixPy(Matrix4D());
221
if (fabs(a.determinant()) > DBL_EPSILON) {
225
PyErr_SetString(PyExc_RuntimeError, "Cannot invert singular matrix");
235
return new MatrixPy(res);
238
PyObject* MatrixPy::richCompare(PyObject* v, PyObject* w, int op)
240
if (PyObject_TypeCheck(v, &(MatrixPy::Type)) && PyObject_TypeCheck(w, &(MatrixPy::Type))) {
241
Matrix4D m1 = static_cast<MatrixPy*>(v)->value();
242
Matrix4D m2 = static_cast<MatrixPy*>(w)->value();
244
PyObject* res = nullptr;
245
if (op != Py_EQ && op != Py_NE) {
246
PyErr_SetString(PyExc_TypeError, "no ordering relation is defined for Matrix");
250
res = (m1 == m2) ? Py_True : Py_False; // NOLINT
255
res = (m1 != m2) ? Py_True : Py_False; // NOLINT
259
// This always returns False
260
Py_INCREF(Py_NotImplemented);
261
return Py_NotImplemented;
264
PyObject* MatrixPy::move(PyObject* args)
270
PyObject* pcVecObj {};
272
do { // dummy do..while for cascaded if
273
if (PyArg_ParseTuple(args, "ddd", &x, &y, &z)) {
279
// clears the error from previous PyArg_ParseTuple()
281
if (PyArg_ParseTuple(args, "O!", &PyTuple_Type, &pcVecObj)) {
282
vec = getVectorFromTuple<double>(pcVecObj);
285
// clears the error from previous PyArg_ParseTuple()
287
if (PyArg_ParseTuple(args,
288
"O!;three floats, or a tuple, or a vector is needed",
289
&(Base::VectorPy::Type),
291
Base::VectorPy* pcObject = static_cast<Base::VectorPy*>(pcVecObj);
292
Base::Vector3d* val = pcObject->getVectorPtr();
293
vec.Set(val->x, val->y, val->z);
301
getMatrixPtr()->move(vec);
307
PyObject* MatrixPy::scale(PyObject* args)
313
PyObject* pcVecObj {};
315
do { // dummy do..while for cascaded if
316
if (PyArg_ParseTuple(args, "ddd", &x, &y, &z)) {
322
// clears the error from previous PyArg_ParseTuple()
324
if (PyArg_ParseTuple(args, "d", &x)) {
325
vec.x = vec.y = vec.z = x;
328
// clears the error from previous PyArg_ParseTuple()
330
if (PyArg_ParseTuple(args, "O!", &PyTuple_Type, &pcVecObj)) {
331
vec = getVectorFromTuple<double>(pcVecObj);
334
// clears the error from previous PyArg_ParseTuple()
336
if (PyArg_ParseTuple(args,
337
"O!;one or three floats, or a tuple, or a vector is needed",
338
&(Base::VectorPy::Type),
340
Base::VectorPy* pcObject = static_cast<Base::VectorPy*>(pcVecObj);
341
Base::Vector3d* val = pcObject->getVectorPtr();
342
vec.Set(val->x, val->y, val->z);
350
getMatrixPtr()->scale(vec);
356
PyObject* MatrixPy::hasScale(PyObject* args)
359
if (!PyArg_ParseTuple(args, "|d", &tol)) {
363
ScaleType type = getMatrixPtr()->hasScale(tol);
364
Py::Module mod("FreeCAD");
365
return Py::new_reference_to(
366
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Int(static_cast<int>(type)))));
369
PyObject* MatrixPy::decompose(PyObject* args)
371
if (!PyArg_ParseTuple(args, "")) {
375
auto ms = getMatrixPtr()->decompose();
377
for (int i = 0; i < 4; i++) {
378
tuple.setItem(i, Py::Matrix(ms[i]));
380
return Py::new_reference_to(tuple);
383
PyObject* MatrixPy::nullify()
387
getMatrixPtr()->nullify();
393
PyObject* MatrixPy::isNull()
397
bool ok = getMatrixPtr()->isNull();
398
return Py::new_reference_to(Py::Boolean(ok));
403
PyObject* MatrixPy::unity()
407
getMatrixPtr()->setToUnity();
413
PyObject* MatrixPy::isUnity(PyObject* args)
416
if (!PyArg_ParseTuple(args, "|d", &tol)) {
422
bool ok = getMatrixPtr()->isUnity(tol);
423
return Py::new_reference_to(Py::Boolean(ok));
428
PyObject* MatrixPy::transform(PyObject* args)
432
PyObject* pcVecObj {};
433
PyObject* pcMatObj {};
435
if (!PyArg_ParseTuple(
437
"O!O!: a transform point (Vector) and a transform matrix (Matrix) is needed",
438
&(Base::VectorPy::Type),
445
Base::VectorPy* pcObject = static_cast<Base::VectorPy*>(pcVecObj);
446
Base::Vector3d* val = pcObject->getVectorPtr();
447
vec.Set(val->x, val->y, val->z);
448
mat = *(static_cast<MatrixPy*>(pcMatObj)->getMatrixPtr());
450
getMatrixPtr()->transform(vec, mat);
454
PyObject* MatrixPy::col(PyObject* args)
457
if (!PyArg_ParseTuple(args, "i", &index)) {
461
if (index < 0 || index > 3) {
462
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
466
Matrix4D* mat = getMatrixPtr();
467
Base::Vector3d v = mat->getCol(index);
468
return Py::new_reference_to(Py::Vector(v));
471
PyObject* MatrixPy::setCol(PyObject* args)
475
if (!PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o)) {
479
if (index < 0 || index > 3) {
480
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
484
Base::Vector3d v = Py::Vector(o, false).toVector();
485
Matrix4D* mat = getMatrixPtr();
486
mat->setCol(index, v);
490
PyObject* MatrixPy::row(PyObject* args)
493
if (!PyArg_ParseTuple(args, "i", &index)) {
497
if (index < 0 || index > 3) {
498
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
502
Matrix4D* mat = getMatrixPtr();
503
Base::Vector3d v = mat->getRow(index);
504
return Py::new_reference_to(Py::Vector(v));
507
PyObject* MatrixPy::setRow(PyObject* args)
511
if (!PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o)) {
515
if (index < 0 || index > 3) {
516
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
520
Base::Vector3d v = Py::Vector(o, false).toVector();
521
Matrix4D* mat = getMatrixPtr();
522
mat->setRow(index, v);
526
PyObject* MatrixPy::diagonal()
528
Matrix4D* mat = getMatrixPtr();
529
Base::Vector3d v = mat->diagonal();
530
return Py::new_reference_to(Py::Vector(v));
533
PyObject* MatrixPy::setDiagonal(PyObject* args)
536
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &o)) {
540
Base::Vector3d v = Py::Vector(o, false).toVector();
541
Matrix4D* mat = getMatrixPtr();
546
PyObject* MatrixPy::rotateX(PyObject* args)
551
if (PyArg_ParseTuple(args, "O!", &(Base::QuantityPy::Type), &object)) {
552
Quantity* q = static_cast<Base::QuantityPy*>(object)->getQuantityPtr();
553
if (q->getUnit() == Base::Unit::Angle) {
554
angle = q->getValueAs(Base::Quantity::Radian);
560
if (PyArg_ParseTuple(args, "d: angle to rotate (double) needed", &angle)) {
564
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
570
getMatrixPtr()->rotX(angle);
576
PyObject* MatrixPy::rotateY(PyObject* args)
581
if (PyArg_ParseTuple(args, "O!", &(Base::QuantityPy::Type), &object)) {
582
Quantity* q = static_cast<Base::QuantityPy*>(object)->getQuantityPtr();
583
if (q->getUnit() == Base::Unit::Angle) {
584
angle = q->getValueAs(Base::Quantity::Radian);
590
if (PyArg_ParseTuple(args, "d: angle to rotate (double) needed", &angle)) {
594
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
600
getMatrixPtr()->rotY(angle);
606
PyObject* MatrixPy::rotateZ(PyObject* args)
611
if (PyArg_ParseTuple(args, "O!", &(Base::QuantityPy::Type), &object)) {
612
Quantity* q = static_cast<Base::QuantityPy*>(object)->getQuantityPtr();
613
if (q->getUnit() == Base::Unit::Angle) {
614
angle = q->getValueAs(Base::Quantity::Radian);
620
if (PyArg_ParseTuple(args, "d: angle to rotate (double) needed", &angle)) {
624
PyErr_SetString(PyExc_TypeError, "For angle either float or Quantity expected");
630
getMatrixPtr()->rotZ(angle);
636
PyObject* MatrixPy::multiply(PyObject* args)
639
if (PyArg_ParseTuple(args, "O!", &(MatrixPy::Type), &o)) {
640
Matrix4D mat = (*getMatrixPtr()) * static_cast<Base::MatrixPy*>(o)->value();
641
return new MatrixPy(new Matrix4D(mat));
645
if (PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &o)) {
646
Vector3d vec = (*getMatrixPtr()) * static_cast<Base::VectorPy*>(o)->value();
647
return new VectorPy(new Vector3d(vec));
650
PyErr_SetString(PyExc_TypeError, "either vector or matrix expected");
654
PyObject* MatrixPy::multVec(PyObject* args)
657
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) {
661
Base::Vector3d vec(static_cast<VectorPy*>(obj)->value());
662
getMatrixPtr()->multVec(vec, vec);
663
return new VectorPy(new Vector3d(vec));
666
PyObject* MatrixPy::invert()
670
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON) {
671
getMatrixPtr()->inverseGauss();
675
PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot invert singular matrix");
681
PyObject* MatrixPy::inverse()
685
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON) {
686
Base::Matrix4D m = *getMatrixPtr();
688
return new MatrixPy(m);
691
PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot invert singular matrix");
697
PyObject* MatrixPy::determinant()
699
return PyFloat_FromDouble(getMatrixPtr()->determinant());
702
PyObject* MatrixPy::submatrix(PyObject* args)
705
if (!PyArg_ParseTuple(args, "i", &dim)) {
709
if (dim < 1 || dim > 4) {
710
PyErr_SetString(PyExc_IndexError, "Dimension out of range");
714
const Base::Matrix4D& mat = *getMatrixPtr();
718
sub[0][0] = mat[0][0];
721
sub[0][0] = mat[0][0];
722
sub[0][1] = mat[0][1];
723
sub[1][0] = mat[1][0];
724
sub[1][1] = mat[1][1];
727
sub[0][0] = mat[0][0];
728
sub[0][1] = mat[0][1];
729
sub[0][2] = mat[0][2];
730
sub[1][0] = mat[1][0];
731
sub[1][1] = mat[1][1];
732
sub[1][2] = mat[1][2];
733
sub[2][0] = mat[2][0];
734
sub[2][1] = mat[2][1];
735
sub[2][2] = mat[2][2];
742
return new MatrixPy(sub);
745
PyObject* MatrixPy::isOrthogonal(PyObject* args)
747
double eps = 1.0e-06;
748
if (!PyArg_ParseTuple(args, "|d", &eps)) {
752
const Base::Matrix4D& mat = *getMatrixPtr();
753
Base::Matrix4D trp = mat;
758
double mult = trp[0][0];
759
for (unsigned short i = 0; i < 4 && ok; i++) {
760
for (unsigned short j = 0; j < 4 && ok; j++) {
762
if (fabs(trp[i][j]) > eps) {
767
else { // the main diagonal
768
if (fabs(trp[i][j] - mult) > eps) {
776
return Py::new_reference_to(Py::Float(ok ? mult : 0.0));
779
PyObject* MatrixPy::transposed()
783
Base::Matrix4D m = *getMatrixPtr();
785
return new MatrixPy(m);
790
PyObject* MatrixPy::transpose()
794
getMatrixPtr()->transpose();
800
PyObject* MatrixPy::analyze()
804
std::string type = getMatrixPtr()->analyse();
805
return PyUnicode_FromString(type.c_str());
810
Py::Float MatrixPy::getA11() const
812
double val = (*this->getMatrixPtr())[0][0];
813
return Py::Float(val);
816
void MatrixPy::setA11(Py::Float arg)
818
(*this->getMatrixPtr())[0][0] = static_cast<double>(arg);
821
Py::Float MatrixPy::getA12() const
823
double val = (*this->getMatrixPtr())[0][1];
824
return Py::Float(val);
827
void MatrixPy::setA12(Py::Float arg)
829
(*this->getMatrixPtr())[0][1] = static_cast<double>(arg);
832
Py::Float MatrixPy::getA13() const
834
double val = (*this->getMatrixPtr())[0][2];
835
return Py::Float(val);
838
void MatrixPy::setA13(Py::Float arg)
840
(*this->getMatrixPtr())[0][2] = static_cast<double>(arg);
843
Py::Float MatrixPy::getA14() const
845
double val = (*this->getMatrixPtr())[0][3];
846
return Py::Float(val);
849
void MatrixPy::setA14(Py::Float arg)
851
(*this->getMatrixPtr())[0][3] = static_cast<double>(arg);
854
Py::Float MatrixPy::getA21() const
856
double val = (*this->getMatrixPtr())[1][0];
857
return Py::Float(val);
860
void MatrixPy::setA21(Py::Float arg)
862
(*this->getMatrixPtr())[1][0] = static_cast<double>(arg);
865
Py::Float MatrixPy::getA22() const
867
double val = (*this->getMatrixPtr())[1][1];
868
return Py::Float(val);
871
void MatrixPy::setA22(Py::Float arg)
873
(*this->getMatrixPtr())[1][1] = static_cast<double>(arg);
876
Py::Float MatrixPy::getA23() const
878
double val = (*this->getMatrixPtr())[1][2];
879
return Py::Float(val);
882
void MatrixPy::setA23(Py::Float arg)
884
(*this->getMatrixPtr())[1][2] = static_cast<double>(arg);
887
Py::Float MatrixPy::getA24() const
889
double val = (*this->getMatrixPtr())[1][3];
890
return Py::Float(val);
893
void MatrixPy::setA24(Py::Float arg)
895
(*this->getMatrixPtr())[1][3] = static_cast<double>(arg);
898
Py::Float MatrixPy::getA31() const
900
double val = (*this->getMatrixPtr())[2][0];
901
return Py::Float(val);
904
void MatrixPy::setA31(Py::Float arg)
906
(*this->getMatrixPtr())[2][0] = static_cast<double>(arg);
909
Py::Float MatrixPy::getA32() const
911
double val = (*this->getMatrixPtr())[2][1];
912
return Py::Float(val);
915
void MatrixPy::setA32(Py::Float arg)
917
(*this->getMatrixPtr())[2][1] = static_cast<double>(arg);
920
Py::Float MatrixPy::getA33() const
922
double val = (*this->getMatrixPtr())[2][2];
923
return Py::Float(val);
926
void MatrixPy::setA33(Py::Float arg)
928
(*this->getMatrixPtr())[2][2] = static_cast<double>(arg);
931
Py::Float MatrixPy::getA34() const
933
double val = (*this->getMatrixPtr())[2][3];
934
return Py::Float(val);
937
void MatrixPy::setA34(Py::Float arg)
939
(*this->getMatrixPtr())[2][3] = static_cast<double>(arg);
942
Py::Float MatrixPy::getA41() const
944
double val = (*this->getMatrixPtr())[3][0];
945
return Py::Float(val);
948
void MatrixPy::setA41(Py::Float arg)
950
(*this->getMatrixPtr())[3][0] = static_cast<double>(arg);
953
Py::Float MatrixPy::getA42() const
955
double val = (*this->getMatrixPtr())[3][1];
956
return Py::Float(val);
959
void MatrixPy::setA42(Py::Float arg)
961
(*this->getMatrixPtr())[3][1] = static_cast<double>(arg);
964
Py::Float MatrixPy::getA43() const
966
double val = (*this->getMatrixPtr())[3][2];
967
return Py::Float(val);
970
void MatrixPy::setA43(Py::Float arg)
972
(*this->getMatrixPtr())[3][2] = static_cast<double>(arg);
975
Py::Float MatrixPy::getA44() const
977
double val = (*this->getMatrixPtr())[3][3];
978
return Py::Float(val);
981
void MatrixPy::setA44(Py::Float arg)
983
(*this->getMatrixPtr())[3][3] = static_cast<double>(arg);
986
Py::Sequence MatrixPy::getA() const
989
this->getMatrixPtr()->getMatrix(mat);
991
for (int i = 0; i < 16; i++) {
992
tuple[i] = Py::Float(mat[i]);
994
return std::move(tuple);
997
void MatrixPy::setA(Py::Sequence arg)
1000
this->getMatrixPtr()->getMatrix(mat);
1003
for (Py::Sequence::iterator it = arg.begin(); it != arg.end() && index < 16; ++it) {
1004
mat[index++] = static_cast<double>(Py::Float(*it));
1007
this->getMatrixPtr()->setMatrix(mat);
1010
PyObject* MatrixPy::getCustomAttributes(const char* /*attr*/) const
1015
int MatrixPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
1020
PyObject* MatrixPy::number_divide_handler(PyObject* /*self*/, PyObject* /*other*/)
1022
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1026
PyObject* MatrixPy::number_remainder_handler(PyObject* /*self*/, PyObject* /*other*/)
1028
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1032
PyObject* MatrixPy::number_divmod_handler(PyObject* /*self*/, PyObject* /*other*/)
1034
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1038
PyObject* MatrixPy::number_negative_handler(PyObject* self)
1040
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
1041
PyErr_SetString(PyExc_TypeError, "arg must be Matrix");
1045
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
1046
return new MatrixPy(a * -1);
1049
PyObject* MatrixPy::number_positive_handler(PyObject* self)
1051
if (!PyObject_TypeCheck(self, &(MatrixPy::Type))) {
1052
PyErr_SetString(PyExc_TypeError, "arg must be Matrix");
1056
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
1057
return new MatrixPy(a);
1060
PyObject* MatrixPy::number_absolute_handler(PyObject* /*self*/)
1062
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1066
int MatrixPy::number_nonzero_handler(PyObject* /*self*/)
1071
PyObject* MatrixPy::number_invert_handler(PyObject* /*self*/)
1073
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1077
PyObject* MatrixPy::number_lshift_handler(PyObject* /*self*/, PyObject* /*other*/)
1079
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1083
PyObject* MatrixPy::number_rshift_handler(PyObject* /*self*/, PyObject* /*other*/)
1085
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1089
PyObject* MatrixPy::number_and_handler(PyObject* /*self*/, PyObject* /*other*/)
1091
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1095
PyObject* MatrixPy::number_xor_handler(PyObject* /*self*/, PyObject* /*other*/)
1097
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1101
PyObject* MatrixPy::number_or_handler(PyObject* /*self*/, PyObject* /*other*/)
1103
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1107
PyObject* MatrixPy::number_int_handler(PyObject* /*self*/)
1109
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
1113
PyObject* MatrixPy::number_float_handler(PyObject* /*self*/)
1115
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");