mirror of
https://github.com/snowykami/mbcp.git
synced 2026-01-20 18:52:02 +00:00
📝 测试文档部署
This commit is contained in:
@@ -1,28 +1,25 @@
|
||||
---
|
||||
title: mbcp.mp\nmath.point
|
||||
order: 1
|
||||
icon: laptop-code
|
||||
category: API
|
||||
title: mbcp.mp_math.point
|
||||
---
|
||||
|
||||
### ***class*** `Point3`
|
||||
|
||||
- #### *def* `__init__(self, x: float, y: float, z: float)`
|
||||
|
||||
|
||||
###   ***def*** `__init__(self, x: float, y: float, z: float) -> None`
|
||||
笛卡尔坐标系中的点。
|
||||
|
||||
 笛卡尔坐标系中的点。
|
||||
参数:
|
||||
|
||||
Args:
|
||||
x: x 坐标
|
||||
|
||||
x: x 坐标
|
||||
y: y 坐标
|
||||
|
||||
y: y 坐标
|
||||
z: z 坐标
|
||||
|
||||
z: z 坐标
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源代码</summary>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
def __init__(self, x: float, y: float, z: float):
|
||||
@@ -39,24 +36,21 @@ def __init__(self, x: float, y: float, z: float):
|
||||
```
|
||||
</details>
|
||||
|
||||
###   ***def*** `approx(self, other: 'Point3', epsilon: float) -> bool`
|
||||
|
||||
 判断两个点是否近似相等。
|
||||
|
||||
Args:
|
||||
|
||||
other:
|
||||
|
||||
epsilon:
|
||||
- #### *def* `approx(self, other: 'Point3', epsilon: float = APPROX)`
|
||||
|
||||
|
||||
判断两个点是否近似相等。
|
||||
|
||||
Returns:
|
||||
参数:
|
||||
|
||||
是否近似相等
|
||||
other:
|
||||
|
||||
epsilon:
|
||||
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源代码</summary>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
|
||||
@@ -73,3 +67,97 @@ def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
|
||||
```
|
||||
</details>
|
||||
|
||||
- #### *def* `__str__(self)`
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
def __str__(self):
|
||||
return f'Point3({self.x}, {self.y}, {self.z})'
|
||||
```
|
||||
</details>
|
||||
|
||||
- #### `@overload`
|
||||
- #### *def* `__add__(self, other: 'Vector3')`
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
@overload
|
||||
def __add__(self, other: 'Vector3') -> 'Point3':
|
||||
...
|
||||
```
|
||||
</details>
|
||||
|
||||
- #### `@overload`
|
||||
- #### *def* `__add__(self, other: 'Point3')`
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
@overload
|
||||
def __add__(self, other: 'Point3') -> 'Point3':
|
||||
...
|
||||
```
|
||||
</details>
|
||||
|
||||
- #### *def* `__add__(self, other)`
|
||||
|
||||
|
||||
P + V -> P
|
||||
P + P -> P
|
||||
|
||||
参数:
|
||||
|
||||
other:
|
||||
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
def __add__(self, other):
|
||||
"""
|
||||
P + V -> P
|
||||
P + P -> P
|
||||
Args:
|
||||
other:
|
||||
Returns:
|
||||
"""
|
||||
return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
|
||||
```
|
||||
</details>
|
||||
|
||||
- #### *def* `__eq__(self, other)`
|
||||
|
||||
|
||||
判断两个点是否相等。
|
||||
|
||||
参数:
|
||||
|
||||
other:
|
||||
|
||||
|
||||
- #
|
||||
<details>
|
||||
<summary>源码</summary>
|
||||
|
||||
```python
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
判断两个点是否相等。
|
||||
Args:
|
||||
other:
|
||||
Returns:
|
||||
"""
|
||||
return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user