📝 优化文档样式

This commit is contained in:
2024-08-29 13:46:59 +08:00
parent 260a0f8709
commit 86b8a4c922
39 changed files with 1721 additions and 2470 deletions

View File

@ -6,18 +6,16 @@ title: mbcp.mp_math.angle
### *method* `__init__(self, value: float, is_radian: bool = False)`
任意角度。
**Description**: 任意角度。
**Arguments**:
- value: 角度或弧度值
- is_radian: 是否为弧度,默认为否
> - value: 角度或弧度值
> - is_radian: 是否为弧度,默认为否
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, value: float, is_radian: bool=False):
@ -38,16 +36,14 @@ def __init__(self, value: float, is_radian: bool=False):
### *method* `complementary(self) -> AnyAngle`
余角两角的和为90°。
**Return**:
- 余角
**Description**: 余角两角的和为90°。
**Return**: 余角
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -65,16 +61,14 @@ def complementary(self) -> 'AnyAngle':
### *method* `supplementary(self) -> AnyAngle`
补角两角的和为180°。
**Return**:
- 补角
**Description**: 补角两角的和为180°。
**Return**: 补角
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -92,16 +86,14 @@ def supplementary(self) -> 'AnyAngle':
### *method* `degree(self) -> float`
角度。
**Return**:
- 弧度
**Description**: 角度。
**Return**: 弧度
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -119,16 +111,14 @@ def degree(self) -> float:
### *method* `minimum_positive(self) -> AnyAngle`
最小正角。
**Return**:
- 最小正角度
**Description**: 最小正角。
**Return**: 最小正角度
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -146,16 +136,14 @@ def minimum_positive(self) -> 'AnyAngle':
### *method* `maximum_negative(self) -> AnyAngle`
最大负角。
**Return**:
- 最大负角度
**Description**: 最大负角。
**Return**: 最大负角度
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -173,16 +161,14 @@ def maximum_negative(self) -> 'AnyAngle':
### *method* `sin(self) -> float`
正弦值。
**Return**:
- 正弦值
**Description**: 正弦值。
**Return**: 正弦值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -200,16 +186,14 @@ def sin(self) -> float:
### *method* `cos(self) -> float`
余弦值。
**Return**:
- 余弦值
**Description**: 余弦值。
**Return**: 余弦值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -227,16 +211,14 @@ def cos(self) -> float:
### *method* `tan(self) -> float`
正切值。
**Return**:
- 正切值
**Description**: 正切值。
**Return**: 正切值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -254,16 +236,14 @@ def tan(self) -> float:
### *method* `cot(self) -> float`
余切值。
**Return**:
- 余切值
**Description**: 余切值。
**Return**: 余切值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -281,16 +261,14 @@ def cot(self) -> float:
### *method* `sec(self) -> float`
正割值。
**Return**:
- 正割值
**Description**: 正割值。
**Return**: 正割值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -308,16 +286,14 @@ def sec(self) -> float:
### *method* `csc(self) -> float`
余割值。
**Return**:
- 余割值
**Description**: 余割值。
**Return**: 余割值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -335,7 +311,7 @@ def csc(self) -> float:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
@ -347,7 +323,7 @@ def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other):
@ -359,7 +335,7 @@ def __eq__(self, other):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
@ -371,7 +347,7 @@ def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __mul__(self, other: float) -> 'AnyAngle':
@ -384,7 +360,7 @@ def __mul__(self, other: float) -> 'AnyAngle':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -398,7 +374,7 @@ def __truediv__(self, other: float) -> 'AnyAngle':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -411,7 +387,7 @@ def __truediv__(self, other: 'AnyAngle') -> float:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __truediv__(self, other):

View File

@ -4,28 +4,22 @@ title: mbcp.mp_math.equation
### *func* `get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc`
求N元函数一阶偏导函数。这玩意不太稳定慎用。
**Description**: 求N元函数一阶偏导函数。这玩意不太稳定慎用。
**Return**: 偏导函数
**Arguments**:
- func: 函数
- var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
- epsilon: 偏移量
**Return**:
- 偏导函数
> - func: 函数
> - var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
> - epsilon: 偏移量
**Raises**:
- ValueError 无效变量类型
> - ValueError 无效变量类型
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
@ -66,7 +60,7 @@ def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...],
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def partial_derivative_func(*args: Var) -> Var:
@ -82,7 +76,7 @@ def partial_derivative_func(*args: Var) -> Var:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def high_order_partial_derivative_func(*args: Var) -> Var:
@ -97,20 +91,17 @@ def high_order_partial_derivative_func(*args: Var) -> Var:
### *method* `__init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)`
曲线方程。
**Description**: 曲线方程。
**Arguments**:
- x_func: x函数
- y_func: y函数
- z_func: z函数
> - x_func: x函数
> - y_func: y函数
> - z_func: z函数
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
@ -130,18 +121,16 @@ def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
### *method* `__call__(self) -> Point3 | tuple[Point3, ...]`
计算曲线上的点。
**Description**: 计算曲线上的点。
**Arguments**:
- *t:
- 参数:
> - *t:
> - 参数:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:

View File

@ -5,18 +5,16 @@ title: mbcp.mp_math.line
### *method* `__init__(self, point: Point3, direction: Vector3)`
三维空间中的直线。由一个点和一个方向向量确定。
**Description**: 三维空间中的直线。由一个点和一个方向向量确定。
**Arguments**:
- point: 直线上的一点
- direction: 直线的方向向量
> - point: 直线上的一点
> - direction: 直线的方向向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, point: 'Point3', direction: 'Vector3'):
@ -34,22 +32,18 @@ def __init__(self, point: 'Point3', direction: 'Vector3'):
### *method* `approx(self, other: Line3, epsilon: float = APPROX) -> bool`
判断两条直线是否近似相等。
**Description**: 判断两条直线是否近似相等。
**Return**: 是否近似相等
**Arguments**:
- other: 另一条直线
- epsilon: 误差
**Return**:
- 是否近似相等
> - other: 另一条直线
> - epsilon: 误差
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
@ -68,24 +62,20 @@ def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
### *method* `cal_angle(self, other: Line3) -> AnyAngle`
计算直线和直线之间的夹角。
**Description**: 计算直线和直线之间的夹角。
**Return**: 夹角弧度
**Arguments**:
- other: 另一条直线
**Return**:
- 夹角弧度
> - other: 另一条直线
**Raises**:
- TypeError 不支持的类型
> - TypeError 不支持的类型
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
@ -105,24 +95,20 @@ def cal_angle(self, other: 'Line3') -> 'AnyAngle':
### *method* `cal_distance(self, other: Line3 | Point3) -> float`
计算直线和直线或点之间的距离。
**Description**: 计算直线和直线或点之间的距离。
**Return**: 距离
**Arguments**:
- other: 平行直线或点
**Return**:
- 距离
> - other: 平行直线或点
**Raises**:
- TypeError 不支持的类型
> - TypeError 不支持的类型
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_distance(self, other: 'Line3 | Point3') -> float:
@ -155,26 +141,21 @@ def cal_distance(self, other: 'Line3 | Point3') -> float:
### *method* `cal_intersection(self, other: Line3) -> Point3`
计算两条直线的交点。
**Description**: 计算两条直线的交点。
**Return**: 交点
**Arguments**:
- other: 另一条直线
**Return**:
- 交点
> - other: 另一条直线
**Raises**:
- ValueError 直线平行
- ValueError 直线不共面
> - ValueError 直线平行
> - ValueError 直线不共面
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_intersection(self, other: 'Line3') -> 'Point3':
@ -199,20 +180,17 @@ def cal_intersection(self, other: 'Line3') -> 'Point3':
### *method* `cal_perpendicular(self, point: Point3) -> Line3`
计算直线经过指定点p的垂线。
**Description**: 计算直线经过指定点p的垂线。
**Return**: 垂线
**Arguments**:
- point: 指定点
**Return**:
- 垂线
> - point: 指定点
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
@ -230,20 +208,17 @@ def cal_perpendicular(self, point: 'Point3') -> 'Line3':
### *method* `get_point(self, t: RealNumber) -> Point3`
获取直线上的点。同一条直线但起始点和方向向量不同则同一个t对应的点不同。
**Description**: 获取直线上的点。同一条直线但起始点和方向向量不同则同一个t对应的点不同。
**Return**: 点
**Arguments**:
- t: 参数t
**Return**:
-
> - t: 参数t
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def get_point(self, t: RealNumber) -> 'Point3':
@ -261,16 +236,14 @@ def get_point(self, t: RealNumber) -> 'Point3':
### *method* `get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]`
获取直线的参数方程。
**Return**:
- x(t), y(t), z(t)
**Description**: 获取直线的参数方程。
**Return**: x(t), y(t), z(t)
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
@ -286,22 +259,18 @@ def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc,
### *method* `is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool`
判断两条直线是否近似平行。
**Description**: 判断两条直线是否近似平行。
**Return**: 是否近似平行
**Arguments**:
- other: 另一条直线
- epsilon: 误差
**Return**:
- 是否近似平行
> - other: 另一条直线
> - epsilon: 误差
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
@ -320,20 +289,17 @@ def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
### *method* `is_parallel(self, other: Line3) -> bool`
判断两条直线是否平行。
**Description**: 判断两条直线是否平行。
**Return**: 是否平行
**Arguments**:
- other: 另一条直线
**Return**:
- 是否平行
> - other: 另一条直线
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_parallel(self, other: 'Line3') -> bool:
@ -351,20 +317,17 @@ def is_parallel(self, other: 'Line3') -> bool:
### *method* `is_collinear(self, other: Line3) -> bool`
判断两条直线是否共线。
**Description**: 判断两条直线是否共线。
**Return**: 是否共线
**Arguments**:
- other: 另一条直线
**Return**:
- 是否共线
> - other: 另一条直线
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_collinear(self, other: 'Line3') -> bool:
@ -382,20 +345,17 @@ def is_collinear(self, other: 'Line3') -> bool:
### *method* `is_point_on(self, point: Point3) -> bool`
判断点是否在直线上。
**Description**: 判断点是否在直线上。
**Return**: 是否在直线上
**Arguments**:
- point: 点
**Return**:
- 是否在直线上
> - point: 点
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_point_on(self, point: 'Point3') -> bool:
@ -413,21 +373,18 @@ def is_point_on(self, point: 'Point3') -> bool:
### *method* `is_coplanar(self, other: Line3) -> bool`
判断两条直线是否共面。
**Description**: 判断两条直线是否共面。
充要条件两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
**Return**: 是否共面
**Arguments**:
- other: 另一条直线
**Return**:
- 是否共面
> - other: 另一条直线
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_coplanar(self, other: 'Line3') -> bool:
@ -446,15 +403,15 @@ def is_coplanar(self, other: 'Line3') -> bool:
### *method* `simplify(self)`
简化直线方程,等价相等。
**Description**: 简化直线方程,等价相等。
自体简化,不返回值。
按照可行性一次对x y z 化 0 处理,并对向量单位化
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def simplify(self):
@ -478,22 +435,18 @@ def simplify(self):
### *method* `from_two_points(cls, p1: Point3, p2: Point3) -> Line3`
工厂函数 由两点构造直线。
**Description**: 工厂函数 由两点构造直线。
**Return**: 直线
**Arguments**:
- p1: 点1
- p2: 点2
**Return**:
- 直线
> - p1: 点1
> - p2: 点2
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@classmethod
@ -514,20 +467,17 @@ def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
### *method* `__and__(self, other: Line3) -> Line3 | Point3 | None`
计算两条直线点集合的交集。重合线返回自身平行线返回None交线返回交点。
**Description**: 计算两条直线点集合的交集。重合线返回自身平行线返回None交线返回交点。
**Return**: 交点
**Arguments**:
- other: 另一条直线
**Return**:
- 交点
> - other: 另一条直线
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
@ -550,18 +500,17 @@ def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
### *method* `__eq__(self, other) -> bool`
判断两条直线是否等价。
**Description**: 判断两条直线是否等价。
v1 // v2 ∧ (p1 - p2) // v1
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other) -> bool:

View File

@ -5,22 +5,18 @@ title: mbcp.mp_math.plane
### *method* `__init__(self, a: float, b: float, c: float, d: float)`
平面方程ax + by + cz + d = 0
**Description**: 平面方程ax + by + cz + d = 0
**Arguments**:
- a: x系数
- b: y系数
- c: z系数
- d: 常数项
> - a: x系数
> - b: y系数
> - c: z系数
> - d: 常数项
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, a: float, b: float, c: float, d: float):
@ -42,20 +38,17 @@ def __init__(self, a: float, b: float, c: float, d: float):
### *method* `approx(self, other: Plane3) -> bool`
判断两个平面是否近似相等。
**Description**: 判断两个平面是否近似相等。
**Return**: 是否近似相等
**Arguments**:
- other: 另一个平面
**Return**:
- 是否近似相等
> - other: 另一个平面
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def approx(self, other: 'Plane3') -> bool:
@ -83,24 +76,20 @@ def approx(self, other: 'Plane3') -> bool:
### *method* `cal_angle(self, other: Line3 | Plane3) -> AnyAngle`
计算平面与平面之间的夹角。
**Description**: 计算平面与平面之间的夹角。
**Return**: 夹角弧度
**Arguments**:
- other: 另一个平面
**Return**:
- 夹角弧度
> - other: 另一个平面
**Raises**:
- TypeError 不支持的类型
> - TypeError 不支持的类型
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
@ -125,24 +114,20 @@ def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
### *method* `cal_distance(self, other: Plane3 | Point3) -> float`
计算平面与平面或点之间的距离。
**Description**: 计算平面与平面或点之间的距离。
**Return**: 距离
**Arguments**:
- other: 另一个平面或点
**Return**:
- 距离
> - other: 另一个平面或点
**Raises**:
- TypeError 不支持的类型
> - TypeError 不支持的类型
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
@ -167,20 +152,17 @@ def cal_distance(self, other: 'Plane3 | Point3') -> float:
### *method* `cal_intersection_line3(self, other: Plane3) -> Line3`
计算两平面的交线。
**Description**: 计算两平面的交线。
**Return**: 两平面的交线
**Arguments**:
- other: 另一个平面
**Return**:
- 两平面的交线
> - other: 另一个平面
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
@ -215,24 +197,20 @@ def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
### *method* `cal_intersection_point3(self, other: Line3) -> Point3`
计算平面与直线的交点。
**Description**: 计算平面与直线的交点。
**Return**: 交点
**Arguments**:
- other: 不与平面平行或在平面上的直线
**Return**:
- 交点
> - other: 不与平面平行或在平面上的直线
**Raises**:
- ValueError 平面与直线平行或重合
> - ValueError 平面与直线平行或重合
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
@ -256,20 +234,17 @@ def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
### *method* `cal_parallel_plane3(self, point: Point3) -> Plane3`
计算平行于该平面且过指定点的平面。
**Description**: 计算平行于该平面且过指定点的平面。
**Return**: 所求平面
**Arguments**:
- point: 指定点
**Return**:
- 所求平面
> - point: 指定点
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
@ -287,20 +262,17 @@ def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
### *method* `is_parallel(self, other: Plane3) -> bool`
判断两个平面是否平行。
**Description**: 判断两个平面是否平行。
**Return**: 是否平行
**Arguments**:
- other: 另一个平面
**Return**:
- 是否平行
> - other: 另一个平面
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_parallel(self, other: 'Plane3') -> bool:
@ -319,16 +291,14 @@ def is_parallel(self, other: 'Plane3') -> bool:
### *method* `normal(self) -> Vector3`
平面的法向量。
**Return**:
- 法向量
**Description**: 平面的法向量。
**Return**: 法向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -346,22 +316,18 @@ def normal(self) -> 'Vector3':
### *method* `from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3`
工厂函数 由点和法向量构造平面(点法式构造)。
**Description**: 工厂函数 由点和法向量构造平面(点法式构造)。
**Return**: 平面
**Arguments**:
- point: 平面上的一点
- normal: 法向量
**Return**:
- 平面
> - point: 平面上的一点
> - normal: 法向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@classmethod
@ -384,24 +350,19 @@ def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
### *method* `from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3`
工厂函数 由三点构造平面。
**Description**: 工厂函数 由三点构造平面。
**Return**: 平面
**Arguments**:
- p1: 点1
- p2: 点2
- p3: 点3
**Return**:
- 平面
> - p1: 点1
> - p2: 点2
> - p3: 点3
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@classmethod
@ -426,22 +387,18 @@ def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'
### *method* `from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3`
工厂函数 由两直线构造平面。
**Description**: 工厂函数 由两直线构造平面。
**Return**: 平面
**Arguments**:
- l1: 直线1
- l2: 直线2
**Return**:
- 平面
> - l1: 直线1
> - l2: 直线2
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@classmethod
@ -466,22 +423,18 @@ def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
### *method* `from_point_and_line(cls, point: Point3, line: Line3) -> Plane3`
工厂函数 由点和直线构造平面。
**Description**: 工厂函数 由点和直线构造平面。
**Return**: 平面
**Arguments**:
- point: 面上
- line: 面上直线,不包含点
**Return**:
- 平面
> - point: 面上一点
> - line: 面上直线,不包含
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@classmethod
@ -503,7 +456,7 @@ def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -517,7 +470,7 @@ def __and__(self, other: 'Line3') -> 'Point3 | None':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -529,20 +482,17 @@ def __and__(self, other: 'Plane3') -> 'Line3 | None':
### *method* `__and__(self, other)`
取两平面的交集(人话:交线)
**Description**: 取两平面的交集(人话:交线)
**Return**: 不平行平面的交线平面平行返回None
**Arguments**:
- other:
**Return**:
- 不平行平面的交线平面平行返回None
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __and__(self, other):
@ -570,7 +520,7 @@ def __and__(self, other):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other) -> bool:
@ -582,7 +532,7 @@ def __eq__(self, other) -> bool:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __rand__(self, other: 'Line3') -> 'Point3':

View File

@ -5,20 +5,17 @@ title: mbcp.mp_math.point
### *method* `__init__(self, x: float, y: float, z: float)`
笛卡尔坐标系中的点。
**Description**: 笛卡尔坐标系中的点。
**Arguments**:
- x: x 坐标
- y: y 坐标
- z: z 坐标
> - x: x 坐标
> - y: y 坐标
> - z: z 坐标
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, x: float, y: float, z: float):
@ -38,22 +35,18 @@ def __init__(self, x: float, y: float, z: float):
### *method* `approx(self, other: Point3, epsilon: float = APPROX) -> bool`
判断两个点是否近似相等。
**Description**: 判断两个点是否近似相等。
**Return**: 是否近似相等
**Arguments**:
- other:
- epsilon:
**Return**:
- 是否近似相等
> - other:
> - epsilon:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
@ -75,7 +68,7 @@ def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -89,7 +82,7 @@ def __add__(self, other: 'Vector3') -> 'Point3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -101,17 +94,16 @@ def __add__(self, other: 'Point3') -> 'Point3':
### *method* `self + other`
P + V -> P
**Description**: P + V -> P
P + P -> P
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __add__(self, other):
@ -129,16 +121,15 @@ def __add__(self, other):
### *method* `__eq__(self, other)`
判断两个点是否相等。
**Description**: 判断两个点是否相等。
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other):
@ -155,18 +146,17 @@ def __eq__(self, other):
### *method* `self - other: Point3 => Vector3`
P - P -> V
**Description**: P - P -> V
P - V -> P 已在 :class:`Vector3` 中实现
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __sub__(self, other: 'Point3') -> 'Vector3':

View File

@ -5,14 +5,14 @@ title: mbcp.mp_math.segment
### *method* `__init__(self, p1: Point3, p2: Point3)`
三维空间中的线段。
**Description**: 三维空间中的线段。
:param p1:
:param p2:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, p1: 'Point3', p2: 'Point3'):

View File

@ -4,24 +4,19 @@ title: mbcp.mp_math.utils
### *func* `clamp() -> float`
区间限定函数
**Description**: 区间限定函数
**Return**: 限制后的值
**Arguments**:
- x: 待限定的
- min_: 最小值
- max_: 最大值
**Return**:
- 限制后的值
> - x: 待限定的值
> - min_: 最小
> - max_: 最大值
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def clamp(x: float, min_: float, max_: float) -> float:
@ -42,24 +37,19 @@ def clamp(x: float, min_: float, max_: float) -> float:
### *func* `approx(x: float = 0.0, y: float = APPROX) -> bool`
判断两个数是否近似相等。或包装一个实数用于判断是否近似于0。
**Description**: 判断两个数是否近似相等。或包装一个实数用于判断是否近似于0。
**Return**: 是否近似相等
**Arguments**:
- x: 数1
- y: 数2
- epsilon: 误差
**Return**:
- 是否近似相等
> - x: 数1
> - y: 数2
> - epsilon: 误差
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
@ -79,22 +69,18 @@ def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
### *func* `sign(x: float = False) -> str`
获取数的符号。
**Description**: 获取数的符号。
**Return**: 符号 + - ""
**Arguments**:
- x: 数
- only_neg: 是否只返回负数的符号
**Return**:
- 符号 + - ""
> - x: 数
> - only_neg: 是否只返回负数的符号
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def sign(x: float, only_neg: bool=False) -> str:
@ -117,25 +103,21 @@ def sign(x: float, only_neg: bool=False) -> str:
### *func* `sign_format(x: float = False) -> str`
格式化符号数
**Description**: 格式化符号数
-1 -> -1
1 -> +1
0 -> ""
**Return**: 符号 + - ""
**Arguments**:
- x: 数
- only_neg: 是否只返回负数的符号
**Return**:
- 符号 + - ""
> - x: 数
> - only_neg: 是否只返回负数的符号
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def sign_format(x: float, only_neg: bool=False) -> str:
@ -163,7 +145,7 @@ def sign_format(x: float, only_neg: bool=False) -> str:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, value: RealNumber):
@ -175,7 +157,7 @@ def __init__(self, value: RealNumber):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other):
@ -196,7 +178,7 @@ def __eq__(self, other):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def raise_type_error(self, other):
@ -208,7 +190,7 @@ def raise_type_error(self, other):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __ne__(self, other):

View File

@ -5,20 +5,17 @@ title: mbcp.mp_math.vector
### *method* `__init__(self, x: float, y: float, z: float)`
3维向量
**Description**: 3维向量
**Arguments**:
- x: x轴分量
- y: y轴分量
- z: z轴分量
> - x: x轴分量
> - y: y轴分量
> - z: z轴分量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __init__(self, x: float, y: float, z: float):
@ -38,22 +35,18 @@ def __init__(self, x: float, y: float, z: float):
### *method* `approx(self, other: Vector3, epsilon: float = APPROX) -> bool`
判断两个向量是否近似相等。
**Description**: 判断两个向量是否近似相等。
**Return**: 是否近似相等
**Arguments**:
- other:
- epsilon:
**Return**:
- 是否近似相等
> - other:
> - epsilon:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
@ -73,20 +66,17 @@ def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
### *method* `cal_angle(self, other: Vector3) -> AnyAngle`
计算两个向量之间的夹角。
**Description**: 计算两个向量之间的夹角。
**Return**: 夹角
**Arguments**:
- other: 另一个向量
**Return**:
- 夹角
> - other: 另一个向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
@ -104,24 +94,21 @@ def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
### *method* `cross(self, other: Vector3) -> Vector3`
向量积 叉乘v1 cross v2 -> v3
**Description**: 向量积 叉乘v1 cross v2 -> v3
叉乘为0则两向量平行。
其余结果的模为平行四边形的面积。
**Return**: 行列式的结果
**Arguments**:
- other:
**Return**:
- 行列式的结果
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def cross(self, other: 'Vector3') -> 'Vector3':
@ -151,22 +138,18 @@ def cross(self, other: 'Vector3') -> 'Vector3':
### *method* `is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool`
判断两个向量是否近似平行。
**Description**: 判断两个向量是否近似平行。
**Return**: 是否近似平行
**Arguments**:
- other: 另一个向量
- epsilon: 允许的误差
**Return**:
- 是否近似平行
> - other: 另一个向量
> - epsilon: 允许的误差
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
@ -185,20 +168,17 @@ def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
### *method* `is_parallel(self, other: Vector3) -> bool`
判断两个向量是否平行。
**Description**: 判断两个向量是否平行。
**Return**: 是否平行
**Arguments**:
- other: 另一个向量
**Return**:
- 是否平行
> - other: 另一个向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def is_parallel(self, other: 'Vector3') -> bool:
@ -216,14 +196,14 @@ def is_parallel(self, other: 'Vector3') -> bool:
### *method* `normalize(self)`
将向量归一化。
**Description**: 将向量归一化。
自体归一化,不返回值。
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def normalize(self):
@ -245,10 +225,8 @@ def normalize(self):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -265,16 +243,14 @@ def np_array(self) -> 'np.ndarray':
### *method* `length(self) -> float`
向量的模。
**Return**:
-
**Description**: 向量的模。
**Return**: 模
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -292,16 +268,14 @@ def length(self) -> float:
### *method* `unit(self) -> Vector3`
获取该向量的单位向量。
**Return**:
- 单位向量
**Description**: 获取该向量的单位向量。
**Return**: 单位向量
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@property
@ -319,7 +293,7 @@ def unit(self) -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __abs__(self):
@ -332,7 +306,7 @@ def __abs__(self):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -346,7 +320,7 @@ def __add__(self, other: 'Vector3') -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -358,18 +332,17 @@ def __add__(self, other: 'Point3') -> 'Point3':
### *method* `self + other`
V + P -> P
**Description**: V + P -> P
V + V -> V
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __add__(self, other):
@ -394,20 +367,17 @@ def __add__(self, other):
### *method* `__eq__(self, other)`
判断两个向量是否相等。
**Description**: 判断两个向量是否相等。
**Return**: 是否相等
**Arguments**:
- other:
**Return**:
- 是否相等
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __eq__(self, other):
@ -425,16 +395,16 @@ def __eq__(self, other):
### *method* `self + other: Point3 => Point3`
P + V -> P
**Description**: P + V -> P
别去点那边实现了。
:param other:
:return:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __radd__(self, other: 'Point3') -> 'Point3':
@ -454,7 +424,7 @@ def __radd__(self, other: 'Point3') -> 'Point3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -468,7 +438,7 @@ def __sub__(self, other: 'Vector3') -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -480,18 +450,17 @@ def __sub__(self, other: 'Point3') -> 'Point3':
### *method* `self - other`
V - P -> P
**Description**: V - P -> P
V - V -> V
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __sub__(self, other):
@ -515,16 +484,15 @@ def __sub__(self, other):
### *method* `self - other: Point3`
P - V -> P
**Description**: P - V -> P
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __rsub__(self, other: 'Point3'):
@ -547,7 +515,7 @@ def __rsub__(self, other: 'Point3'):
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -561,7 +529,7 @@ def __mul__(self, other: 'Vector3') -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@overload
@ -573,16 +541,15 @@ def __mul__(self, other: RealNumber) -> 'Vector3':
### *method* `self * other: int | float | Vector3 => Vector3`
数组运算 非点乘。点乘使用@叉乘使用cross。
**Description**: 数组运算 非点乘。点乘使用@叉乘使用cross。
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
@ -606,7 +573,7 @@ def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
@ -617,16 +584,15 @@ def __rmul__(self, other: 'RealNumber') -> 'Vector3':
### *method* `self @ other: Vector3 => RealNumber`
点乘。
**Description**: 点乘。
**Arguments**:
- other:
> - other:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
@ -644,7 +610,7 @@ def __matmul__(self, other: 'Vector3') -> 'RealNumber':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __truediv__(self, other: RealNumber) -> 'Vector3':
@ -656,7 +622,7 @@ def __truediv__(self, other: RealNumber) -> 'Vector3':
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
def __neg__(self):

View File

@ -6,22 +6,18 @@ title: mbcp.presets.model
### *method* `sphere(radius: float, density: float)`
生成球体上的点集。
**Description**: 生成球体上的点集。
**Return**: List[Point3]: 球体上的点集。
**Arguments**:
- radius:
- density:
**Return**:
- List[Point3]: 球体上的点集。
> - radius:
> - density:
<details>
<summary> <i>Source code</i> </summary>
<summary> <b>Source code</b> </summary>
```python
@staticmethod