📝 docs: add some tips

This commit is contained in:
远野千束 2024-09-06 15:42:16 +08:00
parent 10d05375a4
commit 7018a25beb
6 changed files with 69 additions and 19 deletions

View File

@ -1,7 +1,7 @@
// 共有配置项导入index用 // 共有配置项导入index用
import {defineConfig} from 'vitepress' import {defineConfig} from 'vitepress'
import {generateSidebar} from 'vitepress-sidebar'; import {generateSidebar} from 'vitepress-sidebar';
import {useData} from "vitepress";
import {zh} from "./zh"; import {zh} from "./zh";
import {en} from "./en"; import {en} from "./en";
import {ja} from "./ja"; import {ja} from "./ja";

View File

@ -1,4 +1,29 @@
import DefaultTheme from 'vitepress/theme-without-fonts' import DefaultTheme from 'vitepress/theme-without-fonts'
import Theme from 'vitepress/theme'
import {createI18n} from 'vue-i18n'
import './fonts.css' import './fonts.css'
export default DefaultTheme 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)
}
}

View File

@ -0,0 +1,5 @@
---
title: 微分方程
---
# 微分方程

View File

@ -52,8 +52,18 @@ class Plane3:
return False return False
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle': 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: Args:
other ([`Line3`](./line#class-line3) | [`Plane3`](./plane#class-plane3)): 另一个平面或直线 other ([`Line3`](./line#class-line3) | [`Plane3`](./plane#class-plane3)): 另一个平面或直线
Returns: Returns:
@ -86,8 +96,19 @@ class Plane3:
raise TypeError(f"Unsupported type: {type(other)}") raise TypeError(f"Unsupported type: {type(other)}")
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3': 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: Args:
other ([`Plane3`](./plane#class-plane3)): 另一个平面 other ([`Plane3`](./plane#class-plane3)): 另一个平面
Returns: Returns:

View File

@ -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]) 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': def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
""" r"""
计算两个向量之间的夹角 计算两个向量之间的夹角
:::tip
向量夹角计算公式:
$$\theta = \arccos(\frac{v1 \cdot v2}{|v1| \cdot |v2|})$$
:::
Args: Args:
other ([`Vector3`](#class-vector3)): 另一个向量 other ([`Vector3`](#class-vector3)): 另一个向量
Returns: Returns:
@ -50,20 +54,15 @@ class Vector3:
return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True) return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
def cross(self, other: 'Vector3') -> 'Vector3': def cross(self, other: 'Vector3') -> 'Vector3':
""" r"""
向量积 叉乘v1 cross v2 -> v3 向量积 叉乘v1 x v2 -> v3
叉乘为0则两向量平行
其余结果的模为平行四边形的面积
返回如下行列式的结果
``i j k``
``x1 y1 z1``
``x2 y2 z2``
:::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: Args:
other ([`Vector3`](#class-vector3)): 另一个向量 other ([`Vector3`](#class-vector3)): 另一个向量
Returns: Returns:

View File

@ -6,7 +6,7 @@ authors = [
{name = "snowykami", email = "snowykami@outlook.com"}, {name = "snowykami", email = "snowykami@outlook.com"},
] ]
dependencies = [ dependencies = [
"numpy~=2.0.1", "numpy>=2.1.1",
"liteyukibot>=6.3.9", "liteyukibot>=6.3.9",
] ]
requires-python = ">=3.10" requires-python = ">=3.10"