From 513ac423d65ef53fe0d85402c20a88a03e1076d5 Mon Sep 17 00:00:00 2001 From: snowykami Date: Wed, 28 Aug 2024 13:28:34 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20snowykami/mb?= =?UTF-8?q?cp@de42d34e3838a5486ed49ea9de9e59f845959d58=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- api-ex.html | 2 +- api/index.html | 2 +- api/mp_math/angle.html | 46 ++++++------- api/mp_math/const.html | 2 +- api/mp_math/equation.html | 18 +++--- api/mp_math/index.html | 2 +- api/mp_math/line.html | 42 ++++++------ api/mp_math/mp_math_typing.html | 2 +- api/mp_math/plane.html | 47 +++++++------- api/mp_math/point.html | 31 ++++++--- api/mp_math/segment.html | 10 +-- api/mp_math/utils.html | 20 +++--- api/mp_math/vector.html | 64 +++++++++---------- api/particle/index.html | 2 +- api/presets/index.html | 2 +- api/presets/model/index.html | 6 +- assets/api_mp_math_angle.md.7ZvAVHFT.lean.js | 1 - ...H7.js => api_mp_math_angle.md.DKMXAFbW.js} | 44 ++++++------- assets/api_mp_math_angle.md.DKMXAFbW.lean.js | 1 + ...js => api_mp_math_equation.md.BXP6BUSg.js} | 14 ++-- ... api_mp_math_equation.md.BXP6BUSg.lean.js} | 2 +- ..._V9.js => api_mp_math_line.md.CzpblksR.js} | 40 ++++++------ ...s => api_mp_math_line.md.CzpblksR.lean.js} | 2 +- assets/api_mp_math_plane.md.B7Mh7SKE.lean.js | 1 - ...KE.js => api_mp_math_plane.md.CZDq9vG4.js} | 43 +++++++------ assets/api_mp_math_plane.md.CZDq9vG4.lean.js | 1 + assets/api_mp_math_point.md.BJ9u2OpE.js | 52 +++++++++++++++ assets/api_mp_math_point.md.BJ9u2OpE.lean.js | 1 + assets/api_mp_math_point.md.BhIb1HeT.lean.js | 1 - ....js => api_mp_math_segment.md.B0wRl0bP.js} | 8 +-- ...> api_mp_math_segment.md.B0wRl0bP.lean.js} | 2 +- ...df.js => api_mp_math_utils.md.DPDde5hx.js} | 18 +++--- ... => api_mp_math_utils.md.DPDde5hx.lean.js} | 2 +- ...c.js => api_mp_math_vector.md.BBiKQwmG.js} | 60 ++++++++--------- assets/api_mp_math_vector.md.BBiKQwmG.lean.js | 1 + assets/api_mp_math_vector.md.BxisUL7s.lean.js | 1 - ...=> api_presets_model_index.md.BNeuRwjr.js} | 4 +- ...i_presets_model_index.md.BNeuRwjr.lean.js} | 2 +- .../en_api_mp_math_angle.md.Cpkg14Nd.lean.js | 1 - ...js => en_api_mp_math_angle.md.DYZo7hBD.js} | 44 ++++++------- .../en_api_mp_math_angle.md.DYZo7hBD.lean.js | 1 + ...=> en_api_mp_math_equation.md.Bsq2lQHW.js} | 14 ++-- ..._api_mp_math_equation.md.Bsq2lQHW.lean.js} | 2 +- ....js => en_api_mp_math_line.md.CP3RuJkk.js} | 40 ++++++------ ...> en_api_mp_math_line.md.CP3RuJkk.lean.js} | 2 +- ...js => en_api_mp_math_plane.md.eYXZ3wvh.js} | 43 +++++++------ ... en_api_mp_math_plane.md.eYXZ3wvh.lean.js} | 2 +- assets/en_api_mp_math_point.md.DNEIRDFB.js | 52 +++++++++++++++ .../en_api_mp_math_point.md.DNEIRDFB.lean.js | 1 + assets/en_api_mp_math_point.md.D_AsGf3x.js | 41 ------------ .../en_api_mp_math_point.md.D_AsGf3x.lean.js | 1 - ...en_api_mp_math_segment.md.CRs1-Itg.lean.js | 1 - ... => en_api_mp_math_segment.md.CUQFMm0Q.js} | 8 +-- ...en_api_mp_math_segment.md.CUQFMm0Q.lean.js | 1 + ...js => en_api_mp_math_utils.md.D6PiZ35J.js} | 18 +++--- ... en_api_mp_math_utils.md.D6PiZ35J.lean.js} | 2 +- ...s => en_api_mp_math_vector.md.BaY0-PMv.js} | 60 ++++++++--------- .../en_api_mp_math_vector.md.BaY0-PMv.lean.js | 1 + .../en_api_mp_math_vector.md.Dk4b7P4S.lean.js | 1 - ...en_api_presets_model_index.md.gEUCj87b.js} | 4 +- ...i_presets_model_index.md.gEUCj87b.lean.js} | 2 +- .../ja_api_mp_math_angle.md.B0vK-3H7.lean.js | 1 - ...js => ja_api_mp_math_angle.md._xBKQuir.js} | 44 ++++++------- .../ja_api_mp_math_angle.md._xBKQuir.lean.js | 1 + ...=> ja_api_mp_math_equation.md.DVrOBmbN.js} | 14 ++-- ..._api_mp_math_equation.md.DVrOBmbN.lean.js} | 2 +- ....js => ja_api_mp_math_line.md.B4_v4TOY.js} | 40 ++++++------ ...> ja_api_mp_math_line.md.B4_v4TOY.lean.js} | 2 +- ...js => ja_api_mp_math_plane.md.BSSDxRzL.js} | 43 +++++++------ ... ja_api_mp_math_plane.md.BSSDxRzL.lean.js} | 2 +- assets/ja_api_mp_math_point.md.DsWUjRQD.js | 41 ------------ .../ja_api_mp_math_point.md.DsWUjRQD.lean.js | 1 - ...js => ja_api_mp_math_point.md.DvD45PEI.js} | 27 +++++--- .../ja_api_mp_math_point.md.DvD45PEI.lean.js | 1 + ... => ja_api_mp_math_segment.md.oiONXysZ.js} | 8 +-- ...a_api_mp_math_segment.md.oiONXysZ.lean.js} | 2 +- ...js => ja_api_mp_math_utils.md.Bc0yJ70T.js} | 18 +++--- ... ja_api_mp_math_utils.md.Bc0yJ70T.lean.js} | 2 +- .../ja_api_mp_math_vector.md.BaQ1gWXc.lean.js | 1 - ...s => ja_api_mp_math_vector.md.TVqfIGHG.js} | 60 ++++++++--------- .../ja_api_mp_math_vector.md.TVqfIGHG.lean.js | 1 + ...ja_api_presets_model_index.md.DJGptHhw.js} | 4 +- ...i_presets_model_index.md.DJGptHhw.lean.js} | 2 +- en/api/index.html | 2 +- en/api/mp_math/angle.html | 46 ++++++------- en/api/mp_math/const.html | 2 +- en/api/mp_math/equation.html | 18 +++--- en/api/mp_math/index.html | 2 +- en/api/mp_math/line.html | 42 ++++++------ en/api/mp_math/mp_math_typing.html | 2 +- en/api/mp_math/plane.html | 47 +++++++------- en/api/mp_math/point.html | 31 ++++++--- en/api/mp_math/segment.html | 10 +-- en/api/mp_math/utils.html | 20 +++--- en/api/mp_math/vector.html | 64 +++++++++---------- en/api/particle/index.html | 2 +- en/api/presets/index.html | 2 +- en/api/presets/model/index.html | 6 +- hashmap.json | 2 +- index.html | 2 +- ja/api/index.html | 2 +- ja/api/mp_math/angle.html | 46 ++++++------- ja/api/mp_math/const.html | 2 +- ja/api/mp_math/equation.html | 18 +++--- ja/api/mp_math/index.html | 2 +- ja/api/mp_math/line.html | 42 ++++++------ ja/api/mp_math/mp_math_typing.html | 2 +- ja/api/mp_math/plane.html | 47 +++++++------- ja/api/mp_math/point.html | 31 ++++++--- ja/api/mp_math/segment.html | 10 +-- ja/api/mp_math/utils.html | 20 +++--- ja/api/mp_math/vector.html | 64 +++++++++---------- ja/api/particle/index.html | 2 +- ja/api/presets/index.html | 2 +- ja/api/presets/model/index.html | 6 +- md-ex.html | 2 +- 117 files changed, 965 insertions(+), 893 deletions(-) delete mode 100644 assets/api_mp_math_angle.md.7ZvAVHFT.lean.js rename assets/{ja_api_mp_math_angle.md.B0vK-3H7.js => api_mp_math_angle.md.DKMXAFbW.js} (56%) create mode 100644 assets/api_mp_math_angle.md.DKMXAFbW.lean.js rename assets/{ja_api_mp_math_equation.md.CxOZG3Ck.js => api_mp_math_equation.md.BXP6BUSg.js} (67%) rename assets/{api_mp_math_equation.md.DcgE8elZ.lean.js => api_mp_math_equation.md.BXP6BUSg.lean.js} (85%) rename assets/{api_mp_math_line.md.CPz5W_V9.js => api_mp_math_line.md.CzpblksR.js} (66%) rename assets/{api_mp_math_line.md.CPz5W_V9.lean.js => api_mp_math_line.md.CzpblksR.lean.js} (58%) delete mode 100644 assets/api_mp_math_plane.md.B7Mh7SKE.lean.js rename assets/{api_mp_math_plane.md.B7Mh7SKE.js => api_mp_math_plane.md.CZDq9vG4.js} (71%) create mode 100644 assets/api_mp_math_plane.md.CZDq9vG4.lean.js create mode 100644 assets/api_mp_math_point.md.BJ9u2OpE.js create mode 100644 assets/api_mp_math_point.md.BJ9u2OpE.lean.js delete mode 100644 assets/api_mp_math_point.md.BhIb1HeT.lean.js rename assets/{en_api_mp_math_segment.md.CRs1-Itg.js => api_mp_math_segment.md.B0wRl0bP.js} (62%) rename assets/{api_mp_math_segment.md.BpLgqrZ6.lean.js => api_mp_math_segment.md.B0wRl0bP.lean.js} (57%) rename assets/{api_mp_math_utils.md.BgmONBdf.js => api_mp_math_utils.md.DPDde5hx.js} (65%) rename assets/{api_mp_math_utils.md.BgmONBdf.lean.js => api_mp_math_utils.md.DPDde5hx.lean.js} (85%) rename assets/{ja_api_mp_math_vector.md.BaQ1gWXc.js => api_mp_math_vector.md.BBiKQwmG.js} (61%) create mode 100644 assets/api_mp_math_vector.md.BBiKQwmG.lean.js delete mode 100644 assets/api_mp_math_vector.md.BxisUL7s.lean.js rename assets/{api_presets_model_index.md.O3tM1JKS.js => api_presets_model_index.md.BNeuRwjr.js} (85%) rename assets/{api_presets_model_index.md.O3tM1JKS.lean.js => api_presets_model_index.md.BNeuRwjr.lean.js} (85%) delete mode 100644 assets/en_api_mp_math_angle.md.Cpkg14Nd.lean.js rename assets/{en_api_mp_math_angle.md.Cpkg14Nd.js => en_api_mp_math_angle.md.DYZo7hBD.js} (56%) create mode 100644 assets/en_api_mp_math_angle.md.DYZo7hBD.lean.js rename assets/{en_api_mp_math_equation.md.BEubflOs.js => en_api_mp_math_equation.md.Bsq2lQHW.js} (69%) rename assets/{en_api_mp_math_equation.md.BEubflOs.lean.js => en_api_mp_math_equation.md.Bsq2lQHW.lean.js} (86%) rename assets/{en_api_mp_math_line.md.JAqG1sD6.js => en_api_mp_math_line.md.CP3RuJkk.js} (67%) rename assets/{en_api_mp_math_line.md.JAqG1sD6.lean.js => en_api_mp_math_line.md.CP3RuJkk.lean.js} (57%) rename assets/{ja_api_mp_math_plane.md.DoFcs9On.js => en_api_mp_math_plane.md.eYXZ3wvh.js} (71%) rename assets/{en_api_mp_math_plane.md.BRPMklJt.lean.js => en_api_mp_math_plane.md.eYXZ3wvh.lean.js} (57%) create mode 100644 assets/en_api_mp_math_point.md.DNEIRDFB.js create mode 100644 assets/en_api_mp_math_point.md.DNEIRDFB.lean.js delete mode 100644 assets/en_api_mp_math_point.md.D_AsGf3x.js delete mode 100644 assets/en_api_mp_math_point.md.D_AsGf3x.lean.js delete mode 100644 assets/en_api_mp_math_segment.md.CRs1-Itg.lean.js rename assets/{ja_api_mp_math_segment.md.B3JRHboi.js => en_api_mp_math_segment.md.CUQFMm0Q.js} (65%) create mode 100644 assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js rename assets/{ja_api_mp_math_utils.md.CMaGJtHQ.js => en_api_mp_math_utils.md.D6PiZ35J.js} (62%) rename assets/{en_api_mp_math_utils.md.CoXbSyss.lean.js => en_api_mp_math_utils.md.D6PiZ35J.lean.js} (71%) rename assets/{en_api_mp_math_vector.md.Dk4b7P4S.js => en_api_mp_math_vector.md.BaY0-PMv.js} (63%) create mode 100644 assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js delete mode 100644 assets/en_api_mp_math_vector.md.Dk4b7P4S.lean.js rename assets/{en_api_presets_model_index.md.DD5WCYA0.js => en_api_presets_model_index.md.gEUCj87b.js} (86%) rename assets/{en_api_presets_model_index.md.DD5WCYA0.lean.js => en_api_presets_model_index.md.gEUCj87b.lean.js} (86%) delete mode 100644 assets/ja_api_mp_math_angle.md.B0vK-3H7.lean.js rename assets/{api_mp_math_angle.md.7ZvAVHFT.js => ja_api_mp_math_angle.md._xBKQuir.js} (57%) create mode 100644 assets/ja_api_mp_math_angle.md._xBKQuir.lean.js rename assets/{api_mp_math_equation.md.DcgE8elZ.js => ja_api_mp_math_equation.md.DVrOBmbN.js} (69%) rename assets/{ja_api_mp_math_equation.md.CxOZG3Ck.lean.js => ja_api_mp_math_equation.md.DVrOBmbN.lean.js} (86%) rename assets/{ja_api_mp_math_line.md.B_sNS7i2.js => ja_api_mp_math_line.md.B4_v4TOY.js} (66%) rename assets/{ja_api_mp_math_line.md.B_sNS7i2.lean.js => ja_api_mp_math_line.md.B4_v4TOY.lean.js} (57%) rename assets/{en_api_mp_math_plane.md.BRPMklJt.js => ja_api_mp_math_plane.md.BSSDxRzL.js} (72%) rename assets/{ja_api_mp_math_plane.md.DoFcs9On.lean.js => ja_api_mp_math_plane.md.BSSDxRzL.lean.js} (57%) delete mode 100644 assets/ja_api_mp_math_point.md.DsWUjRQD.js delete mode 100644 assets/ja_api_mp_math_point.md.DsWUjRQD.lean.js rename assets/{api_mp_math_point.md.BhIb1HeT.js => ja_api_mp_math_point.md.DvD45PEI.js} (51%) create mode 100644 assets/ja_api_mp_math_point.md.DvD45PEI.lean.js rename assets/{api_mp_math_segment.md.BpLgqrZ6.js => ja_api_mp_math_segment.md.oiONXysZ.js} (72%) rename assets/{ja_api_mp_math_segment.md.B3JRHboi.lean.js => ja_api_mp_math_segment.md.oiONXysZ.lean.js} (57%) rename assets/{en_api_mp_math_utils.md.CoXbSyss.js => ja_api_mp_math_utils.md.Bc0yJ70T.js} (68%) rename assets/{ja_api_mp_math_utils.md.CMaGJtHQ.lean.js => ja_api_mp_math_utils.md.Bc0yJ70T.lean.js} (85%) delete mode 100644 assets/ja_api_mp_math_vector.md.BaQ1gWXc.lean.js rename assets/{api_mp_math_vector.md.BxisUL7s.js => ja_api_mp_math_vector.md.TVqfIGHG.js} (64%) create mode 100644 assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js rename assets/{ja_api_presets_model_index.md.D4BAOCXn.js => ja_api_presets_model_index.md.DJGptHhw.js} (86%) rename assets/{ja_api_presets_model_index.md.D4BAOCXn.lean.js => ja_api_presets_model_index.md.DJGptHhw.lean.js} (86%) diff --git a/404.html b/404.html index 50f0607..6456764 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 103cfc1..14155b2 100644 --- a/api-ex.html +++ b/api-ex.html @@ -350,7 +350,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 86753fe..22198b2 100644 --- a/api/index.html +++ b/api/index.html @@ -18,7 +18,7 @@
- + \ No newline at end of file diff --git a/api/mp_math/angle.html b/api/mp_math/angle.html index bd8e36d..2dc22d9 100644 --- a/api/mp_math/angle.html +++ b/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
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):
+    
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:
@@ -27,98 +27,98 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

返回:

余角

源码
python
@property
+        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)

补角:两角的和为180°。

返回:

补角

源码
python
@property
+    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)

角度。

返回:

弧度

源码
python
@property
+    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)

最小正角。

返回:

最小正角度

源码
python
@property
+    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)

最大负角。

返回:

最大负角度

源码
python
@property
+    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)

正弦值。

返回:

正弦值

源码
python
@property
+    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)

余弦值。

返回:

余弦值

源码
python
@property
+    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)

正切值。

返回:

正切值

源码
python
@property
+    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)

余切值。

返回:

余切值

源码
python
@property
+    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)

正割值。

返回:

正割值

源码
python
@property
+    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)

余割值。

返回:

余割值

源码
python
@property
+    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')

源码
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')

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

源码
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
源码
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
源码
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@overload

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

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

源码
python
def __truediv__(self, other):
+    ...

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/api/mp_math/const.html b/api/mp_math/const.html index dd24f17..faa3dbd 100644 --- a/api/mp_math/const.html +++ b/api/mp_math/const.html @@ -18,7 +18,7 @@
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/api/mp_math/equation.html b/api/mp_math/equation.html index 515be17..6fee931 100644 --- a/api/mp_math/equation.html +++ b/api/mp_math/equation.html @@ -12,12 +12,12 @@ - + -
Skip to content

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

参数:

func: 函数

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

epsilon: 偏移量

源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -47,16 +47,16 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

源码
python
def partial_derivative_func(*args: Var) -> Var:
+        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()

源码
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    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):
+    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:
@@ -66,7 +66,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

参数:

*t:

参数:

源码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

参数:

  • *t:

  • 参数:

源码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,9 @@
     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))])
源码
python
def __str__(self):
-    return 'CurveEquation()'
- + 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/api/mp_math/index.html b/api/mp_math/index.html index 1514ffb..0535d61 100644 --- a/api/mp_math/index.html +++ b/api/mp_math/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/api/mp_math/line.html b/api/mp_math/line.html index 5be626d..87f518b 100644 --- a/api/mp_math/line.html +++ b/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

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

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

参数:

point: 直线上的一点

direction: 直线的方向向量

源码
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

源码
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

参数:

other: 另一条直线

epsilon: 误差

源码
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    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:
@@ -34,7 +34,7 @@
         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')

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

参数:

other: 另一条直线

源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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: 另一条直线
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

参数:

other: 平行直线或点

源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点
源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     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')

计算两条直线的交点。

参数:

other: 另一条直线

源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

参数:

  • other: 另一条直线
源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         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')

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

参数:

point: 指定点

源码
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

参数:

t: 参数t

源码
python
def get_point(self, t: RealNumber) -> 'Point3':
+    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:
@@ -98,13 +98,13 @@
         Returns:
 
         """
-    return self.point + t * self.direction
  • def get_parametric_equations(self)

获取直线的参数方程。

返回:

x(t), y(t), z(t)

源码
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    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)

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

参数:

other: 另一条直线

epsilon: 误差

源码
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

参数:

other: 另一条直线

源码
python
def is_parallel(self, other: 'Line3') -> bool:
+    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:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

参数:

other: 另一条直线

源码
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

参数:

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

判断点是否在直线上。

参数:

point: 点

源码
python
def is_point_on(self, point: 'Point3') -> bool:
+    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:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

参数:

other: 另一条直线

源码
python
def is_coplanar(self, other: 'Line3') -> bool:
+    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。
@@ -146,7 +146,7 @@
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0
  • def simplify(self)

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

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

源码
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

源码
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     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')

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

参数:

p1: 点1

p2: 点2

源码
python
@classmethod
+        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':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

参数:

other: 另一条直线

源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    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:
@@ -183,7 +183,7 @@
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)
  • def __eq__(self, other)

判断两条直线是否等价。

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

参数:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

参数:

  • other:
源码
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,7 +194,7 @@
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
源码
python
def __str__(self):
+    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:
@@ -207,9 +207,9 @@
         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
源码
python
def __repr__(self):
+    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/api/mp_math/mp_math_typing.html b/api/mp_math/mp_math_typing.html index 73a1cd9..2db996f 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: 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/api/mp_math/plane.html b/api/mp_math/plane.html index b02677b..f81e03e 100644 --- a/api/mp_math/plane.html +++ b/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

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])

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):
+    
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:
@@ -29,7 +29,7 @@
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

参数:

other:

源码
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

参数:

  • other:
源码
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -38,6 +38,7 @@
         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)
@@ -48,7 +49,7 @@
         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')

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

参数:

other: 另一个平面

源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

参数:

  • other: 另一个平面
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -63,7 +64,7 @@
     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')

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

参数:

other: 另一个平面或点

源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点
源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -78,7 +79,7 @@
     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')

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

参数:

other: 另一个平面

源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        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:
@@ -103,7 +104,7 @@
         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')

计算平面与直线的交点。

参数:

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

源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

  • other: 不与平面平行或在平面上的直线
源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -117,7 +118,7 @@
         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')

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

参数:

point: 指定点

源码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    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:
@@ -125,7 +126,7 @@
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

参数:

other: 另一个平面

源码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    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:
@@ -133,14 +134,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

返回:

法向量

源码
python
@property
+    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')

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

参数:

point: 平面上的一点

normal: 法向量

源码
python
@classmethod
+    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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -152,7 +153,7 @@
         """
     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')

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

参数:

p1: 点1

p2: 点2

p3: 点3

源码
python
@classmethod
+    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':
     """
         工厂函数 由三点构造平面。
@@ -166,7 +167,7 @@
     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')

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

参数:

l1: 直线1

l2: 直线2

源码
python
@classmethod
+    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':
     """
         工厂函数 由两直线构造平面。
@@ -180,7 +181,7 @@
     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')

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

参数:

point: 面上一点

line: 面上直线,不包含点

源码
python
@classmethod
+    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':
     """
         工厂函数 由点和直线构造平面。
@@ -190,8 +191,8 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
源码
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
源码
python
def __str__(self):
+    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'
@@ -201,11 +202,11 @@
         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')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@overload

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

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

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

参数:

other:

源码
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

参数:

  • other:
源码
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -222,10 +223,10 @@
             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)

源码
python
def __eq__(self, other) -> bool:
-    return self.approx(other)
  • def __rand__(self, other: 'Line3')

源码
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
- + 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/api/mp_math/point.html b/api/mp_math/point.html index 9013fb6..1cf9dd6 100644 --- a/api/mp_math/point.html +++ b/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
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):
+    
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:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Point3', epsilon: float = APPROX)

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

参数:

other:

epsilon:

源码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    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:
@@ -37,12 +37,12 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])
源码
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

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

参数:

  • other:
源码
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -50,15 +50,26 @@
             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):
+    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)
- + 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/api/mp_math/segment.html b/api/mp_math/segment.html index 47ebfec..c1186e8 100644 --- a/api/mp_math/segment.html +++ b/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

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

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

源码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
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:
@@ -30,10 +30,10 @@
     '长度'
     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)
源码
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
源码
python
def __str__(self):
+    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/api/mp_math/utils.html b/api/mp_math/utils.html index 272252c..69edafe 100644 --- a/api/mp_math/utils.html +++ b/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp()

区间截断函数。

参数:

x:

min_:

max_:

源码
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

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

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

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

参数:

x:

y:

epsilon:

源码
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    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:
@@ -39,7 +39,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False)

获取数的符号。

参数:

x: 数

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

源码
python
def sign(x: float, only_neg: bool=False) -> str:
+    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: 数
@@ -52,7 +52,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

参数:

x: 数

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

源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        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
@@ -68,8 +68,8 @@
     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):
+        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
@@ -79,10 +79,10 @@
         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):
+            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/api/mp_math/vector.html b/api/mp_math/vector.html index 2b0a890..1661678 100644 --- a/api/mp_math/vector.html +++ b/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

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)

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):
+    
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:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

参数:

other:

epsilon:

源码
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -37,7 +37,7 @@
         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')

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

参数:

other: 另一个向量

源码
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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:
@@ -45,7 +45,7 @@
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
  • def cross(self, other: 'Vector3')

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

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

源码
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

源码
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         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)

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

参数:

other: 另一个向量

epsilon: 允许的误差

源码
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

参数:

other: 另一个向量

源码
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

参数:

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

将向量归一化。

自体归一化,不返回值。

源码
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源码
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
源码
python
@property
+    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)

向量的模。

返回:

源码
python
@property
+    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)

获取该向量的单位向量。

返回:

单位向量

源码
python
@property
+    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
源码
python
def __abs__(self):
-    return self.length
  • @overload

  • def __add__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

参数:

  • other:
源码
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     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):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:
源码
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -139,7 +139,7 @@
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

源码
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

参数:

  • other:
源码
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     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'):
+        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:
@@ -176,11 +176,11 @@
     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')

源码
python
@overload
+        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)

源码
python
@overload
+    ...

@overload

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

源码
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

参数:

other:

源码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

参数:

  • other:
源码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,20 @@
     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')

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

点乘。

参数:

other:

源码
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        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)

源码
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
源码
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
源码
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
源码
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
- + 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/api/particle/index.html b/api/particle/index.html index b73caba..fe6980f 100644 --- a/api/particle/index.html +++ b/api/particle/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/api/presets/index.html b/api/presets/index.html index 7d167b3..dd61db7 100644 --- a/api/presets/index.html +++ b/api/presets/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/api/presets/model/index.html b/api/presets/model/index.html index f2beffb..4f3df63 100644 --- a/api/presets/model/index.html +++ b/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

参数:

radius:

density:

源码
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

源码
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -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/api_mp_math_angle.md.7ZvAVHFT.lean.js b/assets/api_mp_math_angle.md.7ZvAVHFT.lean.js deleted file mode 100644 index 9273f75..0000000 --- a/assets/api_mp_math_angle.md.7ZvAVHFT.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"api/mp_math/angle.md"},n=l("",93),t=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_angle.md.B0vK-3H7.js b/assets/api_mp_math_angle.md.DKMXAFbW.js similarity index 56% rename from assets/ja_api_mp_math_angle.md.B0vK-3H7.js rename to assets/api_mp_math_angle.md.DKMXAFbW.js index cec49b1..95d0f6b 100644 --- a/assets/ja_api_mp_math_angle.md.B0vK-3H7.js +++ b/assets/api_mp_math_angle.md.DKMXAFbW.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/api/mp_math/angle.md"},n=l(`

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):
+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":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"api/mp_math/angle.md"},l=n(`

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:
@@ -8,94 +8,94 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

戻り値:

余角

ソースコード
python
@property
+        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)

补角:两角的和为180°。

戻り値:

补角

ソースコード
python
@property
+    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)

角度。

戻り値:

弧度

ソースコード
python
@property
+    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)

最小正角。

戻り値:

最小正角度

ソースコード
python
@property
+    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)

最大负角。

戻り値:

最大负角度

ソースコード
python
@property
+    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)

正弦值。

戻り値:

正弦值

ソースコード
python
@property
+    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)

余弦值。

戻り値:

余弦值

ソースコード
python
@property
+    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)

正切值。

戻り値:

正切值

ソースコード
python
@property
+    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)

余切值。

戻り値:

余切值

ソースコード
python
@property
+    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)

正割值。

戻り値:

正割值

ソースコード
python
@property
+    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)

余割值。

戻り値:

余割值

ソースコード
python
@property
+    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')

ソースコード
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')

ソースコード
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)
  • def __mul__(self, other: float)

ソースコード
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
ソースコード
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
ソースコード
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@overload

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

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

ソースコード
python
def __truediv__(self, other):
+    ...

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=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; + 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/api_mp_math_angle.md.DKMXAFbW.lean.js b/assets/api_mp_math_angle.md.DKMXAFbW.lean.js new file mode 100644 index 0000000..97c8210 --- /dev/null +++ b/assets/api_mp_math_angle.md.DKMXAFbW.lean.js @@ -0,0 +1 @@ +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":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"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/ja_api_mp_math_equation.md.CxOZG3Ck.js b/assets/api_mp_math_equation.md.BXP6BUSg.js similarity index 67% rename from assets/ja_api_mp_math_equation.md.CxOZG3Ck.js rename to assets/api_mp_math_equation.md.BXP6BUSg.js index e66b89b..fc6d4de 100644 --- a/assets/ja_api_mp_math_equation.md.CxOZG3Ck.js +++ b/assets/api_mp_math_equation.md.BXP6BUSg.js @@ -1,4 +1,4 @@ -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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n(`

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

引数:

func: 函数

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

epsilon: 偏移量

ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n(`

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -28,16 +28,16 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

ソースコード
python
def partial_derivative_func(*args: Var) -> Var:
+        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()

ソースコード
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    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):
+    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:
@@ -47,7 +47,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

引数:

*t:

参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

参数:

  • *t:

  • 参数:

源码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     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))])
ソースコード
python
def __str__(self):
-    return 'CurveEquation()'
`,30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; + 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)

`,23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/api_mp_math_equation.md.DcgE8elZ.lean.js b/assets/api_mp_math_equation.md.BXP6BUSg.lean.js similarity index 85% rename from assets/api_mp_math_equation.md.DcgE8elZ.lean.js rename to assets/api_mp_math_equation.md.BXP6BUSg.lean.js index 1da9d96..72c38e7 100644 --- a/assets/api_mp_math_equation.md.DcgE8elZ.lean.js +++ b/assets/api_mp_math_equation.md.BXP6BUSg.lean.js @@ -1 +1 @@ -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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n("",30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; +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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n("",23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/api_mp_math_line.md.CPz5W_V9.js b/assets/api_mp_math_line.md.CzpblksR.js similarity index 66% rename from assets/api_mp_math_line.md.CPz5W_V9.js rename to assets/api_mp_math_line.md.CzpblksR.js index 2338bdb..689d4fd 100644 --- a/assets/api_mp_math_line.md.CPz5W_V9.js +++ b/assets/api_mp_math_line.md.CzpblksR.js @@ -1,4 +1,4 @@ -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":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},h=n(`

class Line3

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

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

参数:

point: 直线上的一点

direction: 直线的方向向量

源码
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+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":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n(`

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

源码
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

参数:

other: 另一条直线

epsilon: 误差

源码
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    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:
@@ -15,7 +15,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

参数:

other: 另一条直线

源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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: 另一条直线
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -25,7 +25,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

参数:

other: 平行直线或点

源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点
源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -48,7 +48,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

计算两条直线的交点。

参数:

other: 另一条直线

源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

参数:

  • other: 另一条直线
源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

参数:

point: 指定点

源码
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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:
@@ -71,7 +71,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

参数:

t: 参数t

源码
python
def get_point(self, t: RealNumber) -> 'Point3':
+    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:
@@ -79,13 +79,13 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.point + t * self.direction
  • def get_parametric_equations(self)

获取直线的参数方程。

返回:

x(t), y(t), z(t)

源码
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    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)

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

参数:

other: 另一条直线

epsilon: 误差

源码
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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:
@@ -94,7 +94,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

参数:

other: 另一条直线

源码
python
def is_parallel(self, other: 'Line3') -> bool:
+    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:
@@ -102,7 +102,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

参数:

other: 另一条直线

源码
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

参数:

  • other: 另一条直线
源码
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -110,7 +110,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)
  • def is_point_on(self, point: 'Point3')

判断点是否在直线上。

参数:

point: 点

源码
python
def is_point_on(self, point: 'Point3') -> bool:
+    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:
@@ -118,7 +118,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

参数:

other: 另一条直线

源码
python
def is_coplanar(self, other: 'Line3') -> bool:
+    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。
@@ -127,7 +127,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0
  • def simplify(self)

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

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

源码
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

源码
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -140,7 +140,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

参数:

p1: 点1

p2: 点2

源码
python
@classmethod
+        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':
     """
         工厂函数 由两点构造直线。
@@ -151,7 +151,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

参数:

other: 另一条直线

源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    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:
@@ -164,7 +164,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)
  • def __eq__(self, other)

判断两条直线是否等价。

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

参数:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

参数:

  • other:
源码
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,7 +175,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
源码
python
def __str__(self):
+    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:
@@ -188,5 +188,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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
源码
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,111),t=[h];function p(e,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; + return s

def __repr__(self)

源码
python
def __repr__(self):
+    return f'Line3({self.point}, {self.direction})'
`,91),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/api_mp_math_line.md.CPz5W_V9.lean.js b/assets/api_mp_math_line.md.CzpblksR.lean.js similarity index 58% rename from assets/api_mp_math_line.md.CPz5W_V9.lean.js rename to assets/api_mp_math_line.md.CzpblksR.lean.js index 6e645a3..5616832 100644 --- a/assets/api_mp_math_line.md.CPz5W_V9.lean.js +++ b/assets/api_mp_math_line.md.CzpblksR.lean.js @@ -1 +1 @@ -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":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},h=n("",111),t=[h];function p(e,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; +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":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n("",91),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/api_mp_math_plane.md.B7Mh7SKE.lean.js b/assets/api_mp_math_plane.md.B7Mh7SKE.lean.js deleted file mode 100644 index b35c9ea..0000000 --- a/assets/api_mp_math_plane.md.B7Mh7SKE.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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n("",115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; diff --git a/assets/api_mp_math_plane.md.B7Mh7SKE.js b/assets/api_mp_math_plane.md.CZDq9vG4.js similarity index 71% rename from assets/api_mp_math_plane.md.B7Mh7SKE.js rename to assets/api_mp_math_plane.md.CZDq9vG4.js index a583ba8..1388466 100644 --- a/assets/api_mp_math_plane.md.B7Mh7SKE.js +++ b/assets/api_mp_math_plane.md.CZDq9vG4.js @@ -1,4 +1,4 @@ -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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n(`

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])

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):
+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":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"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

参数:

  • a:

  • b:

  • c:

  • d:

源码
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -10,7 +10,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

参数:

other:

源码
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

参数:

  • other:
源码
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -19,6 +19,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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)
@@ -29,7 +30,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

参数:

other: 另一个平面

源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

参数:

  • other: 另一个平面
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -44,7 +45,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

参数:

other: 另一个平面或点

源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点
源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -59,7 +60,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

参数:

other: 另一个平面

源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        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:
@@ -84,7 +85,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

计算平面与直线的交点。

参数:

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

源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

  • other: 不与平面平行或在平面上的直线
源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -98,7 +99,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

参数:

point: 指定点

源码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    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:
@@ -106,7 +107,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

参数:

other: 另一个平面

源码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    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:
@@ -114,14 +115,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

返回:

法向量

源码
python
@property
+    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')

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

参数:

point: 平面上的一点

normal: 法向量

源码
python
@classmethod
+    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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -133,7 +134,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         """
     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')

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

参数:

p1: 点1

p2: 点2

p3: 点3

源码
python
@classmethod
+    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':
     """
         工厂函数 由三点构造平面。
@@ -147,7 +148,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

参数:

l1: 直线1

l2: 直线2

源码
python
@classmethod
+    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':
     """
         工厂函数 由两直线构造平面。
@@ -161,7 +162,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

参数:

point: 面上一点

line: 面上直线,不包含点

源码
python
@classmethod
+    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':
     """
         工厂函数 由点和直线构造平面。
@@ -171,8 +172,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
源码
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
源码
python
def __str__(self):
+    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'
@@ -182,11 +183,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@overload

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

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

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

参数:

other:

源码
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

参数:

  • other:
源码
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -203,6 +204,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             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)

源码
python
def __eq__(self, other) -> bool:
-    return self.approx(other)
  • def __rand__(self, other: 'Line3')

源码
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
`,115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; + 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])

`,100),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/api_mp_math_plane.md.CZDq9vG4.lean.js b/assets/api_mp_math_plane.md.CZDq9vG4.lean.js new file mode 100644 index 0000000..14763bd --- /dev/null +++ b/assets/api_mp_math_plane.md.CZDq9vG4.lean.js @@ -0,0 +1 @@ +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":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n("",100),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/api_mp_math_point.md.BJ9u2OpE.js b/assets/api_mp_math_point.md.BJ9u2OpE.js new file mode 100644 index 0000000..f8c5428 --- /dev/null +++ b/assets/api_mp_math_point.md.BJ9u2OpE.js @@ -0,0 +1,52 @@ +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":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},l=n(`

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)
`,35),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/api_mp_math_point.md.BJ9u2OpE.lean.js b/assets/api_mp_math_point.md.BJ9u2OpE.lean.js new file mode 100644 index 0000000..e80f7d5 --- /dev/null +++ b/assets/api_mp_math_point.md.BJ9u2OpE.lean.js @@ -0,0 +1 @@ +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":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},l=n("",35),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/api_mp_math_point.md.BhIb1HeT.lean.js b/assets/api_mp_math_point.md.BhIb1HeT.lean.js deleted file mode 100644 index 797587b..0000000 --- a/assets/api_mp_math_point.md.BhIb1HeT.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},n=l("",34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const g=s(t,[["render",e]]);export{y as __pageData,g as default}; diff --git a/assets/en_api_mp_math_segment.md.CRs1-Itg.js b/assets/api_mp_math_segment.md.B0wRl0bP.js similarity index 62% rename from assets/en_api_mp_math_segment.md.CRs1-Itg.js rename to assets/api_mp_math_segment.md.B0wRl0bP.js index 00a7777..9ec5df3 100644 --- a/assets/en_api_mp_math_segment.md.CRs1-Itg.js +++ b/assets/api_mp_math_segment.md.B0wRl0bP.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),h={name:"en/api/mp_math/segment.md"},t=n(`

class Segment3

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

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+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":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"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:
@@ -11,6 +11,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     '长度'
     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)
Source code
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
Source code
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
`,9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const y=s(h,[["render",e]]);export{o as __pageData,y as default}; + 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/api_mp_math_segment.md.BpLgqrZ6.lean.js b/assets/api_mp_math_segment.md.B0wRl0bP.lean.js similarity index 57% rename from assets/api_mp_math_segment.md.BpLgqrZ6.lean.js rename to assets/api_mp_math_segment.md.B0wRl0bP.lean.js index 5d33d09..650fdb4 100644 --- a/assets/api_mp_math_segment.md.BpLgqrZ6.lean.js +++ b/assets/api_mp_math_segment.md.B0wRl0bP.lean.js @@ -1 +1 @@ -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":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),h={name:"api/mp_math/segment.md"},t=n("",9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const o=s(h,[["render",e]]);export{y as __pageData,o as default}; +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":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"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/api_mp_math_utils.md.BgmONBdf.js b/assets/api_mp_math_utils.md.DPDde5hx.js similarity index 65% rename from assets/api_mp_math_utils.md.BgmONBdf.js rename to assets/api_mp_math_utils.md.DPDde5hx.js index 2fbb1f3..f4feeb5 100644 --- a/assets/api_mp_math_utils.md.BgmONBdf.js +++ b/assets/api_mp_math_utils.md.DPDde5hx.js @@ -1,4 +1,4 @@ -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":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n(`

def clamp()

区间截断函数。

参数:

x:

min_:

max_:

源码
python
def clamp(x: float, min_: float, max_: float) -> float:
+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":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

源码
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -9,7 +9,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

参数:

x:

y:

epsilon:

源码
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    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:
@@ -20,7 +20,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False)

获取数的符号。

参数:

x: 数

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

源码
python
def sign(x: float, only_neg: bool=False) -> str:
+    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: 数
@@ -33,7 +33,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

参数:

x: 数

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

源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        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
@@ -49,8 +49,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     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):
+        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
@@ -60,6 +60,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         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)
`,35),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}; + 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)
`,29),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/api_mp_math_utils.md.BgmONBdf.lean.js b/assets/api_mp_math_utils.md.DPDde5hx.lean.js similarity index 85% rename from assets/api_mp_math_utils.md.BgmONBdf.lean.js rename to assets/api_mp_math_utils.md.DPDde5hx.lean.js index 3eb15bf..9df1220 100644 --- a/assets/api_mp_math_utils.md.BgmONBdf.lean.js +++ b/assets/api_mp_math_utils.md.DPDde5hx.lean.js @@ -1 +1 @@ -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":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n("",35),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}; +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":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n("",29),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/ja_api_mp_math_vector.md.BaQ1gWXc.js b/assets/api_mp_math_vector.md.BBiKQwmG.js similarity index 61% rename from assets/ja_api_mp_math_vector.md.BaQ1gWXc.js rename to assets/api_mp_math_vector.md.BBiKQwmG.js index 2dbde1a..dbf18e2 100644 --- a/assets/ja_api_mp_math_vector.md.BaQ1gWXc.js +++ b/assets/api_mp_math_vector.md.BBiKQwmG.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),h={name:"ja/api/mp_math/vector.md"},n=l(`

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)

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):
+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":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),t={name:"api/mp_math/vector.md"},l=n(`

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:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

引数:

other:

epsilon:

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

引数:

other: 另一个向量

ソースコード
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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:
@@ -26,7 +26,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
  • def cross(self, other: 'Vector3')

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

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

ソースコード
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

源码
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -46,7 +46,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         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)

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

引数:

other: 另一个向量

epsilon: 允许的误差

ソースコード
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -55,7 +55,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

引数:

other: 另一个向量

ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

参数:

  • other: 另一个向量
源码
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)
  • def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源码
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
ソースコード
python
@property
+    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)

向量的模。

戻り値:

ソースコード
python
@property
+    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)

获取该向量的单位向量。

戻り値:

单位向量

ソースコード
python
@property
+    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
ソースコード
python
def __abs__(self):
-    return self.length
  • @overload

  • def __add__(self, other: 'Vector3')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

参数:

  • other:
源码
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:
源码
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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
 
@@ -128,11 +128,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@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):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

参数:

  • other:
源码
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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'):
+        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:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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')

ソースコード
python
@overload
+        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)

ソースコード
python
@overload
+    ...

@overload

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

源码
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

引数:

other:

ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

参数:

  • other:
源码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,16 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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')

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)
  • def __matmul__(self, other: 'Vector3')

点乘。

引数:

other:

ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        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)

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
ソースコード
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
ソースコード
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
ソースコード
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
`,130),e=[n];function t(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(h,[["render",t]]);export{g as __pageData,F as default}; + 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)

`,119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.BBiKQwmG.lean.js b/assets/api_mp_math_vector.md.BBiKQwmG.lean.js new file mode 100644 index 0000000..4845af4 --- /dev/null +++ b/assets/api_mp_math_vector.md.BBiKQwmG.lean.js @@ -0,0 +1 @@ +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":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),t={name:"api/mp_math/vector.md"},l=n("",119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.BxisUL7s.lean.js b/assets/api_mp_math_vector.md.BxisUL7s.lean.js deleted file mode 100644 index 61c6995..0000000 --- a/assets/api_mp_math_vector.md.BxisUL7s.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),h={name:"api/mp_math/vector.md"},n=l("",130),e=[n];function t(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(h,[["render",t]]);export{g as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.O3tM1JKS.js b/assets/api_presets_model_index.md.BNeuRwjr.js similarity index 85% rename from assets/api_presets_model_index.md.O3tM1JKS.js rename to assets/api_presets_model_index.md.BNeuRwjr.js index dbb802d..667e064 100644 --- a/assets/api_presets_model_index.md.O3tM1JKS.js +++ b/assets/api_presets_model_index.md.BNeuRwjr.js @@ -1,4 +1,4 @@ -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":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n(`

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

参数:

radius:

density:

源码
python
@staticmethod
+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":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

源码
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -15,4 +15,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     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)]
`,8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.O3tM1JKS.lean.js b/assets/api_presets_model_index.md.BNeuRwjr.lean.js similarity index 85% rename from assets/api_presets_model_index.md.O3tM1JKS.lean.js rename to assets/api_presets_model_index.md.BNeuRwjr.lean.js index 6d000b8..887b976 100644 --- a/assets/api_presets_model_index.md.O3tM1JKS.lean.js +++ b/assets/api_presets_model_index.md.BNeuRwjr.lean.js @@ -1 +1 @@ -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":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n("",8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +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":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.Cpkg14Nd.lean.js b/assets/en_api_mp_math_angle.md.Cpkg14Nd.lean.js deleted file mode 100644 index f5c4657..0000000 --- a/assets/en_api_mp_math_angle.md.Cpkg14Nd.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as e}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),l={name:"en/api/mp_math/angle.md"},n=e("",93),t=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(l,[["render",h]]);export{g as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.Cpkg14Nd.js b/assets/en_api_mp_math_angle.md.DYZo7hBD.js similarity index 56% rename from assets/en_api_mp_math_angle.md.Cpkg14Nd.js rename to assets/en_api_mp_math_angle.md.DYZo7hBD.js index 877c4a6..c706bce 100644 --- a/assets/en_api_mp_math_angle.md.Cpkg14Nd.js +++ b/assets/en_api_mp_math_angle.md.DYZo7hBD.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as e}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),l={name:"en/api/mp_math/angle.md"},n=e(`

class Angle

class AnyAngle

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

任意角度。

Args:

value: 角度或弧度值

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

Source code
python
def __init__(self, value: float, is_radian: bool=False):
+import{_ as s,c as i,o as a,a2 as e}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),n={name:"en/api/mp_math/angle.md"},l=e(`

class Angle

class AnyAngle

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

任意角度。

Args:

  • value: 角度或弧度值

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

Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,94 +8,94 @@ import{_ as s,c as i,o as a,a2 as e}from"./chunks/framework.BV61Qrc0.js";const g
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

Return:

余角

Source code
python
@property
+        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

Return:

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

  • def supplementary(self)

补角:两角的和为180°。

Return:

补角

Source code
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

Return:

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

  • def degree(self)

角度。

Return:

弧度

Source code
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

Return:

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

  • def minimum_positive(self)

最小正角。

Return:

最小正角度

Source code
python
@property
+    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

Return:

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

  • def maximum_negative(self)

最大负角。

Return:

最大负角度

Source code
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

Return:

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

  • def sin(self)

正弦值。

Return:

正弦值

Source code
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

Return:

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

  • def cos(self)

余弦值。

Return:

余弦值

Source code
python
@property
+    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

Return:

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

  • def tan(self)

正切值。

Return:

正切值

Source code
python
@property
+    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

Return:

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

  • def cot(self)

余切值。

Return:

余切值

Source code
python
@property
+    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

Return:

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

  • def sec(self)

正割值。

Return:

正割值

Source code
python
@property
+    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

Return:

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

  • def csc(self)

余割值。

Return:

余割值

Source code
python
@property
+    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

Return:

  • 余割值
Source code
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)
  • def __add__(self, other: 'AnyAngle')

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)
  • def __eq__(self, other)

Source code
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)
  • def __sub__(self, other: 'AnyAngle')

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)
  • def __mul__(self, other: float)

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
Source code
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
Source code
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

Source code
python
@overload
+    return 1 / math.sin(self.radian)

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

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

def __eq__(self, other)

Source code
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

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

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

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

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

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

Source code
python
def __str__(self):
+    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

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

Source code
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...
  • @overload

  • def __truediv__(self, other: 'AnyAngle')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...
  • def __truediv__(self, other)

Source code
python
def __truediv__(self, other):
+    ...

def __truediv__(self, other)

Source code
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,93),t=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(l,[["render",h]]);export{g as __pageData,F as default}; + 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 F=s(n,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.DYZo7hBD.lean.js b/assets/en_api_mp_math_angle.md.DYZo7hBD.lean.js new file mode 100644 index 0000000..1b0df5b --- /dev/null +++ b/assets/en_api_mp_math_angle.md.DYZo7hBD.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as e}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),n={name:"en/api/mp_math/angle.md"},l=e("",93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const F=s(n,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/en_api_mp_math_equation.md.BEubflOs.js b/assets/en_api_mp_math_equation.md.Bsq2lQHW.js similarity index 69% rename from assets/en_api_mp_math_equation.md.BEubflOs.js rename to assets/en_api_mp_math_equation.md.Bsq2lQHW.js index 0b4ff44..56d2cb5 100644 --- a/assets/en_api_mp_math_equation.md.BEubflOs.js +++ b/assets/en_api_mp_math_equation.md.Bsq2lQHW.js @@ -1,4 +1,4 @@ -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":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n(`

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

Args:

func: 函数

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

epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+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":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n(`

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

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

Args:

  • func: 函数

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

  • epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -28,16 +28,16 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

Source code
python
def partial_derivative_func(*args: Var) -> Var:
+        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

Source code
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()

Source code
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

Source code
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)

曲线方程。

Args:

x_func: x函数

y_func: y函数

z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    return result_func(*args)

class CurveEquation

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

曲线方程。

Args:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
     """
         曲线方程。
         Args:
@@ -47,7 +47,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

Args:

*t:

参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

Args:

  • *t:

  • 参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
     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))])
Source code
python
def __str__(self):
-    return 'CurveEquation()'
`,30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; + 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)

Source code
python
def __str__(self):
+    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,23),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/en_api_mp_math_equation.md.BEubflOs.lean.js b/assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js similarity index 86% rename from assets/en_api_mp_math_equation.md.BEubflOs.lean.js rename to assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js index 89524f3..5c96c7b 100644 --- a/assets/en_api_mp_math_equation.md.BEubflOs.lean.js +++ b/assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js @@ -1 +1 @@ -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":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n("",30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; +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":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n("",23),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/en_api_mp_math_line.md.JAqG1sD6.js b/assets/en_api_mp_math_line.md.CP3RuJkk.js similarity index 67% rename from assets/en_api_mp_math_line.md.JAqG1sD6.js rename to assets/en_api_mp_math_line.md.CP3RuJkk.js index e2f8661..5a1d7ba 100644 --- a/assets/en_api_mp_math_line.md.JAqG1sD6.js +++ b/assets/en_api_mp_math_line.md.CP3RuJkk.js @@ -1,4 +1,4 @@ -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":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},h=n(`

class Line3

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

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

Args:

point: 直线上的一点

direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+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":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n(`

class Line3

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

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

Args:

  • point: 直线上的一点

  • direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

Args:

other: 另一条直线

epsilon: 误差

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -15,7 +15,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

Args:

other: 另一条直线

Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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'

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

Args:

  • other: 另一条直线
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -25,7 +25,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

Args:

other: 平行直线或点

Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

Args:

  • other: 平行直线或点
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -48,7 +48,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

计算两条直线的交点。

Args:

other: 另一条直线

Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

Args:

  • other: 另一条直线
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

Args:

point: 指定点

Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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的垂线。

Args:

  • point: 指定点
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
     """
         计算直线经过指定点p的垂线。
         Args:
@@ -71,7 +71,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

Args:

t: 参数t

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

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

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

Args:

  • t: 参数t
Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -79,13 +79,13 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.point + t * self.direction
  • def get_parametric_equations(self)

获取直线的参数方程。

Return:

x(t), y(t), z(t)

Source code
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

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

获取直线的参数方程。

Return:

  • x(t), y(t), z(t)
Source code
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)

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

Args:

other: 另一条直线

epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
     """
         判断两条直线是否近似平行。
         Args:
@@ -94,7 +94,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

Args:

other: 另一条直线

Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

Args:

  • other: 另一条直线
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -102,7 +102,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

Args:

other: 另一条直线

Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

Args:

  • other: 另一条直线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -110,7 +110,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)
  • def is_point_on(self, point: 'Point3')

判断点是否在直线上。

Args:

point: 点

Source code
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

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

判断点是否在直线上。

Args:

  • point: 点
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -118,7 +118,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

Args:

other: 另一条直线

Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

Args:

  • other: 另一条直线
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -127,7 +127,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0
  • def simplify(self)

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

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

Source code
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

Source code
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -140,7 +140,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

Args:

p1: 点1

p2: 点2

Source code
python
@classmethod
+        self.point.z = 0

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

Source code
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -151,7 +151,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

Args:

other: 另一条直线

Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

Args:

  • other: 另一条直线
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -164,7 +164,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)
  • def __eq__(self, other)

判断两条直线是否等价。

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

Args:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

Args:

  • other:
Source code
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,7 +175,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
Source code
python
def __str__(self):
+    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

Source code
python
def __str__(self):
     """
         返回点向式(x-x0)
         Returns:
@@ -188,5 +188,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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
Source code
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,111),t=[h];function e(p,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; + return s

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'Line3({self.point}, {self.direction})'
`,91),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/en_api_mp_math_line.md.JAqG1sD6.lean.js b/assets/en_api_mp_math_line.md.CP3RuJkk.lean.js similarity index 57% rename from assets/en_api_mp_math_line.md.JAqG1sD6.lean.js rename to assets/en_api_mp_math_line.md.CP3RuJkk.lean.js index bfb1e17..dd8b683 100644 --- a/assets/en_api_mp_math_line.md.JAqG1sD6.lean.js +++ b/assets/en_api_mp_math_line.md.CP3RuJkk.lean.js @@ -1 +1 @@ -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":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},h=n("",111),t=[h];function e(p,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; +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":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n("",91),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/ja_api_mp_math_plane.md.DoFcs9On.js b/assets/en_api_mp_math_plane.md.eYXZ3wvh.js similarity index 71% rename from assets/ja_api_mp_math_plane.md.DoFcs9On.js rename to assets/en_api_mp_math_plane.md.eYXZ3wvh.js index cdea063..9b8e61e 100644 --- a/assets/ja_api_mp_math_plane.md.DoFcs9On.js +++ b/assets/en_api_mp_math_plane.md.eYXZ3wvh.js @@ -1,4 +1,4 @@ -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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n(`

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])

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):
+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":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/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

Args:

  • a:

  • b:

  • c:

  • d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -10,7 +10,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

引数:

other:

ソースコード
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

Args:

  • other:
Source code
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -19,6 +19,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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)
@@ -29,7 +30,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

引数:

other: 另一个平面

ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -44,7 +45,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

引数:

other: 另一个平面或点

ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面或点
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -59,7 +60,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

引数:

other: 另一个平面

ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -84,7 +85,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

计算平面与直线的交点。

引数:

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

ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -98,7 +99,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

引数:

point: 指定点

ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

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

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

Args:

  • point: 指定点
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -106,7 +107,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

引数:

other: 另一个平面

ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

Args:

  • other: 另一个平面
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -114,14 +115,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

戻り値:

法向量

ソースコード
python
@property
+    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

Return:

  • 法向量
Source code
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')

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

引数:

point: 平面上的一点

normal: 法向量

ソースコード
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

Args:

  • point: 平面上的一点

  • normal: 法向量

Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -133,7 +134,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         """
     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')

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

引数:

p1: 点1

p2: 点2

p3: 点3

ソースコード
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -147,7 +148,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

引数:

l1: 直线1

l2: 直线2

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

Args:

  • l1: 直线1

  • l2: 直线2

Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -161,7 +162,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

引数:

point: 面上一点

line: 面上直线,不包含点

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

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

Args:

  • point: 面上一点

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

Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -171,8 +172,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
ソースコード
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
ソースコード
python
def __str__(self):
+    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

Source code
python
def __str__(self):
     s = 'Plane3: '
     if self.a != 0:
         s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
@@ -182,11 +183,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

ソースコード
python
@overload
+    return s + ' = 0'

@overload

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

Source code
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...
  • @overload

  • def __and__(self, other: 'Plane3')

ソースコード
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...
  • def __and__(self, other)

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

引数:

other:

ソースコード
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

Args:

  • other:
Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -203,6 +204,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             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)

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

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
`,115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

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

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

Source code
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])

`,100),t=[h];function p(e,k,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/en_api_mp_math_plane.md.BRPMklJt.lean.js b/assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js similarity index 57% rename from assets/en_api_mp_math_plane.md.BRPMklJt.lean.js rename to assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js index 034f614..ccfd979 100644 --- a/assets/en_api_mp_math_plane.md.BRPMklJt.lean.js +++ b/assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js @@ -1 +1 @@ -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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/api/mp_math/plane.md"},h=n("",115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; +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":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/api/mp_math/plane.md"},h=n("",100),t=[h];function p(e,k,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/en_api_mp_math_point.md.DNEIRDFB.js b/assets/en_api_mp_math_point.md.DNEIRDFB.js new file mode 100644 index 0000000..2b4a6b9 --- /dev/null +++ b/assets/en_api_mp_math_point.md.DNEIRDFB.js @@ -0,0 +1,52 @@ +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":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},l=n(`

class Point3

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

笛卡尔坐标系中的点。

Args:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
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

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

Args:

  • other:

  • epsilon:

Source code
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)

Source code
python
def __str__(self):
+    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

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

Source code
python
@overload
+def __add__(self, other: 'Vector3') -> 'Point3':
+    ...

@overload

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

Source code
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

def __add__(self, other)

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

Args:

  • other:
Source code
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)

判断两个点是否相等。

Args:

  • other:
Source code
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 中实现

Args:

  • other:
Source code
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)
`,35),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/en_api_mp_math_point.md.DNEIRDFB.lean.js b/assets/en_api_mp_math_point.md.DNEIRDFB.lean.js new file mode 100644 index 0000000..5c60e43 --- /dev/null +++ b/assets/en_api_mp_math_point.md.DNEIRDFB.lean.js @@ -0,0 +1 @@ +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":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},l=n("",35),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/en_api_mp_math_point.md.D_AsGf3x.js b/assets/en_api_mp_math_point.md.D_AsGf3x.js deleted file mode 100644 index b9b055e..0000000 --- a/assets/en_api_mp_math_point.md.D_AsGf3x.js +++ /dev/null @@ -1,41 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},n=l(`

class Point3

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

笛卡尔坐标系中的点。

Args:

x: x 坐标

y: y 坐标

z: z 坐标

Source code
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)

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

Args:

other:

epsilon:

Source code
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])
Source code
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

Source code
python
@overload
-def __add__(self, other: 'Vector3') -> 'Point3':
-    ...
  • @overload

  • def __add__(self, other: 'Point3')

Source code
python
@overload
-def __add__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __add__(self, other)

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

Args:

other:

Source code
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)

判断两个点是否相等。

Args:

other:

Source code
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)
`,34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{g as __pageData,y as default}; diff --git a/assets/en_api_mp_math_point.md.D_AsGf3x.lean.js b/assets/en_api_mp_math_point.md.D_AsGf3x.lean.js deleted file mode 100644 index c76158e..0000000 --- a/assets/en_api_mp_math_point.md.D_AsGf3x.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},n=l("",34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{g as __pageData,y as default}; diff --git a/assets/en_api_mp_math_segment.md.CRs1-Itg.lean.js b/assets/en_api_mp_math_segment.md.CRs1-Itg.lean.js deleted file mode 100644 index 8f15e17..0000000 --- a/assets/en_api_mp_math_segment.md.CRs1-Itg.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.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),h={name:"en/api/mp_math/segment.md"},t=n("",9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const y=s(h,[["render",e]]);export{o as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_segment.md.B3JRHboi.js b/assets/en_api_mp_math_segment.md.CUQFMm0Q.js similarity index 65% rename from assets/ja_api_mp_math_segment.md.B3JRHboi.js rename to assets/en_api_mp_math_segment.md.CUQFMm0Q.js index 3339232..66345f9 100644 --- a/assets/ja_api_mp_math_segment.md.B3JRHboi.js +++ b/assets/en_api_mp_math_segment.md.CUQFMm0Q.js @@ -1,4 +1,4 @@ -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":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),h={name:"ja/api/mp_math/segment.md"},t=n(`

class Segment3

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

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

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+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":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),t={name:"en/api/mp_math/segment.md"},h=n(`

class Segment3

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

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -11,6 +11,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     '长度'
     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)
ソースコード
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
ソースコード
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
`,9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const o=s(h,[["render",e]]);export{y as __pageData,o as default}; + 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)

Source code
python
def __repr__(self):
+    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

Source code
python
def __str__(self):
+    return f'Segment3({self.p1} -> {self.p2})'
`,8),e=[h];function p(l,k,d,r,E,g){return a(),i("div",null,e)}const o=s(t,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js b/assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js new file mode 100644 index 0000000..c25d96b --- /dev/null +++ b/assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js @@ -0,0 +1 @@ +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":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),t={name:"en/api/mp_math/segment.md"},h=n("",8),e=[h];function p(l,k,d,r,E,g){return a(),i("div",null,e)}const o=s(t,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/ja_api_mp_math_utils.md.CMaGJtHQ.js b/assets/en_api_mp_math_utils.md.D6PiZ35J.js similarity index 62% rename from assets/ja_api_mp_math_utils.md.CMaGJtHQ.js rename to assets/en_api_mp_math_utils.md.D6PiZ35J.js index 7c9c23b..220cb3f 100644 --- a/assets/ja_api_mp_math_utils.md.CMaGJtHQ.js +++ b/assets/en_api_mp_math_utils.md.D6PiZ35J.js @@ -1,4 +1,4 @@ -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":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n(`

def clamp()

区间截断函数。

引数:

x:

min_:

max_:

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -9,7 +9,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

引数:

x:

y:

epsilon:

ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

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

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

Args:

  • x:

  • y:

  • epsilon:

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -20,7 +20,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False)

获取数的符号。

引数:

x: 数

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

ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

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

获取数的符号。

Args:

  • x: 数

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

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -33,7 +33,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

引数:

x: 数

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

ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

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

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

Args:

  • x: 数

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

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -49,8 +49,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     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):
+        return ''

class Approx

def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
+    self.value = value

def __eq__(self, other)

Source code
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -60,6 +60,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         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)
`,35),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}; + self.raise_type_error(other)

def 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)}')

def __ne__(self, other)

Source code
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,29),t=[h];function p(e,k,r,d,F,g){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{o as __pageData,y as default}; diff --git a/assets/en_api_mp_math_utils.md.CoXbSyss.lean.js b/assets/en_api_mp_math_utils.md.D6PiZ35J.lean.js similarity index 71% rename from assets/en_api_mp_math_utils.md.CoXbSyss.lean.js rename to assets/en_api_mp_math_utils.md.D6PiZ35J.lean.js index 71639ba..c6f2204 100644 --- a/assets/en_api_mp_math_utils.md.CoXbSyss.lean.js +++ b/assets/en_api_mp_math_utils.md.D6PiZ35J.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},h=n("",35),t=[h];function e(p,k,r,d,F,E){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{o as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},h=n("",29),t=[h];function p(e,k,r,d,F,g){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{o as __pageData,y as default}; diff --git a/assets/en_api_mp_math_vector.md.Dk4b7P4S.js b/assets/en_api_mp_math_vector.md.BaY0-PMv.js similarity index 63% rename from assets/en_api_mp_math_vector.md.Dk4b7P4S.js rename to assets/en_api_mp_math_vector.md.BaY0-PMv.js index cf37d28..8ca0903 100644 --- a/assets/en_api_mp_math_vector.md.Dk4b7P4S.js +++ b/assets/en_api_mp_math_vector.md.BaY0-PMv.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),e={name:"en/api/mp_math/vector.md"},h=l(`

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)

class Vector3

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

3维向量

Args:

x: x轴分量

y: y轴分量

z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
+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":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),t={name:"en/api/mp_math/vector.md"},e=n(`

class Vector3

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

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

Args:

other:

epsilon:

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

Args:

  • other:

  • epsilon:

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         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')

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

Args:

other: 另一个向量

Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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'

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

Args:

  • other: 另一个向量
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -26,7 +26,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
  • def cross(self, other: 'Vector3')

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

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

Source code
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -46,7 +46,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         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)

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

Args:

other: 另一个向量

epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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

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

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -55,7 +55,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

Args:

other: 另一个向量

Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

Args:

  • other: 另一个向量
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)
  • def normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
Source code
python
@property
+    self.z /= length

@property

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

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

  • def length(self)

向量的模。

Return:

Source code
python
@property
+    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

Return:

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

  • def unit(self)

获取该向量的单位向量。

Return:

单位向量

Source code
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

Return:

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

  • def __add__(self, other: 'Vector3')

Source code
python
@overload
+    return self / self.length

def __abs__(self)

Source code
python
def __abs__(self):
+    return self.length

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __add__(self, other: 'Point3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __add__(self, other)

V + P -> P

V + V -> V

Args:

other:

Source code
python
def __add__(self, other):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

Args:

  • other:
Source code
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
     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)

判断两个向量是否相等。

Args:

other:

Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:
Source code
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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:

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -128,11 +128,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

Source code
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

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

Source code
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __sub__(self, other: 'Point3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __sub__(self, other)

V - P -> P

V - V -> V

Args:

other:

Source code
python
def __sub__(self, other):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

Args:

  • other:
Source code
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
     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

Args:

other:

Source code
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

Args:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
     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')

Source code
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

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

Source code
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __mul__(self, other: RealNumber)

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

Args:

other:

Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

Args:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,16 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
     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')

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)
  • def __matmul__(self, other: 'Vector3')

点乘。

Args:

other:

Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

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

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

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

点乘。

Args:

  • other:
Source code
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)

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
Source code
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
Source code
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
Source code
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
`,130),n=[h];function t(p,k,r,d,o,E){return a(),i("div",null,n)}const F=s(e,[["render",t]]);export{y as __pageData,F as default}; + return self.x * other.x + self.y * other.y + self.z * other.z

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

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

def __neg__(self)

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

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

Source code
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)

`,119),l=[e];function h(p,k,r,d,o,E){return a(),i("div",null,l)}const F=s(t,[["render",h]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js b/assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js new file mode 100644 index 0000000..365b150 --- /dev/null +++ b/assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js @@ -0,0 +1 @@ +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":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),t={name:"en/api/mp_math/vector.md"},e=n("",119),l=[e];function h(p,k,r,d,o,E){return a(),i("div",null,l)}const F=s(t,[["render",h]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_vector.md.Dk4b7P4S.lean.js b/assets/en_api_mp_math_vector.md.Dk4b7P4S.lean.js deleted file mode 100644 index d09bf07..0000000 --- a/assets/en_api_mp_math_vector.md.Dk4b7P4S.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),e={name:"en/api/mp_math/vector.md"},h=l("",130),n=[h];function t(p,k,r,d,o,E){return a(),i("div",null,n)}const F=s(e,[["render",t]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.DD5WCYA0.js b/assets/en_api_presets_model_index.md.gEUCj87b.js similarity index 86% rename from assets/en_api_presets_model_index.md.DD5WCYA0.js rename to assets/en_api_presets_model_index.md.gEUCj87b.js index 5b2b39f..7cfdfce 100644 --- a/assets/en_api_presets_model_index.md.DD5WCYA0.js +++ b/assets/en_api_presets_model_index.md.gEUCj87b.js @@ -1,4 +1,4 @@ -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":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n(`

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

Args:

radius:

density:

Source code
python
@staticmethod
+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":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

Source code
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -15,4 +15,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     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)]
`,8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.DD5WCYA0.lean.js b/assets/en_api_presets_model_index.md.gEUCj87b.lean.js similarity index 86% rename from assets/en_api_presets_model_index.md.DD5WCYA0.lean.js rename to assets/en_api_presets_model_index.md.gEUCj87b.lean.js index 951e976..2670e74 100644 --- a/assets/en_api_presets_model_index.md.DD5WCYA0.lean.js +++ b/assets/en_api_presets_model_index.md.gEUCj87b.lean.js @@ -1 +1 @@ -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":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n("",8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +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":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_angle.md.B0vK-3H7.lean.js b/assets/ja_api_mp_math_angle.md.B0vK-3H7.lean.js deleted file mode 100644 index b0fa464..0000000 --- a/assets/ja_api_mp_math_angle.md.B0vK-3H7.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/api/mp_math/angle.md"},n=l("",93),t=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/api_mp_math_angle.md.7ZvAVHFT.js b/assets/ja_api_mp_math_angle.md._xBKQuir.js similarity index 57% rename from assets/api_mp_math_angle.md.7ZvAVHFT.js rename to assets/ja_api_mp_math_angle.md._xBKQuir.js index 8294e09..e87acc2 100644 --- a/assets/api_mp_math_angle.md.7ZvAVHFT.js +++ b/assets/ja_api_mp_math_angle.md._xBKQuir.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"api/mp_math/angle.md"},n=l(`

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):
+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":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/api/mp_math/angle.md"},l=n(`

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:
@@ -8,94 +8,94 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const c
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

返回:

余角

源码
python
@property
+        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)

补角:两角的和为180°。

返回:

补角

源码
python
@property
+    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)

角度。

返回:

弧度

源码
python
@property
+    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)

最小正角。

返回:

最小正角度

源码
python
@property
+    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)

最大负角。

返回:

最大负角度

源码
python
@property
+    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)

正弦值。

返回:

正弦值

源码
python
@property
+    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)

余弦值。

返回:

余弦值

源码
python
@property
+    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)

正切值。

返回:

正切值

源码
python
@property
+    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)

余切值。

返回:

余切值

源码
python
@property
+    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)

正割值。

返回:

正割值

源码
python
@property
+    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)

余割值。

返回:

余割值

源码
python
@property
+    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')

源码
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')

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

源码
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
源码
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
源码
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...
  • def __truediv__(self, other)

源码
python
def __truediv__(self, other):
+    ...

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=[n];function h(p,k,r,d,o,y){return a(),i("div",null,t)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; + 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/ja_api_mp_math_angle.md._xBKQuir.lean.js b/assets/ja_api_mp_math_angle.md._xBKQuir.lean.js new file mode 100644 index 0000000..528de95 --- /dev/null +++ b/assets/ja_api_mp_math_angle.md._xBKQuir.lean.js @@ -0,0 +1 @@ +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":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/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/api_mp_math_equation.md.DcgE8elZ.js b/assets/ja_api_mp_math_equation.md.DVrOBmbN.js similarity index 69% rename from assets/api_mp_math_equation.md.DcgE8elZ.js rename to assets/ja_api_mp_math_equation.md.DVrOBmbN.js index 7e8e7cb..985f48d 100644 --- a/assets/api_mp_math_equation.md.DcgE8elZ.js +++ b/assets/ja_api_mp_math_equation.md.DVrOBmbN.js @@ -1,4 +1,4 @@ -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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n(`

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

参数:

func: 函数

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

epsilon: 偏移量

源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n(`

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

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

引数:

  • func: 函数

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

  • epsilon: 偏移量

ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -28,16 +28,16 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

源码
python
def partial_derivative_func(*args: Var) -> Var:
+        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()

源码
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    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):
+    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:
@@ -47,7 +47,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

参数:

*t:

参数:

源码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

引数:

  • *t:

  • 参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     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))])
源码
python
def __str__(self):
-    return 'CurveEquation()'
`,30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; + 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)

`,23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_equation.md.CxOZG3Ck.lean.js b/assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js similarity index 86% rename from assets/ja_api_mp_math_equation.md.CxOZG3Ck.lean.js rename to assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js index 7cdc0ef..8516d78 100644 --- a/assets/ja_api_mp_math_equation.md.CxOZG3Ck.lean.js +++ b/assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js @@ -1 +1 @@ -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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n("",30),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; +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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n("",23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_line.md.B_sNS7i2.js b/assets/ja_api_mp_math_line.md.B4_v4TOY.js similarity index 66% rename from assets/ja_api_mp_math_line.md.B_sNS7i2.js rename to assets/ja_api_mp_math_line.md.B4_v4TOY.js index ae66185..dec455b 100644 --- a/assets/ja_api_mp_math_line.md.B_sNS7i2.js +++ b/assets/ja_api_mp_math_line.md.B4_v4TOY.js @@ -1,4 +1,4 @@ -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":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},h=n(`

class Line3

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

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

引数:

point: 直线上的一点

direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+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":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n(`

class Line3

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

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

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

引数:

other: 另一条直线

epsilon: 误差

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    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:
@@ -15,7 +15,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

引数:

other: 另一条直线

ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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: 另一条直线
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -25,7 +25,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

引数:

other: 平行直线或点

ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

引数:

  • other: 平行直线或点
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -48,7 +48,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

计算两条直线的交点。

引数:

other: 另一条直线

ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

引数:

  • other: 另一条直线
ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

引数:

point: 指定点

ソースコード
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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:
@@ -71,7 +71,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

引数:

t: 参数t

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    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:
@@ -79,13 +79,13 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.point + t * self.direction
  • def get_parametric_equations(self)

获取直线的参数方程。

戻り値:

x(t), y(t), z(t)

ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    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)

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

引数:

other: 另一条直线

epsilon: 误差

ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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:
@@ -94,7 +94,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

引数:

other: 另一条直线

ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
+    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:
@@ -102,7 +102,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

引数:

other: 另一条直线

ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

引数:

  • other: 另一条直线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -110,7 +110,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)
  • def is_point_on(self, point: 'Point3')

判断点是否在直线上。

引数:

point: 点

ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
+    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:
@@ -118,7 +118,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

引数:

other: 另一条直线

ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
+    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。
@@ -127,7 +127,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0
  • def simplify(self)

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

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

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

ソースコード
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -140,7 +140,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

引数:

p1: 点1

p2: 点2

ソースコード
python
@classmethod
+        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':
     """
         工厂函数 由两点构造直线。
@@ -151,7 +151,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

引数:

other: 另一条直线

ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    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:
@@ -164,7 +164,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)
  • def __eq__(self, other)

判断两条直线是否等价。

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

引数:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,7 +175,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
ソースコード
python
def __str__(self):
+    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:
@@ -188,5 +188,5 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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
ソースコード
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,111),t=[h];function p(e,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; + return s

def __repr__(self)

ソースコード
python
def __repr__(self):
+    return f'Line3({self.point}, {self.direction})'
`,91),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/ja_api_mp_math_line.md.B_sNS7i2.lean.js b/assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js similarity index 57% rename from assets/ja_api_mp_math_line.md.B_sNS7i2.lean.js rename to assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js index 5f01760..fba677c 100644 --- a/assets/ja_api_mp_math_line.md.B_sNS7i2.lean.js +++ b/assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js @@ -1 +1 @@ -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":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},h=n("",111),t=[h];function p(e,k,r,d,o,F){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; +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":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n("",91),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/en_api_mp_math_plane.md.BRPMklJt.js b/assets/ja_api_mp_math_plane.md.BSSDxRzL.js similarity index 72% rename from assets/en_api_mp_math_plane.md.BRPMklJt.js rename to assets/ja_api_mp_math_plane.md.BSSDxRzL.js index 8c9bac1..572a682 100644 --- a/assets/en_api_mp_math_plane.md.BRPMklJt.js +++ b/assets/ja_api_mp_math_plane.md.BSSDxRzL.js @@ -1,4 +1,4 @@ -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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/api/mp_math/plane.md"},h=n(`

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])

class Plane3

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

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

Args:

a:

b:

c:

d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
+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":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/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

引数:

  • a:

  • b:

  • c:

  • d:

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -10,7 +10,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

Args:

other:

Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

引数:

  • other:
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -19,6 +19,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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)
@@ -29,7 +30,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

Args:

other: 另一个平面

Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

引数:

  • other: 另一个平面
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -44,7 +45,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

Args:

other: 另一个平面或点

Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

引数:

  • other: 另一个平面或点
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -59,7 +60,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

Args:

other: 另一个平面

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        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:
@@ -84,7 +85,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

计算平面与直线的交点。

Args:

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

Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -98,7 +99,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

Args:

point: 指定点

Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    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:
@@ -106,7 +107,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

Args:

other: 另一个平面

Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    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:
@@ -114,14 +115,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

Return:

法向量

Source code
python
@property
+    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')

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

Args:

point: 平面上的一点

normal: 法向量

Source code
python
@classmethod
+    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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -133,7 +134,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         """
     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')

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

Args:

p1: 点1

p2: 点2

p3: 点3

Source code
python
@classmethod
+    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':
     """
         工厂函数 由三点构造平面。
@@ -147,7 +148,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

Args:

l1: 直线1

l2: 直线2

Source code
python
@classmethod
+    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':
     """
         工厂函数 由两直线构造平面。
@@ -161,7 +162,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

Args:

point: 面上一点

line: 面上直线,不包含点

Source code
python
@classmethod
+    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':
     """
         工厂函数 由点和直线构造平面。
@@ -171,8 +172,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
Source code
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
Source code
python
def __str__(self):
+    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'
@@ -182,11 +183,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         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')

Source code
python
@overload
+    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')

Source code
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...
  • def __and__(self, other)

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

Args:

other:

Source code
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

引数:

  • other:
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -203,6 +204,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
             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)

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

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
`,115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; + 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])

`,100),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/ja_api_mp_math_plane.md.DoFcs9On.lean.js b/assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js similarity index 57% rename from assets/ja_api_mp_math_plane.md.DoFcs9On.lean.js rename to assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js index 2af19c1..51e2aa5 100644 --- a/assets/ja_api_mp_math_plane.md.DoFcs9On.lean.js +++ b/assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js @@ -1 +1 @@ -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.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n("",115),t=[h];function e(p,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{g as __pageData,y as default}; +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":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n("",100),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/ja_api_mp_math_point.md.DsWUjRQD.js b/assets/ja_api_mp_math_point.md.DsWUjRQD.js deleted file mode 100644 index e2b3a96..0000000 --- a/assets/ja_api_mp_math_point.md.DsWUjRQD.js +++ /dev/null @@ -1,41 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},n=l(`

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)

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

引数:

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])
ソースコード
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

ソースコード
python
@overload
-def __add__(self, other: 'Vector3') -> 'Point3':
-    ...
  • @overload

  • def __add__(self, other: '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)
`,34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const g=s(t,[["render",e]]);export{y as __pageData,g as default}; diff --git a/assets/ja_api_mp_math_point.md.DsWUjRQD.lean.js b/assets/ja_api_mp_math_point.md.DsWUjRQD.lean.js deleted file mode 100644 index 024986c..0000000 --- a/assets/ja_api_mp_math_point.md.DsWUjRQD.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},n=l("",34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const g=s(t,[["render",e]]);export{y as __pageData,g as default}; diff --git a/assets/api_mp_math_point.md.BhIb1HeT.js b/assets/ja_api_mp_math_point.md.DvD45PEI.js similarity index 51% rename from assets/api_mp_math_point.md.BhIb1HeT.js rename to assets/ja_api_mp_math_point.md.DvD45PEI.js index b8a33c2..e7f7681 100644 --- a/assets/api_mp_math_point.md.BhIb1HeT.js +++ b/assets/ja_api_mp_math_point.md.DvD45PEI.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},n=l(`

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):
+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":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},l=n(`

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:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Point3', epsilon: float = APPROX)

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

参数:

other:

epsilon:

源码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    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:
@@ -18,12 +18,12 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])
源码
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

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

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -31,11 +31,22 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y
             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):
+    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)
`,34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const g=s(t,[["render",e]]);export{y as __pageData,g as default}; + 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)
`,35),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/ja_api_mp_math_point.md.DvD45PEI.lean.js b/assets/ja_api_mp_math_point.md.DvD45PEI.lean.js new file mode 100644 index 0000000..836f83b --- /dev/null +++ b/assets/ja_api_mp_math_point.md.DvD45PEI.lean.js @@ -0,0 +1 @@ +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":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},l=n("",35),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/api_mp_math_segment.md.BpLgqrZ6.js b/assets/ja_api_mp_math_segment.md.oiONXysZ.js similarity index 72% rename from assets/api_mp_math_segment.md.BpLgqrZ6.js rename to assets/ja_api_mp_math_segment.md.oiONXysZ.js index e27ab68..3bea08e 100644 --- a/assets/api_mp_math_segment.md.BpLgqrZ6.js +++ b/assets/ja_api_mp_math_segment.md.oiONXysZ.js @@ -1,4 +1,4 @@ -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":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),h={name:"api/mp_math/segment.md"},t=n(`

class Segment3

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

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

源码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+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":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/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:
@@ -11,6 +11,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     '长度'
     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)
源码
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
源码
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
`,9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const o=s(h,[["render",e]]);export{y as __pageData,o as default}; + 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/ja_api_mp_math_segment.md.B3JRHboi.lean.js b/assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js similarity index 57% rename from assets/ja_api_mp_math_segment.md.B3JRHboi.lean.js rename to assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js index dff63b7..e0ff302 100644 --- a/assets/ja_api_mp_math_segment.md.B3JRHboi.lean.js +++ b/assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js @@ -1 +1 @@ -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":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),h={name:"ja/api/mp_math/segment.md"},t=n("",9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const o=s(h,[["render",e]]);export{y as __pageData,o as default}; +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":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/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/en_api_mp_math_utils.md.CoXbSyss.js b/assets/ja_api_mp_math_utils.md.Bc0yJ70T.js similarity index 68% rename from assets/en_api_mp_math_utils.md.CoXbSyss.js rename to assets/ja_api_mp_math_utils.md.Bc0yJ70T.js index 912aa02..29a33c0 100644 --- a/assets/en_api_mp_math_utils.md.CoXbSyss.js +++ b/assets/ja_api_mp_math_utils.md.Bc0yJ70T.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},h=n(`

def clamp()

区间截断函数。

Args:

x:

min_:

max_:

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
+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":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -9,7 +9,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

Args:

x:

y:

epsilon:

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    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:
@@ -20,7 +20,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False)

获取数的符号。

Args:

x: 数

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

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
+    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: 数
@@ -33,7 +33,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

Args:

x: 数

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

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        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
@@ -49,8 +49,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

  • def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
-    self.value = value
  • def __eq__(self, other)

Source code
python
def __eq__(self, other):
+        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
@@ -60,6 +60,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
         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)

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

Source code
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,35),t=[h];function e(p,k,r,d,F,E){return a(),i("div",null,t)}const y=s(l,[["render",e]]);export{o as __pageData,y as default}; + 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)
`,29),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/ja_api_mp_math_utils.md.CMaGJtHQ.lean.js b/assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js similarity index 85% rename from assets/ja_api_mp_math_utils.md.CMaGJtHQ.lean.js rename to assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js index fd6dddd..36c0189 100644 --- a/assets/ja_api_mp_math_utils.md.CMaGJtHQ.lean.js +++ b/assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js @@ -1 +1 @@ -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":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n("",35),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}; +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":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n("",29),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/ja_api_mp_math_vector.md.BaQ1gWXc.lean.js b/assets/ja_api_mp_math_vector.md.BaQ1gWXc.lean.js deleted file mode 100644 index 396f99e..0000000 --- a/assets/ja_api_mp_math_vector.md.BaQ1gWXc.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),h={name:"ja/api/mp_math/vector.md"},n=l("",130),e=[n];function t(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(h,[["render",t]]);export{g as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.BxisUL7s.js b/assets/ja_api_mp_math_vector.md.TVqfIGHG.js similarity index 64% rename from assets/api_mp_math_vector.md.BxisUL7s.js rename to assets/ja_api_mp_math_vector.md.TVqfIGHG.js index 834f3bf..59f6899 100644 --- a/assets/api_mp_math_vector.md.BxisUL7s.js +++ b/assets/ja_api_mp_math_vector.md.TVqfIGHG.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),h={name:"api/mp_math/vector.md"},n=l(`

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)

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):
+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":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),t={name:"ja/api/mp_math/vector.md"},l=n(`

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:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

参数:

other:

epsilon:

源码
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         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')

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

参数:

other: 另一个向量

源码
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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:
@@ -26,7 +26,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
  • def cross(self, other: 'Vector3')

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

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

源码
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -46,7 +46,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         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)

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

参数:

other: 另一个向量

epsilon: 允许的误差

源码
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -55,7 +55,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

参数:

other: 另一个向量

源码
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

引数:

  • other: 另一个向量
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)
  • def normalize(self)

将向量归一化。

自体归一化,不返回值。

源码
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
源码
python
@property
+    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)

向量的模。

返回:

源码
python
@property
+    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)

获取该向量的单位向量。

返回:

单位向量

源码
python
@property
+    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
源码
python
def __abs__(self):
-    return self.length
  • @overload

  • def __add__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

源码
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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
 
@@ -128,11 +128,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

源码
python
@overload
+    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')

源码
python
@overload
+    ...

@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):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

引数:

  • other:
ソースコード
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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'):
+        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:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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')

源码
python
@overload
+        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)

源码
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

参数:

other:

源码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,16 @@ import{_ as s,c as i,o as a,a2 as l}from"./chunks/framework.BV61Qrc0.js";const g
     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')

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

点乘。

参数:

other:

源码
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        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)

源码
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
源码
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
源码
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
源码
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
`,130),e=[n];function t(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(h,[["render",t]]);export{g as __pageData,F as default}; + 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)

`,119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js b/assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js new file mode 100644 index 0000000..f8188b5 --- /dev/null +++ b/assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js @@ -0,0 +1 @@ +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":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),t={name:"ja/api/mp_math/vector.md"},l=n("",119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.D4BAOCXn.js b/assets/ja_api_presets_model_index.md.DJGptHhw.js similarity index 86% rename from assets/ja_api_presets_model_index.md.D4BAOCXn.js rename to assets/ja_api_presets_model_index.md.DJGptHhw.js index 880ff0e..48011b0 100644 --- a/assets/ja_api_presets_model_index.md.D4BAOCXn.js +++ b/assets/ja_api_presets_model_index.md.DJGptHhw.js @@ -1,4 +1,4 @@ -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":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n(`

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

引数:

radius:

density:

ソースコード
python
@staticmethod
+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":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

ソースコード
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -15,4 +15,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     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)]
`,8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.D4BAOCXn.lean.js b/assets/ja_api_presets_model_index.md.DJGptHhw.lean.js similarity index 86% rename from assets/ja_api_presets_model_index.md.D4BAOCXn.lean.js rename to assets/ja_api_presets_model_index.md.DJGptHhw.lean.js index c43a674..a7af87a 100644 --- a/assets/ja_api_presets_model_index.md.D4BAOCXn.lean.js +++ b/assets/ja_api_presets_model_index.md.DJGptHhw.lean.js @@ -1 +1 @@ -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":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n("",8),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +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":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; diff --git a/en/api/index.html b/en/api/index.html index e1295bd..2e393ce 100644 --- a/en/api/index.html +++ b/en/api/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/en/api/mp_math/angle.html b/en/api/mp_math/angle.html index 73ec6fa..18e71a3 100644 --- a/en/api/mp_math/angle.html +++ b/en/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle

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

任意角度。

Args:

value: 角度或弧度值

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

Source code
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle

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

任意角度。

Args:

  • value: 角度或弧度值

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

Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,98 +27,98 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

Return:

余角

Source code
python
@property
+        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

Return:

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

  • def supplementary(self)

补角:两角的和为180°。

Return:

补角

Source code
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

Return:

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

  • def degree(self)

角度。

Return:

弧度

Source code
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

Return:

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

  • def minimum_positive(self)

最小正角。

Return:

最小正角度

Source code
python
@property
+    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

Return:

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

  • def maximum_negative(self)

最大负角。

Return:

最大负角度

Source code
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

Return:

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

  • def sin(self)

正弦值。

Return:

正弦值

Source code
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

Return:

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

  • def cos(self)

余弦值。

Return:

余弦值

Source code
python
@property
+    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

Return:

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

  • def tan(self)

正切值。

Return:

正切值

Source code
python
@property
+    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

Return:

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

  • def cot(self)

余切值。

Return:

余切值

Source code
python
@property
+    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

Return:

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

  • def sec(self)

正割值。

Return:

正割值

Source code
python
@property
+    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

Return:

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

  • def csc(self)

余割值。

Return:

余割值

Source code
python
@property
+    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

Return:

  • 余割值
Source code
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)
  • def __add__(self, other: 'AnyAngle')

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)
  • def __eq__(self, other)

Source code
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)
  • def __sub__(self, other: 'AnyAngle')

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)
  • def __mul__(self, other: float)

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
Source code
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
Source code
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

Source code
python
@overload
+    return 1 / math.sin(self.radian)

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

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

def __eq__(self, other)

Source code
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

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

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

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

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

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

Source code
python
def __str__(self):
+    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

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

Source code
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...
  • @overload

  • def __truediv__(self, other: 'AnyAngle')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...
  • def __truediv__(self, other)

Source code
python
def __truediv__(self, other):
+    ...

def __truediv__(self, other)

Source code
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/en/api/mp_math/const.html b/en/api/mp_math/const.html index 36f5882..c95d459 100644 --- a/en/api/mp_math/const.html +++ b/en/api/mp_math/const.html @@ -18,7 +18,7 @@
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/en/api/mp_math/equation.html b/en/api/mp_math/equation.html index 2f8c0bc..a80d592 100644 --- a/en/api/mp_math/equation.html +++ b/en/api/mp_math/equation.html @@ -12,12 +12,12 @@ - + -
Skip to content

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

Args:

func: 函数

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

epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

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

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

Args:

  • func: 函数

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

  • epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -47,16 +47,16 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

Source code
python
def partial_derivative_func(*args: Var) -> Var:
+        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

Source code
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()

Source code
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

Source code
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)

曲线方程。

Args:

x_func: x函数

y_func: y函数

z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    return result_func(*args)

class CurveEquation

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

曲线方程。

Args:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
     """
         曲线方程。
         Args:
@@ -66,7 +66,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

Args:

*t:

参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

Args:

  • *t:

  • 参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,9 @@
     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))])
Source code
python
def __str__(self):
-    return 'CurveEquation()'
- + 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)

Source code
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/en/api/mp_math/index.html b/en/api/mp_math/index.html index 66ade17..6ab6560 100644 --- a/en/api/mp_math/index.html +++ b/en/api/mp_math/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/en/api/mp_math/line.html b/en/api/mp_math/line.html index a7b9148..f778013 100644 --- a/en/api/mp_math/line.html +++ b/en/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

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

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

Args:

point: 直线上的一点

direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

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

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

Args:

  • point: 直线上的一点

  • direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

Args:

other: 另一条直线

epsilon: 误差

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -34,7 +34,7 @@
         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')

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

Args:

other: 另一条直线

Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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'

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

Args:

  • other: 另一条直线
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

Args:

other: 平行直线或点

Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

Args:

  • other: 平行直线或点
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     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')

计算两条直线的交点。

Args:

other: 另一条直线

Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

Args:

  • other: 另一条直线
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         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')

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

Args:

point: 指定点

Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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的垂线。

Args:

  • point: 指定点
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
     """
         计算直线经过指定点p的垂线。
         Args:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

Args:

t: 参数t

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

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

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

Args:

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

获取直线的参数方程。

Return:

x(t), y(t), z(t)

Source code
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

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

获取直线的参数方程。

Return:

  • x(t), y(t), z(t)
Source code
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)

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

Args:

other: 另一条直线

epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
     """
         判断两条直线是否近似平行。
         Args:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

Args:

other: 另一条直线

Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

Args:

  • other: 另一条直线
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

Args:

other: 另一条直线

Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

Args:

  • other: 另一条直线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -129,7 +129,7 @@
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)
  • def is_point_on(self, point: 'Point3')

判断点是否在直线上。

Args:

point: 点

Source code
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

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

判断点是否在直线上。

Args:

  • point: 点
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

Args:

other: 另一条直线

Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

Args:

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

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

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

Source code
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

Source code
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     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')

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

Args:

p1: 点1

p2: 点2

Source code
python
@classmethod
+        self.point.z = 0

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

Source code
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

Args:

other: 另一条直线

Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

Args:

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

判断两条直线是否等价。

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

Args:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

Args:

  • other:
Source code
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,7 +194,7 @@
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
Source code
python
def __str__(self):
+    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

Source code
python
def __str__(self):
     """
         返回点向式(x-x0)
         Returns:
@@ -207,9 +207,9 @@
         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
Source code
python
def __repr__(self):
+    return s

def __repr__(self)

Source code
python
def __repr__(self):
     return f'Line3({self.point}, {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 da44311..c64e780 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: 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/en/api/mp_math/plane.html b/en/api/mp_math/plane.html index 5546560..40dcd83 100644 --- a/en/api/mp_math/plane.html +++ b/en/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

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])

class Plane3

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

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

Args:

a:

b:

c:

d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

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

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

Args:

  • a:

  • b:

  • c:

  • d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -29,7 +29,7 @@
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

Args:

other:

Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

Args:

  • other:
Source code
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -38,6 +38,7 @@
         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)
@@ -48,7 +49,7 @@
         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')

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

Args:

other: 另一个平面

Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -63,7 +64,7 @@
     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')

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

Args:

other: 另一个平面或点

Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面或点
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -78,7 +79,7 @@
     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')

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

Args:

other: 另一个平面

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -103,7 +104,7 @@
         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')

计算平面与直线的交点。

Args:

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

Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -117,7 +118,7 @@
         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')

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

Args:

point: 指定点

Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

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

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

Args:

  • point: 指定点
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -125,7 +126,7 @@
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

Args:

other: 另一个平面

Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

Args:

  • other: 另一个平面
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -133,14 +134,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

Return:

法向量

Source code
python
@property
+    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

Return:

  • 法向量
Source code
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')

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

Args:

point: 平面上的一点

normal: 法向量

Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

Args:

  • point: 平面上的一点

  • normal: 法向量

Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -152,7 +153,7 @@
         """
     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')

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

Args:

p1: 点1

p2: 点2

p3: 点3

Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -166,7 +167,7 @@
     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')

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

Args:

l1: 直线1

l2: 直线2

Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

Args:

  • l1: 直线1

  • l2: 直线2

Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -180,7 +181,7 @@
     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')

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

Args:

point: 面上一点

line: 面上直线,不包含点

Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

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

Args:

  • point: 面上一点

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

Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -190,8 +191,8 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
Source code
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
Source code
python
def __str__(self):
+    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

Source code
python
def __str__(self):
     s = 'Plane3: '
     if self.a != 0:
         s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
@@ -201,11 +202,11 @@
         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')

Source code
python
@overload
+    return s + ' = 0'

@overload

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

Source code
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...
  • @overload

  • def __and__(self, other: 'Plane3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...
  • def __and__(self, other)

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

Args:

other:

Source code
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

Args:

  • other:
Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -222,10 +223,10 @@
             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)

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

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
- + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

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

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

Source code
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/en/api/mp_math/point.html b/en/api/mp_math/point.html index d3c2674..bc98769 100644 --- a/en/api/mp_math/point.html +++ b/en/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

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

笛卡尔坐标系中的点。

Args:

x: x 坐标

y: y 坐标

z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

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

笛卡尔坐标系中的点。

Args:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Point3', epsilon: float = APPROX)

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

Args:

other:

epsilon:

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

Args:

  • other:

  • epsilon:

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,12 +37,12 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])
Source code
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

Source code
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

Source code
python
def __str__(self):
+    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...
  • @overload

  • def __add__(self, other: 'Point3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __add__(self, other)

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

Args:

other:

Source code
python
def __add__(self, other):
+    ...

def __add__(self, other)

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

Args:

  • other:
Source code
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -50,15 +50,26 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • def __eq__(self, other)

判断两个点是否相等。

Args:

other:

Source code
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

Args:

  • other:
Source code
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)
- + 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 中实现

Args:

  • other:
Source code
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/en/api/mp_math/segment.html b/en/api/mp_math/segment.html index 128ade9..52ca0ba 100644 --- a/en/api/mp_math/segment.html +++ b/en/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

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

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

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

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -30,10 +30,10 @@
     '长度'
     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)
Source code
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
Source code
python
def __str__(self):
+    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)

Source code
python
def __repr__(self):
+    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

Source code
python
def __str__(self):
     return f'Segment3({self.p1} -> {self.p2})'
- + \ No newline at end of file diff --git a/en/api/mp_math/utils.html b/en/api/mp_math/utils.html index fe684e7..48e7a19 100644 --- a/en/api/mp_math/utils.html +++ b/en/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp()

区间截断函数。

Args:

x:

min_:

max_:

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -28,7 +28,7 @@
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

Args:

x:

y:

epsilon:

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

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

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

Args:

  • x:

  • y:

  • epsilon:

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

def sign(x: float = False)

获取数的符号。

Args:

x: 数

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

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

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

获取数的符号。

Args:

  • x: 数

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

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +52,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

Args:

x: 数

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

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

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

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

Args:

  • x: 数

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

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -68,8 +68,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

  • def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
-    self.value = value
  • def __eq__(self, other)

Source code
python
def __eq__(self, other):
+        return ''

class Approx

def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
+    self.value = value

def __eq__(self, other)

Source code
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -79,10 +79,10 @@
         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)

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

Source code
python
def __ne__(self, other):
+            self.raise_type_error(other)

def 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)}')

def __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 1650a99..602a31e 100644 --- a/en/api/mp_math/vector.html +++ b/en/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

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)

class Vector3

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

3维向量

Args:

x: x轴分量

y: y轴分量

z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Vector3

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

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

Args:

other:

epsilon:

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

Args:

  • other:

  • epsilon:

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -37,7 +37,7 @@
         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')

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

Args:

other: 另一个向量

Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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'

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

Args:

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

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

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

Source code
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         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)

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

Args:

other: 另一个向量

epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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

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

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

Args:

other: 另一个向量

Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

Args:

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

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
Source code
python
@property
+    self.z /= length

@property

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

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

  • def length(self)

向量的模。

Return:

Source code
python
@property
+    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

Return:

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

  • def unit(self)

获取该向量的单位向量。

Return:

单位向量

Source code
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

Return:

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

  • def __add__(self, other: 'Vector3')

Source code
python
@overload
+    return self / self.length

def __abs__(self)

Source code
python
def __abs__(self):
+    return self.length

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __add__(self, other: 'Point3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __add__(self, other)

V + P -> P

V + V -> V

Args:

other:

Source code
python
def __add__(self, other):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

Args:

  • other:
Source code
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     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)

判断两个向量是否相等。

Args:

other:

Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:
Source code
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -139,7 +139,7 @@
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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:

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

Source code
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

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

Source code
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __sub__(self, other: 'Point3')

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...
  • def __sub__(self, other)

V - P -> P

V - V -> V

Args:

other:

Source code
python
def __sub__(self, other):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

Args:

  • other:
Source code
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     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

Args:

other:

Source code
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

Args:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -176,11 +176,11 @@
     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')

Source code
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

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

Source code
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...
  • @overload

  • def __mul__(self, other: RealNumber)

Source code
python
@overload
+    ...

@overload

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

Source code
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

Args:

other:

Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

Args:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,20 @@
     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')

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)
  • def __matmul__(self, other: 'Vector3')

点乘。

Args:

other:

Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

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

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

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

点乘。

Args:

  • other:
Source code
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)

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
Source code
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
Source code
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
Source code
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
- + return self.x * other.x + self.y * other.y + self.z * other.z

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

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

def __neg__(self)

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

def __repr__(self)

Source code
python
def __repr__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

Source code
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/en/api/particle/index.html b/en/api/particle/index.html index 26c1b03..c5d095d 100644 --- a/en/api/particle/index.html +++ b/en/api/particle/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/en/api/presets/index.html b/en/api/presets/index.html index 2d54599..d2813a6 100644 --- a/en/api/presets/index.html +++ b/en/api/presets/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/en/api/presets/model/index.html b/en/api/presets/model/index.html index d476ce7..003c338 100644 --- a/en/api/presets/model/index.html +++ b/en/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

Args:

radius:

density:

Source code
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

Source code
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -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/hashmap.json b/hashmap.json index 156b8a3..76644d7 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"7ZvAVHFT","api_mp_math_const.md":"Bc1LxtcU","api_mp_math_equation.md":"DcgE8elZ","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"CPz5W_V9","api_mp_math_mp_math_typing.md":"BHJOAxTl","api_mp_math_plane.md":"B7Mh7SKE","api_mp_math_point.md":"BhIb1HeT","api_mp_math_segment.md":"BpLgqrZ6","api_mp_math_utils.md":"BgmONBdf","api_mp_math_vector.md":"BxisUL7s","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"O3tM1JKS","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"Cpkg14Nd","en_api_mp_math_const.md":"DfcWuGeV","en_api_mp_math_equation.md":"BEubflOs","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"JAqG1sD6","en_api_mp_math_mp_math_typing.md":"Dh1by9kw","en_api_mp_math_plane.md":"BRPMklJt","en_api_mp_math_point.md":"D_AsGf3x","en_api_mp_math_segment.md":"CRs1-Itg","en_api_mp_math_utils.md":"CoXbSyss","en_api_mp_math_vector.md":"Dk4b7P4S","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"DD5WCYA0","index.md":"CJvRmMfL","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"B0vK-3H7","ja_api_mp_math_const.md":"CQY-Qdbh","ja_api_mp_math_equation.md":"CxOZG3Ck","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"B_sNS7i2","ja_api_mp_math_mp_math_typing.md":"CeASNaiE","ja_api_mp_math_plane.md":"DoFcs9On","ja_api_mp_math_point.md":"DsWUjRQD","ja_api_mp_math_segment.md":"B3JRHboi","ja_api_mp_math_utils.md":"CMaGJtHQ","ja_api_mp_math_vector.md":"BaQ1gWXc","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"D4BAOCXn","md-ex.md":"BX0WqOqv"} +{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"DKMXAFbW","api_mp_math_const.md":"Bc1LxtcU","api_mp_math_equation.md":"BXP6BUSg","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"CzpblksR","api_mp_math_mp_math_typing.md":"BHJOAxTl","api_mp_math_plane.md":"CZDq9vG4","api_mp_math_point.md":"BJ9u2OpE","api_mp_math_segment.md":"B0wRl0bP","api_mp_math_utils.md":"DPDde5hx","api_mp_math_vector.md":"BBiKQwmG","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"BNeuRwjr","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DYZo7hBD","en_api_mp_math_const.md":"DfcWuGeV","en_api_mp_math_equation.md":"Bsq2lQHW","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"CP3RuJkk","en_api_mp_math_mp_math_typing.md":"Dh1by9kw","en_api_mp_math_plane.md":"eYXZ3wvh","en_api_mp_math_point.md":"DNEIRDFB","en_api_mp_math_segment.md":"CUQFMm0Q","en_api_mp_math_utils.md":"D6PiZ35J","en_api_mp_math_vector.md":"BaY0-PMv","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"gEUCj87b","index.md":"CJvRmMfL","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"_xBKQuir","ja_api_mp_math_const.md":"CQY-Qdbh","ja_api_mp_math_equation.md":"DVrOBmbN","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"B4_v4TOY","ja_api_mp_math_mp_math_typing.md":"CeASNaiE","ja_api_mp_math_plane.md":"BSSDxRzL","ja_api_mp_math_point.md":"DvD45PEI","ja_api_mp_math_segment.md":"oiONXysZ","ja_api_mp_math_utils.md":"Bc0yJ70T","ja_api_mp_math_vector.md":"TVqfIGHG","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"DJGptHhw","md-ex.md":"BX0WqOqv"} diff --git a/index.html b/index.html index 355d7b1..1b00cc2 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 5f5fbc1..f5baa2c 100644 --- a/ja/api/index.html +++ b/ja/api/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/ja/api/mp_math/angle.html b/ja/api/mp_math/angle.html index 14a4320..387cf9f 100644 --- a/ja/api/mp_math/angle.html +++ b/ja/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
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):
+    
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:
@@ -27,98 +27,98 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180
  • @property

  • def complementary(self)

余角:两角的和为90°。

戻り値:

余角

ソースコード
python
@property
+        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)

补角:两角的和为180°。

戻り値:

补角

ソースコード
python
@property
+    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)

角度。

戻り値:

弧度

ソースコード
python
@property
+    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)

最小正角。

戻り値:

最小正角度

ソースコード
python
@property
+    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)

最大负角。

戻り値:

最大负角度

ソースコード
python
@property
+    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)

正弦值。

戻り値:

正弦值

ソースコード
python
@property
+    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)

余弦值。

戻り値:

余弦值

ソースコード
python
@property
+    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)

正切值。

戻り値:

正切值

ソースコード
python
@property
+    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)

余切值。

戻り値:

余切值

ソースコード
python
@property
+    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)

正割值。

戻り値:

正割值

ソースコード
python
@property
+    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)

余割值。

戻り値:

余割值

ソースコード
python
@property
+    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')

ソースコード
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')

ソースコード
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)
  • def __mul__(self, other: float)

ソースコード
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)
ソースコード
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'
ソースコード
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'
  • @overload

  • def __truediv__(self, other: float)

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...
  • def __truediv__(self, other)

ソースコード
python
def __truediv__(self, other):
+    ...

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/ja/api/mp_math/const.html b/ja/api/mp_math/const.html index b21d096..ac360ae 100644 --- a/ja/api/mp_math/const.html +++ b/ja/api/mp_math/const.html @@ -18,7 +18,7 @@
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/ja/api/mp_math/equation.html b/ja/api/mp_math/equation.html index 2a8d9cc..5d11ea7 100644 --- a/ja/api/mp_math/equation.html +++ b/ja/api/mp_math/equation.html @@ -12,12 +12,12 @@ - + -
Skip to content

var result_func = get_partial_derivative_func(result_func, v, epsilon)

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON)

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

引数:

func: 函数

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

epsilon: 偏移量

ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

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

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

引数:

  • func: 函数

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

  • epsilon: 偏移量

ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -47,16 +47,16 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func()

ソースコード
python
def partial_derivative_func(*args: Var) -> Var:
+        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()

ソースコード
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    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):
+    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:
@@ -66,7 +66,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func
  • def __call__(self)

计算曲线上的点。

引数:

*t:

参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

引数:

  • *t:

  • 参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,9 @@
     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))])
ソースコード
python
def __str__(self):
-    return 'CurveEquation()'
- + 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/ja/api/mp_math/index.html b/ja/api/mp_math/index.html index b6e2ac9..7a682ca 100644 --- a/ja/api/mp_math/index.html +++ b/ja/api/mp_math/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/ja/api/mp_math/line.html b/ja/api/mp_math/line.html index dff5329..cf2b030 100644 --- a/ja/api/mp_math/line.html +++ b/ja/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

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

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

引数:

point: 直线上的一点

direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

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

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

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction
  • def approx(self, other: 'Line3', epsilon: float = APPROX)

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

引数:

other: 另一条直线

epsilon: 误差

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    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:
@@ -34,7 +34,7 @@
         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')

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

引数:

other: 另一条直线

ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    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: 另一条直线
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)
  • def cal_distance(self, other: 'Line3 | Point3')

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

引数:

other: 平行直线或点

ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

引数:

  • other: 平行直线或点
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     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')

计算两条直线的交点。

引数:

other: 另一条直线

ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

引数:

  • other: 另一条直线
ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         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')

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

引数:

point: 指定点

ソースコード
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    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:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))
  • def get_point(self, t: RealNumber)

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

引数:

t: 参数t

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    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:
@@ -98,13 +98,13 @@
         Returns:
 
         """
-    return self.point + t * self.direction
  • def get_parametric_equations(self)

获取直线的参数方程。

戻り値:

x(t), y(t), z(t)

ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    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)

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

引数:

other: 另一条直线

epsilon: 误差

ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    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:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)
  • def is_parallel(self, other: 'Line3')

判断两条直线是否平行。

引数:

other: 另一条直线

ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
+    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:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)
  • def is_collinear(self, other: 'Line3')

判断两条直线是否共线。

引数:

other: 另一条直线

ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

引数:

  • other: 另一条直线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -129,7 +129,7 @@
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)
  • def is_point_on(self, point: 'Point3')

判断点是否在直线上。

引数:

point: 点

ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
+    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:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)
  • def is_coplanar(self, other: 'Line3')

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

引数:

other: 另一条直线

ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
+    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。
@@ -146,7 +146,7 @@
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0
  • def simplify(self)

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

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

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

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

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

ソースコード
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     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')

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

引数:

p1: 点1

p2: 点2

ソースコード
python
@classmethod
+        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':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)
  • def __and__(self, other: 'Line3')

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

引数:

other: 另一条直线

ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    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:
@@ -183,7 +183,7 @@
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)
  • def __eq__(self, other)

判断两条直线是否等价。

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

引数:

other:

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

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,7 +194,7 @@
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
ソースコード
python
def __str__(self):
+    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:
@@ -207,9 +207,9 @@
         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
ソースコード
python
def __repr__(self):
+    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/ja/api/mp_math/mp_math_typing.html b/ja/api/mp_math/mp_math_typing.html index cbcd608..b1fd838 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: 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/ja/api/mp_math/plane.html b/ja/api/mp_math/plane.html index aeda391..ed81def 100644 --- a/ja/api/mp_math/plane.html +++ b/ja/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

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])

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):
+    
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:
@@ -29,7 +29,7 @@
     self.a = a
     self.b = b
     self.c = c
-    self.d = d
  • def approx(self, other: 'Plane3')

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

引数:

other:

ソースコード
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

引数:

  • other:
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -38,6 +38,7 @@
         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)
@@ -48,7 +49,7 @@
         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')

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

引数:

other: 另一个平面

ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

引数:

  • other: 另一个平面
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -63,7 +64,7 @@
     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')

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

引数:

other: 另一个平面或点

ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

引数:

  • other: 另一个平面或点
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -78,7 +79,7 @@
     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')

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

引数:

other: 另一个平面

ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        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:
@@ -103,7 +104,7 @@
         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')

计算平面与直线的交点。

引数:

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

ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -117,7 +118,7 @@
         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')

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

引数:

point: 指定点

ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    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:
@@ -125,7 +126,7 @@
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)
  • def is_parallel(self, other: 'Plane3')

判断两个平面是否平行。

引数:

other: 另一个平面

ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
+    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:
@@ -133,14 +134,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)
  • @property

  • def normal(self)

平面的法向量。

戻り値:

法向量

ソースコード
python
@property
+    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')

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

引数:

point: 平面上的一点

normal: 法向量

ソースコード
python
@classmethod
+    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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -152,7 +153,7 @@
         """
     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')

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

引数:

p1: 点1

p2: 点2

p3: 点3

ソースコード
python
@classmethod
+    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':
     """
         工厂函数 由三点构造平面。
@@ -166,7 +167,7 @@
     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')

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

引数:

l1: 直线1

l2: 直线2

ソースコード
python
@classmethod
+    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':
     """
         工厂函数 由两直线构造平面。
@@ -180,7 +181,7 @@
     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')

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

引数:

point: 面上一点

line: 面上直线,不包含点

ソースコード
python
@classmethod
+    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':
     """
         工厂函数 由点和直线构造平面。
@@ -190,8 +191,8 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)
ソースコード
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'
ソースコード
python
def __str__(self):
+    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'
@@ -201,11 +202,11 @@
         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')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...
  • def __and__(self, other)

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

引数:

other:

ソースコード
python
def __and__(self, other):
+    ...

def __and__(self, other)

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

引数:

  • other:
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -222,10 +223,10 @@
             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)

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

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
- + 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/ja/api/mp_math/point.html b/ja/api/mp_math/point.html index cf36822..5e3592f 100644 --- a/ja/api/mp_math/point.html +++ b/ja/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
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):
+    
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:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Point3', epsilon: float = APPROX)

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

引数:

other:

epsilon:

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    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:
@@ -37,12 +37,12 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])
ソースコード
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'
  • @overload

  • def __add__(self, other: 'Vector3')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

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

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -50,15 +50,26 @@
             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):
+    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)
- + 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/ja/api/mp_math/segment.html b/ja/api/mp_math/segment.html index 093c1ac..82d9f09 100644 --- a/ja/api/mp_math/segment.html +++ b/ja/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

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

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

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
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:
@@ -30,10 +30,10 @@
     '长度'
     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)
ソースコード
python
def __repr__(self):
-    return f'Segment3({self.p1}, {self.p2})'
ソースコード
python
def __str__(self):
+    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/ja/api/mp_math/utils.html b/ja/api/mp_math/utils.html index 9512ffa..ba59a9e 100644 --- a/ja/api/mp_math/utils.html +++ b/ja/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp()

区间截断函数。

引数:

x:

min_:

max_:

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -28,7 +28,7 @@
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

引数:

x:

y:

epsilon:

ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    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:
@@ -39,7 +39,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False)

获取数的符号。

引数:

x: 数

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

ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
+    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: 数
@@ -52,7 +52,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False)

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

引数:

x: 数

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

ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        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
@@ -68,8 +68,8 @@
     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):
+        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
@@ -79,10 +79,10 @@
         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):
+            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/ja/api/mp_math/vector.html b/ja/api/mp_math/vector.html index 3c1dd2b..766af14 100644 --- a/ja/api/mp_math/vector.html +++ b/ja/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

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)

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):
+    
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:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z
  • def approx(self, other: 'Vector3', epsilon: float = APPROX)

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

引数:

other:

epsilon:

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -37,7 +37,7 @@
         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')

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

引数:

other: 另一个向量

ソースコード
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    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:
@@ -45,7 +45,7 @@
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)
  • def cross(self, other: 'Vector3')

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

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

ソースコード
python
def cross(self, other: 'Vector3') -> '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,则两向量平行。 其余结果的模为平行四边形的面积。

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         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)

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

引数:

other: 另一个向量

epsilon: 允许的误差

ソースコード
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    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:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon
  • def is_parallel(self, other: 'Vector3')

判断两个向量是否平行。

引数:

other: 另一个向量

ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

引数:

  • other: 另一个向量
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -82,7 +82,7 @@
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)
  • def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length
ソースコード
python
@property
+    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)

向量的模。

戻り値:

ソースコード
python
@property
+    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)

获取该向量的单位向量。

戻り値:

单位向量

ソースコード
python
@property
+    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
ソースコード
python
def __abs__(self):
-    return self.length
  • @overload

  • def __add__(self, other: 'Vector3')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@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):
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     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):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -139,7 +139,7 @@
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
  • def __radd__(self, other: 'Point3')

P + V -> P

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

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    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
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
  • @overload

  • def __sub__(self, other: 'Vector3')

ソースコード
python
@overload
+    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')

ソースコード
python
@overload
+    ...

@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):
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

引数:

  • other:
ソースコード
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     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'):
+        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:
@@ -176,11 +176,11 @@
     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')

ソースコード
python
@overload
+        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)

ソースコード
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...
  • def __mul__(self, other: 'int | float | Vector3')

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

引数:

other:

ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

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

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

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,20 @@
     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')

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)
  • def __matmul__(self, other: 'Vector3')

点乘。

引数:

other:

ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        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)

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)
ソースコード
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)
ソースコード
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
ソースコード
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'
- + 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/ja/api/particle/index.html b/ja/api/particle/index.html index 38c2eae..bac07d5 100644 --- a/ja/api/particle/index.html +++ b/ja/api/particle/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/ja/api/presets/index.html b/ja/api/presets/index.html index a59b646..8a82656 100644 --- a/ja/api/presets/index.html +++ b/ja/api/presets/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/ja/api/presets/model/index.html b/ja/api/presets/model/index.html index 635af05..60bb1f2 100644 --- a/ja/api/presets/model/index.html +++ b/ja/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

  • @staticmethod

  • def sphere(radius: float, density: float)

生成球体上的点集。

引数:

radius:

density:

ソースコード
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

ソースコード
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -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 b7fe31a..3ab7f1e 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