2018-07-21 13:57:30 +02:00
|
|
|
/*
|
|
|
|
|
Copyright (C) 2018 Erik Ogenvik
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CYPHESIS_CYPY_VECTOR3D_H
|
|
|
|
|
#define CYPHESIS_CYPY_VECTOR3D_H
|
|
|
|
|
|
|
|
|
|
#include "WrapperBase.h"
|
|
|
|
|
#include <wfmath/vector.h>
|
|
|
|
|
|
|
|
|
|
class CyPy_Vector3D : public WrapperBase<WFMath::Vector<3>, CyPy_Vector3D>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CyPy_Vector3D(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds);
|
|
|
|
|
|
|
|
|
|
CyPy_Vector3D(Py::PythonClassInstance* self, WFMath::Vector<3> value);
|
|
|
|
|
|
|
|
|
|
static WFMath::Vector<3> parse(const Py::Object& object);
|
|
|
|
|
|
|
|
|
|
static void init_type();
|
|
|
|
|
|
2018-07-23 16:43:39 +02:00
|
|
|
Py::Object getattro(const Py::String& name) override;
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
int setattro(const Py::String& name, const Py::Object& attr) override;
|
|
|
|
|
|
|
|
|
|
Py::Object repr() override;
|
|
|
|
|
|
|
|
|
|
Py::Object rich_compare(const Py::Object&, int) override;
|
|
|
|
|
|
|
|
|
|
PyCxx_ssize_t sequence_length() override;
|
|
|
|
|
|
|
|
|
|
Py::Object sequence_item(Py_ssize_t) override;
|
|
|
|
|
|
|
|
|
|
int sequence_ass_item(Py_ssize_t, const Py::Object&) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_add(const Py::Object& other) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_subtract(const Py::Object& other) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_multiply(const Py::Object& other) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_floor_divide(const Py::Object& other) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_true_divide(const Py::Object& other) override;
|
|
|
|
|
|
|
|
|
|
Py::Object number_negative() override;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Py::Object dot(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, dot);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object cross(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, cross);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object rotatex(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, rotatex);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object rotatey(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, rotatey);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object rotatez(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, rotatez);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object rotate(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, rotate);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object angle(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, angle);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object sqr_mag();
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_NOARGS_METHOD_DECL(CyPy_Vector3D, sqr_mag);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object mag();
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_NOARGS_METHOD_DECL(CyPy_Vector3D, mag);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object is_valid();
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_NOARGS_METHOD_DECL(CyPy_Vector3D, is_valid);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object unit_vector();
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_NOARGS_METHOD_DECL(CyPy_Vector3D, unit_vector);
|
2018-07-21 13:57:30 +02:00
|
|
|
|
|
|
|
|
Py::Object unit_vector_to(const Py::Tuple& args);
|
|
|
|
|
|
2018-07-24 21:16:50 +02:00
|
|
|
PYCXX_VARARGS_METHOD_DECL(CyPy_Vector3D, unit_vector_to);
|
2018-07-21 13:57:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //CYPHESIS_CYPY_VECTOR3D_H
|