diff --git a/404.html b/404.html index e446e0f..75d3694 100644 --- a/404.html +++ b/404.html @@ -15,7 +15,7 @@
- + \ No newline at end of file diff --git a/api-ex.html b/api-ex.html index d95a1f4..f00c318 100644 --- a/api-ex.html +++ b/api-ex.html @@ -322,98 +322,6 @@ ] } ], - "/zh-Hant/": [ - { - "text": "zh-hant", - "items": [ - { - "text": "api", - "items": [ - { - "text": "mbcp", - "link": "/zh-Hant/api/index.md" - }, - { - "text": "mp_math", - "items": [ - { - "text": "mbcp.mp_math", - "link": "/zh-Hant/api/mp_math/index.md" - }, - { - "text": "mbcp.mp_math.angle", - "link": "/zh-Hant/api/mp_math/angle.md" - }, - { - "text": "mbcp.mp_math.const", - "link": "/zh-Hant/api/mp_math/const.md" - }, - { - "text": "mbcp.mp_math.equation", - "link": "/zh-Hant/api/mp_math/equation.md" - }, - { - "text": "mbcp.mp_math.line", - "link": "/zh-Hant/api/mp_math/line.md" - }, - { - "text": "mbcp.mp_math.mp_math_typing", - "link": "/zh-Hant/api/mp_math/mp_math_typing.md" - }, - { - "text": "mbcp.mp_math.plane", - "link": "/zh-Hant/api/mp_math/plane.md" - }, - { - "text": "mbcp.mp_math.point", - "link": "/zh-Hant/api/mp_math/point.md" - }, - { - "text": "mbcp.mp_math.segment", - "link": "/zh-Hant/api/mp_math/segment.md" - }, - { - "text": "mbcp.mp_math.utils", - "link": "/zh-Hant/api/mp_math/utils.md" - }, - { - "text": "mbcp.mp_math.vector", - "link": "/zh-Hant/api/mp_math/vector.md" - } - ] - }, - { - "text": "particle", - "items": [ - { - "text": "mbcp.particle", - "link": "/zh-Hant/api/particle/index.md" - } - ] - }, - { - "text": "presets", - "items": [ - { - "text": "mbcp.presets", - "link": "/zh-Hant/api/presets/index.md" - }, - { - "text": "model", - "items": [ - { - "text": "mbcp.presets.model", - "link": "/zh-Hant/api/presets/model/index.md" - } - ] - } - ] - } - ] - } - ] - } - ], "/zht/": [ { "text": "zht", @@ -545,7 +453,7 @@ }

Page Frontmatter

{
   "outline": "deep"
 }

More

Check out the documentation for the full list of runtime APIs.

- + \ No newline at end of file diff --git a/api/index.html b/api/index.html index e69f6a8..dd17963 100644 --- a/api/index.html +++ b/api/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/api/mp_math/angle.html b/api/mp_math/angle.html index 9e9723e..fe94573 100644 --- a/api/mp_math/angle.html +++ b/api/mp_math/angle.html @@ -116,7 +116,7 @@ if isinstance(other, AnyAngle): return self.radian / other.radian return AnyAngle(self.radian / other, is_radian=True) - + \ No newline at end of file diff --git a/api/mp_math/const.html b/api/mp_math/const.html index f7225a4..4fbadff 100644 --- a/api/mp_math/const.html +++ b/api/mp_math/const.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/api/mp_math/equation.html b/api/mp_math/equation.html index 86a2497..29958f4 100644 --- a/api/mp_math/equation.html +++ b/api/mp_math/equation.html @@ -79,7 +79,7 @@ return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0])) else: return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))]) - + \ No newline at end of file diff --git a/api/mp_math/index.html b/api/mp_math/index.html index fa93033..baf8c1f 100644 --- a/api/mp_math/index.html +++ b/api/mp_math/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/api/mp_math/line.html b/api/mp_math/line.html index 6e98271..b66340b 100644 --- a/api/mp_math/line.html +++ b/api/mp_math/line.html @@ -195,7 +195,7 @@ """ return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction) - + \ No newline at end of file diff --git a/api/mp_math/mp_math_typing.html b/api/mp_math/mp_math_typing.html index 38d2bb3..d5d11df 100644 --- a/api/mp_math/mp_math_typing.html +++ b/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • 类型: TypeAlias

var Number = RealNumber | complex

  • 类型: TypeAlias

var Var = SingleVar | ArrayVar

  • 类型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 类型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 类型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 类型: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • 类型: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • 类型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 类型: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • 类型: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • 类型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 类型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 类型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 类型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 类型: TypeAlias
- + \ No newline at end of file diff --git a/api/mp_math/plane.html b/api/mp_math/plane.html index 3dd7a1b..2fb2532 100644 --- a/api/mp_math/plane.html +++ b/api/mp_math/plane.html @@ -213,7 +213,7 @@ raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源代码
python
def __eq__(self, other) -> bool:
     return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/api/mp_math/point.html b/api/mp_math/point.html index 30b9dd2..19587e4 100644 --- a/api/mp_math/point.html +++ b/api/mp_math/point.html @@ -68,7 +68,7 @@ """ from .vector import Vector3 return Vector3(self.x - other.x, self.y - other.y, self.z - other.z) - + \ No newline at end of file diff --git a/api/mp_math/segment.html b/api/mp_math/segment.html index 4c12661..e0fb7e5 100644 --- a/api/mp_math/segment.html +++ b/api/mp_math/segment.html @@ -31,7 +31,7 @@ self.length = self.direction.length '中心点' self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2) - + \ No newline at end of file diff --git a/api/mp_math/utils.html b/api/mp_math/utils.html index 05d3487..dec213f 100644 --- a/api/mp_math/utils.html +++ b/api/mp_math/utils.html @@ -81,7 +81,7 @@ self.raise_type_error(other)

method raise_type_error(self, other)

源代码
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源代码
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/api/mp_math/vector.html b/api/mp_math/vector.html index 9ed91d4..2651a32 100644 --- a/api/mp_math/vector.html +++ b/api/mp_math/vector.html @@ -204,7 +204,7 @@ return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源代码
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
     return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源代码
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/api/particle/index.html b/api/particle/index.html index 0a5529a..350594a 100644 --- a/api/particle/index.html +++ b/api/particle/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/api/presets/index.html b/api/presets/index.html index dbe740e..5d403d4 100644 --- a/api/presets/index.html +++ b/api/presets/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/api/presets/model/index.html b/api/presets/model/index.html index 040f0d0..fbbc2de 100644 --- a/api/presets/model/index.html +++ b/api/presets/model/index.html @@ -35,7 +35,7 @@ y_array = radius * np.sin(phi_list) * np.sin(theta_list) z_array = radius * np.cos(phi_list) return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)] - + \ No newline at end of file diff --git a/assets/zh-Hant_api_index.md.D-iBkJb-.js b/assets/zh-Hant_api_index.md.D-iBkJb-.js deleted file mode 100644 index 3bbc9de..0000000 --- a/assets/zh-Hant_api_index.md.D-iBkJb-.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp","description":"","frontmatter":{"title":"mbcp"},"headers":[],"relativePath":"zh-Hant/api/index.md","filePath":"zh-Hant/api/index.md"}'),n={name:"zh-Hant/api/index.md"};function i(r,c,o,p,s,d){return a(),t("div")}const f=e(n,[["render",i]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js b/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js deleted file mode 100644 index 3bbc9de..0000000 --- a/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp","description":"","frontmatter":{"title":"mbcp"},"headers":[],"relativePath":"zh-Hant/api/index.md","filePath":"zh-Hant/api/index.md"}'),n={name:"zh-Hant/api/index.md"};function i(r,c,o,p,s,d){return a(),t("div")}const f=e(n,[["render",i]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js deleted file mode 100644 index 49a636b..0000000 --- a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js +++ /dev/null @@ -1,101 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"zh-Hant/api/mp_math/angle.md","filePath":"zh-Hant/api/mp_math/angle.md"}'),e={name:"zh-Hant/api/mp_math/angle.md"},l=n(`

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

參數:

源碼
python
def __init__(self, value: float, is_radian: bool=False):
-    """
-        任意角度。
-        Args:
-            value: 角度或弧度值
-            is_radian: 是否为弧度,默认为否
-        """
-    if is_radian:
-        self.radian = value
-    else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

源碼
python
@property
-def complementary(self) -> 'AnyAngle':
-    """
-        余角:两角的和为90°。
-        Returns:
-            余角
-        """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

源碼
python
@property
-def supplementary(self) -> 'AnyAngle':
-    """
-        补角:两角的和为180°。
-        Returns:
-            补角
-        """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

返回:

源碼
python
@property
-def degree(self) -> float:
-    """
-        角度。
-        Returns:
-            弧度
-        """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

源碼
python
@property
-def minimum_positive(self) -> 'AnyAngle':
-    """
-        最小正角。
-        Returns:
-            最小正角度
-        """
-    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

源碼
python
@property
-def maximum_negative(self) -> 'AnyAngle':
-    """
-        最大负角。
-        Returns:
-            最大负角度
-        """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

返回:

源碼
python
@property
-def sin(self) -> float:
-    """
-        正弦值。
-        Returns:
-            正弦值
-        """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

返回:

源碼
python
@property
-def cos(self) -> float:
-    """
-        余弦值。
-        Returns:
-            余弦值
-        """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

返回:

源碼
python
@property
-def tan(self) -> float:
-    """
-        正切值。
-        Returns:
-            正切值
-        """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

返回:

源碼
python
@property
-def cot(self) -> float:
-    """
-        余切值。
-        Returns:
-            余切值
-        """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

返回:

源碼
python
@property
-def sec(self) -> float:
-    """
-        正割值。
-        Returns:
-            正割值
-        """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

返回:

源碼
python
@property
-def csc(self) -> float:
-    """
-        余割值。
-        Returns:
-            余割值
-        """
-    return 1 / math.sin(self.radian)

def __add__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

def __eq__(self, other)

源碼
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

def __sub__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

def __mul__(self, other: float) -> 'AnyAngle'

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

源碼
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

def __truediv__(self, other: float) -> 'AnyAngle'

源碼
python
@overload
-def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

源碼
python
@overload
-def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

def __truediv__(self, other)

源碼
python
def __truediv__(self, other):
-    if isinstance(other, AnyAngle):
-        return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js deleted file mode 100644 index c5406a3..0000000 --- a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"zh-Hant/api/mp_math/angle.md","filePath":"zh-Hant/api/mp_math/angle.md"}'),e={name:"zh-Hant/api/mp_math/angle.md"},l=n("",93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js deleted file mode 100644 index d637d48..0000000 --- a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as a,c as e,o as t,a2 as r}from"./chunks/framework.BV61Qrc0.js";const v=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zh-Hant/api/mp_math/const.md","filePath":"zh-Hant/api/mp_math/const.md"}'),o={name:"zh-Hant/api/mp_math/const.md"},n=r('

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

',6),s=[n];function h(m,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",h]]);export{v as __pageData,P as default}; diff --git a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js deleted file mode 100644 index 71a259b..0000000 --- a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as a,c as e,o as t,a2 as r}from"./chunks/framework.BV61Qrc0.js";const v=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zh-Hant/api/mp_math/const.md","filePath":"zh-Hant/api/mp_math/const.md"}'),o={name:"zh-Hant/api/mp_math/const.md"},n=r("",6),s=[n];function h(m,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",h]]);export{v as __pageData,P as default}; diff --git a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js deleted file mode 100644 index 660a9c3..0000000 --- a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js +++ /dev/null @@ -1,63 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zh-Hant/api/mp_math/equation.md","filePath":"zh-Hant/api/mp_math/equation.md"}'),l={name:"zh-Hant/api/mp_math/equation.md"},t=n(`

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

參數:

返回:

引發:

源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
-    """
-    求N元函数一阶偏导函数。这玩意不太稳定,慎用。
-    Args:
-        func: 函数
-        var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
-        epsilon: 偏移量
-    Returns:
-        偏导函数
-    Raises:
-        ValueError: 无效变量类型
-    """
-    if isinstance(var, int):
-
-        def partial_derivative_func(*args: Var) -> Var:
-            args_list_plus = list(args)
-            args_list_plus[var] += epsilon
-            args_list_minus = list(args)
-            args_list_minus[var] -= epsilon
-            return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)
-        return partial_derivative_func
-    elif isinstance(var, tuple):
-
-        def high_order_partial_derivative_func(*args: Var) -> Var:
-            result_func = func
-            for v in var:
-                result_func = get_partial_derivative_func(result_func, v, epsilon)
-            return result_func(*args)
-        return high_order_partial_derivative_func
-    else:
-        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

源碼
python
def partial_derivative_func(*args: Var) -> Var:
-    args_list_plus = list(args)
-    args_list_plus[var] += epsilon
-    args_list_minus = list(args)
-    args_list_minus[var] -= epsilon
-    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

源碼
python
def high_order_partial_derivative_func(*args: Var) -> Var:
-    result_func = func
-    for v in var:
-        result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

參數:

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
-    """
-        曲线方程。
-        Args:
-            x_func: x函数
-            y_func: y函数
-            z_func: z函数
-        """
-    self.x_func = x_func
-    self.y_func = y_func
-    self.z_func = z_func

def __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

參數:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
-    """
-        计算曲线上的点。
-        Args:
-            *t:
-                参数
-        Returns:
-
-        """
-    if len(t) == 1:
-        return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
-    else:
-        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

源碼
python
def __str__(self):
-    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js deleted file mode 100644 index 06e1674..0000000 --- a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zh-Hant/api/mp_math/equation.md","filePath":"zh-Hant/api/mp_math/equation.md"}'),l={name:"zh-Hant/api/mp_math/equation.md"},t=n("",27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js deleted file mode 100644 index 901aa65..0000000 --- a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zh-Hant/api/mp_math/index.md","filePath":"zh-Hant/api/mp_math/index.md"}'),n={name:"zh-Hant/api/mp_math/index.md"};function m(p,i,r,c,o,s){return e(),a("div")}const h=t(n,[["render",m]]);export{d as __pageData,h as default}; diff --git a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js deleted file mode 100644 index 901aa65..0000000 --- a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zh-Hant/api/mp_math/index.md","filePath":"zh-Hant/api/mp_math/index.md"}'),n={name:"zh-Hant/api/mp_math/index.md"};function m(p,i,r,c,o,s){return e(),a("div")}const h=t(n,[["render",m]]);export{d as __pageData,h as default}; diff --git a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js deleted file mode 100644 index a9339c5..0000000 --- a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js +++ /dev/null @@ -1,192 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zh-Hant/api/mp_math/line.md","filePath":"zh-Hant/api/mp_math/line.md"}'),l={name:"zh-Hant/api/mp_math/line.md"},t=n(`

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

參數:

源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
-    """
-        三维空间中的直线。由一个点和一个方向向量确定。
-        Args:
-            point: 直线上的一点
-            direction: 直线的方向向量
-        """
-    self.point = point
-    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
-    """
-        判断两条直线是否近似相等。
-        Args:
-            other: 另一条直线
-            epsilon: 误差
-        Returns:
-            是否近似相等
-        """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

參數:

返回:

引發:

源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
-    """
-        计算直线和直线之间的夹角。
-        Args:
-            other: 另一条直线
-        Returns:
-            夹角弧度
-        Raises:
-            TypeError: 不支持的类型
-        """
-    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

參數:

返回:

引發:

源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
-    """
-        计算直线和直线或点之间的距离。
-        Args:
-            other: 平行直线或点
-
-        Returns:
-            距离
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Line3):
-        if self == other:
-            return 0
-        elif self.is_parallel(other):
-            return (other.point - self.point).cross(self.direction).length / self.direction.length
-        elif not self.is_coplanar(other):
-            return abs(self.direction.cross(other.direction) @ (self.point - other.point) / self.direction.cross(other.direction).length)
-        else:
-            return 0
-    elif isinstance(other, Point3):
-        return (other - self.point).cross(self.direction).length / self.direction.length
-    else:
-        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

參數:

返回:

引發:

源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
-    """
-        计算两条直线的交点。
-        Args:
-            other: 另一条直线
-        Returns:
-            交点
-        Raises:
-            ValueError: 直线平行
-            ValueError: 直线不共面
-        """
-    if self.is_parallel(other):
-        raise ValueError('Lines are parallel and do not intersect.')
-    if not self.is_coplanar(other):
-        raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

參數:

返回:

源碼
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
-    """
-        计算直线经过指定点p的垂线。
-        Args:
-            point: 指定点
-        Returns:
-            垂线
-        """
-    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

參數:

返回:

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
-    """
-        获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
-        Args:
-            t: 参数t
-        Returns:
-
-        """
-    return self.point + t * self.direction

def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
-    """
-        获取直线的参数方程。
-        Returns:
-            x(t), y(t), z(t)
-        """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

參數:

返回:

源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
-    """
-        判断两条直线是否近似平行。
-        Args:
-            other: 另一条直线
-            epsilon: 误差
-        Returns:
-            是否近似平行
-        """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否平行。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否平行
-        """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

參數:

返回:

源碼
python
def is_collinear(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否共线。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否共线
-        """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

參數:

返回:

源碼
python
def is_point_on(self, point: 'Point3') -> bool:
-    """
-        判断点是否在直线上。
-        Args:
-            point: 点
-        Returns:
-            是否在直线上
-        """
-    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

參數:

返回:

源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否共面。
-        充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否共面
-        """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
-    """
-        简化直线方程,等价相等。
-        自体简化,不返回值。
-
-        按照可行性一次对x y z 化 0 处理,并对向量单位化
-        """
-    self.direction.normalize()
-    if self.direction.x == 0:
-        self.point.x = 0
-    if self.direction.y == 0:
-        self.point.y = 0
-    if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

參數:

返回:

源碼
python
@classmethod
-def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
-    """
-        工厂函数 由两点构造直线。
-        Args:
-            p1: 点1
-            p2: 点2
-        Returns:
-            直线
-        """
-    direction = p2 - p1
-    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

參數:

返回:

源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
-    """
-        计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
-        Args:
-            other: 另一条直线
-        Returns:
-            交点
-        """
-    if self.is_collinear(other):
-        return self
-    elif self.is_parallel(other) or not self.is_coplanar(other):
-        return None
-    else:
-        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

參數:

源碼
python
def __eq__(self, other) -> bool:
-    """
-        判断两条直线是否等价。
-
-        v1 // v2 ∧ (p1 - p2) // v1
-        Args:
-            other:
-
-        Returns:
-
-        """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

源碼
python
def __str__(self):
-    """
-        返回点向式(x-x0)
-        Returns:
-
-        """
-    s = 'Line3: '
-    if self.direction.x != 0:
-        s += f'(x{sign_format(-self.point.x)})/{self.direction.x}'
-    if self.direction.y != 0:
-        s += f' = (y{sign_format(-self.point.y)})/{self.direction.y}'
-    if self.direction.z != 0:
-        s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
-    return s

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js deleted file mode 100644 index cbe4865..0000000 --- a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zh-Hant/api/mp_math/line.md","filePath":"zh-Hant/api/mp_math/line.md"}'),l={name:"zh-Hant/api/mp_math/line.md"},t=n("",123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js deleted file mode 100644 index 304c219..0000000 --- a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"zh-Hant/api/mp_math/mp_math_typing.md","filePath":"zh-Hant/api/mp_math/mp_math_typing.md"}'),n={name:"zh-Hant/api/mp_math/mp_math_typing.md"},i=l('

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

',17),s=[i];function t(o,c,u,y,v,g){return e(),r("div",null,s)}const d=a(n,[["render",t]]);export{m as __pageData,d as default}; diff --git a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js deleted file mode 100644 index 14e4d8e..0000000 --- a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"zh-Hant/api/mp_math/mp_math_typing.md","filePath":"zh-Hant/api/mp_math/mp_math_typing.md"}'),n={name:"zh-Hant/api/mp_math/mp_math_typing.md"},i=l("",17),s=[i];function t(o,c,u,y,v,g){return e(),r("div",null,s)}const d=a(n,[["render",t]]);export{m as __pageData,d as default}; diff --git a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js deleted file mode 100644 index eed11ae..0000000 --- a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js +++ /dev/null @@ -1,209 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"zh-Hant/api/mp_math/plane.md","filePath":"zh-Hant/api/mp_math/plane.md"}'),l={name:"zh-Hant/api/mp_math/plane.md"},h=n(`

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

參數:

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
-    """
-        平面方程:ax + by + cz + d = 0
-        Args:
-            a:
-            b:
-            c:
-            d:
-        """
-    self.a = a
-    self.b = b
-    self.c = c
-    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Plane3') -> bool:
-    """
-        判断两个平面是否近似相等。
-        Args:
-            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)
-    elif self.b != 0:
-        k = other.b / self.b
-        return approx(other.a, self.a * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
-    elif self.c != 0:
-        k = other.c / self.c
-        return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
-    else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

參數:

返回:

引發:

源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
-    """
-        计算平面与平面之间的夹角。
-        Args:
-            other: 另一个平面
-        Returns:
-            夹角弧度
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Line3):
-        return self.normal.cal_angle(other.direction).complementary
-    elif isinstance(other, Plane3):
-        return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
-    else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

參數:

返回:

引發:

源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
-    """
-        计算平面与平面或点之间的距离。
-        Args:
-            other: 另一个平面或点
-        Returns:
-            距离
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Plane3):
-        return 0
-    elif isinstance(other, Point3):
-        return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
-    else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

參數:

返回:

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
-    """
-        计算两平面的交线。该方法有问题,待修复。
-        Args:
-            other: 另一个平面
-        Returns:
-            交线
-        Raises:
-        """
-    if self.normal.is_parallel(other.normal):
-        raise ValueError('Planes are parallel and have no intersection.')
-    direction = self.normal.cross(other.normal)
-    x, y, 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])
-        y, z = np.linalg.solve(A, B)
-    elif self.b != 0 and other.b != 0:
-        A = np.array([[self.a, self.c], [other.a, other.c]])
-        B = np.array([-self.d, -other.d])
-        x, z = np.linalg.solve(A, B)
-    elif self.c != 0 and other.c != 0:
-        A = np.array([[self.a, self.b], [other.a, other.b]])
-        B = np.array([-self.d, -other.d])
-        x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

參數:

返回:

引發:

源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
-    """
-        计算平面与直线的交点。
-        Args:
-            other: 不与平面平行或在平面上的直线
-        Returns:
-            交点
-        Raises:
-            ValueError: 平面与直线平行或重合
-        """
-    if self.normal @ other.direction == 0:
-        raise ValueError('The plane and the line are parallel or coincident.')
-    x, y, z = other.get_parametric_equations()
-    t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
-    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

參數:

返回:

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
-    """
-        计算平行于该平面且过指定点的平面。
-        Args:
-            point: 指定点
-        Returns:
-            平面
-        """
-    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
-    """
-        判断两个平面是否平行。
-        Args:
-            other: 另一个平面
-        Returns:
-            是否平行
-        """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

源碼
python
@property
-def normal(self) -> 'Vector3':
-    """
-        平面的法向量。
-        Returns:
-            法向量
-        """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

參數:

返回:

源碼
python
@classmethod
-def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
-    """
-        工厂函数 由点和法向量构造平面(点法式构造)。
-        Args:
-            point: 平面上的一点
-            normal: 法向量
-        Returns:
-            平面
-        """
-    a, b, c = (normal.x, normal.y, normal.z)
-    d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

參數:

返回:

源碼
python
@classmethod
-def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
-    """
-        工厂函数 由三点构造平面。
-        Args:
-            p1: 点1
-            p2: 点2
-            p3: 点3
-        Returns:
-            平面
-        """
-    v1 = p2 - p1
-    v2 = p3 - p1
-    normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

參數:

返回:

源碼
python
@classmethod
-def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
-    """
-        工厂函数 由两直线构造平面。
-        Args:
-            l1: 直线1
-            l2: 直线2
-        Returns:
-            平面
-        """
-    v1 = l1.direction
-    v2 = l2.point - l1.point
-    if v2 == zero_vector3:
-        v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

參數:

返回:

源碼
python
@classmethod
-def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
-    """
-        工厂函数 由点和直线构造平面。
-        Args:
-            point: 面上一点
-            line: 面上直线,不包含点
-        Returns:
-            平面
-        """
-    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

源碼
python
def __str__(self):
-    s = 'Plane3: '
-    if self.a != 0:
-        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
-    if self.b != 0:
-        s += f' {sign(self.b)} {abs(self.b)}y'
-    if self.c != 0:
-        s += f' {sign(self.c)} {abs(self.c)}z'
-    if self.d != 0:
-        s += f' {sign(self.d)} {abs(self.d)}'
-    return s + ' = 0'

@overload

def __and__(self, other: 'Line3') -> 'Point3 | None'

源碼
python
@overload
-def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

源碼
python
@overload
-def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

參數:

返回:

源碼
python
def __and__(self, other):
-    """
-        取两平面的交集(人话:交线)
-        Args:
-            other:
-        Returns:
-            不平行平面的交线,平面平行返回None
-        """
-    if isinstance(other, Plane3):
-        if self.normal.is_parallel(other.normal):
-            return None
-        return self.cal_intersection_line3(other)
-    elif isinstance(other, Line3):
-        if self.normal @ other.direction == 0:
-            return None
-        return self.cal_intersection_point3(other)
-    else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

`,130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js deleted file mode 100644 index b368dc9..0000000 --- a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"zh-Hant/api/mp_math/plane.md","filePath":"zh-Hant/api/mp_math/plane.md"}'),l={name:"zh-Hant/api/mp_math/plane.md"},h=n("",130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js deleted file mode 100644 index 30f76dc..0000000 --- a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js +++ /dev/null @@ -1,52 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zh-Hant/api/mp_math/point.md","filePath":"zh-Hant/api/mp_math/point.md"}'),t={name:"zh-Hant/api/mp_math/point.md"},l=n(`

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

參數:

源碼
python
def __init__(self, x: float, y: float, z: float):
-    """
-        笛卡尔坐标系中的点。
-        Args:
-            x: x 坐标
-            y: y 坐标
-            z: z 坐标
-        """
-    self.x = x
-    self.y = y
-    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个点是否近似相等。
-        Args:
-            other:
-            epsilon:
-
-        Returns:
-            是否近似相等
-        """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

源碼
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

def __add__(self, other: 'Vector3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

P + V -> P P + P -> P

參數:

源碼
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)

def __eq__(self, other)

判断两个点是否相等。

參數:

源碼
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)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

參數:

源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
-    """
-        P - P -> V
-
-        P - V -> P  已在 :class:\`Vector3\` 中实现
-        Args:
-            other:
-        Returns:
-
-        """
-    from .vector import Vector3
-    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js deleted file mode 100644 index ba83f1e..0000000 --- a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zh-Hant/api/mp_math/point.md","filePath":"zh-Hant/api/mp_math/point.md"}'),t={name:"zh-Hant/api/mp_math/point.md"},l=n("",37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js deleted file mode 100644 index 0a31d63..0000000 --- a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js +++ /dev/null @@ -1,16 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"zh-Hant/api/mp_math/segment.md","filePath":"zh-Hant/api/mp_math/segment.md"}'),t={name:"zh-Hant/api/mp_math/segment.md"},h=n(`

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
-    """
-        三维空间中的线段。
-        :param p1:
-        :param p2:
-        """
-    self.p1 = p1
-    self.p2 = p2
-    '方向向量'
-    self.direction = self.p2 - self.p1
-    '长度'
-    self.length = self.direction.length
-    '中心点'
-    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

源碼
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
`,8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js deleted file mode 100644 index 1ab28dc..0000000 --- a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"zh-Hant/api/mp_math/segment.md","filePath":"zh-Hant/api/mp_math/segment.md"}'),t={name:"zh-Hant/api/mp_math/segment.md"},h=n("",8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js deleted file mode 100644 index 5b88f5d..0000000 --- a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js +++ /dev/null @@ -1,65 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zh-Hant/api/mp_math/utils.md","filePath":"zh-Hant/api/mp_math/utils.md"}'),l={name:"zh-Hant/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

參數:

返回:

源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
-    """
-    区间截断函数。
-    Args:
-        x:
-        min_:
-        max_:
-
-    Returns:
-        限制后的值
-    """
-    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

參數:

返回:

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
-    """
-    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
-    Args:
-        x:
-        y:
-        epsilon:
-
-    Returns:
-        是否近似相等
-    """
-    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

參數:

返回:

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
-    """获取数的符号。
-    Args:
-        x: 数
-        only_neg: 是否只返回负数的符号
-    Returns:
-        符号 + - ""
-    """
-    if x > 0:
-        return '+' if not only_neg else ''
-    elif x < 0:
-        return '-'
-    else:
-        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

參數:

返回:

源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
-    """格式化符号数
-    -1 -> -1
-    1 -> +1
-    0 -> ""
-    Args:
-        x: 数
-        only_neg: 是否只返回负数的符号
-    Returns:
-        符号 + - ""
-    """
-    if x > 0:
-        return f'+{x}' if not only_neg else f'{x}'
-    elif x < 0:
-        return f'-{abs(x)}'
-    else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
-    self.value = value

def __eq__(self, other)

源碼
python
def __eq__(self, other):
-    if isinstance(self.value, (float, int)):
-        if isinstance(other, (float, int)):
-            return abs(self.value - other) < APPROX
-        else:
-            self.raise_type_error(other)
-    elif isinstance(self.value, Vector3):
-        if isinstance(other, (Vector3, Point3, Plane3, Line3)):
-            return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
-        else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

源碼
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js deleted file mode 100644 index 0d11677..0000000 --- a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zh-Hant/api/mp_math/utils.md","filePath":"zh-Hant/api/mp_math/utils.md"}'),l={name:"zh-Hant/api/mp_math/utils.md"},h=n("",37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js deleted file mode 100644 index df99f43..0000000 --- a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js +++ /dev/null @@ -1,189 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zh-Hant/api/mp_math/vector.md","filePath":"zh-Hant/api/mp_math/vector.md"}'),l={name:"zh-Hant/api/mp_math/vector.md"},t=n(`

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

參數:

源碼
python
def __init__(self, x: float, y: float, z: float):
-    """
-        3维向量
-        Args:
-            x: x轴分量
-            y: y轴分量
-            z: z轴分量
-        """
-    self.x = x
-    self.y = y
-    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个向量是否近似相等。
-        Args:
-            other:
-            epsilon:
-
-        Returns:
-            是否近似相等
-        """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

參數:

返回:

源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
-    """
-        计算两个向量之间的夹角。
-        Args:
-            other: 另一个向量
-        Returns:
-            夹角
-        """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

參數:

返回:

源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
-    """
-        向量积 叉乘:v1 cross v2 -> v3
-
-        叉乘为0,则两向量平行。
-        其余结果的模为平行四边形的面积。
-
-        返回如下行列式的结果:
-
-        \`\`i  j  k\`\`
-
-        \`\`x1 y1 z1\`\`
-
-        \`\`x2 y2 z2\`\`
-
-        Args:
-            other:
-        Returns:
-            行列式的结果
-        """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

參數:

返回:

源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个向量是否近似平行。
-        Args:
-            other: 另一个向量
-            epsilon: 允许的误差
-        Returns:
-            是否近似平行
-        """
-    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
-    """
-        判断两个向量是否平行。
-        Args:
-            other: 另一个向量
-        Returns:
-            是否平行
-        """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
-    """
-        将向量归一化。
-
-        自体归一化,不返回值。
-        """
-    length = self.length
-    self.x /= length
-    self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

源碼
python
@property
-def np_array(self) -> 'np.ndarray':
-    """
-        返回numpy数组
-        Returns:
-        """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

返回:

源碼
python
@property
-def length(self) -> float:
-    """
-        向量的模。
-        Returns:
-
-        """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

源碼
python
@property
-def unit(self) -> 'Vector3':
-    """
-        获取该向量的单位向量。
-        Returns:
-            单位向量
-        """
-    return self / self.length

def __abs__(self)

源碼
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

V + P -> P

V + V -> V

參數:

源碼
python
def __add__(self, other):
-    """
-        V + P -> P
-
-        V + V -> V
-        Args:
-            other:
-        Returns:
-
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x + other.x, self.y + other.y, self.z + other.z)
-    elif isinstance(other, Point3):
-        return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
-    else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

參數:

返回:

源碼
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)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

源碼
python
def __radd__(self, other: 'Point3') -> 'Point3':
-    """
-        P + V -> P
-
-        别去点那边实现了。
-        :param other:
-        :return:
-        """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

def __sub__(self, other)

V - P -> P

V - V -> V

參數:

源碼
python
def __sub__(self, other):
-    """
-        V - P -> P
-
-        V - V -> V
-        Args:
-            other:
-        Returns:
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
-    elif isinstance(other, Point3):
-        return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
-    else:
-        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

參數:

源碼
python
def __rsub__(self, other: 'Point3'):
-    """
-        P - V -> P
-        Args:
-            other:
-        Returns:
-
-        """
-    if isinstance(other, Point3):
-        return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
-    else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

源碼
python
@overload
-def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

參數:

源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
-    """
-        数组运算 非点乘。点乘使用@,叉乘使用cross。
-        Args:
-            other:
-
-        Returns:
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x * other.x, self.y * other.y, self.z * other.z)
-    elif isinstance(other, (float, int)):
-        return Vector3(self.x * other, self.y * other, self.z * other)
-    else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

參數:

源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
-    """
-        点乘。
-        Args:
-            other:
-        Returns:
-        """
-    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

源碼
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

源碼
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js deleted file mode 100644 index f16f6cd..0000000 --- a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zh-Hant/api/mp_math/vector.md","filePath":"zh-Hant/api/mp_math/vector.md"}'),l={name:"zh-Hant/api/mp_math/vector.md"},t=n("",133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zh-Hant_api_particle_index.md.BlduIPtw.js b/assets/zh-Hant_api_particle_index.md.BlduIPtw.js deleted file mode 100644 index de07182..0000000 --- a/assets/zh-Hant_api_particle_index.md.BlduIPtw.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.particle","description":"","frontmatter":{"title":"mbcp.particle"},"headers":[],"relativePath":"zh-Hant/api/particle/index.md","filePath":"zh-Hant/api/particle/index.md"}'),i={name:"zh-Hant/api/particle/index.md"};function r(c,n,p,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js b/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js deleted file mode 100644 index de07182..0000000 --- a/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.particle","description":"","frontmatter":{"title":"mbcp.particle"},"headers":[],"relativePath":"zh-Hant/api/particle/index.md","filePath":"zh-Hant/api/particle/index.md"}'),i={name:"zh-Hant/api/particle/index.md"};function r(c,n,p,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zh-Hant_api_presets_index.md.CDyg87e9.js b/assets/zh-Hant_api_presets_index.md.CDyg87e9.js deleted file mode 100644 index 364ad88..0000000 --- a/assets/zh-Hant_api_presets_index.md.CDyg87e9.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zh-Hant/api/presets/index.md","filePath":"zh-Hant/api/presets/index.md"}'),s={name:"zh-Hant/api/presets/index.md"};function r(n,p,i,c,o,d){return a(),t("div")}const f=e(s,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js b/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js deleted file mode 100644 index 364ad88..0000000 --- a/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zh-Hant/api/presets/index.md","filePath":"zh-Hant/api/presets/index.md"}'),s={name:"zh-Hant/api/presets/index.md"};function r(n,p,i,c,o,d){return a(),t("div")}const f=e(s,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js deleted file mode 100644 index 1e6ab6f..0000000 --- a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js +++ /dev/null @@ -1,18 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"zh-Hant/api/presets/model/index.md","filePath":"zh-Hant/api/presets/model/index.md"}'),h={name:"zh-Hant/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

參數:

返回:

源碼
python
@staticmethod
-def sphere(radius: float, density: float):
-    """
-        生成球体上的点集。
-        Args:
-            radius:
-            density:
-        Returns:
-            List[Point3]: 球体上的点集。
-        """
-    area = 4 * np.pi * radius ** 2
-    num = int(area * density)
-    phi_list = np.arccos([clamp(-1 + (2.0 * _ - 1.0) / num, -1, 1) for _ in range(num)])
-    theta_list = np.sqrt(num * np.pi) * phi_list
-    x_array = radius * np.sin(phi_list) * np.cos(theta_list)
-    y_array = radius * np.sin(phi_list) * np.sin(theta_list)
-    z_array = radius * np.cos(phi_list)
-    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js deleted file mode 100644 index 420e83b..0000000 --- a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"zh-Hant/api/presets/model/index.md","filePath":"zh-Hant/api/presets/model/index.md"}'),h={name:"zh-Hant/api/presets/model/index.md"},t=n("",9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/en/api/index.html b/en/api/index.html index c583374..8708722 100644 --- a/en/api/index.html +++ b/en/api/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/en/api/mp_math/angle.html b/en/api/mp_math/angle.html index 4ad434c..3497e5b 100644 --- a/en/api/mp_math/angle.html +++ b/en/api/mp_math/angle.html @@ -116,7 +116,7 @@ if isinstance(other, AnyAngle): return self.radian / other.radian return AnyAngle(self.radian / other, is_radian=True) - + \ No newline at end of file diff --git a/en/api/mp_math/const.html b/en/api/mp_math/const.html index dbc696f..012984c 100644 --- a/en/api/mp_math/const.html +++ b/en/api/mp_math/const.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/en/api/mp_math/equation.html b/en/api/mp_math/equation.html index 38e7d48..d269818 100644 --- a/en/api/mp_math/equation.html +++ b/en/api/mp_math/equation.html @@ -79,7 +79,7 @@ return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0])) else: return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))]) - + \ No newline at end of file diff --git a/en/api/mp_math/index.html b/en/api/mp_math/index.html index db03beb..2d16cd8 100644 --- a/en/api/mp_math/index.html +++ b/en/api/mp_math/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/en/api/mp_math/line.html b/en/api/mp_math/line.html index 62d85bf..d2f26c2 100644 --- a/en/api/mp_math/line.html +++ b/en/api/mp_math/line.html @@ -195,7 +195,7 @@ """ return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction) - + \ No newline at end of file diff --git a/en/api/mp_math/mp_math_typing.html b/en/api/mp_math/mp_math_typing.html index f6458b2..d73ac50 100644 --- a/en/api/mp_math/mp_math_typing.html +++ b/en/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • Type: TypeAlias

var Number = RealNumber | complex

  • Type: TypeAlias

var Var = SingleVar | ArrayVar

  • Type: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • Type: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • Type: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • Type: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • Type: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • Type: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • Type: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • Type: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • Type: TypeAlias
- + \ No newline at end of file diff --git a/en/api/mp_math/plane.html b/en/api/mp_math/plane.html index 18ae326..57998f9 100644 --- a/en/api/mp_math/plane.html +++ b/en/api/mp_math/plane.html @@ -213,7 +213,7 @@ raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
     return self.approx(other)

method __rand__(self, other: Line3) -> Point3

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/point.html b/en/api/mp_math/point.html index 50b95d0..52b9f88 100644 --- a/en/api/mp_math/point.html +++ b/en/api/mp_math/point.html @@ -68,7 +68,7 @@ """ from .vector import Vector3 return Vector3(self.x - other.x, self.y - other.y, self.z - other.z) - + \ No newline at end of file diff --git a/en/api/mp_math/segment.html b/en/api/mp_math/segment.html index d32c8a0..e08cb77 100644 --- a/en/api/mp_math/segment.html +++ b/en/api/mp_math/segment.html @@ -31,7 +31,7 @@ self.length = self.direction.length '中心点' self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2) - + \ No newline at end of file diff --git a/en/api/mp_math/utils.html b/en/api/mp_math/utils.html index d14cd0c..9297448 100644 --- a/en/api/mp_math/utils.html +++ b/en/api/mp_math/utils.html @@ -81,7 +81,7 @@ self.raise_type_error(other)

method raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

Source code
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/vector.html b/en/api/mp_math/vector.html index 86624a1..a7c7898 100644 --- a/en/api/mp_math/vector.html +++ b/en/api/mp_math/vector.html @@ -204,7 +204,7 @@ return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
     return Vector3(self.x / other, self.y / other, self.z / other)

method - self

Source code
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/en/api/particle/index.html b/en/api/particle/index.html index 9b3d4d6..575efb8 100644 --- a/en/api/particle/index.html +++ b/en/api/particle/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/en/api/presets/index.html b/en/api/presets/index.html index d1a7990..731714a 100644 --- a/en/api/presets/index.html +++ b/en/api/presets/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/en/api/presets/model/index.html b/en/api/presets/model/index.html index 5331904..adc647c 100644 --- a/en/api/presets/model/index.html +++ b/en/api/presets/model/index.html @@ -35,7 +35,7 @@ y_array = radius * np.sin(phi_list) * np.sin(theta_list) z_array = radius * np.cos(phi_list) return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)] - + \ No newline at end of file diff --git a/guide/index.html b/guide/index.html index dda75a1..82bb893 100644 --- a/guide/index.html +++ b/guide/index.html @@ -18,7 +18,7 @@
Skip to content

开始不了一点

- + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index fce8c3d..734628a 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"B8w0LP6o","api_mp_math_const.md":"BzOZuyZq","api_mp_math_equation.md":"Ck19tFkF","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"B1jAKPr1","api_mp_math_mp_math_typing.md":"B0OaWJmF","api_mp_math_plane.md":"DLB54RNP","api_mp_math_point.md":"BwXaSbuz","api_mp_math_segment.md":"C6i78ST1","api_mp_math_utils.md":"Bkx3QJ6f","api_mp_math_vector.md":"Efti6kdT","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"DY6YMRqf","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DmK_A9xI","en_api_mp_math_const.md":"6yNmEodn","en_api_mp_math_equation.md":"DyRN0jPI","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"BBlzflWh","en_api_mp_math_mp_math_typing.md":"Ba9aYPR2","en_api_mp_math_plane.md":"cxytQLD4","en_api_mp_math_point.md":"CXQGh5Zt","en_api_mp_math_segment.md":"CxreVgqR","en_api_mp_math_utils.md":"aavLLFMy","en_api_mp_math_vector.md":"BvKJEw7_","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"DBfUZUBC","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"DxBe_g0o","ja_api_mp_math_const.md":"CflutYeA","ja_api_mp_math_equation.md":"3a6umjdP","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"CMfQT6TH","ja_api_mp_math_mp_math_typing.md":"Bhy6h0r0","ja_api_mp_math_plane.md":"Cm4a8eqF","ja_api_mp_math_point.md":"CQAIjHfb","ja_api_mp_math_segment.md":"D0U5bMSu","ja_api_mp_math_utils.md":"CXGqGLUs","ja_api_mp_math_vector.md":"C9TtayJk","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"DAVK1sDI","md-ex.md":"BX0WqOqv","zh-hant_api_index.md":"D-iBkJb-","zh-hant_api_mp_math_angle.md":"eKQSpiMX","zh-hant_api_mp_math_const.md":"B_tZ9wL7","zh-hant_api_mp_math_equation.md":"DPinrp8_","zh-hant_api_mp_math_index.md":"B8NLV8Cf","zh-hant_api_mp_math_line.md":"B-s8aLxY","zh-hant_api_mp_math_mp_math_typing.md":"DOwDUOu8","zh-hant_api_mp_math_plane.md":"B60Bzq3i","zh-hant_api_mp_math_point.md":"BEsHV_8G","zh-hant_api_mp_math_segment.md":"C-4eJk-Y","zh-hant_api_mp_math_utils.md":"z2lMMpnT","zh-hant_api_mp_math_vector.md":"n5Efae6D","zh-hant_api_particle_index.md":"BlduIPtw","zh-hant_api_presets_index.md":"CDyg87e9","zh-hant_api_presets_model_index.md":"DCHpjjZ_","zht_api_index.md":"Dq4XPUKZ","zht_api_mp_math_angle.md":"_4N19GGe","zht_api_mp_math_const.md":"CIhADrI2","zht_api_mp_math_equation.md":"2k-eEs3U","zht_api_mp_math_index.md":"D09y2ubg","zht_api_mp_math_line.md":"4ncoPmkZ","zht_api_mp_math_mp_math_typing.md":"DlxSozR9","zht_api_mp_math_plane.md":"Buk-SLcC","zht_api_mp_math_point.md":"Bb3tyGv-","zht_api_mp_math_segment.md":"U_lS4vUA","zht_api_mp_math_utils.md":"ig9jQkoA","zht_api_mp_math_vector.md":"CDyAXuJb","zht_api_particle_index.md":"kAm9VAEw","zht_api_presets_index.md":"BmouaEaT","zht_api_presets_model_index.md":"CrdAyyCM"} +{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"B8w0LP6o","api_mp_math_const.md":"BzOZuyZq","api_mp_math_equation.md":"Ck19tFkF","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"B1jAKPr1","api_mp_math_mp_math_typing.md":"B0OaWJmF","api_mp_math_plane.md":"DLB54RNP","api_mp_math_point.md":"BwXaSbuz","api_mp_math_segment.md":"C6i78ST1","api_mp_math_utils.md":"Bkx3QJ6f","api_mp_math_vector.md":"Efti6kdT","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"DY6YMRqf","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DmK_A9xI","en_api_mp_math_const.md":"6yNmEodn","en_api_mp_math_equation.md":"DyRN0jPI","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"BBlzflWh","en_api_mp_math_mp_math_typing.md":"Ba9aYPR2","en_api_mp_math_plane.md":"cxytQLD4","en_api_mp_math_point.md":"CXQGh5Zt","en_api_mp_math_segment.md":"CxreVgqR","en_api_mp_math_utils.md":"aavLLFMy","en_api_mp_math_vector.md":"BvKJEw7_","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"DBfUZUBC","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"DxBe_g0o","ja_api_mp_math_const.md":"CflutYeA","ja_api_mp_math_equation.md":"3a6umjdP","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"CMfQT6TH","ja_api_mp_math_mp_math_typing.md":"Bhy6h0r0","ja_api_mp_math_plane.md":"Cm4a8eqF","ja_api_mp_math_point.md":"CQAIjHfb","ja_api_mp_math_segment.md":"D0U5bMSu","ja_api_mp_math_utils.md":"CXGqGLUs","ja_api_mp_math_vector.md":"C9TtayJk","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"DAVK1sDI","md-ex.md":"BX0WqOqv","zht_api_index.md":"Dq4XPUKZ","zht_api_mp_math_angle.md":"_4N19GGe","zht_api_mp_math_const.md":"CIhADrI2","zht_api_mp_math_equation.md":"2k-eEs3U","zht_api_mp_math_index.md":"D09y2ubg","zht_api_mp_math_line.md":"4ncoPmkZ","zht_api_mp_math_mp_math_typing.md":"DlxSozR9","zht_api_mp_math_plane.md":"Buk-SLcC","zht_api_mp_math_point.md":"Bb3tyGv-","zht_api_mp_math_segment.md":"U_lS4vUA","zht_api_mp_math_utils.md":"ig9jQkoA","zht_api_mp_math_vector.md":"CDyAXuJb","zht_api_particle_index.md":"kAm9VAEw","zht_api_presets_index.md":"BmouaEaT","zht_api_presets_model_index.md":"CrdAyyCM"} diff --git a/index.html b/index.html index cee801d..1c3a97f 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@
Skip to content

MBCP docs

More basic change particle

用于几何运算和粒子制作的库

- + \ No newline at end of file diff --git a/ja/api/index.html b/ja/api/index.html index 3734adc..f8d0488 100644 --- a/ja/api/index.html +++ b/ja/api/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/ja/api/mp_math/angle.html b/ja/api/mp_math/angle.html index b14294f..161be19 100644 --- a/ja/api/mp_math/angle.html +++ b/ja/api/mp_math/angle.html @@ -116,7 +116,7 @@ if isinstance(other, AnyAngle): return self.radian / other.radian return AnyAngle(self.radian / other, is_radian=True) - + \ No newline at end of file diff --git a/ja/api/mp_math/const.html b/ja/api/mp_math/const.html index 19902f2..1263f2d 100644 --- a/ja/api/mp_math/const.html +++ b/ja/api/mp_math/const.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/ja/api/mp_math/equation.html b/ja/api/mp_math/equation.html index e7624d8..d4256e3 100644 --- a/ja/api/mp_math/equation.html +++ b/ja/api/mp_math/equation.html @@ -79,7 +79,7 @@ return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0])) else: return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))]) - + \ No newline at end of file diff --git a/ja/api/mp_math/index.html b/ja/api/mp_math/index.html index e62ccf2..294546c 100644 --- a/ja/api/mp_math/index.html +++ b/ja/api/mp_math/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/ja/api/mp_math/line.html b/ja/api/mp_math/line.html index c02741f..68037b9 100644 --- a/ja/api/mp_math/line.html +++ b/ja/api/mp_math/line.html @@ -195,7 +195,7 @@ """ return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction) - + \ No newline at end of file diff --git a/ja/api/mp_math/mp_math_typing.html b/ja/api/mp_math/mp_math_typing.html index 3753523..79e96e0 100644 --- a/ja/api/mp_math/mp_math_typing.html +++ b/ja/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • タイプ: TypeAlias

var Number = RealNumber | complex

  • タイプ: TypeAlias

var Var = SingleVar | ArrayVar

  • タイプ: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • タイプ: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • タイプ: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • タイプ: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • タイプ: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • タイプ: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • タイプ: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • タイプ: TypeAlias
- + \ No newline at end of file diff --git a/ja/api/mp_math/plane.html b/ja/api/mp_math/plane.html index 3a5245d..5b7d111 100644 --- a/ja/api/mp_math/plane.html +++ b/ja/api/mp_math/plane.html @@ -213,7 +213,7 @@ raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
     return self.approx(other)

method __rand__(self, other: Line3) -> Point3

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/point.html b/ja/api/mp_math/point.html index 49a527c..7c87d6e 100644 --- a/ja/api/mp_math/point.html +++ b/ja/api/mp_math/point.html @@ -68,7 +68,7 @@ """ from .vector import Vector3 return Vector3(self.x - other.x, self.y - other.y, self.z - other.z) - + \ No newline at end of file diff --git a/ja/api/mp_math/segment.html b/ja/api/mp_math/segment.html index b372bf1..f5958d6 100644 --- a/ja/api/mp_math/segment.html +++ b/ja/api/mp_math/segment.html @@ -31,7 +31,7 @@ self.length = self.direction.length '中心点' self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2) - + \ No newline at end of file diff --git a/ja/api/mp_math/utils.html b/ja/api/mp_math/utils.html index 5246b12..e9f2476 100644 --- a/ja/api/mp_math/utils.html +++ b/ja/api/mp_math/utils.html @@ -81,7 +81,7 @@ self.raise_type_error(other)

method raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/vector.html b/ja/api/mp_math/vector.html index 5817e97..bbb7584 100644 --- a/ja/api/mp_math/vector.html +++ b/ja/api/mp_math/vector.html @@ -204,7 +204,7 @@ return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
     return Vector3(self.x / other, self.y / other, self.z / other)

method - self

ソースコード
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/ja/api/particle/index.html b/ja/api/particle/index.html index 53ccaf9..416678d 100644 --- a/ja/api/particle/index.html +++ b/ja/api/particle/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/ja/api/presets/index.html b/ja/api/presets/index.html index 55641ca..1fddc75 100644 --- a/ja/api/presets/index.html +++ b/ja/api/presets/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/ja/api/presets/model/index.html b/ja/api/presets/model/index.html index 2b3a397..c0a673a 100644 --- a/ja/api/presets/model/index.html +++ b/ja/api/presets/model/index.html @@ -35,7 +35,7 @@ y_array = radius * np.sin(phi_list) * np.sin(theta_list) z_array = radius * np.cos(phi_list) return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)] - + \ No newline at end of file diff --git a/md-ex.html b/md-ex.html index dab4757..db77791 100644 --- a/md-ex.html +++ b/md-ex.html @@ -50,7 +50,7 @@ ::: details This is a details block. :::

Output

INFO

This is an info box.

TIP

This is a tip.

WARNING

This is a warning.

DANGER

This is a dangerous warning.

Details

This is a details block.

More

Check out the documentation for the full list of markdown extensions.

- + \ No newline at end of file diff --git a/zh-Hant/api/index.html b/zh-Hant/api/index.html deleted file mode 100644 index 6727c9c..0000000 --- a/zh-Hant/api/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp | MBCP docs - - - - - - - - - - - - - -
Skip to content
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/angle.html b/zh-Hant/api/mp_math/angle.html deleted file mode 100644 index 3b216e8..0000000 --- a/zh-Hant/api/mp_math/angle.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - mbcp.mp_math.angle | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

參數:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

源碼
python
def __init__(self, value: float, is_radian: bool=False):
-    """
-        任意角度。
-        Args:
-            value: 角度或弧度值
-            is_radian: 是否为弧度,默认为否
-        """
-    if is_radian:
-        self.radian = value
-    else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

  • 余角
源碼
python
@property
-def complementary(self) -> 'AnyAngle':
-    """
-        余角:两角的和为90°。
-        Returns:
-            余角
-        """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

  • 补角
源碼
python
@property
-def supplementary(self) -> 'AnyAngle':
-    """
-        补角:两角的和为180°。
-        Returns:
-            补角
-        """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

返回:

  • 弧度
源碼
python
@property
-def degree(self) -> float:
-    """
-        角度。
-        Returns:
-            弧度
-        """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

  • 最小正角度
源碼
python
@property
-def minimum_positive(self) -> 'AnyAngle':
-    """
-        最小正角。
-        Returns:
-            最小正角度
-        """
-    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

  • 最大负角度
源碼
python
@property
-def maximum_negative(self) -> 'AnyAngle':
-    """
-        最大负角。
-        Returns:
-            最大负角度
-        """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

返回:

  • 正弦值
源碼
python
@property
-def sin(self) -> float:
-    """
-        正弦值。
-        Returns:
-            正弦值
-        """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

返回:

  • 余弦值
源碼
python
@property
-def cos(self) -> float:
-    """
-        余弦值。
-        Returns:
-            余弦值
-        """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

返回:

  • 正切值
源碼
python
@property
-def tan(self) -> float:
-    """
-        正切值。
-        Returns:
-            正切值
-        """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

返回:

  • 余切值
源碼
python
@property
-def cot(self) -> float:
-    """
-        余切值。
-        Returns:
-            余切值
-        """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

返回:

  • 正割值
源碼
python
@property
-def sec(self) -> float:
-    """
-        正割值。
-        Returns:
-            正割值
-        """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

返回:

  • 余割值
源碼
python
@property
-def csc(self) -> float:
-    """
-        余割值。
-        Returns:
-            余割值
-        """
-    return 1 / math.sin(self.radian)

def __add__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

def __eq__(self, other)

源碼
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

def __sub__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

def __mul__(self, other: float) -> 'AnyAngle'

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

源碼
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

def __truediv__(self, other: float) -> 'AnyAngle'

源碼
python
@overload
-def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

源碼
python
@overload
-def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

def __truediv__(self, other)

源碼
python
def __truediv__(self, other):
-    if isinstance(other, AnyAngle):
-        return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/const.html b/zh-Hant/api/mp_math/const.html deleted file mode 100644 index a148063..0000000 --- a/zh-Hant/api/mp_math/const.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp.mp_math.const | MBCP docs - - - - - - - - - - - - - -
Skip to content

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/equation.html b/zh-Hant/api/mp_math/equation.html deleted file mode 100644 index 343b659..0000000 --- a/zh-Hant/api/mp_math/equation.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - mbcp.mp_math.equation | MBCP docs - - - - - - - - - - - - - -
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

參數:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

返回:

  • 偏导函数

引發:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
-    """
-    求N元函数一阶偏导函数。这玩意不太稳定,慎用。
-    Args:
-        func: 函数
-        var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
-        epsilon: 偏移量
-    Returns:
-        偏导函数
-    Raises:
-        ValueError: 无效变量类型
-    """
-    if isinstance(var, int):
-
-        def partial_derivative_func(*args: Var) -> Var:
-            args_list_plus = list(args)
-            args_list_plus[var] += epsilon
-            args_list_minus = list(args)
-            args_list_minus[var] -= epsilon
-            return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)
-        return partial_derivative_func
-    elif isinstance(var, tuple):
-
-        def high_order_partial_derivative_func(*args: Var) -> Var:
-            result_func = func
-            for v in var:
-                result_func = get_partial_derivative_func(result_func, v, epsilon)
-            return result_func(*args)
-        return high_order_partial_derivative_func
-    else:
-        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

源碼
python
def partial_derivative_func(*args: Var) -> Var:
-    args_list_plus = list(args)
-    args_list_plus[var] += epsilon
-    args_list_minus = list(args)
-    args_list_minus[var] -= epsilon
-    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

源碼
python
def high_order_partial_derivative_func(*args: Var) -> Var:
-    result_func = func
-    for v in var:
-        result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

參數:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
-    """
-        曲线方程。
-        Args:
-            x_func: x函数
-            y_func: y函数
-            z_func: z函数
-        """
-    self.x_func = x_func
-    self.y_func = y_func
-    self.z_func = z_func

def __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

參數:

  • *t:

  • 参数:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
-    """
-        计算曲线上的点。
-        Args:
-            *t:
-                参数
-        Returns:
-
-        """
-    if len(t) == 1:
-        return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
-    else:
-        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

源碼
python
def __str__(self):
-    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/index.html b/zh-Hant/api/mp_math/index.html deleted file mode 100644 index 9222330..0000000 --- a/zh-Hant/api/mp_math/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp.mp_math | MBCP docs - - - - - - - - - - - - - -
Skip to content
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/line.html b/zh-Hant/api/mp_math/line.html deleted file mode 100644 index 914d2bd..0000000 --- a/zh-Hant/api/mp_math/line.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - mbcp.mp_math.line | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

參數:

  • point: 直线上的一点

  • direction: 直线的方向向量

源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
-    """
-        三维空间中的直线。由一个点和一个方向向量确定。
-        Args:
-            point: 直线上的一点
-            direction: 直线的方向向量
-        """
-    self.point = point
-    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

參數:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
-    """
-        判断两条直线是否近似相等。
-        Args:
-            other: 另一条直线
-            epsilon: 误差
-        Returns:
-            是否近似相等
-        """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

參數:

  • other: 另一条直线

返回:

  • 夹角弧度

引發:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
-    """
-        计算直线和直线之间的夹角。
-        Args:
-            other: 另一条直线
-        Returns:
-            夹角弧度
-        Raises:
-            TypeError: 不支持的类型
-        """
-    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

參數:

  • other: 平行直线或点

返回:

  • 距离

引發:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
-    """
-        计算直线和直线或点之间的距离。
-        Args:
-            other: 平行直线或点
-
-        Returns:
-            距离
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Line3):
-        if self == other:
-            return 0
-        elif self.is_parallel(other):
-            return (other.point - self.point).cross(self.direction).length / self.direction.length
-        elif not self.is_coplanar(other):
-            return abs(self.direction.cross(other.direction) @ (self.point - other.point) / self.direction.cross(other.direction).length)
-        else:
-            return 0
-    elif isinstance(other, Point3):
-        return (other - self.point).cross(self.direction).length / self.direction.length
-    else:
-        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

參數:

  • other: 另一条直线

返回:

  • 交点

引發:

  • ValueError 直线平行

  • ValueError 直线不共面

源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
-    """
-        计算两条直线的交点。
-        Args:
-            other: 另一条直线
-        Returns:
-            交点
-        Raises:
-            ValueError: 直线平行
-            ValueError: 直线不共面
-        """
-    if self.is_parallel(other):
-        raise ValueError('Lines are parallel and do not intersect.')
-    if not self.is_coplanar(other):
-        raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

參數:

  • point: 指定点

返回:

  • 垂线
源碼
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
-    """
-        计算直线经过指定点p的垂线。
-        Args:
-            point: 指定点
-        Returns:
-            垂线
-        """
-    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

參數:

  • t: 参数t

返回:

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
-    """
-        获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
-        Args:
-            t: 参数t
-        Returns:
-
-        """
-    return self.point + t * self.direction

def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
-    """
-        获取直线的参数方程。
-        Returns:
-            x(t), y(t), z(t)
-        """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

參數:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
-    """
-        判断两条直线是否近似平行。
-        Args:
-            other: 另一条直线
-            epsilon: 误差
-        Returns:
-            是否近似平行
-        """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

參數:

  • other: 另一条直线

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否平行。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否平行
-        """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

參數:

  • other: 另一条直线

返回:

  • 是否共线
源碼
python
def is_collinear(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否共线。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否共线
-        """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

參數:

  • point: 点

返回:

  • 是否在直线上
源碼
python
def is_point_on(self, point: 'Point3') -> bool:
-    """
-        判断点是否在直线上。
-        Args:
-            point: 点
-        Returns:
-            是否在直线上
-        """
-    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

參數:

  • other: 另一条直线

返回:

  • 是否共面
源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
-    """
-        判断两条直线是否共面。
-        充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
-        Args:
-            other: 另一条直线
-        Returns:
-            是否共面
-        """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
-    """
-        简化直线方程,等价相等。
-        自体简化,不返回值。
-
-        按照可行性一次对x y z 化 0 处理,并对向量单位化
-        """
-    self.direction.normalize()
-    if self.direction.x == 0:
-        self.point.x = 0
-    if self.direction.y == 0:
-        self.point.y = 0
-    if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

參數:

  • p1: 点1

  • p2: 点2

返回:

  • 直线
源碼
python
@classmethod
-def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
-    """
-        工厂函数 由两点构造直线。
-        Args:
-            p1: 点1
-            p2: 点2
-        Returns:
-            直线
-        """
-    direction = p2 - p1
-    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

參數:

  • other: 另一条直线

返回:

  • 交点
源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
-    """
-        计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
-        Args:
-            other: 另一条直线
-        Returns:
-            交点
-        """
-    if self.is_collinear(other):
-        return self
-    elif self.is_parallel(other) or not self.is_coplanar(other):
-        return None
-    else:
-        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

參數:

  • other:
源碼
python
def __eq__(self, other) -> bool:
-    """
-        判断两条直线是否等价。
-
-        v1 // v2 ∧ (p1 - p2) // v1
-        Args:
-            other:
-
-        Returns:
-
-        """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

源碼
python
def __str__(self):
-    """
-        返回点向式(x-x0)
-        Returns:
-
-        """
-    s = 'Line3: '
-    if self.direction.x != 0:
-        s += f'(x{sign_format(-self.point.x)})/{self.direction.x}'
-    if self.direction.y != 0:
-        s += f' = (y{sign_format(-self.point.y)})/{self.direction.y}'
-    if self.direction.z != 0:
-        s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
-    return s

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/mp_math_typing.html b/zh-Hant/api/mp_math/mp_math_typing.html deleted file mode 100644 index 05b27b2..0000000 --- a/zh-Hant/api/mp_math/mp_math_typing.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp.mp_math.mp_math_typing | MBCP docs - - - - - - - - - - - - - -
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/plane.html b/zh-Hant/api/mp_math/plane.html deleted file mode 100644 index 0cb6614..0000000 --- a/zh-Hant/api/mp_math/plane.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - mbcp.mp_math.plane | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

參數:

  • a:

  • b:

  • c:

  • d:

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
-    """
-        平面方程:ax + by + cz + d = 0
-        Args:
-            a:
-            b:
-            c:
-            d:
-        """
-    self.a = a
-    self.b = b
-    self.c = c
-    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

參數:

  • other:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Plane3') -> bool:
-    """
-        判断两个平面是否近似相等。
-        Args:
-            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)
-    elif self.b != 0:
-        k = other.b / self.b
-        return approx(other.a, self.a * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
-    elif self.c != 0:
-        k = other.c / self.c
-        return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
-    else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

參數:

  • other: 另一个平面

返回:

  • 夹角弧度

引發:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
-    """
-        计算平面与平面之间的夹角。
-        Args:
-            other: 另一个平面
-        Returns:
-            夹角弧度
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Line3):
-        return self.normal.cal_angle(other.direction).complementary
-    elif isinstance(other, Plane3):
-        return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
-    else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

參數:

  • other: 另一个平面或点

返回:

  • 距离

引發:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
-    """
-        计算平面与平面或点之间的距离。
-        Args:
-            other: 另一个平面或点
-        Returns:
-            距离
-        Raises:
-            TypeError: 不支持的类型
-        """
-    if isinstance(other, Plane3):
-        return 0
-    elif isinstance(other, Point3):
-        return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
-    else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

參數:

  • other: 另一个平面

返回:

  • 交线
源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
-    """
-        计算两平面的交线。该方法有问题,待修复。
-        Args:
-            other: 另一个平面
-        Returns:
-            交线
-        Raises:
-        """
-    if self.normal.is_parallel(other.normal):
-        raise ValueError('Planes are parallel and have no intersection.')
-    direction = self.normal.cross(other.normal)
-    x, y, 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])
-        y, z = np.linalg.solve(A, B)
-    elif self.b != 0 and other.b != 0:
-        A = np.array([[self.a, self.c], [other.a, other.c]])
-        B = np.array([-self.d, -other.d])
-        x, z = np.linalg.solve(A, B)
-    elif self.c != 0 and other.c != 0:
-        A = np.array([[self.a, self.b], [other.a, other.b]])
-        B = np.array([-self.d, -other.d])
-        x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

參數:

  • other: 不与平面平行或在平面上的直线

返回:

  • 交点

引發:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
-    """
-        计算平面与直线的交点。
-        Args:
-            other: 不与平面平行或在平面上的直线
-        Returns:
-            交点
-        Raises:
-            ValueError: 平面与直线平行或重合
-        """
-    if self.normal @ other.direction == 0:
-        raise ValueError('The plane and the line are parallel or coincident.')
-    x, y, z = other.get_parametric_equations()
-    t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
-    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

參數:

  • point: 指定点

返回:

  • 平面
源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
-    """
-        计算平行于该平面且过指定点的平面。
-        Args:
-            point: 指定点
-        Returns:
-            平面
-        """
-    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

參數:

  • other: 另一个平面

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
-    """
-        判断两个平面是否平行。
-        Args:
-            other: 另一个平面
-        Returns:
-            是否平行
-        """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

  • 法向量
源碼
python
@property
-def normal(self) -> 'Vector3':
-    """
-        平面的法向量。
-        Returns:
-            法向量
-        """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

參數:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源碼
python
@classmethod
-def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
-    """
-        工厂函数 由点和法向量构造平面(点法式构造)。
-        Args:
-            point: 平面上的一点
-            normal: 法向量
-        Returns:
-            平面
-        """
-    a, b, c = (normal.x, normal.y, normal.z)
-    d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

參數:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

  • 平面
源碼
python
@classmethod
-def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
-    """
-        工厂函数 由三点构造平面。
-        Args:
-            p1: 点1
-            p2: 点2
-            p3: 点3
-        Returns:
-            平面
-        """
-    v1 = p2 - p1
-    v2 = p3 - p1
-    normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

參數:

  • l1: 直线1

  • l2: 直线2

返回:

  • 平面
源碼
python
@classmethod
-def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
-    """
-        工厂函数 由两直线构造平面。
-        Args:
-            l1: 直线1
-            l2: 直线2
-        Returns:
-            平面
-        """
-    v1 = l1.direction
-    v2 = l2.point - l1.point
-    if v2 == zero_vector3:
-        v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

參數:

  • point: 面上一点

  • line: 面上直线,不包含点

返回:

  • 平面
源碼
python
@classmethod
-def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
-    """
-        工厂函数 由点和直线构造平面。
-        Args:
-            point: 面上一点
-            line: 面上直线,不包含点
-        Returns:
-            平面
-        """
-    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

源碼
python
def __str__(self):
-    s = 'Plane3: '
-    if self.a != 0:
-        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
-    if self.b != 0:
-        s += f' {sign(self.b)} {abs(self.b)}y'
-    if self.c != 0:
-        s += f' {sign(self.c)} {abs(self.c)}z'
-    if self.d != 0:
-        s += f' {sign(self.d)} {abs(self.d)}'
-    return s + ' = 0'

@overload

def __and__(self, other: 'Line3') -> 'Point3 | None'

源碼
python
@overload
-def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

源碼
python
@overload
-def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

參數:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源碼
python
def __and__(self, other):
-    """
-        取两平面的交集(人话:交线)
-        Args:
-            other:
-        Returns:
-            不平行平面的交线,平面平行返回None
-        """
-    if isinstance(other, Plane3):
-        if self.normal.is_parallel(other.normal):
-            return None
-        return self.cal_intersection_line3(other)
-    elif isinstance(other, Line3):
-        if self.normal @ other.direction == 0:
-            return None
-        return self.cal_intersection_point3(other)
-    else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/point.html b/zh-Hant/api/mp_math/point.html deleted file mode 100644 index 03fdbb3..0000000 --- a/zh-Hant/api/mp_math/point.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - mbcp.mp_math.point | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

參數:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源碼
python
def __init__(self, x: float, y: float, z: float):
-    """
-        笛卡尔坐标系中的点。
-        Args:
-            x: x 坐标
-            y: y 坐标
-            z: z 坐标
-        """
-    self.x = x
-    self.y = y
-    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

參數:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个点是否近似相等。
-        Args:
-            other:
-            epsilon:
-
-        Returns:
-            是否近似相等
-        """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

源碼
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

def __add__(self, other: 'Vector3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

P + V -> P P + P -> P

參數:

  • other:
源碼
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)

def __eq__(self, other)

判断两个点是否相等。

參數:

  • other:
源碼
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)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

參數:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
-    """
-        P - P -> V
-
-        P - V -> P  已在 :class:`Vector3` 中实现
-        Args:
-            other:
-        Returns:
-
-        """
-    from .vector import Vector3
-    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/segment.html b/zh-Hant/api/mp_math/segment.html deleted file mode 100644 index c9edb02..0000000 --- a/zh-Hant/api/mp_math/segment.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - mbcp.mp_math.segment | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
-    """
-        三维空间中的线段。
-        :param p1:
-        :param p2:
-        """
-    self.p1 = p1
-    self.p2 = p2
-    '方向向量'
-    self.direction = self.p2 - self.p1
-    '长度'
-    self.length = self.direction.length
-    '中心点'
-    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

源碼
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/utils.html b/zh-Hant/api/mp_math/utils.html deleted file mode 100644 index f8f0dbe..0000000 --- a/zh-Hant/api/mp_math/utils.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - mbcp.mp_math.utils | MBCP docs - - - - - - - - - - - - - -
Skip to content

def clamp() -> float

区间截断函数。

參數:

  • x:

  • min_:

  • max_:

返回:

  • 限制后的值
源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
-    """
-    区间截断函数。
-    Args:
-        x:
-        min_:
-        max_:
-
-    Returns:
-        限制后的值
-    """
-    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

參數:

  • x:

  • y:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
-    """
-    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
-    Args:
-        x:
-        y:
-        epsilon:
-
-    Returns:
-        是否近似相等
-    """
-    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

參數:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign(x: float, only_neg: bool=False) -> str:
-    """获取数的符号。
-    Args:
-        x: 数
-        only_neg: 是否只返回负数的符号
-    Returns:
-        符号 + - ""
-    """
-    if x > 0:
-        return '+' if not only_neg else ''
-    elif x < 0:
-        return '-'
-    else:
-        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

參數:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
-    """格式化符号数
-    -1 -> -1
-    1 -> +1
-    0 -> ""
-    Args:
-        x: 数
-        only_neg: 是否只返回负数的符号
-    Returns:
-        符号 + - ""
-    """
-    if x > 0:
-        return f'+{x}' if not only_neg else f'{x}'
-    elif x < 0:
-        return f'-{abs(x)}'
-    else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
-    self.value = value

def __eq__(self, other)

源碼
python
def __eq__(self, other):
-    if isinstance(self.value, (float, int)):
-        if isinstance(other, (float, int)):
-            return abs(self.value - other) < APPROX
-        else:
-            self.raise_type_error(other)
-    elif isinstance(self.value, Vector3):
-        if isinstance(other, (Vector3, Point3, Plane3, Line3)):
-            return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
-        else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

源碼
python
def __ne__(self, other):
-    return not self.__eq__(other)
- - - - \ No newline at end of file diff --git a/zh-Hant/api/mp_math/vector.html b/zh-Hant/api/mp_math/vector.html deleted file mode 100644 index 1fd3190..0000000 --- a/zh-Hant/api/mp_math/vector.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - mbcp.mp_math.vector | MBCP docs - - - - - - - - - - - - - -
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

參數:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源碼
python
def __init__(self, x: float, y: float, z: float):
-    """
-        3维向量
-        Args:
-            x: x轴分量
-            y: y轴分量
-            z: z轴分量
-        """
-    self.x = x
-    self.y = y
-    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

參數:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个向量是否近似相等。
-        Args:
-            other:
-            epsilon:
-
-        Returns:
-            是否近似相等
-        """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

參數:

  • other: 另一个向量

返回:

  • 夹角
源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
-    """
-        计算两个向量之间的夹角。
-        Args:
-            other: 另一个向量
-        Returns:
-            夹角
-        """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

參數:

  • other:

返回:

  • 行列式的结果
源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
-    """
-        向量积 叉乘:v1 cross v2 -> v3
-
-        叉乘为0,则两向量平行。
-        其余结果的模为平行四边形的面积。
-
-        返回如下行列式的结果:
-
-        ``i  j  k``
-
-        ``x1 y1 z1``
-
-        ``x2 y2 z2``
-
-        Args:
-            other:
-        Returns:
-            行列式的结果
-        """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

參數:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
-    """
-        判断两个向量是否近似平行。
-        Args:
-            other: 另一个向量
-            epsilon: 允许的误差
-        Returns:
-            是否近似平行
-        """
-    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

參數:

  • other: 另一个向量

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
-    """
-        判断两个向量是否平行。
-        Args:
-            other: 另一个向量
-        Returns:
-            是否平行
-        """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
-    """
-        将向量归一化。
-
-        自体归一化,不返回值。
-        """
-    length = self.length
-    self.x /= length
-    self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

源碼
python
@property
-def np_array(self) -> 'np.ndarray':
-    """
-        返回numpy数组
-        Returns:
-        """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

返回:

源碼
python
@property
-def length(self) -> float:
-    """
-        向量的模。
-        Returns:
-
-        """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

  • 单位向量
源碼
python
@property
-def unit(self) -> 'Vector3':
-    """
-        获取该向量的单位向量。
-        Returns:
-            单位向量
-        """
-    return self / self.length

def __abs__(self)

源碼
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

V + P -> P

V + V -> V

參數:

  • other:
源碼
python
def __add__(self, other):
-    """
-        V + P -> P
-
-        V + V -> V
-        Args:
-            other:
-        Returns:
-
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x + other.x, self.y + other.y, self.z + other.z)
-    elif isinstance(other, Point3):
-        return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
-    else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

參數:

  • other:

返回:

  • 是否相等
源碼
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)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

源碼
python
def __radd__(self, other: 'Point3') -> 'Point3':
-    """
-        P + V -> P
-
-        别去点那边实现了。
-        :param other:
-        :return:
-        """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
-def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

def __sub__(self, other)

V - P -> P

V - V -> V

參數:

  • other:
源碼
python
def __sub__(self, other):
-    """
-        V - P -> P
-
-        V - V -> V
-        Args:
-            other:
-        Returns:
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
-    elif isinstance(other, Point3):
-        return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
-    else:
-        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

參數:

  • other:
源碼
python
def __rsub__(self, other: 'Point3'):
-    """
-        P - V -> P
-        Args:
-            other:
-        Returns:
-
-        """
-    if isinstance(other, Point3):
-        return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
-    else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
-def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

源碼
python
@overload
-def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

參數:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
-    """
-        数组运算 非点乘。点乘使用@,叉乘使用cross。
-        Args:
-            other:
-
-        Returns:
-        """
-    if isinstance(other, Vector3):
-        return Vector3(self.x * other.x, self.y * other.y, self.z * other.z)
-    elif isinstance(other, (float, int)):
-        return Vector3(self.x * other, self.y * other, self.z * other)
-    else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

參數:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
-    """
-        点乘。
-        Args:
-            other:
-        Returns:
-        """
-    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

源碼
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

源碼
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

源碼
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- - - - \ No newline at end of file diff --git a/zh-Hant/api/particle/index.html b/zh-Hant/api/particle/index.html deleted file mode 100644 index d36c0a2..0000000 --- a/zh-Hant/api/particle/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp.particle | MBCP docs - - - - - - - - - - - - - -
Skip to content
- - - - \ No newline at end of file diff --git a/zh-Hant/api/presets/index.html b/zh-Hant/api/presets/index.html deleted file mode 100644 index b3d4a0f..0000000 --- a/zh-Hant/api/presets/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - mbcp.presets | MBCP docs - - - - - - - - - - - - - -
Skip to content
- - - - \ No newline at end of file diff --git a/zh-Hant/api/presets/model/index.html b/zh-Hant/api/presets/model/index.html deleted file mode 100644 index 715c3a2..0000000 --- a/zh-Hant/api/presets/model/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - mbcp.presets.model | MBCP docs - - - - - - - - - - - - - -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

參數:

  • radius:

  • density:

返回:

  • List[Point3]: 球体上的点集。
源碼
python
@staticmethod
-def sphere(radius: float, density: float):
-    """
-        生成球体上的点集。
-        Args:
-            radius:
-            density:
-        Returns:
-            List[Point3]: 球体上的点集。
-        """
-    area = 4 * np.pi * radius ** 2
-    num = int(area * density)
-    phi_list = np.arccos([clamp(-1 + (2.0 * _ - 1.0) / num, -1, 1) for _ in range(num)])
-    theta_list = np.sqrt(num * np.pi) * phi_list
-    x_array = radius * np.sin(phi_list) * np.cos(theta_list)
-    y_array = radius * np.sin(phi_list) * np.sin(theta_list)
-    z_array = radius * np.cos(phi_list)
-    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
- - - - \ No newline at end of file diff --git a/zht/api/index.html b/zht/api/index.html index 24762f5..4f2ee7e 100644 --- a/zht/api/index.html +++ b/zht/api/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/zht/api/mp_math/angle.html b/zht/api/mp_math/angle.html index 94f4b83..04d4546 100644 --- a/zht/api/mp_math/angle.html +++ b/zht/api/mp_math/angle.html @@ -116,7 +116,7 @@ if isinstance(other, AnyAngle): return self.radian / other.radian return AnyAngle(self.radian / other, is_radian=True) - + \ No newline at end of file diff --git a/zht/api/mp_math/const.html b/zht/api/mp_math/const.html index 08ad9c2..751cc1e 100644 --- a/zht/api/mp_math/const.html +++ b/zht/api/mp_math/const.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/zht/api/mp_math/equation.html b/zht/api/mp_math/equation.html index 849e310..bc8fe7a 100644 --- a/zht/api/mp_math/equation.html +++ b/zht/api/mp_math/equation.html @@ -79,7 +79,7 @@ return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0])) else: return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))]) - + \ No newline at end of file diff --git a/zht/api/mp_math/index.html b/zht/api/mp_math/index.html index c784d48..09c8052 100644 --- a/zht/api/mp_math/index.html +++ b/zht/api/mp_math/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/zht/api/mp_math/line.html b/zht/api/mp_math/line.html index 0acda47..8b99c35 100644 --- a/zht/api/mp_math/line.html +++ b/zht/api/mp_math/line.html @@ -195,7 +195,7 @@ """ return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction) - + \ No newline at end of file diff --git a/zht/api/mp_math/mp_math_typing.html b/zht/api/mp_math/mp_math_typing.html index 92da03a..6187e8e 100644 --- a/zht/api/mp_math/mp_math_typing.html +++ b/zht/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • 類型: TypeAlias

var Number = RealNumber | complex

  • 類型: TypeAlias

var Var = SingleVar | ArrayVar

  • 類型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 類型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 類型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 類型: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 類型: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 類型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 類型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 類型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 類型: TypeAlias
- + \ No newline at end of file diff --git a/zht/api/mp_math/plane.html b/zht/api/mp_math/plane.html index 631e876..4305ccd 100644 --- a/zht/api/mp_math/plane.html +++ b/zht/api/mp_math/plane.html @@ -213,7 +213,7 @@ raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
     return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/zht/api/mp_math/point.html b/zht/api/mp_math/point.html index b4b1192..c2a8642 100644 --- a/zht/api/mp_math/point.html +++ b/zht/api/mp_math/point.html @@ -68,7 +68,7 @@ """ from .vector import Vector3 return Vector3(self.x - other.x, self.y - other.y, self.z - other.z) - + \ No newline at end of file diff --git a/zht/api/mp_math/segment.html b/zht/api/mp_math/segment.html index 5667903..c1fc6fc 100644 --- a/zht/api/mp_math/segment.html +++ b/zht/api/mp_math/segment.html @@ -31,7 +31,7 @@ self.length = self.direction.length '中心点' self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2) - + \ No newline at end of file diff --git a/zht/api/mp_math/utils.html b/zht/api/mp_math/utils.html index c9589bb..5768013 100644 --- a/zht/api/mp_math/utils.html +++ b/zht/api/mp_math/utils.html @@ -81,7 +81,7 @@ self.raise_type_error(other)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/zht/api/mp_math/vector.html b/zht/api/mp_math/vector.html index 857fd36..343107a 100644 --- a/zht/api/mp_math/vector.html +++ b/zht/api/mp_math/vector.html @@ -204,7 +204,7 @@ return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
     return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/zht/api/particle/index.html b/zht/api/particle/index.html index 2ec71d9..b3f4b01 100644 --- a/zht/api/particle/index.html +++ b/zht/api/particle/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/zht/api/presets/index.html b/zht/api/presets/index.html index da46d07..e9ed31c 100644 --- a/zht/api/presets/index.html +++ b/zht/api/presets/index.html @@ -18,7 +18,7 @@
Skip to content
- + \ No newline at end of file diff --git a/zht/api/presets/model/index.html b/zht/api/presets/model/index.html index ce8192c..b3174aa 100644 --- a/zht/api/presets/model/index.html +++ b/zht/api/presets/model/index.html @@ -35,7 +35,7 @@ y_array = radius * np.sin(phi_list) * np.sin(theta_list) z_array = radius * np.cos(phi_list) return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)] - + \ No newline at end of file