mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
...
This commit is contained in:
parent
5cf6267f5b
commit
8d9761c6b5
21
src/linalg.h
21
src/linalg.h
@ -562,17 +562,22 @@ struct PyMat3x3: Mat3x3{
|
|||||||
return VAR_T(PyMat3x3, self / other);
|
return VAR_T(PyMat3x3, self / other);
|
||||||
});
|
});
|
||||||
|
|
||||||
vm->bind_method<1>(type, "__matmul__", [](VM* vm, ArgsView args){
|
auto f_mm = [](VM* vm, ArgsView args){
|
||||||
PyMat3x3& self = _CAST(PyMat3x3&, args[0]);
|
PyMat3x3& self = _CAST(PyMat3x3&, args[0]);
|
||||||
PyMat3x3& other = CAST(PyMat3x3&, args[1]);
|
if(is_non_tagged_type(args[1], PyMat3x3::_type(vm))){
|
||||||
|
PyMat3x3& other = _CAST(PyMat3x3&, args[1]);
|
||||||
return VAR_T(PyMat3x3, self.matmul(other));
|
return VAR_T(PyMat3x3, self.matmul(other));
|
||||||
});
|
}
|
||||||
|
if(is_non_tagged_type(args[1], PyVec3::_type(vm))){
|
||||||
|
PyVec3& other = _CAST(PyVec3&, args[1]);
|
||||||
|
return VAR_T(PyVec3, self.matmul(other));
|
||||||
|
}
|
||||||
|
vm->TypeError("unsupported operand type(s) for @");
|
||||||
|
return vm->None;
|
||||||
|
};
|
||||||
|
|
||||||
vm->bind_method<1>(type, "matmul", [](VM* vm, ArgsView args){
|
vm->bind_method<1>(type, "__matmul__", f_mm);
|
||||||
PyMat3x3& self = _CAST(PyMat3x3&, args[0]);
|
vm->bind_method<1>(type, "matmul", f_mm);
|
||||||
PyMat3x3& other = CAST(PyMat3x3&, args[1]);
|
|
||||||
return VAR_T(PyMat3x3, self.matmul(other));
|
|
||||||
});
|
|
||||||
|
|
||||||
vm->bind_method<1>(type, "__eq__", [](VM* vm, ArgsView args){
|
vm->bind_method<1>(type, "__eq__", [](VM* vm, ArgsView args){
|
||||||
PyMat3x3& self = _CAST(PyMat3x3&, args[0]);
|
PyMat3x3& self = _CAST(PyMat3x3&, args[0]);
|
||||||
|
@ -64,8 +64,13 @@ class mat3x3:
|
|||||||
def __sub__(self, other: mat3x3) -> mat3x3: ...
|
def __sub__(self, other: mat3x3) -> mat3x3: ...
|
||||||
def __mul__(self, other: float) -> mat3x3: ...
|
def __mul__(self, other: float) -> mat3x3: ...
|
||||||
def __truediv__(self, other: float) -> mat3x3: ...
|
def __truediv__(self, other: float) -> mat3x3: ...
|
||||||
|
@overload
|
||||||
def __matmul__(self, other: mat3x3) -> mat3x3: ...
|
def __matmul__(self, other: mat3x3) -> mat3x3: ...
|
||||||
|
@overload
|
||||||
|
def __matmul__(self, other: vec3) -> vec3: ...
|
||||||
|
@overload
|
||||||
def matmul(self, other: mat3x3) -> mat3x3: ...
|
def matmul(self, other: mat3x3) -> mat3x3: ...
|
||||||
|
@overload
|
||||||
def matmul(self, other: vec3) -> vec3: ...
|
def matmul(self, other: vec3) -> vec3: ...
|
||||||
def determinant(self) -> float: ...
|
def determinant(self) -> float: ...
|
||||||
def transpose(self) -> mat3x3: ...
|
def transpose(self) -> mat3x3: ...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user