mirror of
https://github.com/snowykami/mbcp.git
synced 2026-04-25 20:05:37 +00:00
📝 litedoc新增类继承显示,新增变量自动获取注释,新增类方法和函数的区分,新增魔术方法的特殊展示模式
This commit is contained in:
@@ -22,10 +22,10 @@ class Plane3:
|
||||
"""
|
||||
平面方程:ax + by + cz + d = 0
|
||||
Args:
|
||||
a:
|
||||
b:
|
||||
c:
|
||||
d:
|
||||
a: x系数
|
||||
b: y系数
|
||||
c: z系数
|
||||
d: 常数项
|
||||
"""
|
||||
self.a = a
|
||||
self.b = b
|
||||
@@ -36,13 +36,10 @@ class Plane3:
|
||||
"""
|
||||
判断两个平面是否近似相等。
|
||||
Args:
|
||||
other:
|
||||
|
||||
other: 另一个平面
|
||||
Returns:
|
||||
是否近似相等
|
||||
"""
|
||||
|
||||
a = 3 # 测试变量
|
||||
if self.a != 0:
|
||||
k = other.a / self.a
|
||||
return approx(other.b, self.b * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
|
||||
@@ -91,11 +88,11 @@ class Plane3:
|
||||
|
||||
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
|
||||
"""
|
||||
计算两平面的交线。该方法有问题,待修复。
|
||||
计算两平面的交线。
|
||||
Args:
|
||||
other: 另一个平面
|
||||
Returns:
|
||||
交线
|
||||
两平面的交线
|
||||
Raises:
|
||||
"""
|
||||
if self.normal.is_parallel(other.normal):
|
||||
@@ -105,6 +102,7 @@ class Plane3:
|
||||
x, y, z = 0, 0, 0
|
||||
# 依次判断条件假设x=0, y=0, z=0,找到合适的点
|
||||
# 先假设其中一个系数不为0,则令此坐标为0,构建增广矩阵,解出另外两个坐标
|
||||
|
||||
if self.a != 0 and other.a != 0:
|
||||
A = np.array([[self.b, self.c], [other.b, other.c]])
|
||||
B = np.array([-self.d, -other.d])
|
||||
@@ -146,7 +144,7 @@ class Plane3:
|
||||
Args:
|
||||
point: 指定点
|
||||
Returns:
|
||||
平面
|
||||
所求平面
|
||||
"""
|
||||
return Plane3.from_point_and_normal(point, self.normal)
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ if TYPE_CHECKING:
|
||||
|
||||
def clamp(x: float, min_: float, max_: float) -> float:
|
||||
"""
|
||||
区间截断函数。
|
||||
区间限定函数
|
||||
Args:
|
||||
x:
|
||||
min_:
|
||||
max_:
|
||||
x: 待限定的值
|
||||
min_: 最小值
|
||||
max_: 最大值
|
||||
|
||||
Returns:
|
||||
限制后的值
|
||||
@@ -40,7 +40,6 @@ class Approx:
|
||||
|
||||
已实现对象 实数 Vector3 Point3 Plane3 Line3
|
||||
"""
|
||||
|
||||
def __init__(self, value: RealNumber):
|
||||
self.value = value
|
||||
|
||||
@@ -67,10 +66,9 @@ def approx(x: float, y: float = 0.0, epsilon: float = APPROX) -> bool:
|
||||
"""
|
||||
判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
|
||||
Args:
|
||||
x:
|
||||
y:
|
||||
epsilon:
|
||||
|
||||
x: 数1
|
||||
y: 数2
|
||||
epsilon: 误差
|
||||
Returns:
|
||||
是否近似相等
|
||||
"""
|
||||
|
||||
@@ -263,11 +263,11 @@ class Vector3:
|
||||
return f"Vector3({self.x}, {self.y}, {self.z})"
|
||||
|
||||
|
||||
zero_vector3 = Vector3(0, 0, 0)
|
||||
zero_vector3: Vector3 = Vector3(0, 0, 0)
|
||||
"""零向量"""
|
||||
x_axis = Vector3(1, 0, 0)
|
||||
x_axis: Vector3 = Vector3(1, 0, 0)
|
||||
"""x轴单位向量"""
|
||||
y_axis = Vector3(0, 1, 0)
|
||||
y_axis: Vector3 = Vector3(0, 1, 0)
|
||||
"""y轴单位向量"""
|
||||
z_axis = Vector3(0, 0, 1)
|
||||
z_axis: Vector3 = Vector3(0, 0, 1)
|
||||
"""z轴单位向量"""
|
||||
|
||||
Reference in New Issue
Block a user