diff --git a/docs/.vitepress/config/common.ts b/docs/.vitepress/config/common.ts index 50925d5..32cb237 100644 --- a/docs/.vitepress/config/common.ts +++ b/docs/.vitepress/config/common.ts @@ -1,7 +1,7 @@ // 共有配置项,导入index用 - import {defineConfig} from 'vitepress' import {generateSidebar} from 'vitepress-sidebar'; +import {useData} from "vitepress"; import {zh} from "./zh"; import {en} from "./en"; import {ja} from "./ja"; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 254c539..631772e 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,29 @@ import DefaultTheme from 'vitepress/theme-without-fonts' +import Theme from 'vitepress/theme' +import {createI18n} from 'vue-i18n' import './fonts.css' -export default DefaultTheme \ No newline at end of file +const i18n = createI18n({ + // something vue-i18n options here .. + messages: { + en: { + tip: "TIP", + }, + ja: { + tip: "ヒント", + }, + zh: { + tip: "提示", + }, + zht: { + tip: "提示", + } + } +}) + +export default { + extends: Theme, + enhanceApp({app}) { + app.use(i18n) + } +} \ No newline at end of file diff --git a/docs/zh/refer/7-differential-euqtion/index.md b/docs/zh/refer/7-differential-euqtion/index.md new file mode 100644 index 0000000..270c37e --- /dev/null +++ b/docs/zh/refer/7-differential-euqtion/index.md @@ -0,0 +1,5 @@ +--- +title: 微分方程 +--- + +# 微分方程 diff --git a/mbcp/mp_math/plane.py b/mbcp/mp_math/plane.py index d874287..32b2426 100644 --- a/mbcp/mp_math/plane.py +++ b/mbcp/mp_math/plane.py @@ -52,8 +52,18 @@ class Plane3: return False def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle': - """ + r""" 计算平面与平面之间的夹角。 + :::tip + 平面间夹角计算公式: + $$\theta = \arccos(\frac{n1 \cdot n2}{|n1| \cdot |n2|})$$ + 其中 $n1$ 和 $n2$ 分别为两个平面的法向量 + ::: + :::tip + 平面与直线夹角计算公式: + $$\theta = \arccos(\frac{n \cdot d}{|n| \cdot |d|})$$ + 其中 $n$ 为平面的法向量,$d$ 为直线的方向向量 + ::: Args: other ([`Line3`](./line#class-line3) | [`Plane3`](./plane#class-plane3)): 另一个平面或直线 Returns: @@ -86,8 +96,19 @@ class Plane3: raise TypeError(f"Unsupported type: {type(other)}") def cal_intersection_line3(self, other: 'Plane3') -> 'Line3': - """ + r""" 计算两平面的交线。 + :::tip {{ $t('tip') }} + 计算两平面交线的一般步骤: + 1. 求两平面的法向量的叉乘得到方向向量 + $$ d = n1 \times n2 $$ + 2. 寻找直线上的一点,依次假设$x=0$, $y=0$, $z=0$,并代入两平面方程求出合适的点 + 直线最终可用参数方程或点向式表示 + $$ \begin{cases} x = x_0 + dt \\ y = y_0 + dt \\ z = z_0 + dt \end{cases} $$ + 或 + $$ \frac{x - x_0}{m} = \frac{y - y_0}{n} = \frac{z - z_0}{p} $$ + ::: + Args: other ([`Plane3`](./plane#class-plane3)): 另一个平面 Returns: diff --git a/mbcp/mp_math/vector.py b/mbcp/mp_math/vector.py index a6102b6..d2d020d 100644 --- a/mbcp/mp_math/vector.py +++ b/mbcp/mp_math/vector.py @@ -40,8 +40,12 @@ class Vector3: 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': - """ + r""" 计算两个向量之间的夹角。 + :::tip + 向量夹角计算公式: + $$\theta = \arccos(\frac{v1 \cdot v2}{|v1| \cdot |v2|})$$ + ::: Args: other ([`Vector3`](#class-vector3)): 另一个向量 Returns: @@ -50,20 +54,15 @@ class Vector3: return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True) def cross(self, other: 'Vector3') -> 'Vector3': - """ - 向量积 叉乘:v1 cross v2 -> v3 - - 叉乘为0,则两向量平行。 - 其余结果的模为平行四边形的面积。 - - 返回如下行列式的结果: - - ``i j k`` - - ``x1 y1 z1`` - - ``x2 y2 z2`` + r""" + 向量积 叉乘:v1 x v2 -> v3 + :::tip + 叉乘运算法则为: + $$ v1 \times v2 = (v1_y \cdot v2_z - v1_z \cdot v2_y, v1_z \cdot v2_x - v1_x \cdot v2_z, v1_x \cdot v2_y - v1_y \cdot v2_x) $$ + 转换为行列式形式: + $$ v1 \times v2 = \begin{vmatrix} i & j & k \\ v1_x & v1_y & v1_z \\ v2_x & v2_y & v2_z \end{vmatrix} $$ + ::: Args: other ([`Vector3`](#class-vector3)): 另一个向量 Returns: diff --git a/pyproject.toml b/pyproject.toml index a130ecf..fd29375 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ {name = "snowykami", email = "snowykami@outlook.com"}, ] dependencies = [ - "numpy~=2.0.1", + "numpy>=2.1.1", "liteyukibot>=6.3.9", ] requires-python = ">=3.10"