Debian Codegraph @

src/Base/RotationPyImp.cpp

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
5 * *
6 * This file is part of the FreeCAD CAx development system. *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Library General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Library General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Library General Public *
19 * License along with this library; see the file COPYING.LIB. If not, *
20 * write to the Free Software Foundation, Inc., 59 Temple Place, *
21 * Suite 330, Boston, MA 02111-1307, USA *
22 * *
23 ***************************************************************************/
24
25 #include "GeometryPyCXX.h"
26 #include "PyWrapParseTupleAndKeywords.h"
27 #include "Tools.h"
28
29 // generated out of Rotation.pyi
30 #include "RotationPy.h"
31 #include "RotationPy.cpp"
32
33 #include "VectorPy.h"
34
35 using namespace Base;
36
37 // returns a string which represents the object e.g. when printed in python
38 std::string RotationPy::representation() const
39 {
40 RotationPy::PointerType ptr = getRotationPtr();
41 Py::Float q0(ptr->getValue()[0]);
42 Py::Float q1(ptr->getValue()[1]);
43 Py::Float q2(ptr->getValue()[2]);
44 Py::Float q3(ptr->getValue()[3]);
45 std::stringstream str;
46 str << "Rotation (";
47 str << static_cast<std::string>(q0.repr()) << ", " << static_cast<std::string>(q1.repr()) << ", "
48 << static_cast<std::string>(q2.repr()) << ", " << static_cast<std::string>(q3.repr());
49 str << ")";
50
51 return str.str();
52 }
53
54 PyObject* RotationPy::PyMake(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/)
55 {
56 // create a new instance of RotationPy and the Twin object
57 return new RotationPy(new Rotation);
58 }
59
60 // clang-format off
61 // constructor method
62 int RotationPy::PyInit(PyObject* args, PyObject* kwds)
63 {
64 PyObject* o {};
65 if (PyArg_ParseTuple(args, "")) {
66 return 0;
67 }
68
69 PyErr_Clear();
70 if (PyArg_ParseTuple(args, "O!", &(RotationPy::Type), &o)) {
71 Rotation* rot = static_cast<RotationPy*>(o)->getRotationPtr();
72 getRotationPtr()->setValue(rot->getValue());
73 return 0;
74 }
75
76 PyErr_Clear();
77 double angle {};
78 static const std::array<const char*, 3> kw_deg {"Axis", "Degree", nullptr};
79 if (Wrapped_ParseTupleAndKeywords(args,
80 kwds,
81 "O!d",
82 kw_deg,
83 &(VectorPy::Type),
84 &o,
85 &angle)) {
86 // NOTE: The last parameter defines the rotation angle in degree.
87 getRotationPtr()->setValue(static_cast<VectorPy*>(o)->value(),
88 toRadians<double>(angle));
89 return 0;
90 }
91
92 PyErr_Clear();
93 static const std::array<const char*, 3> kw_rad {"Axis", "Radian", nullptr};
94 if (Wrapped_ParseTupleAndKeywords(args,
95 kwds,
96 "O!d",
97 kw_rad,
98 &(VectorPy::Type),
99 &o,
100 &angle)) {
101 getRotationPtr()->setValue(static_cast<VectorPy*>(o)->value(), angle);
102 return 0;
103 }
104
105 PyErr_Clear();
106 if (PyArg_ParseTuple(args, "O!", &(MatrixPy::Type), &o)) {
107 try {
108 getRotationPtr()->setValue(static_cast<MatrixPy*>(o)->value());
109 return 0;
110 }
111 catch (const Exception& e) {
112 PyErr_SetString(e.getPyExceptionType(), e.what());
113 return -1;
114 }
115 }
116
117 PyErr_Clear();
118 double q0 {};
119 double q1 {};
120 double q2 {};
121 double q3 {};
122 if (PyArg_ParseTuple(args, "dddd", &q0, &q1, &q2, &q3)) {
123 getRotationPtr()->setValue(q0, q1, q2, q3);
124 return 0;
125 }
126
127 PyErr_Clear();
128 double y {};
129 double p {};
130 double r {};
131 if (PyArg_ParseTuple(args, "ddd", &y, &p, &r)) {
132 getRotationPtr()->setYawPitchRoll(y, p, r);
133 return 0;
134 }
135
136 PyErr_Clear();
137 const char* seq {};
138 double a {};
139 double b {};
140 double c {};
141 if (PyArg_ParseTuple(args, "sddd", &seq, &a, &b, &c)) {
142 PY_TRY
143 {
144 getRotationPtr()->setEulerAngles(Rotation::eulerSequenceFromName(seq), a, b, c);
145 return 0;
146 }
147 _PY_CATCH(return -1)
148 }
149
150 // NOLINTBEGIN
151 double a11 = 1.0, a12 = 0.0, a13 = 0.0, a14 = 0.0;
152 double a21 = 0.0, a22 = 1.0, a23 = 0.0, a24 = 0.0;
153 double a31 = 0.0, a32 = 0.0, a33 = 1.0, a34 = 0.0;
154 double a41 = 0.0, a42 = 0.0, a43 = 0.0, a44 = 1.0;
155 // NOLINTEND
156
157 // try read a 4x4 matrix
158 PyErr_Clear();
159 if (PyArg_ParseTuple(args,
160 "dddddddddddddddd",
161 &a11, &a12, &a13, &a14,
162 &a21, &a22, &a23, &a24,
163 &a31, &a32, &a33, &a34,
164 &a41, &a42, &a43, &a44)) {
165 try {
166 Matrix4D mtx(a11, a12, a13, a14,
167 a21, a22, a23, a24,
168 a31, a32, a33, a34,
169 a41, a42, a43, a44);
170 getRotationPtr()->setValue(mtx);
171 return 0;
172 }
173 catch (const Exception& e) {
174 PyErr_SetString(e.getPyExceptionType(), e.what());
175 return -1;
176 }
177 }
178
179 // try read a 3x3 matrix
180 PyErr_Clear();
181 if (PyArg_ParseTuple(args, "ddddddddd",
182 &a11, &a12, &a13,
183 &a21, &a22, &a23,
184 &a31, &a32, &a33)) {
185 try {
186 Matrix4D mtx(a11, a12, a13, a14,
187 a21, a22, a23, a24,
188 a31, a32, a33, a34,
189 a41, a42, a43, a44);
190 getRotationPtr()->setValue(mtx);
191 return 0;
192 }
193 catch (const Exception& e) {
194 PyErr_SetString(e.getPyExceptionType(), e.what());
195 return -1;
196 }
197 }
198
199 PyErr_Clear();
200 PyObject* v1 {};
201 PyObject* v2 {};
202 if (PyArg_ParseTuple(args,
203 "O!O!",
204 &(VectorPy::Type), &v1,
205 &(VectorPy::Type), &v2)) {
206 Py::Vector from(v1, false);
207 Py::Vector to(v2, false);
208 getRotationPtr()->setValue(from.toVector(), to.toVector());
209 return 0;
210 }
211
212 PyErr_Clear();
213 PyObject* v3 {};
214 const char* priority = nullptr;
215 if (PyArg_ParseTuple(args,
216 "O!O!O!|s",
217 &(VectorPy::Type), &v1,
218 &(VectorPy::Type), &v2,
219 &(VectorPy::Type), &v3,
220 &priority)) {
221 Py::Vector xdir(v1, false);
222 Py::Vector ydir(v2, false);
223 Py::Vector zdir(v3, false);
224 if (!priority) {
225 priority = "ZXY";
226 }
227 try {
228 *getRotationPtr() = (Rotation::makeRotationByAxes(xdir.toVector(),
229 ydir.toVector(),
230 zdir.toVector(),
231 priority));
232 }
233 catch (Exception& e) {
234 std::string str;
235 str += "FreeCAD exception thrown (";
236 str += e.what();
237 str += ")";
238 PyErr_SetString(PyExc_FC_GeneralError, str.c_str());
239 return -1;
240 }
241
242 return 0;
243 }
244
245 PyErr_SetString(PyExc_TypeError,
246 "Rotation constructor accepts:\n"
247 "-- empty parameter list\n"
248 "-- Rotation object\n"
249 "-- four floats (a quaternion)\n"
250 "-- three floats (yaw, pitch, roll)\n"
251 "-- Vector (rotation axis) and float (rotation angle)\n"
252 "-- two Vectors (two axes)\n"
253 "-- Matrix object\n"
254 "-- 16 floats (4x4 matrix)\n"
255 "-- 9 floats (3x3 matrix)\n"
256 "-- 3 vectors + optional string");
257 return -1;
258 }
259 // clang-format on
260
261 PyObject* RotationPy::richCompare(PyObject* v, PyObject* w, int op)
262 {
263 if (PyObject_TypeCheck(v, &(RotationPy::Type)) && PyObject_TypeCheck(w, &(RotationPy::Type))) {
264 Rotation r1 = *static_cast<RotationPy*>(v)->getRotationPtr();
265 Rotation r2 = *static_cast<RotationPy*>(w)->getRotationPtr();
266
267 PyObject* res = nullptr;
268 if (op != Py_EQ && op != Py_NE) {
269 PyErr_SetString(PyExc_TypeError, "no ordering relation is defined for Rotation");
270 return nullptr;
271 }
272 if (op == Py_EQ) {
273 res = (r1 == r2) ? Py_True : Py_False;
274 Py_INCREF(res);
275 return res;
276 }
277 res = (r1 != r2) ? Py_True : Py_False;
278 Py_INCREF(res);
279 return res;
280 }
281 // This always returns False
282 Py_INCREF(Py_NotImplemented);
283 return Py_NotImplemented;
284 }
285
286 PyObject* RotationPy::invert(PyObject* args)
287 {
288 if (!PyArg_ParseTuple(args, "")) {
289 return nullptr;
290 }
291 this->getRotationPtr()->invert();
292 Py_Return;
293 }
294
295 PyObject* RotationPy::inverted(PyObject* args) const
296 {
297 if (!PyArg_ParseTuple(args, "")) {
298 return nullptr;
299 }
300 Rotation mult = this->getRotationPtr()->inverse();
301 return new RotationPy(new Rotation(mult));
302 }
303
304 PyObject* RotationPy::multiply(PyObject* args) const
305 {
306 PyObject* rot {};
307 if (!PyArg_ParseTuple(args, "O!", &(RotationPy::Type), &rot)) {
308 return nullptr;
309 }
310 Rotation mult = (*getRotationPtr()) * (*static_cast<RotationPy*>(rot)->getRotationPtr());
311 return new RotationPy(new Rotation(mult));
312 }
313
314 PyObject* RotationPy::multVec(PyObject* args) const
315 {
316 PyObject* obj {};
317 if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) {
318 return nullptr;
319 }
320 Vector3d vec(static_cast<VectorPy*>(obj)->value());
321 getRotationPtr()->multVec(vec, vec);
322 return new VectorPy(new Vector3d(vec));
323 }
324
325 PyObject* RotationPy::slerp(PyObject* args) const
326 {
327 PyObject* rot {};
328 double t {};
329 if (!PyArg_ParseTuple(args, "O!d", &(RotationPy::Type), &rot, &t)) {
330 return nullptr;
331 }
332 Rotation* rot0 = this->getRotationPtr();
333 Rotation* rot1 = static_cast<RotationPy*>(rot)->getRotationPtr();
334 Rotation sl = Rotation::slerp(*rot0, *rot1, t);
335 return new RotationPy(new Rotation(sl));
336 }
337
338 PyObject* RotationPy::setYawPitchRoll(PyObject* args)
339 {
340 double A {};
341 double B {};
342 double C {};
343 if (!PyArg_ParseTuple(args, "ddd", &A, &B, &C)) {
344 return nullptr;
345 }
346 this->getRotationPtr()->setYawPitchRoll(A, B, C);
347 Py_Return;
348 }
349
350 PyObject* RotationPy::getYawPitchRoll(PyObject* args) const
351 {
352 if (!PyArg_ParseTuple(args, "")) {
353 return nullptr;
354 }
355 double A {};
356 double B {};
357 double C {};
358 this->getRotationPtr()->getYawPitchRoll(A, B, C);
359
360 Py::Tuple tuple(3);
361 tuple.setItem(0, Py::Float(A));
362 tuple.setItem(1, Py::Float(B));
363 tuple.setItem(2, Py::Float(C));
364 return Py::new_reference_to(tuple);
365 }
366
367 PyObject* RotationPy::setEulerAngles(PyObject* args)
368 {
369 const char* seq {};
370 double A {};
371 double B {};
372 double C {};
373 if (!PyArg_ParseTuple(args, "sddd", &seq, &A, &B, &C)) {
374 return nullptr;
375 }
376
377 try {
378 getRotationPtr()->setEulerAngles(Rotation::eulerSequenceFromName(seq), A, B, C);
379 Py_Return;
380 }
381 catch (const Exception& e) {
382 e.setPyException();
383 return nullptr;
384 }
385 }
386
387 PyObject* RotationPy::toEulerAngles(PyObject* args) const
388 {
389 const char* seq = nullptr;
390 if (!PyArg_ParseTuple(args, "|s", &seq)) {
391 return nullptr;
392 }
393 if (!seq) {
394 Py::List res;
395 for (int i = 1; i < Rotation::EulerSequenceLast; ++i) {
396 res.append(Py::String(Rotation::eulerSequenceName((Rotation::EulerSequence)i)));
397 }
398 return Py::new_reference_to(res);
399 }
400
401 PY_TRY
402 {
403 double A {};
404 double B {};
405 double C {};
406 this->getRotationPtr()->getEulerAngles(Rotation::eulerSequenceFromName(seq), A, B, C);
407
408 Py::Tuple tuple(3);
409 tuple.setItem(0, Py::Float(A));
410 tuple.setItem(1, Py::Float(B));
411 tuple.setItem(2, Py::Float(C));
412 return Py::new_reference_to(tuple);
413 }
414 PY_CATCH
415 }
416
417 PyObject* RotationPy::toMatrix(PyObject* args) const
418 {
419 if (!PyArg_ParseTuple(args, "")) {
420 return nullptr;
421 }
422 Matrix4D mat;
423 getRotationPtr()->getValue(mat);
424 return new MatrixPy(new Matrix4D(mat));
425 }
426
427 PyObject* RotationPy::isSame(PyObject* args)
428 {
429 PyObject* rot {};
430 double tol = 0.0;
431 if (!PyArg_ParseTuple(args, "O!|d", &(RotationPy::Type), &rot, &tol)) {
432 return nullptr;
433 }
434 Rotation rot1 = *getRotationPtr();
435 Rotation rot2 = *static_cast<RotationPy*>(rot)->getRotationPtr();
436 bool same = tol > 0.0 ? rot1.isSame(rot2, tol) : rot1.isSame(rot2);
437 return Py_BuildValue("O", (same ? Py_True : Py_False));
438 }
439
440 PyObject* RotationPy::isIdentity(PyObject* args) const
441 {
442 double tol = 0.0;
443 if (!PyArg_ParseTuple(args, "|d", &tol)) {
444 return nullptr;
445 }
446 bool null = tol > 0.0 ? getRotationPtr()->isIdentity(tol) : getRotationPtr()->isIdentity();
447 return Py_BuildValue("O", (null ? Py_True : Py_False));
448 }
449
450 PyObject* RotationPy::isNull(PyObject* args) const
451 {
452 if (!PyArg_ParseTuple(args, "")) {
453 return nullptr;
454 }
455 bool null = getRotationPtr()->isNull();
456 return Py_BuildValue("O", (null ? Py_True : Py_False));
457 }
458
459 Py::Tuple RotationPy::getQ() const
460 {
461 double q0 {};
462 double q1 {};
463 double q2 {};
464 double q3 {};
465 this->getRotationPtr()->getValue(q0, q1, q2, q3);
466
467 Py::Tuple tuple(4);
468 tuple.setItem(0, Py::Float(q0));
469 tuple.setItem(1, Py::Float(q1));
470 tuple.setItem(2, Py::Float(q2));
471 tuple.setItem(3, Py::Float(q3));
472 return tuple;
473 }
474
475 void RotationPy::setQ(Py::Tuple arg)
476 {
477 double q0 = static_cast<double>(Py::Float(arg.getItem(0)));
478 double q1 = static_cast<double>(Py::Float(arg.getItem(1)));
479 double q2 = static_cast<double>(Py::Float(arg.getItem(2)));
480 double q3 = static_cast<double>(Py::Float(arg.getItem(3)));
481 this->getRotationPtr()->setValue(q0, q1, q2, q3);
482 }
483
484 Py::Object RotationPy::getRawAxis() const
485 {
486 Vector3d axis;
487 double angle {};
488 this->getRotationPtr()->getRawValue(axis, angle);
489 return Py::Vector(axis); // NOLINT
490 }
491
492 Py::Object RotationPy::getAxis() const
493 {
494 Vector3d axis;
495 double angle {};
496 this->getRotationPtr()->getValue(axis, angle);
497 return Py::Vector(axis); // NOLINT
498 }
499
500 void RotationPy::setAxis(Py::Object arg)
501 {
502 Vector3d axis;
503 double angle {};
504 this->getRotationPtr()->getValue(axis, angle);
505 axis = Py::Vector(arg).toVector();
506 this->getRotationPtr()->setValue(axis, angle);
507 }
508
509 Py::Float RotationPy::getAngle() const
510 {
511 Vector3d axis;
512 double angle {};
513 this->getRotationPtr()->getValue(axis, angle);
514 return Py::Float(angle);
515 }
516
517 void RotationPy::setAngle(Py::Float arg)
518 {
519 Vector3d axis;
520 double angle {};
521 this->getRotationPtr()->getRawValue(axis, angle);
522 angle = static_cast<double>(arg);
523 this->getRotationPtr()->setValue(axis, angle);
524 }
525
526 PyObject* RotationPy::getCustomAttributes(const char* attr) const
527 {
528 if (strcmp(attr, "Matrix") == 0) {
529 Matrix4D mat;
530 this->getRotationPtr()->getValue(mat);
531 return new MatrixPy(mat);
532 }
533 if (strcmp(attr, "Yaw") == 0) {
534 double A {};
535 double B {};
536 double C {};
537 this->getRotationPtr()->getYawPitchRoll(A, B, C);
538 return PyFloat_FromDouble(A);
539 }
540 if (strcmp(attr, "Pitch") == 0) {
541 double A {};
542 double B {};
543 double C {};
544 this->getRotationPtr()->getYawPitchRoll(A, B, C);
545 return PyFloat_FromDouble(B);
546 }
547 if (strcmp(attr, "Roll") == 0) {
548 double A {};
549 double B {};
550 double C {};
551 this->getRotationPtr()->getYawPitchRoll(A, B, C);
552 return PyFloat_FromDouble(C);
553 }
554 if (strcmp(attr, "toEuler") == 0) {
555 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
556 Py::Object self(const_cast<RotationPy*>(this), false);
557 return Py::new_reference_to(self.getAttr("getYawPitchRoll"));
558 }
559 return nullptr;
560 }
561
562 int RotationPy::setCustomAttributes(const char* attr, PyObject* obj)
563 {
564 if (strcmp(attr, "Matrix") == 0) {
565 if (PyObject_TypeCheck(obj, &(MatrixPy::Type))) {
566 try {
567 this->getRotationPtr()->setValue(*static_cast<MatrixPy*>(obj)->getMatrixPtr());
568 return 1;
569 }
570 catch (const Exception& e) {
571 PyErr_SetString(e.getPyExceptionType(), e.what());
572 return -1;
573 }
574 }
575 }
576 else if (strcmp(attr, "Axes") == 0) {
577 if (PySequence_Check(obj)) {
578 Py::Sequence sequence(obj);
579 if (sequence.size() == 2) {
580 Py::Object vec1 = sequence.getItem(0);
581 Py::Object vec2 = sequence.getItem(1);
582 if (PyObject_TypeCheck(vec1.ptr(), &(VectorPy::Type))
583 && PyObject_TypeCheck(vec2.ptr(), &(VectorPy::Type))) {
584 Vector3d* pt1 = static_cast<VectorPy*>(vec1.ptr())->getVectorPtr();
585 Vector3d* pt2 = static_cast<VectorPy*>(vec2.ptr())->getVectorPtr();
586 this->getRotationPtr()->setValue(*pt1, *pt2);
587 return 1;
588 }
589 }
590 }
591 }
592 else if (strcmp(attr, "Yaw") == 0) {
593 if (PyNumber_Check(obj)) {
594 double V = PyFloat_AsDouble(obj);
595 double A {};
596 double B {};
597 double C {};
598 this->getRotationPtr()->getYawPitchRoll(A, B, C);
599 this->getRotationPtr()->setYawPitchRoll(V, B, C);
600 return 1;
601 }
602 }
603 else if (strcmp(attr, "Pitch") == 0) {
604 if (PyNumber_Check(obj)) {
605 double V = PyFloat_AsDouble(obj);
606 double A {};
607 double B {};
608 double C {};
609 this->getRotationPtr()->getYawPitchRoll(A, B, C);
610 this->getRotationPtr()->setYawPitchRoll(A, V, C);
611 return 1;
612 }
613 }
614 else if (strcmp(attr, "Roll") == 0) {
615 if (PyNumber_Check(obj)) {
616 double V = PyFloat_AsDouble(obj);
617 double A {};
618 double B {};
619 double C {};
620 this->getRotationPtr()->getYawPitchRoll(A, B, C);
621 this->getRotationPtr()->setYawPitchRoll(A, B, V);
622 return 1;
623 }
624 }
625 return 0;
626 }
627
628 PyObject* RotationPy::number_multiply_handler(PyObject* self, PyObject* other)
629 {
630 if (PyObject_TypeCheck(self, &(RotationPy::Type))) {
631 auto a = static_cast<RotationPy*>(self)->value();
632
633 if (PyObject_TypeCheck(other, &(VectorPy::Type))) {
634 Vector3d res;
635 a.multVec(static_cast<VectorPy*>(other)->value(), res);
636 return new VectorPy(res);
637 }
638
639 if (PyObject_TypeCheck(other, &(PlacementPy::Type))) {
640 const auto& b = static_cast<PlacementPy*>(other)->value();
641 return new PlacementPy(Placement(Vector3d(), a) * b);
642 }
643
644 if (PyObject_TypeCheck(other, &(RotationPy::Type))) {
645 const auto& b = static_cast<RotationPy*>(other)->value();
646 return new RotationPy(a * b);
647 }
648
649 if (PyObject_TypeCheck(other, &(MatrixPy::Type))) {
650 const auto& b = static_cast<MatrixPy*>(other)->value();
651 Matrix4D mat;
652 a.getValue(mat);
653 return new MatrixPy(mat * b);
654 }
655 }
656
657 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
658 return nullptr;
659 }
660
661 PyObject* RotationPy::number_power_handler(PyObject* self, PyObject* other, PyObject* arg)
662 {
663 if (!PyObject_TypeCheck(self, &(RotationPy::Type)) || !PyLong_Check(other) || arg != Py_None) {
664 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
665 return nullptr;
666 }
667
668 Rotation a = static_cast<RotationPy*>(self)->value();
669 long b = Py::Long(other);
670
671 Vector3d axis;
672 double rfAngle {};
673
674 a.getRawValue(axis, rfAngle);
675 rfAngle *= double(b);
676 a.setValue(axis, rfAngle);
677
678 return new RotationPy(a);
679 }
680
681 PyObject* RotationPy::number_add_handler(PyObject* /*self*/, PyObject* /*other*/)
682 {
683 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
684 return nullptr;
685 }
686
687 PyObject* RotationPy::number_subtract_handler(PyObject* /*self*/, PyObject* /*other*/)
688 {
689 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
690 return nullptr;
691 }
692
693 PyObject* RotationPy::number_divide_handler(PyObject* /*self*/, PyObject* /*other*/)
694 {
695 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
696 return nullptr;
697 }
698
699 PyObject* RotationPy::number_remainder_handler(PyObject* /*self*/, PyObject* /*other*/)
700 {
701 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
702 return nullptr;
703 }
704
705 PyObject* RotationPy::number_divmod_handler(PyObject* /*self*/, PyObject* /*other*/)
706 {
707 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
708 return nullptr;
709 }
710
711 PyObject* RotationPy::number_negative_handler(PyObject* /*self*/)
712 {
713 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
714 return nullptr;
715 }
716
717 PyObject* RotationPy::number_positive_handler(PyObject* /*self*/)
718 {
719 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
720 return nullptr;
721 }
722
723 PyObject* RotationPy::number_absolute_handler(PyObject* /*self*/)
724 {
725 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
726 return nullptr;
727 }
728
729 int RotationPy::number_nonzero_handler(PyObject* /*self*/)
730 {
731 return 1;
732 }
733
734 PyObject* RotationPy::number_invert_handler(PyObject* /*self*/)
735 {
736 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
737 return nullptr;
738 }
739
740 PyObject* RotationPy::number_lshift_handler(PyObject* /*self*/, PyObject* /*other*/)
741 {
742 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
743 return nullptr;
744 }
745
746 PyObject* RotationPy::number_rshift_handler(PyObject* /*self*/, PyObject* /*other*/)
747 {
748 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
749 return nullptr;
750 }
751
752 PyObject* RotationPy::number_and_handler(PyObject* /*self*/, PyObject* /*other*/)
753 {
754 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
755 return nullptr;
756 }
757
758 PyObject* RotationPy::number_xor_handler(PyObject* /*self*/, PyObject* /*other*/)
759 {
760 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
761 return nullptr;
762 }
763
764 PyObject* RotationPy::number_or_handler(PyObject* /*self*/, PyObject* /*other*/)
765 {
766 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
767 return nullptr;
768 }
769
770 PyObject* RotationPy::number_int_handler(PyObject* /*self*/)
771 {
772 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
773 return nullptr;
774 }
775
776 PyObject* RotationPy::number_float_handler(PyObject* /*self*/)
777 {
778 PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
779 return nullptr;
780 }