📝 构建文档测试

This commit is contained in:
2024-08-29 15:05:02 +08:00
parent 86b8a4c922
commit 5763a84679
46 changed files with 312 additions and 2081 deletions

View File

@ -7,13 +7,13 @@ title: mbcp.mp_math.equation
**Description**: 求N元函数一阶偏导函数。这玩意不太稳定慎用。
**Return**: 偏导函数
**Arguments**:
> - func: 函数
> - var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
> - epsilon: 偏移量
**Return**: 偏导函数
**Raises**:
> - ValueError 无效变量类型

View File

@ -35,12 +35,12 @@ def __init__(self, point: 'Point3', direction: 'Vector3'):
**Description**: 判断两条直线是否近似相等。
**Return**: 是否近似相等
**Arguments**:
> - other: 另一条直线
> - epsilon: 误差
**Return**: 是否近似相等
<details>
<summary> <b>Source code</b> </summary>
@ -65,11 +65,11 @@ def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
**Description**: 计算直线和直线之间的夹角。
**Return**: 夹角弧度
**Arguments**:
> - other: 另一条直线
**Return**: 夹角弧度
**Raises**:
> - TypeError 不支持的类型
@ -98,11 +98,11 @@ def cal_angle(self, other: 'Line3') -> 'AnyAngle':
**Description**: 计算直线和直线或点之间的距离。
**Return**: 距离
**Arguments**:
> - other: 平行直线或点
**Return**: 距离
**Raises**:
> - TypeError 不支持的类型
@ -144,11 +144,11 @@ def cal_distance(self, other: 'Line3 | Point3') -> float:
**Description**: 计算两条直线的交点。
**Return**: 交点
**Arguments**:
> - other: 另一条直线
**Return**: 交点
**Raises**:
> - ValueError 直线平行
> - ValueError 直线不共面
@ -183,11 +183,11 @@ def cal_intersection(self, other: 'Line3') -> 'Point3':
**Description**: 计算直线经过指定点p的垂线。
**Return**: 垂线
**Arguments**:
> - point: 指定点
**Return**: 垂线
<details>
<summary> <b>Source code</b> </summary>
@ -211,11 +211,11 @@ def cal_perpendicular(self, point: 'Point3') -> 'Line3':
**Description**: 获取直线上的点。同一条直线但起始点和方向向量不同则同一个t对应的点不同。
**Return**: 点
**Arguments**:
> - t: 参数t
**Return**: 点
<details>
<summary> <b>Source code</b> </summary>
@ -262,12 +262,12 @@ def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc,
**Description**: 判断两条直线是否近似平行。
**Return**: 是否近似平行
**Arguments**:
> - other: 另一条直线
> - epsilon: 误差
**Return**: 是否近似平行
<details>
<summary> <b>Source code</b> </summary>
@ -292,11 +292,11 @@ def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
**Description**: 判断两条直线是否平行。
**Return**: 是否平行
**Arguments**:
> - other: 另一条直线
**Return**: 是否平行
<details>
<summary> <b>Source code</b> </summary>
@ -320,11 +320,11 @@ def is_parallel(self, other: 'Line3') -> bool:
**Description**: 判断两条直线是否共线。
**Return**: 是否共线
**Arguments**:
> - other: 另一条直线
**Return**: 是否共线
<details>
<summary> <b>Source code</b> </summary>
@ -348,11 +348,11 @@ def is_collinear(self, other: 'Line3') -> bool:
**Description**: 判断点是否在直线上。
**Return**: 是否在直线上
**Arguments**:
> - point: 点
**Return**: 是否在直线上
<details>
<summary> <b>Source code</b> </summary>
@ -377,11 +377,11 @@ def is_point_on(self, point: 'Point3') -> bool:
**Description**: 判断两条直线是否共面。
充要条件两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
**Return**: 是否共面
**Arguments**:
> - other: 另一条直线
**Return**: 是否共面
<details>
<summary> <b>Source code</b> </summary>
@ -438,12 +438,12 @@ def simplify(self):
**Description**: 工厂函数 由两点构造直线。
**Return**: 直线
**Arguments**:
> - p1: 点1
> - p2: 点2
**Return**: 直线
<details>
<summary> <b>Source code</b> </summary>
@ -470,11 +470,11 @@ def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
**Description**: 计算两条直线点集合的交集。重合线返回自身平行线返回None交线返回交点。
**Return**: 交点
**Arguments**:
> - other: 另一条直线
**Return**: 交点
<details>
<summary> <b>Source code</b> </summary>

View File

@ -41,11 +41,11 @@ def __init__(self, a: float, b: float, c: float, d: float):
**Description**: 判断两个平面是否近似相等。
**Return**: 是否近似相等
**Arguments**:
> - other: 另一个平面
**Return**: 是否近似相等
<details>
<summary> <b>Source code</b> </summary>
@ -79,11 +79,11 @@ def approx(self, other: 'Plane3') -> bool:
**Description**: 计算平面与平面之间的夹角。
**Return**: 夹角弧度
**Arguments**:
> - other: 另一个平面
**Return**: 夹角弧度
**Raises**:
> - TypeError 不支持的类型
@ -117,11 +117,11 @@ def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
**Description**: 计算平面与平面或点之间的距离。
**Return**: 距离
**Arguments**:
> - other: 另一个平面或点
**Return**: 距离
**Raises**:
> - TypeError 不支持的类型
@ -155,11 +155,11 @@ def cal_distance(self, other: 'Plane3 | Point3') -> float:
**Description**: 计算两平面的交线。
**Return**: 两平面的交线
**Arguments**:
> - other: 另一个平面
**Return**: 两平面的交线
<details>
<summary> <b>Source code</b> </summary>
@ -200,11 +200,11 @@ def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
**Description**: 计算平面与直线的交点。
**Return**: 交点
**Arguments**:
> - other: 不与平面平行或在平面上的直线
**Return**: 交点
**Raises**:
> - ValueError 平面与直线平行或重合
@ -237,11 +237,11 @@ def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
**Description**: 计算平行于该平面且过指定点的平面。
**Return**: 所求平面
**Arguments**:
> - point: 指定点
**Return**: 所求平面
<details>
<summary> <b>Source code</b> </summary>
@ -265,11 +265,11 @@ def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
**Description**: 判断两个平面是否平行。
**Return**: 是否平行
**Arguments**:
> - other: 另一个平面
**Return**: 是否平行
<details>
<summary> <b>Source code</b> </summary>
@ -319,12 +319,12 @@ def normal(self) -> 'Vector3':
**Description**: 工厂函数 由点和法向量构造平面(点法式构造)。
**Return**: 平面
**Arguments**:
> - point: 平面上的一点
> - normal: 法向量
**Return**: 平面
<details>
<summary> <b>Source code</b> </summary>
@ -353,13 +353,13 @@ def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
**Description**: 工厂函数 由三点构造平面。
**Return**: 平面
**Arguments**:
> - p1: 点1
> - p2: 点2
> - p3: 点3
**Return**: 平面
<details>
<summary> <b>Source code</b> </summary>
@ -390,12 +390,12 @@ def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'
**Description**: 工厂函数 由两直线构造平面。
**Return**: 平面
**Arguments**:
> - l1: 直线1
> - l2: 直线2
**Return**: 平面
<details>
<summary> <b>Source code</b> </summary>
@ -426,12 +426,12 @@ def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
**Description**: 工厂函数 由点和直线构造平面。
**Return**: 平面
**Arguments**:
> - point: 面上一点
> - line: 面上直线,不包含点
**Return**: 平面
<details>
<summary> <b>Source code</b> </summary>
@ -485,11 +485,11 @@ def __and__(self, other: 'Plane3') -> 'Line3 | None':
**Description**: 取两平面的交集(人话:交线)
**Return**: 不平行平面的交线平面平行返回None
**Arguments**:
> - other:
**Return**: 不平行平面的交线平面平行返回None
<details>
<summary> <b>Source code</b> </summary>

View File

@ -38,12 +38,12 @@ def __init__(self, x: float, y: float, z: float):
**Description**: 判断两个点是否近似相等。
**Return**: 是否近似相等
**Arguments**:
> - other:
> - epsilon:
**Return**: 是否近似相等
<details>
<summary> <b>Source code</b> </summary>

View File

@ -7,13 +7,13 @@ title: mbcp.mp_math.utils
**Description**: 区间限定函数
**Return**: 限制后的值
**Arguments**:
> - x: 待限定的值
> - min_: 最小值
> - max_: 最大值
**Return**: 限制后的值
<details>
<summary> <b>Source code</b> </summary>
@ -40,13 +40,13 @@ def clamp(x: float, min_: float, max_: float) -> float:
**Description**: 判断两个数是否近似相等。或包装一个实数用于判断是否近似于0。
**Return**: 是否近似相等
**Arguments**:
> - x: 数1
> - y: 数2
> - epsilon: 误差
**Return**: 是否近似相等
<details>
<summary> <b>Source code</b> </summary>
@ -72,12 +72,12 @@ def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
**Description**: 获取数的符号。
**Return**: 符号 + - ""
**Arguments**:
> - x: 数
> - only_neg: 是否只返回负数的符号
**Return**: 符号 + - ""
<details>
<summary> <b>Source code</b> </summary>
@ -109,12 +109,12 @@ def sign(x: float, only_neg: bool=False) -> str:
1 -> +1
0 -> ""
**Return**: 符号 + - ""
**Arguments**:
> - x: 数
> - only_neg: 是否只返回负数的符号
**Return**: 符号 + - ""
<details>
<summary> <b>Source code</b> </summary>

View File

@ -38,12 +38,12 @@ def __init__(self, x: float, y: float, z: float):
**Description**: 判断两个向量是否近似相等。
**Return**: 是否近似相等
**Arguments**:
> - other:
> - epsilon:
**Return**: 是否近似相等
<details>
<summary> <b>Source code</b> </summary>
@ -69,11 +69,11 @@ def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
**Description**: 计算两个向量之间的夹角。
**Return**: 夹角
**Arguments**:
> - other: 另一个向量
**Return**: 夹角
<details>
<summary> <b>Source code</b> </summary>
@ -101,11 +101,11 @@ def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
其余结果的模为平行四边形的面积。
**Return**: 行列式的结果
**Arguments**:
> - other:
**Return**: 行列式的结果
<details>
<summary> <b>Source code</b> </summary>
@ -141,12 +141,12 @@ def cross(self, other: 'Vector3') -> 'Vector3':
**Description**: 判断两个向量是否近似平行。
**Return**: 是否近似平行
**Arguments**:
> - other: 另一个向量
> - epsilon: 允许的误差
**Return**: 是否近似平行
<details>
<summary> <b>Source code</b> </summary>
@ -171,11 +171,11 @@ def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
**Description**: 判断两个向量是否平行。
**Return**: 是否平行
**Arguments**:
> - other: 另一个向量
**Return**: 是否平行
<details>
<summary> <b>Source code</b> </summary>
@ -370,11 +370,11 @@ def __add__(self, other):
**Description**: 判断两个向量是否相等。
**Return**: 是否相等
**Arguments**:
> - other:
**Return**: 是否相等
<details>
<summary> <b>Source code</b> </summary>

View File

@ -9,12 +9,12 @@ title: mbcp.presets.model
**Description**: 生成球体上的点集。
**Return**: List[Point3]: 球体上的点集。
**Arguments**:
> - radius:
> - density:
**Return**: List[Point3]: 球体上的点集。
<details>
<summary> <b>Source code</b> </summary>