|
|
@@ -3,10 +3,11 @@ icon: package
|
|
|
label: linalg
|
|
|
---
|
|
|
|
|
|
-Provide `mat3x3`, `vec2` and `vec3` types.
|
|
|
+Provide `mat3x3`, `vec2`, `vec3` and `vec4` types.
|
|
|
|
|
|
```python
|
|
|
from typing import overload
|
|
|
+from c import float_p
|
|
|
|
|
|
class vec2:
|
|
|
x: float
|
|
|
@@ -24,6 +25,7 @@ class vec2:
|
|
|
def length_squared(self) -> float: ...
|
|
|
def normalize(self) -> vec2: ...
|
|
|
def rotate(self, radians: float) -> vec2: ...
|
|
|
+ def addr(self) -> float_p: ...
|
|
|
|
|
|
class vec3:
|
|
|
x: float
|
|
|
@@ -41,6 +43,25 @@ class vec3:
|
|
|
def length(self) -> float: ...
|
|
|
def length_squared(self) -> float: ...
|
|
|
def normalize(self) -> vec3: ...
|
|
|
+ def addr(self) -> float_p: ...
|
|
|
+
|
|
|
+class vec4:
|
|
|
+ x: float
|
|
|
+ y: float
|
|
|
+ z: float
|
|
|
+ w: float
|
|
|
+
|
|
|
+ def __init__(self, x: float, y: float, z: float, w: float) -> None: ...
|
|
|
+ def copy(self) -> vec4: ...
|
|
|
+ def __add__(self, other: vec4) -> vec4: ...
|
|
|
+ def __sub__(self, other: vec4) -> vec4: ...
|
|
|
+ def __mul__(self, other: float) -> vec4: ...
|
|
|
+ def __truediv__(self, other: float) -> vec4: ...
|
|
|
+ def dot(self, other: vec4) -> float: ...
|
|
|
+ def length(self) -> float: ...
|
|
|
+ def length_squared(self) -> float: ...
|
|
|
+ def normalize(self) -> vec4: ...
|
|
|
+ def addr(self) -> float_p: ...
|
|
|
|
|
|
class mat3x3:
|
|
|
_11: float
|
|
|
@@ -83,6 +104,8 @@ class mat3x3:
|
|
|
def transpose(self) -> mat3x3: ...
|
|
|
def inverse(self) -> mat3x3: ...
|
|
|
|
|
|
+ def __invert__(self) -> mat3x3: ...
|
|
|
+
|
|
|
@staticmethod
|
|
|
def zeros() -> mat3x3: ...
|
|
|
@staticmethod
|
|
|
@@ -95,8 +118,6 @@ class mat3x3:
|
|
|
def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
|
|
|
|
|
|
def is_affine(self) -> bool: ...
|
|
|
- def inverse_affine(self) -> mat3x3: ...
|
|
|
- def matmul_affine(self, other: mat3x3) -> mat3x3: ...
|
|
|
|
|
|
def translation(self) -> vec2: ...
|
|
|
def rotation(self) -> float: ...
|