| 2095 | } |
| 2096 | |
| 2097 | Py::Object FunctionExpression::transformFirstArgument( |
| 2098 | const Expression* expression, |
| 2099 | const std::vector<Expression*> &arguments, |
| 2100 | const Base::Matrix4D* transformationMatrix |
| 2101 | ) |
| 2102 | { |
| 2103 | Py::Object target = arguments[0]->getPyValue(); |
| 2104 | |
| 2105 | if (PyObject_TypeCheck(target.ptr(), &Base::MatrixPy::Type)) { |
| 2106 | Base::Matrix4D matrix = static_cast<Base::MatrixPy*>(target.ptr())->value(); |
| 2107 | return Py::asObject(new Base::MatrixPy(*transformationMatrix * matrix)); |
| 2108 | } else if (PyObject_TypeCheck(target.ptr(), &Base::PlacementPy::Type)) { |
| 2109 | Base::Matrix4D placementMatrix = |
| 2110 | static_cast<Base::PlacementPy*>(target.ptr())->getPlacementPtr()->toMatrix(); |
| 2111 | return Py::asObject(new Base::PlacementPy(Base::Placement(*transformationMatrix * placementMatrix))); |
| 2112 | } else if (PyObject_TypeCheck(target.ptr(), &Base::RotationPy::Type)) { |
| 2113 | Base::Matrix4D rotatioMatrix; |
| 2114 | static_cast<Base::RotationPy*>(target.ptr())->getRotationPtr()->getValue(rotatioMatrix); |
| 2115 | return Py::asObject(new Base::RotationPy(Base::Rotation(*transformationMatrix * rotatioMatrix))); |
| 2116 | } |
| 2117 | |
| 2118 | _EXPR_THROW("Function requires the first argument to be either Matrix, Placement or Rotation.", expression); |
| 2119 | } |
| 2120 | |
| 2121 | Py::Object FunctionExpression::translationMatrix(double x, double y, double z) |
| 2122 | { |