From fdae033b0c552e756c8e240d05f08a708ce97b97 Mon Sep 17 00:00:00 2001 From: snowykami Date: Thu, 29 Aug 2024 10:31:08 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20snowykami/mb?= =?UTF-8?q?cp@807a240c49cb926ea47e4587deee4f1cb04092b6=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 | 42 +++++++------- api/mp_math/const.html | 2 +- api/mp_math/equation.html | 13 +++-- api/mp_math/index.html | 2 +- api/mp_math/line.html | 38 ++++++------ api/mp_math/mp_math_typing.html | 2 +- api/mp_math/plane.html | 40 ++++++------- api/mp_math/point.html | 18 +++--- api/mp_math/segment.html | 6 +- api/mp_math/utils.html | 20 +++---- api/mp_math/vector.html | 58 +++++++++---------- api/particle/index.html | 2 +- api/presets/index.html | 2 +- api/presets/model/index.html | 6 +- ...6o.js => api_mp_math_angle.md.eAy7w1HN.js} | 38 ++++++------ ... => api_mp_math_angle.md.eAy7w1HN.lean.js} | 0 ...js => api_mp_math_equation.md.Cug6-NqN.js} | 11 ++-- ... api_mp_math_equation.md.Cug6-NqN.lean.js} | 2 +- ...Pr1.js => api_mp_math_line.md.DsJQDchM.js} | 36 ++++++------ ...s => api_mp_math_line.md.DsJQDchM.lean.js} | 2 +- ...NP.js => api_mp_math_plane.md.CmoVvPiw.js} | 36 ++++++------ ... => api_mp_math_plane.md.CmoVvPiw.lean.js} | 0 ...uz.js => api_mp_math_point.md.ClJD85mP.js} | 14 ++--- ... => api_mp_math_point.md.ClJD85mP.lean.js} | 0 ....js => api_mp_math_segment.md.7jBtS4F1.js} | 2 +- ...> api_mp_math_segment.md.7jBtS4F1.lean.js} | 0 ...Us.js => api_mp_math_utils.md.BMwtm7TJ.js} | 18 +++--- ... => api_mp_math_utils.md.BMwtm7TJ.lean.js} | 2 +- ...T.js => api_mp_math_vector.md.CROCIDXX.js} | 56 +++++++++--------- ...=> api_mp_math_vector.md.CROCIDXX.lean.js} | 2 +- ...=> api_presets_model_index.md.DUZx13AW.js} | 4 +- ...i_presets_model_index.md.DUZx13AW.lean.js} | 2 +- ...js => en_api_mp_math_angle.md.BuhpKHnt.js} | 40 ++++++------- ... en_api_mp_math_angle.md.BuhpKHnt.lean.js} | 2 +- ...=> en_api_mp_math_equation.md.YQDGr03a.js} | 11 ++-- ..._api_mp_math_equation.md.YQDGr03a.lean.js} | 2 +- ....js => en_api_mp_math_line.md.BEvxdWYQ.js} | 34 +++++------ ...> en_api_mp_math_line.md.BEvxdWYQ.lean.js} | 0 ...js => en_api_mp_math_plane.md.DUu9P3nM.js} | 38 ++++++------ ... en_api_mp_math_plane.md.DUu9P3nM.lean.js} | 2 +- ...js => en_api_mp_math_point.md.DMig0FI1.js} | 14 ++--- ... en_api_mp_math_point.md.DMig0FI1.lean.js} | 0 ... => en_api_mp_math_segment.md.CcaokAF8.js} | 2 +- ...n_api_mp_math_segment.md.CcaokAF8.lean.js} | 0 ...js => en_api_mp_math_utils.md.DZohqw2b.js} | 18 +++--- ... en_api_mp_math_utils.md.DZohqw2b.lean.js} | 0 ...s => en_api_mp_math_vector.md.Sd_IZsgE.js} | 56 +++++++++--------- ...en_api_mp_math_vector.md.Sd_IZsgE.lean.js} | 2 +- ...en_api_presets_model_index.md.Cs8vON2C.js} | 4 +- ...i_presets_model_index.md.Cs8vON2C.lean.js} | 2 +- ...js => ja_api_mp_math_angle.md.DL9J6RE2.js} | 40 ++++++------- ... ja_api_mp_math_angle.md.DL9J6RE2.lean.js} | 0 ...=> ja_api_mp_math_equation.md.tmRhsqm6.js} | 11 ++-- ..._api_mp_math_equation.md.tmRhsqm6.lean.js} | 2 +- ....js => ja_api_mp_math_line.md.fj-_s5Ug.js} | 36 ++++++------ ...> ja_api_mp_math_line.md.fj-_s5Ug.lean.js} | 2 +- ...js => ja_api_mp_math_plane.md.yLekgCvK.js} | 36 ++++++------ ... ja_api_mp_math_plane.md.yLekgCvK.lean.js} | 0 ...js => ja_api_mp_math_point.md.CpHHrSk8.js} | 14 ++--- ... ja_api_mp_math_point.md.CpHHrSk8.lean.js} | 0 ... => ja_api_mp_math_segment.md.CB1_z-rn.js} | 2 +- ...a_api_mp_math_segment.md.CB1_z-rn.lean.js} | 0 ...js => ja_api_mp_math_utils.md.BrfEEfl-.js} | 18 +++--- ... ja_api_mp_math_utils.md.BrfEEfl-.lean.js} | 2 +- ...s => ja_api_mp_math_vector.md.p54TKACE.js} | 56 +++++++++--------- ...ja_api_mp_math_vector.md.p54TKACE.lean.js} | 2 +- ...ja_api_presets_model_index.md.D8yZmO5R.js} | 4 +- ...i_presets_model_index.md.D8yZmO5R.lean.js} | 2 +- ...s => zht_api_mp_math_angle.md.B4T6L25M.js} | 38 ++++++------ ...zht_api_mp_math_angle.md.B4T6L25M.lean.js} | 0 ...> zht_api_mp_math_equation.md.5p50czv3.js} | 11 ++-- ..._api_mp_math_equation.md.5p50czv3.lean.js} | 2 +- ...js => zht_api_mp_math_line.md.DYC1X0oD.js} | 36 ++++++------ ... zht_api_mp_math_line.md.DYC1X0oD.lean.js} | 2 +- ...s => zht_api_mp_math_plane.md.B6GWRRF6.js} | 38 ++++++------ ...zht_api_mp_math_plane.md.B6GWRRF6.lean.js} | 0 ...s => zht_api_mp_math_point.md.Bm1IEwlI.js} | 14 ++--- ...zht_api_mp_math_point.md.Bm1IEwlI.lean.js} | 0 ...=> zht_api_mp_math_segment.md.Bop8t2IE.js} | 2 +- ...t_api_mp_math_segment.md.Bop8t2IE.lean.js} | 0 ...s => zht_api_mp_math_utils.md.CERv8c-M.js} | 18 +++--- ...zht_api_mp_math_utils.md.CERv8c-M.lean.js} | 2 +- ... => zht_api_mp_math_vector.md.BTWxlpB1.js} | 56 +++++++++--------- ...ht_api_mp_math_vector.md.BTWxlpB1.lean.js} | 2 +- ...ht_api_presets_model_index.md.SQ5PPdaL.js} | 4 +- ...i_presets_model_index.md.SQ5PPdaL.lean.js} | 2 +- en/api/index.html | 2 +- en/api/mp_math/angle.html | 42 +++++++------- en/api/mp_math/const.html | 2 +- en/api/mp_math/equation.html | 13 +++-- en/api/mp_math/index.html | 2 +- en/api/mp_math/line.html | 38 ++++++------ en/api/mp_math/mp_math_typing.html | 2 +- en/api/mp_math/plane.html | 40 ++++++------- en/api/mp_math/point.html | 18 +++--- en/api/mp_math/segment.html | 6 +- en/api/mp_math/utils.html | 20 +++---- en/api/mp_math/vector.html | 58 +++++++++---------- en/api/particle/index.html | 2 +- en/api/presets/index.html | 2 +- en/api/presets/model/index.html | 6 +- guide/index.html | 2 +- hashmap.json | 2 +- index.html | 2 +- ja/api/index.html | 2 +- ja/api/mp_math/angle.html | 42 +++++++------- ja/api/mp_math/const.html | 2 +- ja/api/mp_math/equation.html | 13 +++-- ja/api/mp_math/index.html | 2 +- ja/api/mp_math/line.html | 38 ++++++------ ja/api/mp_math/mp_math_typing.html | 2 +- ja/api/mp_math/plane.html | 40 ++++++------- ja/api/mp_math/point.html | 18 +++--- ja/api/mp_math/segment.html | 6 +- ja/api/mp_math/utils.html | 20 +++---- ja/api/mp_math/vector.html | 58 +++++++++---------- ja/api/particle/index.html | 2 +- ja/api/presets/index.html | 2 +- ja/api/presets/model/index.html | 6 +- md-ex.html | 2 +- zht/api/index.html | 2 +- zht/api/mp_math/angle.html | 42 +++++++------- zht/api/mp_math/const.html | 2 +- zht/api/mp_math/equation.html | 13 +++-- zht/api/mp_math/index.html | 2 +- zht/api/mp_math/line.html | 38 ++++++------ zht/api/mp_math/mp_math_typing.html | 2 +- zht/api/mp_math/plane.html | 40 ++++++------- zht/api/mp_math/point.html | 18 +++--- zht/api/mp_math/segment.html | 6 +- zht/api/mp_math/utils.html | 20 +++---- zht/api/mp_math/vector.html | 58 +++++++++---------- zht/api/particle/index.html | 2 +- zht/api/presets/index.html | 2 +- zht/api/presets/model/index.html | 6 +- 138 files changed, 977 insertions(+), 953 deletions(-) rename assets/{api_mp_math_angle.md.B8w0LP6o.js => api_mp_math_angle.md.eAy7w1HN.js} (65%) rename assets/{api_mp_math_angle.md.B8w0LP6o.lean.js => api_mp_math_angle.md.eAy7w1HN.lean.js} (100%) rename assets/{api_mp_math_equation.md.Cn4Dbi_N.js => api_mp_math_equation.md.Cug6-NqN.js} (74%) rename assets/{api_mp_math_equation.md.Cn4Dbi_N.lean.js => api_mp_math_equation.md.Cug6-NqN.lean.js} (85%) rename assets/{api_mp_math_line.md.B1jAKPr1.js => api_mp_math_line.md.DsJQDchM.js} (66%) rename assets/{api_mp_math_line.md.B1jAKPr1.lean.js => api_mp_math_line.md.DsJQDchM.lean.js} (70%) rename assets/{api_mp_math_plane.md.DLB54RNP.js => api_mp_math_plane.md.CmoVvPiw.js} (75%) rename assets/{api_mp_math_plane.md.DLB54RNP.lean.js => api_mp_math_plane.md.CmoVvPiw.lean.js} (100%) rename assets/{api_mp_math_point.md.BwXaSbuz.js => api_mp_math_point.md.ClJD85mP.js} (63%) rename assets/{api_mp_math_point.md.BwXaSbuz.lean.js => api_mp_math_point.md.ClJD85mP.lean.js} (100%) rename assets/{api_mp_math_segment.md.C6i78ST1.js => api_mp_math_segment.md.7jBtS4F1.js} (81%) rename assets/{api_mp_math_segment.md.C6i78ST1.lean.js => api_mp_math_segment.md.7jBtS4F1.lean.js} (100%) rename assets/{ja_api_mp_math_utils.md.CXGqGLUs.js => api_mp_math_utils.md.BMwtm7TJ.js} (69%) rename assets/{api_mp_math_utils.md.Bkx3QJ6f.lean.js => api_mp_math_utils.md.BMwtm7TJ.lean.js} (70%) rename assets/{api_mp_math_vector.md.Efti6kdT.js => api_mp_math_vector.md.CROCIDXX.js} (70%) rename assets/{api_mp_math_vector.md.Efti6kdT.lean.js => api_mp_math_vector.md.CROCIDXX.lean.js} (85%) rename assets/{api_presets_model_index.md.DY6YMRqf.js => api_presets_model_index.md.DUZx13AW.js} (88%) rename assets/{api_presets_model_index.md.DY6YMRqf.lean.js => api_presets_model_index.md.DUZx13AW.lean.js} (85%) rename assets/{ja_api_mp_math_angle.md.DxBe_g0o.js => en_api_mp_math_angle.md.BuhpKHnt.js} (65%) rename assets/{en_api_mp_math_angle.md.DmK_A9xI.lean.js => en_api_mp_math_angle.md.BuhpKHnt.lean.js} (57%) rename assets/{ja_api_mp_math_equation.md.-GejNICN.js => en_api_mp_math_equation.md.YQDGr03a.js} (71%) rename assets/{en_api_mp_math_equation.md.DU8q_g4G.lean.js => en_api_mp_math_equation.md.YQDGr03a.lean.js} (86%) rename assets/{en_api_mp_math_line.md.BBlzflWh.js => en_api_mp_math_line.md.BEvxdWYQ.js} (65%) rename assets/{en_api_mp_math_line.md.BBlzflWh.lean.js => en_api_mp_math_line.md.BEvxdWYQ.lean.js} (100%) rename assets/{ja_api_mp_math_plane.md.Cm4a8eqF.js => en_api_mp_math_plane.md.DUu9P3nM.js} (76%) rename assets/{en_api_mp_math_plane.md.cxytQLD4.lean.js => en_api_mp_math_plane.md.DUu9P3nM.lean.js} (85%) rename assets/{en_api_mp_math_point.md.CXQGh5Zt.js => en_api_mp_math_point.md.DMig0FI1.js} (63%) rename assets/{en_api_mp_math_point.md.CXQGh5Zt.lean.js => en_api_mp_math_point.md.DMig0FI1.lean.js} (100%) rename assets/{en_api_mp_math_segment.md.CxreVgqR.js => en_api_mp_math_segment.md.CcaokAF8.js} (81%) rename assets/{en_api_mp_math_segment.md.CxreVgqR.lean.js => en_api_mp_math_segment.md.CcaokAF8.lean.js} (100%) rename assets/{api_mp_math_utils.md.Bkx3QJ6f.js => en_api_mp_math_utils.md.DZohqw2b.js} (63%) rename assets/{en_api_mp_math_utils.md.aavLLFMy.lean.js => en_api_mp_math_utils.md.DZohqw2b.lean.js} (100%) rename assets/{en_api_mp_math_vector.md.BvKJEw7_.js => en_api_mp_math_vector.md.Sd_IZsgE.js} (69%) rename assets/{en_api_mp_math_vector.md.BvKJEw7_.lean.js => en_api_mp_math_vector.md.Sd_IZsgE.lean.js} (85%) rename assets/{en_api_presets_model_index.md.DBfUZUBC.js => en_api_presets_model_index.md.Cs8vON2C.js} (86%) rename assets/{en_api_presets_model_index.md.DBfUZUBC.lean.js => en_api_presets_model_index.md.Cs8vON2C.lean.js} (58%) rename assets/{en_api_mp_math_angle.md.DmK_A9xI.js => ja_api_mp_math_angle.md.DL9J6RE2.js} (66%) rename assets/{ja_api_mp_math_angle.md.DxBe_g0o.lean.js => ja_api_mp_math_angle.md.DL9J6RE2.lean.js} (100%) rename assets/{en_api_mp_math_equation.md.DU8q_g4G.js => ja_api_mp_math_equation.md.tmRhsqm6.js} (77%) rename assets/{ja_api_mp_math_equation.md.-GejNICN.lean.js => ja_api_mp_math_equation.md.tmRhsqm6.lean.js} (86%) rename assets/{ja_api_mp_math_line.md.CMfQT6TH.js => ja_api_mp_math_line.md.fj-_s5Ug.js} (66%) rename assets/{ja_api_mp_math_line.md.CMfQT6TH.lean.js => ja_api_mp_math_line.md.fj-_s5Ug.lean.js} (57%) rename assets/{zht_api_mp_math_plane.md.Buk-SLcC.js => ja_api_mp_math_plane.md.yLekgCvK.js} (75%) rename assets/{ja_api_mp_math_plane.md.Cm4a8eqF.lean.js => ja_api_mp_math_plane.md.yLekgCvK.lean.js} (100%) rename assets/{ja_api_mp_math_point.md.CQAIjHfb.js => ja_api_mp_math_point.md.CpHHrSk8.js} (64%) rename assets/{ja_api_mp_math_point.md.CQAIjHfb.lean.js => ja_api_mp_math_point.md.CpHHrSk8.lean.js} (100%) rename assets/{ja_api_mp_math_segment.md.D0U5bMSu.js => ja_api_mp_math_segment.md.CB1_z-rn.js} (81%) rename assets/{ja_api_mp_math_segment.md.D0U5bMSu.lean.js => ja_api_mp_math_segment.md.CB1_z-rn.lean.js} (100%) rename assets/{en_api_mp_math_utils.md.aavLLFMy.js => ja_api_mp_math_utils.md.BrfEEfl-.js} (65%) rename assets/{ja_api_mp_math_utils.md.CXGqGLUs.lean.js => ja_api_mp_math_utils.md.BrfEEfl-.lean.js} (57%) rename assets/{ja_api_mp_math_vector.md.C9TtayJk.js => ja_api_mp_math_vector.md.p54TKACE.js} (70%) rename assets/{ja_api_mp_math_vector.md.C9TtayJk.lean.js => ja_api_mp_math_vector.md.p54TKACE.lean.js} (85%) rename assets/{ja_api_presets_model_index.md.DAVK1sDI.js => ja_api_presets_model_index.md.D8yZmO5R.js} (88%) rename assets/{ja_api_presets_model_index.md.DAVK1sDI.lean.js => ja_api_presets_model_index.md.D8yZmO5R.lean.js} (86%) rename assets/{zht_api_mp_math_angle.md._4N19GGe.js => zht_api_mp_math_angle.md.B4T6L25M.js} (66%) rename assets/{zht_api_mp_math_angle.md._4N19GGe.lean.js => zht_api_mp_math_angle.md.B4T6L25M.lean.js} (100%) rename assets/{zht_api_mp_math_equation.md.MGSqd_Ep.js => zht_api_mp_math_equation.md.5p50czv3.js} (72%) rename assets/{zht_api_mp_math_equation.md.MGSqd_Ep.lean.js => zht_api_mp_math_equation.md.5p50czv3.lean.js} (86%) rename assets/{zht_api_mp_math_line.md.4ncoPmkZ.js => zht_api_mp_math_line.md.DYC1X0oD.js} (65%) rename assets/{zht_api_mp_math_line.md.4ncoPmkZ.lean.js => zht_api_mp_math_line.md.DYC1X0oD.lean.js} (57%) rename assets/{en_api_mp_math_plane.md.cxytQLD4.js => zht_api_mp_math_plane.md.B6GWRRF6.js} (76%) rename assets/{zht_api_mp_math_plane.md.Buk-SLcC.lean.js => zht_api_mp_math_plane.md.B6GWRRF6.lean.js} (100%) rename assets/{zht_api_mp_math_point.md.Bb3tyGv-.js => zht_api_mp_math_point.md.Bm1IEwlI.js} (63%) rename assets/{zht_api_mp_math_point.md.Bb3tyGv-.lean.js => zht_api_mp_math_point.md.Bm1IEwlI.lean.js} (100%) rename assets/{zht_api_mp_math_segment.md.U_lS4vUA.js => zht_api_mp_math_segment.md.Bop8t2IE.js} (81%) rename assets/{zht_api_mp_math_segment.md.U_lS4vUA.lean.js => zht_api_mp_math_segment.md.Bop8t2IE.lean.js} (100%) rename assets/{zht_api_mp_math_utils.md.ig9jQkoA.js => zht_api_mp_math_utils.md.CERv8c-M.js} (64%) rename assets/{zht_api_mp_math_utils.md.ig9jQkoA.lean.js => zht_api_mp_math_utils.md.CERv8c-M.lean.js} (57%) rename assets/{zht_api_mp_math_vector.md.CDyAXuJb.js => zht_api_mp_math_vector.md.BTWxlpB1.js} (69%) rename assets/{zht_api_mp_math_vector.md.CDyAXuJb.lean.js => zht_api_mp_math_vector.md.BTWxlpB1.lean.js} (85%) rename assets/{zht_api_presets_model_index.md.CrdAyyCM.js => zht_api_presets_model_index.md.SQ5PPdaL.js} (88%) rename assets/{zht_api_presets_model_index.md.CrdAyyCM.lean.js => zht_api_presets_model_index.md.SQ5PPdaL.lean.js} (86%) diff --git a/404.html b/404.html index a400403..b3be285 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 54943b1..b324d9f 100644 --- a/api-ex.html +++ b/api-ex.html @@ -453,7 +453,7 @@ }

Page Frontmatter

{
   "outline": "deep"
 }

More

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

- + \ No newline at end of file diff --git a/api/index.html b/api/index.html index 3db62f8..053c8cd 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 d7c3338..c00fd01 100644 --- a/api/mp_math/angle.html +++ b/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle(Angle)

method __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(Angle)

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

说明: 任意角度。

参数:

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

@property

method complementary(self) -> AnyAngle

说明: 余角:两角的和为90°。

返回: 余角

源代码
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

说明: 余角:两角的和为90°。

返回: 余角

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

@property

method supplementary(self) -> AnyAngle

说明: 补角:两角的和为180°。

返回: 补角

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

@property

method supplementary(self) -> AnyAngle

说明: 补角:两角的和为180°。

返回: 补角

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

@property

method degree(self) -> float

说明: 角度。

返回: 弧度

源代码
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

说明: 角度。

返回: 弧度

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

@property

method minimum_positive(self) -> AnyAngle

说明: 最小正角。

返回: 最小正角度

源代码
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

说明: 最小正角。

返回: 最小正角度

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

@property

method maximum_negative(self) -> AnyAngle

说明: 最大负角。

返回: 最大负角度

源代码
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

说明: 最大负角。

返回: 最大负角度

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

@property

method sin(self) -> float

说明: 正弦值。

返回: 正弦值

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

@property

method sin(self) -> float

说明: 正弦值。

返回: 正弦值

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

@property

method cos(self) -> float

说明: 余弦值。

返回: 余弦值

源代码
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

说明: 余弦值。

返回: 余弦值

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

@property

method tan(self) -> float

说明: 正切值。

返回: 正切值

源代码
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

说明: 正切值。

返回: 正切值

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

@property

method cot(self) -> float

说明: 余切值。

返回: 余切值

源代码
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

说明: 余切值。

返回: 余切值

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

@property

method sec(self) -> float

说明: 正割值。

返回: 正割值

源代码
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

说明: 正割值。

返回: 正割值

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

@property

method csc(self) -> float

说明: 余割值。

返回: 余割值

源代码
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

说明: 余割值。

返回: 余割值

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

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

源代码
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

源代码
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

method self / other

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

method 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 3bc63a8..395f005 100644 --- a/api/mp_math/const.html +++ b/api/mp_math/const.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/api/mp_math/equation.html b/api/mp_math/equation.html index 976f0fb..507a126 100644 --- a/api/mp_math/equation.html +++ b/api/mp_math/equation.html @@ -12,14 +12,17 @@ - + -
Skip to content

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

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

参数:

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

返回: 偏导函数

引发:

  • ValueError 无效变量类型
源代码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

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

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

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

参数:

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

返回: 偏导函数

引发:

  • ValueError 无效变量类型
源代码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -56,7 +59,7 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +69,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

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

说明: 计算曲线上的点。

参数:

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

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

说明: 计算曲线上的点。

参数:

  • *t:
  • 参数:
源代码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -79,7 +82,7 @@
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
- + \ No newline at end of file diff --git a/api/mp_math/index.html b/api/mp_math/index.html index c7b1939..2d9f267 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 da4826f..6aff5e7 100644 --- a/api/mp_math/line.html +++ b/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

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

参数:

  • point: 直线上的一点
  • direction: 直线的方向向量
源代码
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

method __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

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

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

参数:

  • other: 另一条直线
  • epsilon: 误差

返回: 是否近似相等

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

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

method cal_angle(self, other: Line3) -> AnyAngle

说明: 计算直线和直线之间的夹角。

参数:

  • other: 另一条直线

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
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)

method cal_angle(self, other: Line3) -> AnyAngle

说明: 计算直线和直线之间的夹角。

参数:

  • other: 另一条直线

返回: 夹角弧度

引发:

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

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

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

参数:

  • other: 平行直线或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
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.')

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

说明: 计算两条直线的交点。

参数:

  • other: 另一条直线

返回: 交点

引发:

  • ValueError 直线平行
  • ValueError 直线不共面
源代码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

说明: 计算两条直线的交点。

参数:

  • other: 另一条直线

返回: 交点

引发:

  • ValueError 直线平行
  • ValueError 直线不共面
源代码
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

method cal_perpendicular(self, point: Point3) -> Line3

说明: 计算直线经过指定点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

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

method get_point(self, t: RealNumber) -> Point3

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

参数:

  • t: 参数t

返回: 点

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

method 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

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

说明: 获取直线的参数方程。

返回: x(t), y(t), z(t)

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

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

method 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:
+    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)

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

method is_parallel(self, other: Line3) -> bool

说明: 判断两条直线是否平行。

参数:

  • other: 另一条直线

返回: 是否平行

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

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

method is_collinear(self, other: Line3) -> bool

说明: 判断两条直线是否共线。

参数:

  • other: 另一条直线

返回: 是否共线

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

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

method is_point_on(self, point: Point3) -> bool

说明: 判断点是否在直线上。

参数:

  • point: 点

返回: 是否在直线上

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

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

method is_coplanar(self, other: Line3) -> bool

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

参数:

  • other: 另一条直线

返回: 是否共面

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

method 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

method simplify(self)

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

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

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

method 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

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

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

参数:

  • p1: 点1
  • p2: 点2

返回: 直线

源代码
python
@classmethod
+        self.point.z = 0

@classmethod

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

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

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

参数:

  • other: 另一条直线

返回: 交点

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

method __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)

method __eq__(self, other) -> bool

说明: 判断两条直线是否等价。

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

参数:

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

method __eq__(self, other) -> bool

说明: 判断两条直线是否等价。

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

参数:

  • other:
源代码
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -195,7 +195,7 @@
 
         """
     return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
- + \ No newline at end of file diff --git a/api/mp_math/mp_math_typing.html b/api/mp_math/mp_math_typing.html index 31267b1..fc7b0f3 100644 --- a/api/mp_math/mp_math_typing.html +++ b/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • 类型: TypeAlias

  • 说明: 实数

var Number = RealNumber | complex

  • 类型: TypeAlias

  • 说明: 数

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

  • 说明: 单变量

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

  • 说明: 数组变量

var Var = SingleVar | ArrayVar

  • 类型: TypeAlias

  • 说明: 变量

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 类型: TypeAlias

  • 说明: 一元单变量函数

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 类型: TypeAlias

  • 说明: 一元数组函数

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 类型: TypeAlias

  • 说明: 一元函数

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

  • 类型: TypeAlias

  • 说明: 二元单变量函数

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

  • 类型: TypeAlias

  • 说明: 二元数组函数

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 类型: TypeAlias

  • 说明: 二元函数

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

  • 类型: TypeAlias

  • 说明: 三元单变量函数

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

  • 类型: TypeAlias

  • 说明: 三元数组函数

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 类型: TypeAlias

  • 说明: 三元函数

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 类型: TypeAlias

  • 说明: 多元单变量函数

var MultiArraysFunc = Callable[..., ArrayVar]

  • 类型: TypeAlias

  • 说明: 多元数组函数

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 类型: TypeAlias

  • 说明: 多元函数

- + \ No newline at end of file diff --git a/api/mp_math/plane.html b/api/mp_math/plane.html index 215519b..c78966c 100644 --- a/api/mp_math/plane.html +++ b/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

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

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

参数:

  • a: x系数
  • b: y系数
  • c: z系数
  • d: 常数项
源代码
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

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

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

参数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

method approx(self, other: Plane3) -> bool

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

参数:

  • other: 另一个平面

返回: 是否近似相等

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

method approx(self, other: Plane3) -> bool

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

参数:

  • other: 另一个平面

返回: 是否近似相等

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

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

说明: 计算平面与平面之间的夹角。

参数:

  • other: 另一个平面

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

说明: 计算平面与平面之间的夹角。

参数:

  • other: 另一个平面

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -62,7 +62,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)}')

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

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

参数:

  • other: 另一个平面或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -77,7 +77,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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

说明: 计算两平面的交线。

参数:

  • other: 另一个平面

返回: 两平面的交线

源代码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

说明: 计算两平面的交线。

参数:

  • other: 另一个平面

返回: 两平面的交线

源代码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -102,7 +102,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)

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

说明: 计算平面与直线的交点。

参数:

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

返回: 交点

引发:

  • ValueError 平面与直线平行或重合
源代码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

说明: 计算平面与直线的交点。

参数:

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

返回: 交点

引发:

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

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

参数:

  • point: 指定点

返回: 所求平面

源代码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

参数:

  • point: 指定点

返回: 所求平面

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

method is_parallel(self, other: Plane3) -> bool

说明: 判断两个平面是否平行。

参数:

  • other: 另一个平面

返回: 是否平行

源代码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

说明: 判断两个平面是否平行。

参数:

  • other: 另一个平面

返回: 是否平行

源代码
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -132,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

说明: 平面的法向量。

返回: 法向量

源代码
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

说明: 平面的法向量。

返回: 法向量

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

@classmethod

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

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

参数:

  • point: 平面上的一点
  • normal: 法向量

返回: 平面

源代码
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

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

参数:

  • p1: 点1
  • p2: 点2
  • p3: 点3

返回: 平面

源代码
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -165,7 +165,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

参数:

  • l1: 直线1
  • l2: 直线2

返回: 平面

源代码
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method 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':
     """
         工厂函数 由两直线构造平面。
@@ -179,7 +179,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

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

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

参数:

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

返回: 平面

源代码
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -189,11 +189,11 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

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

源代码
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

源代码
python
@overload
+    ...

@overload

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

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

method __and__(self, other)

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

参数:

  • other:

返回: 不平行平面的交线,平面平行返回None

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

method __and__(self, other)

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

参数:

  • other:

返回: 不平行平面的交线,平面平行返回None

源代码
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -210,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/api/mp_math/point.html b/api/mp_math/point.html index ee5ea9a..2d71357 100644 --- a/api/mp_math/point.html +++ b/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

method __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

method __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

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

源代码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

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

@overload

method self + other: Vector3 => Point3

源代码
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

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

@overload

method self + other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

说明: P + V -> P P + P -> P

参数:

  • other:
源代码
python
def __add__(self, other):
+    ...

method self + other

说明: P + V -> P P + P -> P

参数:

  • other:
源代码
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -49,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

说明: 判断两个点是否相等。

参数:

  • other:
源代码
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

说明: P - P -> V

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

参数:

  • other:
源代码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

说明: P - P -> V

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

参数:

  • other:
源代码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -68,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/api/mp_math/segment.html b/api/mp_math/segment.html index 9a2a480..86e27bb 100644 --- a/api/mp_math/segment.html +++ b/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

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

源代码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

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

源代码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -31,7 +31,7 @@
     self.length = self.direction.length
     '中心点'
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
- + \ No newline at end of file diff --git a/api/mp_math/utils.html b/api/mp_math/utils.html index 360bd68..98971b7 100644 --- a/api/mp_math/utils.html +++ b/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

func clamp() -> float

说明: 区间限定函数

参数:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

返回: 限制后的值

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

func 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_)

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

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

参数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源代码
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

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

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

参数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

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

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

说明: 获取数的符号。

参数:

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

返回: 符号 + - ""

源代码
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

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

说明: 获取数的符号。

参数:

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

返回: 符号 + - ""

源代码
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -51,7 +51,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

func 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:
+        return ''

func 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
@@ -67,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

源代码
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -78,10 +78,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)

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/api/mp_math/vector.html b/api/mp_math/vector.html index 97fedbc..48892f6 100644 --- a/api/mp_math/vector.html +++ b/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

method __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

method __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

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

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

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

method cal_angle(self, other: Vector3) -> AnyAngle

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

参数:

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

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

method cross(self, other: Vector3) -> Vector3

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

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

参数:

  • other:

返回: 行列式的结果

源代码
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

参数:

  • other:

返回: 行列式的结果

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

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

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

参数:

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

method 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

method is_parallel(self, other: Vector3) -> bool

说明: 判断两个向量是否平行。

参数:

  • other: 另一个向量

返回: 是否平行

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

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

method normalize(self)

说明: 将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

说明: 将向量归一化。

自体归一化,不返回值。

源代码
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

method np_array(self) -> np.ndarray

源代码
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

说明: 向量的模。

返回: 模

源代码
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

说明: 向量的模。

返回: 模

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

@property

method unit(self) -> Vector3

说明: 获取该向量的单位向量。

返回: 单位向量

源代码
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

说明: 获取该向量的单位向量。

返回: 单位向量

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

源代码
python
@overload
+    return self / self.length

method __abs__(self)

源代码
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

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

@overload

method self + other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

说明: V + P -> P

V + V -> V

参数:

  • other:
源代码
python
def __add__(self, other):
+    ...

method 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)}'")

method __eq__(self, other)

说明: 判断两个向量是否相等。

参数:

  • other:

返回: 是否相等

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

method __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)

method self + other: Point3 => 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)

method 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

method self - other: Vector3 => Vector3

源代码
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

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

@overload

method self - other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

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

method self - other

说明: V - P -> P

V - V -> V

参数:

  • other:
源代码
python
def __sub__(self, other):
+    ...

method 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)}"')

method 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)}"')

method 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

method self * other: Vector3 => Vector3

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

@overload

method self * other: Vector3 => Vector3

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

@overload

method self * other: RealNumber => Vector3

源代码
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

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

method self * other: int | float | Vector3 => Vector3

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

参数:

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

method self * other: int | float | Vector3 => Vector3

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

参数:

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

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

说明: 点乘。

参数:

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

method self * other: RealNumber => Vector3

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

method 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

method self / other: RealNumber => Vector3

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

method - self

源代码
python
def __neg__(self):
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • 类型: Vector3

  • 说明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 类型: Vector3

  • 说明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 类型: Vector3

  • 说明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 类型: Vector3

  • 说明: z轴单位向量

- + \ No newline at end of file diff --git a/api/particle/index.html b/api/particle/index.html index b18f34e..d2e59e5 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 afc89e0..9dd76bc 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 80028a4..cf38c7a 100644 --- a/api/presets/model/index.html +++ b/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

说明: 生成球体上的点集。

参数:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源代码
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

说明: 生成球体上的点集。

参数:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源代码
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.B8w0LP6o.js b/assets/api_mp_math_angle.md.eAy7w1HN.js similarity index 65% rename from assets/api_mp_math_angle.md.B8w0LP6o.js rename to assets/api_mp_math_angle.md.eAy7w1HN.js index 7b43490..42da5d6 100644 --- a/assets/api_mp_math_angle.md.B8w0LP6o.js +++ b/assets/api_mp_math_angle.md.eAy7w1HN.js @@ -1,4 +1,4 @@ -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"}'),t={name:"api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

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

class Angle

class AnyAngle(Angle)

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

说明: 任意角度。

参数:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
源代码
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,92 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

说明: 余角:两角的和为90°。

返回: 余角

源代码
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

说明: 余角:两角的和为90°。

返回: 余角

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

@property

method supplementary(self) -> AnyAngle

说明: 补角:两角的和为180°。

返回: 补角

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

@property

method supplementary(self) -> AnyAngle

说明: 补角:两角的和为180°。

返回: 补角

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

@property

method degree(self) -> float

说明: 角度。

返回: 弧度

源代码
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

说明: 角度。

返回: 弧度

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

@property

method minimum_positive(self) -> AnyAngle

说明: 最小正角。

返回: 最小正角度

源代码
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

说明: 最小正角。

返回: 最小正角度

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

@property

method maximum_negative(self) -> AnyAngle

说明: 最大负角。

返回: 最大负角度

源代码
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

说明: 最大负角。

返回: 最大负角度

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

@property

method sin(self) -> float

说明: 正弦值。

返回: 正弦值

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

@property

method sin(self) -> float

说明: 正弦值。

返回: 正弦值

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

@property

method cos(self) -> float

说明: 余弦值。

返回: 余弦值

源代码
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

说明: 余弦值。

返回: 余弦值

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

@property

method tan(self) -> float

说明: 正切值。

返回: 正切值

源代码
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

说明: 正切值。

返回: 正切值

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

@property

method cot(self) -> float

说明: 余切值。

返回: 余切值

源代码
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

说明: 余切值。

返回: 余切值

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

@property

method sec(self) -> float

说明: 正割值。

返回: 正割值

源代码
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

说明: 正割值。

返回: 正割值

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

@property

method csc(self) -> float

说明: 余割值。

返回: 余割值

源代码
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

说明: 余割值。

返回: 余割值

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

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

源代码
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

源代码
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

method self / other

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

method self / other

源代码
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
`,78),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const c=s(t,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/api_mp_math_angle.md.B8w0LP6o.lean.js b/assets/api_mp_math_angle.md.eAy7w1HN.lean.js similarity index 100% rename from assets/api_mp_math_angle.md.B8w0LP6o.lean.js rename to assets/api_mp_math_angle.md.eAy7w1HN.lean.js diff --git a/assets/api_mp_math_equation.md.Cn4Dbi_N.js b/assets/api_mp_math_equation.md.Cug6-NqN.js similarity index 74% rename from assets/api_mp_math_equation.md.Cn4Dbi_N.js rename to assets/api_mp_math_equation.md.Cug6-NqN.js index e6df063..f510992 100644 --- a/assets/api_mp_math_equation.md.Cn4Dbi_N.js +++ b/assets/api_mp_math_equation.md.Cug6-NqN.js @@ -1,6 +1,9 @@ -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.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(`

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

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

参数:

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

返回: 偏导函数

引发:

  • ValueError 无效变量类型
源代码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+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.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(`

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

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

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

参数:

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

返回: 偏导函数

引发:

  • ValueError 无效变量类型
源代码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -37,7 +40,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +50,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

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

说明: 计算曲线上的点。

参数:

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

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

说明: 计算曲线上的点。

参数:

  • *t:
  • 参数:
源代码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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))])
`,19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F 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))])
`,20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/api_mp_math_equation.md.Cn4Dbi_N.lean.js b/assets/api_mp_math_equation.md.Cug6-NqN.lean.js similarity index 85% rename from assets/api_mp_math_equation.md.Cn4Dbi_N.lean.js rename to assets/api_mp_math_equation.md.Cug6-NqN.lean.js index ab9b8a3..f4480bb 100644 --- a/assets/api_mp_math_equation.md.Cn4Dbi_N.lean.js +++ b/assets/api_mp_math_equation.md.Cug6-NqN.lean.js @@ -1 +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.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("",19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u 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.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("",20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/api_mp_math_line.md.B1jAKPr1.js b/assets/api_mp_math_line.md.DsJQDchM.js similarity index 66% rename from assets/api_mp_math_line.md.B1jAKPr1.js rename to assets/api_mp_math_line.md.DsJQDchM.js index bafac4e..b12a2f8 100644 --- a/assets/api_mp_math_line.md.B1jAKPr1.js +++ b/assets/api_mp_math_line.md.DsJQDchM.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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

method __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 E=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"}'),t={name:"api/mp_math/line.md"},l=n(`

class Line3

method __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 E
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

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

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

参数:

  • other: 另一条直线
  • epsilon: 误差

返回: 是否近似相等

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

method 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 E
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

说明: 计算直线和直线之间的夹角。

参数:

  • other: 另一条直线

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
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)

method cal_angle(self, other: Line3) -> AnyAngle

说明: 计算直线和直线之间的夹角。

参数:

  • other: 另一条直线

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
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 E
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
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 E
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

说明: 计算两条直线的交点。

参数:

  • other: 另一条直线

返回: 交点

引发:

  • ValueError 直线平行
  • ValueError 直线不共面
源代码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

说明: 计算两条直线的交点。

参数:

  • other: 另一条直线

返回: 交点

引发:

  • ValueError 直线平行
  • ValueError 直线不共面
源代码
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 E
         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

method cal_perpendicular(self, point: Point3) -> Line3

说明: 计算直线经过指定点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

method 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 E
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

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

参数:

  • t: 参数t

返回: 点

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

method 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 E
         Returns:
 
         """
-    return self.point + t * self.direction

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

说明: 获取直线的参数方程。

返回: x(t), y(t), z(t)

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

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

method 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:
+    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)

method 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 E
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

说明: 判断两条直线是否平行。

参数:

  • other: 另一条直线

返回: 是否平行

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

method 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 E
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

说明: 判断两条直线是否共线。

参数:

  • other: 另一条直线

返回: 是否共线

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

method 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 E
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method is_point_on(self, point: Point3) -> bool

说明: 判断点是否在直线上。

参数:

  • point: 点

返回: 是否在直线上

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

method 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 E
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

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

参数:

  • other: 另一条直线

返回: 是否共面

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

method 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 E
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

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

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

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

method 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 E
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

参数:

  • p1: 点1
  • p2: 点2

返回: 直线

源代码
python
@classmethod
+        self.point.z = 0

@classmethod

method 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 E
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

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

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

参数:

  • other: 另一条直线

返回: 交点

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

method __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 E
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

method __eq__(self, other) -> bool

说明: 判断两条直线是否等价。

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

参数:

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

method __eq__(self, other) -> bool

说明: 判断两条直线是否等价。

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

参数:

  • other:
源代码
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,4 +175,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_line.md.B1jAKPr1.lean.js b/assets/api_mp_math_line.md.DsJQDchM.lean.js similarity index 70% rename from assets/api_mp_math_line.md.B1jAKPr1.lean.js rename to assets/api_mp_math_line.md.DsJQDchM.lean.js index e425cef..56efe18 100644 --- a/assets/api_mp_math_line.md.B1jAKPr1.lean.js +++ b/assets/api_mp_math_line.md.DsJQDchM.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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("",105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"api/mp_math/line.md"},l=n("",105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_plane.md.DLB54RNP.js b/assets/api_mp_math_plane.md.CmoVvPiw.js similarity index 75% rename from assets/api_mp_math_plane.md.DLB54RNP.js rename to assets/api_mp_math_plane.md.CmoVvPiw.js index 832d1bf..20f083b 100644 --- a/assets/api_mp_math_plane.md.DLB54RNP.js +++ b/assets/api_mp_math_plane.md.CmoVvPiw.js @@ -1,4 +1,4 @@ -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

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

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

参数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

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

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

参数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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 F
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

method approx(self, other: Plane3) -> bool

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

参数:

  • other: 另一个平面

返回: 是否近似相等

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

method approx(self, other: Plane3) -> bool

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

参数:

  • other: 另一个平面

返回: 是否近似相等

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

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

说明: 计算平面与平面之间的夹角。

参数:

  • other: 另一个平面

返回: 夹角弧度

引发:

  • TypeError 不支持的类型
源代码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

说明: 计算平面与平面之间的夹角。

参数:

  • other: 另一个平面

返回: 夹角弧度

引发:

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

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

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

参数:

  • other: 另一个平面或点

返回: 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点

返回: 距离

引发:

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

method cal_intersection_line3(self, other: Plane3) -> Line3

说明: 计算两平面的交线。

参数:

  • other: 另一个平面

返回: 两平面的交线

源代码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

说明: 计算两平面的交线。

参数:

  • other: 另一个平面

返回: 两平面的交线

源代码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -83,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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)

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

说明: 计算平面与直线的交点。

参数:

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

返回: 交点

引发:

  • ValueError 平面与直线平行或重合
源代码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

说明: 计算平面与直线的交点。

参数:

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

返回: 交点

引发:

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

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

参数:

  • point: 指定点

返回: 所求平面

源代码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

参数:

  • point: 指定点

返回: 所求平面

源代码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -105,7 +105,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

说明: 判断两个平面是否平行。

参数:

  • other: 另一个平面

返回: 是否平行

源代码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

说明: 判断两个平面是否平行。

参数:

  • other: 另一个平面

返回: 是否平行

源代码
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -113,14 +113,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

说明: 平面的法向量。

返回: 法向量

源代码
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

说明: 平面的法向量。

返回: 法向量

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

@classmethod

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

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

参数:

  • point: 平面上的一点
  • normal: 法向量

返回: 平面

源代码
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

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

参数:

  • p1: 点1
  • p2: 点2
  • p3: 点3

返回: 平面

源代码
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

参数:

  • l1: 直线1
  • l2: 直线2

返回: 平面

源代码
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

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

参数:

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

返回: 平面

源代码
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -170,11 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

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

源代码
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

源代码
python
@overload
+    ...

@overload

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

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

method __and__(self, other)

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

参数:

  • other:

返回: 不平行平面的交线,平面平行返回None

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

method __and__(self, other)

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

参数:

  • other:

返回: 不平行平面的交线,平面平行返回None

源代码
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -191,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
`,103),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.DLB54RNP.lean.js b/assets/api_mp_math_plane.md.CmoVvPiw.lean.js similarity index 100% rename from assets/api_mp_math_plane.md.DLB54RNP.lean.js rename to assets/api_mp_math_plane.md.CmoVvPiw.lean.js diff --git a/assets/api_mp_math_point.md.BwXaSbuz.js b/assets/api_mp_math_point.md.ClJD85mP.js similarity index 63% rename from assets/api_mp_math_point.md.BwXaSbuz.js rename to assets/api_mp_math_point.md.ClJD85mP.js index e591140..c1f3ae7 100644 --- a/assets/api_mp_math_point.md.BwXaSbuz.js +++ b/assets/api_mp_math_point.md.ClJD85mP.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"api/mp_math/point.md"},l=t(`

class Point3

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

class Point3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

源代码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

源代码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,11 +18,11 @@ import{_ as s,c as i,o as a,a2 as t}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])

@overload

method self + other: Vector3 => Point3

源代码
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

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

@overload

method self + other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

说明: P + V -> P P + P -> P

参数:

  • other:
源代码
python
def __add__(self, other):
+    ...

method self + other

说明: P + V -> P P + P -> P

参数:

  • other:
源代码
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -30,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

说明: 判断两个点是否相等。

参数:

  • other:
源代码
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

说明: P - P -> V

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

参数:

  • other:
源代码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

说明: P - P -> V

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

参数:

  • other:
源代码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
diff --git a/assets/api_mp_math_point.md.BwXaSbuz.lean.js b/assets/api_mp_math_point.md.ClJD85mP.lean.js
similarity index 100%
rename from assets/api_mp_math_point.md.BwXaSbuz.lean.js
rename to assets/api_mp_math_point.md.ClJD85mP.lean.js
diff --git a/assets/api_mp_math_segment.md.C6i78ST1.js b/assets/api_mp_math_segment.md.7jBtS4F1.js
similarity index 81%
rename from assets/api_mp_math_segment.md.C6i78ST1.js
rename to assets/api_mp_math_segment.md.7jBtS4F1.js
index 8e16b56..304bf09 100644
--- a/assets/api_mp_math_segment.md.C6i78ST1.js
+++ b/assets/api_mp_math_segment.md.7jBtS4F1.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":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"api/mp_math/segment.md"},h=n(`

class Segment3

method __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 o=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

method __init__(self, p1: Point3, p2: Point3)

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

源代码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
diff --git a/assets/api_mp_math_segment.md.C6i78ST1.lean.js b/assets/api_mp_math_segment.md.7jBtS4F1.lean.js
similarity index 100%
rename from assets/api_mp_math_segment.md.C6i78ST1.lean.js
rename to assets/api_mp_math_segment.md.7jBtS4F1.lean.js
diff --git a/assets/ja_api_mp_math_utils.md.CXGqGLUs.js b/assets/api_mp_math_utils.md.BMwtm7TJ.js
similarity index 69%
rename from assets/ja_api_mp_math_utils.md.CXGqGLUs.js
rename to assets/api_mp_math_utils.md.BMwtm7TJ.js
index 4f57e6f..6b2d37f 100644
--- a/assets/ja_api_mp_math_utils.md.CXGqGLUs.js
+++ b/assets/api_mp_math_utils.md.BMwtm7TJ.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"},t=n(`

func clamp() -> float

説明: 区间限定函数

引数:

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

func 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 E
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

引数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

戻り値: 是否近似相等

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

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

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

参数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

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

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

説明: 获取数的符号。

引数:

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

戻り値: 符号 + - ""

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

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

说明: 获取数的符号。

参数:

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

返回: 符号 + - ""

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

func 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:
+        return ''

func 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
@@ -48,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
-    self.value = value

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

源代码
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -59,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         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)

method raise_type_error(self, other)

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

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_utils.md.Bkx3QJ6f.lean.js b/assets/api_mp_math_utils.md.BMwtm7TJ.lean.js similarity index 70% rename from assets/api_mp_math_utils.md.Bkx3QJ6f.lean.js rename to assets/api_mp_math_utils.md.BMwtm7TJ.lean.js index 01c767a..e04783d 100644 --- a/assets/api_mp_math_utils.md.Bkx3QJ6f.lean.js +++ b/assets/api_mp_math_utils.md.BMwtm7TJ.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"},t=n("",33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"api/mp_math/utils.md"},l=n("",33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_vector.md.Efti6kdT.js b/assets/api_mp_math_vector.md.CROCIDXX.js similarity index 70% rename from assets/api_mp_math_vector.md.Efti6kdT.js rename to assets/api_mp_math_vector.md.CROCIDXX.js index a843701..46eb303 100644 --- a/assets/api_mp_math_vector.md.Efti6kdT.js +++ b/assets/api_mp_math_vector.md.CROCIDXX.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"api/mp_math/vector.md"},h=t(`

class Vector3

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

class Vector3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

参数:

  • other:
  • epsilon:

返回: 是否近似相等

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

method 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 t}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])

method cal_angle(self, other: Vector3) -> AnyAngle

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

参数:

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

参数:

  • other:

返回: 行列式的结果

源代码
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

参数:

  • other:

返回: 行列式的结果

源代码
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 t}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)

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

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

参数:

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

说明: 判断两个向量是否平行。

参数:

  • other: 另一个向量

返回: 是否平行

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

method normalize(self)

说明: 将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

说明: 将向量归一化。

自体归一化,不返回值。

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

@property

method np_array(self) -> np.ndarray

源代码
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

说明: 向量的模。

返回: 模

源代码
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

说明: 向量的模。

返回: 模

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

@property

method unit(self) -> Vector3

说明: 获取该向量的单位向量。

返回: 单位向量

源代码
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

说明: 获取该向量的单位向量。

返回: 单位向量

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

源代码
python
@overload
+    return self / self.length

method __abs__(self)

源代码
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

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

@overload

method self + other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

说明: V + P -> P

V + V -> V

参数:

  • other:
源代码
python
def __add__(self, other):
+    ...

method 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 t}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)}'")

method __eq__(self, other)

说明: 判断两个向量是否相等。

参数:

  • other:

返回: 是否相等

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

method __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 t}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)

method self + other: Point3 => 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)

method 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 t}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

method self - other: Vector3 => Vector3

源代码
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

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

@overload

method self - other: Point3 => Point3

源代码
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

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

method self - other

说明: V - P -> P

V - V -> V

参数:

  • other:
源代码
python
def __sub__(self, other):
+    ...

method 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 t}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)}"')

method 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)}"')

method 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 t}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

method self * other: Vector3 => Vector3

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

@overload

method self * other: Vector3 => Vector3

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

@overload

method self * other: RealNumber => Vector3

源代码
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

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

method self * other: int | float | Vector3 => Vector3

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

参数:

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

method self * other: int | float | Vector3 => Vector3

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

参数:

  • other:
源代码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,14 +174,14 @@ import{_ as s,c as i,o as a,a2 as t}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)}'")

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

说明: 点乘。

参数:

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

method self * other: RealNumber => Vector3

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

method 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

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • 类型: Vector3

  • 说明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 类型: Vector3

  • 说明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 类型: Vector3

  • 说明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 类型: Vector3

  • 说明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • 类型: Vector3

  • 说明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 类型: Vector3

  • 说明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 类型: Vector3

  • 说明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 类型: Vector3

  • 说明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.Efti6kdT.lean.js b/assets/api_mp_math_vector.md.CROCIDXX.lean.js similarity index 85% rename from assets/api_mp_math_vector.md.Efti6kdT.lean.js rename to assets/api_mp_math_vector.md.CROCIDXX.lean.js index b68d55a..a26b965 100644 --- a/assets/api_mp_math_vector.md.Efti6kdT.lean.js +++ b/assets/api_mp_math_vector.md.CROCIDXX.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.DY6YMRqf.js b/assets/api_presets_model_index.md.DUZx13AW.js similarity index 88% rename from assets/api_presets_model_index.md.DY6YMRqf.js rename to assets/api_presets_model_index.md.DUZx13AW.js index 9110ab6..703cf6b 100644 --- a/assets/api_presets_model_index.md.DY6YMRqf.js +++ b/assets/api_presets_model_index.md.DUZx13AW.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"}'),t={name:"api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

说明: 生成球体上的点集。

参数:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

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

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

说明: 生成球体上的点集。

参数:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源代码
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=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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)]
`,8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.DY6YMRqf.lean.js b/assets/api_presets_model_index.md.DUZx13AW.lean.js similarity index 85% rename from assets/api_presets_model_index.md.DY6YMRqf.lean.js rename to assets/api_presets_model_index.md.DUZx13AW.lean.js index 433fffa..8d14981 100644 --- a/assets/api_presets_model_index.md.DY6YMRqf.lean.js +++ b/assets/api_presets_model_index.md.DUZx13AW.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"}'),t={name:"api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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"}'),t={name:"api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_angle.md.DxBe_g0o.js b/assets/en_api_mp_math_angle.md.BuhpKHnt.js similarity index 65% rename from assets/ja_api_mp_math_angle.md.DxBe_g0o.js rename to assets/en_api_mp_math_angle.md.BuhpKHnt.js index cb5c395..94ef475 100644 --- a/assets/ja_api_mp_math_angle.md.DxBe_g0o.js +++ b/assets/en_api_mp_math_angle.md.BuhpKHnt.js @@ -1,4 +1,4 @@ -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"}'),t={name:"ja/api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

method __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 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"}'),t={name:"en/api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

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

Description: 任意角度。

Arguments:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,92 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

戻り値: 余角

ソースコード
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

Description: 余角:两角的和为90°。

Return: 余角

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

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

戻り値: 补角

ソースコード
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

Description: 补角:两角的和为180°。

Return: 补角

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

@property

method degree(self) -> float

説明: 角度。

戻り値: 弧度

ソースコード
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

Description: 角度。

Return: 弧度

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

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

戻り値: 最小正角度

ソースコード
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

Description: 最小正角。

Return: 最小正角度

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

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

戻り値: 最大负角度

ソースコード
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

Description: 最大负角。

Return: 最大负角度

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

@property

method sin(self) -> float

説明: 正弦值。

戻り値: 正弦值

ソースコード
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

Description: 正弦值。

Return: 正弦值

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

@property

method cos(self) -> float

説明: 余弦值。

戻り値: 余弦值

ソースコード
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

Description: 余弦值。

Return: 余弦值

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

@property

method tan(self) -> float

説明: 正切值。

戻り値: 正切值

ソースコード
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

Description: 正切值。

Return: 正切值

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

@property

method cot(self) -> float

説明: 余切值。

戻り値: 余切值

ソースコード
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

Description: 余切值。

Return: 余切值

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

@property

method sec(self) -> float

説明: 正割值。

戻り値: 正割值

ソースコード
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

Description: 正割值。

Return: 正割值

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

@property

method csc(self) -> float

説明: 余割值。

戻り値: 余割值

ソースコード
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

Description: 余割值。

Return: 余割值

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

method self + other: AnyAngle => AnyAngle

ソースコード
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

ソースコード
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

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

@overload

method self / other: AnyAngle => float

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

method self / other

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

method 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)
`,78),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const c=s(t,[["render",h]]);export{F as __pageData,c as default}; + return AnyAngle(self.radian / other, is_radian=True)
`,78),l=[e];function h(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(t,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.DmK_A9xI.lean.js b/assets/en_api_mp_math_angle.md.BuhpKHnt.lean.js similarity index 57% rename from assets/en_api_mp_math_angle.md.DmK_A9xI.lean.js rename to assets/en_api_mp_math_angle.md.BuhpKHnt.lean.js index 789df0d..89f6a58 100644 --- a/assets/en_api_mp_math_angle.md.DmK_A9xI.lean.js +++ b/assets/en_api_mp_math_angle.md.BuhpKHnt.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}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"}'),e={name:"en/api/mp_math/angle.md"},t=n("",78),l=[t];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}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"}'),t={name:"en/api/mp_math/angle.md"},e=n("",78),l=[e];function h(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(t,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_equation.md.-GejNICN.js b/assets/en_api_mp_math_equation.md.YQDGr03a.js similarity index 71% rename from assets/ja_api_mp_math_equation.md.-GejNICN.js rename to assets/en_api_mp_math_equation.md.YQDGr03a.js index a68f6f8..6d6c7b2 100644 --- a/assets/ja_api_mp_math_equation.md.-GejNICN.js +++ b/assets/en_api_mp_math_equation.md.YQDGr03a.js @@ -1,6 +1,9 @@ -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.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(`

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

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

引数:

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

戻り値: 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+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(`

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

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

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

Arguments:

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

Return: 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -37,7 +40,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

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

Description: 曲线方程。

Arguments:

  • 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 +50,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

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

説明: 计算曲线上的点。

引数:

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

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

Description: 计算曲线上的点。

Arguments:

  • *t:
  • 参数:
Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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))])
`,19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F 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))])
`,20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const F=s(l,[["render",p]]);export{u as __pageData,F as default}; diff --git a/assets/en_api_mp_math_equation.md.DU8q_g4G.lean.js b/assets/en_api_mp_math_equation.md.YQDGr03a.lean.js similarity index 86% rename from assets/en_api_mp_math_equation.md.DU8q_g4G.lean.js rename to assets/en_api_mp_math_equation.md.YQDGr03a.lean.js index 31b29d2..b8aa112 100644 --- a/assets/en_api_mp_math_equation.md.DU8q_g4G.lean.js +++ b/assets/en_api_mp_math_equation.md.YQDGr03a.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("",19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const F=s(l,[["render",p]]);export{u as __pageData,F 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("",20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const F=s(l,[["render",p]]);export{u as __pageData,F as default}; diff --git a/assets/en_api_mp_math_line.md.BBlzflWh.js b/assets/en_api_mp_math_line.md.BEvxdWYQ.js similarity index 65% rename from assets/en_api_mp_math_line.md.BBlzflWh.js rename to assets/en_api_mp_math_line.md.BEvxdWYQ.js index 77205d2..4003bd5 100644 --- a/assets/en_api_mp_math_line.md.BBlzflWh.js +++ b/assets/en_api_mp_math_line.md.BEvxdWYQ.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"en/api/mp_math/line.md"},l=n(`

class Line3

method __init__(self, point: Point3, direction: Vector3)

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

Arguments:

  • 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 E=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"}'),t={name:"en/api/mp_math/line.md"},l=n(`

class Line3

method __init__(self, point: Point3, direction: Vector3)

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

Arguments:

  • 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 E
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

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

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

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似相等

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

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

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

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似相等

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 E
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

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

Arguments:

  • other: 另一条直线

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
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)

method cal_angle(self, other: Line3) -> AnyAngle

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

Arguments:

  • other: 另一条直线

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
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 E
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

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

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

Arguments:

  • other: 平行直线或点

Return: 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

Arguments:

  • other: 平行直线或点

Return: 距离

Raises:

  • TypeError 不支持的类型
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 E
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

Description: 计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return: 交点

Raises:

  • ValueError 直线平行
  • ValueError 直线不共面
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

Description: 计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return: 交点

Raises:

  • ValueError 直线平行
  • ValueError 直线不共面
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 E
         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

method cal_perpendicular(self, point: Point3) -> Line3

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

Arguments:

  • point: 指定点

Return: 垂线

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

method cal_perpendicular(self, point: Point3) -> Line3

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

Arguments:

  • point: 指定点

Return: 垂线

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 E
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

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

Arguments:

  • t: 参数t

Return: 点

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

method get_point(self, t: RealNumber) -> Point3

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

Arguments:

  • t: 参数t

Return: 点

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 E
         Returns:
 
         """
-    return self.point + t * self.direction

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

Description: 获取直线的参数方程。

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

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

Description: 获取直线的参数方程。

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)

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

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

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似平行

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)

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

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

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似平行

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 E
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

Description: 判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return: 是否平行

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

method is_parallel(self, other: Line3) -> bool

Description: 判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return: 是否平行

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 E
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

Description: 判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return: 是否共线

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

method is_collinear(self, other: Line3) -> bool

Description: 判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return: 是否共线

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 E
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method is_point_on(self, point: Point3) -> bool

Description: 判断点是否在直线上。

Arguments:

  • point: 点

Return: 是否在直线上

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)

method is_point_on(self, point: Point3) -> bool

Description: 判断点是否在直线上。

Arguments:

  • point: 点

Return: 是否在直线上

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 E
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

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

Arguments:

  • other: 另一条直线

Return: 是否共面

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

method is_coplanar(self, other: Line3) -> bool

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

Arguments:

  • other: 另一条直线

Return: 是否共面

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 E
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

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

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

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

method simplify(self)

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

按照可行性一次对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 E
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

Arguments:

  • p1: 点1
  • p2: 点2

Return: 直线

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

@classmethod

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

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

Arguments:

  • p1: 点1
  • p2: 点2

Return: 直线

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 E
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

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

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

Arguments:

  • other: 另一条直线

Return: 交点

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

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

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

Arguments:

  • other: 另一条直线

Return: 交点

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 E
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

method __eq__(self, other) -> bool

Description: 判断两条直线是否等价。

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

Arguments:

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

method __eq__(self, other) -> bool

Description: 判断两条直线是否等价。

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

Arguments:

  • other:
Source code
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
diff --git a/assets/en_api_mp_math_line.md.BBlzflWh.lean.js b/assets/en_api_mp_math_line.md.BEvxdWYQ.lean.js
similarity index 100%
rename from assets/en_api_mp_math_line.md.BBlzflWh.lean.js
rename to assets/en_api_mp_math_line.md.BEvxdWYQ.lean.js
diff --git a/assets/ja_api_mp_math_plane.md.Cm4a8eqF.js b/assets/en_api_mp_math_plane.md.DUu9P3nM.js
similarity index 76%
rename from assets/ja_api_mp_math_plane.md.Cm4a8eqF.js
rename to assets/en_api_mp_math_plane.md.DUu9P3nM.js
index aafb9f5..16d8458 100644
--- a/assets/ja_api_mp_math_plane.md.Cm4a8eqF.js
+++ b/assets/en_api_mp_math_plane.md.DUu9P3nM.js
@@ -1,4 +1,4 @@
-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

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

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

引数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

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

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

Arguments:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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 F
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

method approx(self, other: Plane3) -> bool

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

引数:

  • other: 另一个平面

戻り値: 是否近似相等

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

method approx(self, other: Plane3) -> bool

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

Arguments:

  • other: 另一个平面

Return: 是否近似相等

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

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

説明: 计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

Arguments:

  • other: 另一个平面

Return: 夹角弧度

Raises:

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

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

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

引数:

  • other: 另一个平面或点

戻り値: 距离

例外:

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

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

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

Arguments:

  • other: 另一个平面或点

Return: 距离

Raises:

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

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

引数:

  • other: 另一个平面

戻り値: 两平面的交线

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

method cal_intersection_line3(self, other: Plane3) -> Line3

Description: 计算两平面的交线。

Arguments:

  • other: 另一个平面

Return: 两平面的交线

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -83,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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)

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

説明: 计算平面与直线的交点。

引数:

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

戻り値: 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

Description: 计算平面与直线的交点。

Arguments:

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

Return: 交点

Raises:

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

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

引数:

  • point: 指定点

戻り値: 所求平面

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

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

Arguments:

  • point: 指定点

Return: 所求平面

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

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値: 是否平行

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

method is_parallel(self, other: Plane3) -> bool

Description: 判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return: 是否平行

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

@property

method normal(self) -> Vector3

説明: 平面的法向量。

戻り値: 法向量

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

@property

method normal(self) -> Vector3

Description: 平面的法向量。

Return: 法向量

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

@classmethod

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

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

引数:

  • point: 平面上的一点
  • normal: 法向量

戻り値: 平面

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

@classmethod

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

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

Arguments:

  • point: 平面上的一点
  • normal: 法向量

Return: 平面

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

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

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

引数:

  • p1: 点1
  • p2: 点2
  • p3: 点3

戻り値: 平面

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

@classmethod

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

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

Arguments:

  • p1: 点1
  • p2: 点2
  • p3: 点3

Return: 平面

Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

引数:

  • l1: 直线1
  • l2: 直线2

戻り値: 平面

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

@classmethod

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

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

Arguments:

  • l1: 直线1
  • l2: 直线2

Return: 平面

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

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

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

引数:

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

戻り値: 平面

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

@classmethod

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

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

Arguments:

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

Return: 平面

Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -170,11 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

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

ソースコード
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

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

@overload

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

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

method __and__(self, other)

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

引数:

  • other:

戻り値: 不平行平面的交线,平面平行返回None

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

method __and__(self, other)

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

Arguments:

  • other:

Return: 不平行平面的交线,平面平行返回None

Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -191,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
`,103),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}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,103),t=[h];function p(e,k,r,d,o,E){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.cxytQLD4.lean.js b/assets/en_api_mp_math_plane.md.DUu9P3nM.lean.js similarity index 85% rename from assets/en_api_mp_math_plane.md.cxytQLD4.lean.js rename to assets/en_api_mp_math_plane.md.DUu9P3nM.lean.js index e48f76b..6043c0a 100644 --- a/assets/en_api_mp_math_plane.md.cxytQLD4.lean.js +++ b/assets/en_api_mp_math_plane.md.DUu9P3nM.lean.js @@ -1 +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":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/api/mp_math/plane.md"},h=n("",103),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}; +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("",103),t=[h];function p(e,k,r,d,o,E){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.CXQGh5Zt.js b/assets/en_api_mp_math_point.md.DMig0FI1.js similarity index 63% rename from assets/en_api_mp_math_point.md.CXQGh5Zt.js rename to assets/en_api_mp_math_point.md.DMig0FI1.js index 6a301ea..534c390 100644 --- a/assets/en_api_mp_math_point.md.CXQGh5Zt.js +++ b/assets/en_api_mp_math_point.md.DMig0FI1.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=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"}'),n={name:"en/api/mp_math/point.md"},l=t(`

class Point3

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

Description: 笛卡尔坐标系中的点。

Arguments:

  • 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 t}from"./chunks/framework.BV61Qrc0.js";const y=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"}'),n={name:"en/api/mp_math/point.md"},l=t(`

class Point3

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

Description: 笛卡尔坐标系中的点。

Arguments:

  • x: x 坐标
  • y: y 坐标
  • z: z 坐标
Source code
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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

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

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

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

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,11 +18,11 @@ import{_ as s,c as i,o as a,a2 as t}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])

@overload

method self + other: Vector3 => Point3

Source code
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

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

@overload

method self + other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

Description: P + V -> P P + P -> P

Arguments:

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

method self + other

Description: P + V -> P P + P -> P

Arguments:

  • other:
Source code
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -30,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

Description: 判断两个点是否相等。

Arguments:

  • other:
Source code
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

Description: 判断两个点是否相等。

Arguments:

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

method self - other: Point3 => Vector3

Description: P - P -> V

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

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

Description: P - P -> V

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

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
diff --git a/assets/en_api_mp_math_point.md.CXQGh5Zt.lean.js b/assets/en_api_mp_math_point.md.DMig0FI1.lean.js
similarity index 100%
rename from assets/en_api_mp_math_point.md.CXQGh5Zt.lean.js
rename to assets/en_api_mp_math_point.md.DMig0FI1.lean.js
diff --git a/assets/en_api_mp_math_segment.md.CxreVgqR.js b/assets/en_api_mp_math_segment.md.CcaokAF8.js
similarity index 81%
rename from assets/en_api_mp_math_segment.md.CxreVgqR.js
rename to assets/en_api_mp_math_segment.md.CcaokAF8.js
index f462604..9a9610c 100644
--- a/assets/en_api_mp_math_segment.md.CxreVgqR.js
+++ b/assets/en_api_mp_math_segment.md.CcaokAF8.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"}'),t={name:"en/api/mp_math/segment.md"},h=n(`

class Segment3

method __init__(self, p1: Point3, p2: Point3)

Description: 三维空间中的线段。 :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 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"}'),t={name:"en/api/mp_math/segment.md"},h=n(`

class Segment3

method __init__(self, p1: Point3, p2: Point3)

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
diff --git a/assets/en_api_mp_math_segment.md.CxreVgqR.lean.js b/assets/en_api_mp_math_segment.md.CcaokAF8.lean.js
similarity index 100%
rename from assets/en_api_mp_math_segment.md.CxreVgqR.lean.js
rename to assets/en_api_mp_math_segment.md.CcaokAF8.lean.js
diff --git a/assets/api_mp_math_utils.md.Bkx3QJ6f.js b/assets/en_api_mp_math_utils.md.DZohqw2b.js
similarity index 63%
rename from assets/api_mp_math_utils.md.Bkx3QJ6f.js
rename to assets/en_api_mp_math_utils.md.DZohqw2b.js
index ea744a5..01cddac 100644
--- a/assets/api_mp_math_utils.md.Bkx3QJ6f.js
+++ b/assets/en_api_mp_math_utils.md.DZohqw2b.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"},t=n(`

func clamp() -> float

说明: 区间限定函数

参数:

  • 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 E=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"}'),t={name:"en/api/mp_math/utils.md"},l=n(`

func clamp() -> float

Description: 区间限定函数

Arguments:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

Return: 限制后的值

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 E
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

参数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源代码
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

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

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

Arguments:

  • x: 数1
  • y: 数2
  • epsilon: 误差

Return: 是否近似相等

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

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

说明: 获取数的符号。

参数:

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

返回: 符号 + - ""

源代码
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

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

Description: 获取数的符号。

Arguments:

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

Return: 符号 + - ""

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

func 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:
+        return ''

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

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

Arguments:

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

Return: 符号 + - ""

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -48,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

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

method __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
@@ -59,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         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)

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

Source code
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,33),h=[l];function p(e,k,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_utils.md.aavLLFMy.lean.js b/assets/en_api_mp_math_utils.md.DZohqw2b.lean.js similarity index 100% rename from assets/en_api_mp_math_utils.md.aavLLFMy.lean.js rename to assets/en_api_mp_math_utils.md.DZohqw2b.lean.js diff --git a/assets/en_api_mp_math_vector.md.BvKJEw7_.js b/assets/en_api_mp_math_vector.md.Sd_IZsgE.js similarity index 69% rename from assets/en_api_mp_math_vector.md.BvKJEw7_.js rename to assets/en_api_mp_math_vector.md.Sd_IZsgE.js index 499c2be..26709e7 100644 --- a/assets/en_api_mp_math_vector.md.BvKJEw7_.js +++ b/assets/en_api_mp_math_vector.md.Sd_IZsgE.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"en/api/mp_math/vector.md"},h=t(`

class Vector3

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

Description: 3维向量

Arguments:

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

class Vector3

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

Description: 3维向量

Arguments:

  • 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

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

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

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

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

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

method cal_angle(self, other: Vector3) -> AnyAngle

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

Arguments:

  • other: 另一个向量

Return: 夹角

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

method cal_angle(self, other: Vector3) -> AnyAngle

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

Arguments:

  • other: 另一个向量

Return: 夹角

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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

Arguments:

  • other:

Return: 行列式的结果

Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

Arguments:

  • other:

Return: 行列式的结果

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 t}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)

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

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

Arguments:

  • other: 另一个向量
  • epsilon: 允许的误差

Return: 是否近似平行

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)

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

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

Arguments:

  • other: 另一个向量
  • epsilon: 允许的误差

Return: 是否近似平行

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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

Description: 判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return: 是否平行

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

method is_parallel(self, other: Vector3) -> bool

Description: 判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return: 是否平行

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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

method normalize(self)

Description: 将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

Description: 将向量归一化。

自体归一化,不返回值。

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

@property

method np_array(self) -> np.ndarray

Source code
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

Description: 向量的模。

Return: 模

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

@property

method length(self) -> float

Description: 向量的模。

Return: 模

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

@property

method unit(self) -> Vector3

Description: 获取该向量的单位向量。

Return: 单位向量

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

@property

method unit(self) -> Vector3

Description: 获取该向量的单位向量。

Return: 单位向量

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

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

@overload

method self + other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

method self + other

Description: V + P -> P

V + V -> V

Arguments:

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

method self + other

Description: V + P -> P

V + V -> V

Arguments:

  • 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 t}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)}'")

method __eq__(self, other)

Description: 判断两个向量是否相等。

Arguments:

  • other:

Return: 是否相等

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

method __eq__(self, other)

Description: 判断两个向量是否相等。

Arguments:

  • other:

Return: 是否相等

Source code
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as t}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)

method self + other: Point3 => Point3

Description: 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)

method self + other: Point3 => Point3

Description: 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 t}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

method self - other: Vector3 => Vector3

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

@overload

method self - other: Vector3 => Vector3

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

@overload

method self - other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

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

method self - other

Description: V - P -> P

V - V -> V

Arguments:

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

method self - other

Description: V - P -> P

V - V -> V

Arguments:

  • 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 t}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)}"')

method self - other: Point3

Description: P - V -> P

Arguments:

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

method self - other: Point3

Description: P - V -> P

Arguments:

  • 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 t}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

method self * other: Vector3 => Vector3

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

@overload

method self * other: Vector3 => Vector3

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

@overload

method self * other: RealNumber => Vector3

Source code
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

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

method self * other: int | float | Vector3 => Vector3

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

Arguments:

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

method self * other: int | float | Vector3 => Vector3

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

Arguments:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,14 +174,14 @@ import{_ as s,c as i,o as a,a2 as t}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)}'")

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

Description: 点乘。

Arguments:

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

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

Description: 点乘。

Arguments:

  • 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

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • Type: Vector3

  • Description: 零向量

var x_axis = Vector3(1, 0, 0)

  • Type: Vector3

  • Description: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • Type: Vector3

  • Description: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • Type: Vector3

  • Description: z轴单位向量

`,125),e=[h];function l(p,k,r,o,d,E){return a(),i("div",null,e)}const F=s(n,[["render",l]]);export{y as __pageData,F as default}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • Type: Vector3

  • Description: 零向量

var x_axis = Vector3(1, 0, 0)

  • Type: Vector3

  • Description: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • Type: Vector3

  • Description: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • Type: Vector3

  • Description: z轴单位向量

`,125),e=[h];function l(p,k,r,o,d,g){return a(),i("div",null,e)}const F=s(n,[["render",l]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_vector.md.BvKJEw7_.lean.js b/assets/en_api_mp_math_vector.md.Sd_IZsgE.lean.js similarity index 85% rename from assets/en_api_mp_math_vector.md.BvKJEw7_.lean.js rename to assets/en_api_mp_math_vector.md.Sd_IZsgE.lean.js index 0c06b93..6e6f85e 100644 --- a/assets/en_api_mp_math_vector.md.BvKJEw7_.lean.js +++ b/assets/en_api_mp_math_vector.md.Sd_IZsgE.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"en/api/mp_math/vector.md"},h=t("",125),e=[h];function l(p,k,r,o,d,E){return a(),i("div",null,e)}const F=s(n,[["render",l]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"en/api/mp_math/vector.md"},h=t("",125),e=[h];function l(p,k,r,o,d,g){return a(),i("div",null,e)}const F=s(n,[["render",l]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.DBfUZUBC.js b/assets/en_api_presets_model_index.md.Cs8vON2C.js similarity index 86% rename from assets/en_api_presets_model_index.md.DBfUZUBC.js rename to assets/en_api_presets_model_index.md.Cs8vON2C.js index 5e257f1..9fd5731 100644 --- a/assets/en_api_presets_model_index.md.DBfUZUBC.js +++ b/assets/en_api_presets_model_index.md.Cs8vON2C.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"}'),t={name:"en/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

Description: 生成球体上的点集。

Arguments:

  • radius:
  • density:

Return: List[Point3]: 球体上的点集。

Source code
python
@staticmethod
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=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"}'),t={name:"en/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

Description: 生成球体上的点集。

Arguments:

  • radius:
  • density:

Return: List[Point3]: 球体上的点集。

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=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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)]
`,8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.DBfUZUBC.lean.js b/assets/en_api_presets_model_index.md.Cs8vON2C.lean.js similarity index 58% rename from assets/en_api_presets_model_index.md.DBfUZUBC.lean.js rename to assets/en_api_presets_model_index.md.Cs8vON2C.lean.js index 28f9d3a..dcdc11c 100644 --- a/assets/en_api_presets_model_index.md.DBfUZUBC.lean.js +++ b/assets/en_api_presets_model_index.md.Cs8vON2C.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"}'),t={name:"en/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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 y=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"}'),t={name:"en/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.DmK_A9xI.js b/assets/ja_api_mp_math_angle.md.DL9J6RE2.js similarity index 66% rename from assets/en_api_mp_math_angle.md.DmK_A9xI.js rename to assets/ja_api_mp_math_angle.md.DL9J6RE2.js index 46d588d..bc97db1 100644 --- a/assets/en_api_mp_math_angle.md.DmK_A9xI.js +++ b/assets/ja_api_mp_math_angle.md.DL9J6RE2.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}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"}'),e={name:"en/api/mp_math/angle.md"},t=n(`

class Angle

class AnyAngle(Angle)

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

Description: 任意角度。

Arguments:

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

class Angle

class AnyAngle(Angle)

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

説明: 任意角度。

引数:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,92 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const c
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

Description: 余角:两角的和为90°。

Return: 余角

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

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

戻り値: 余角

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

@property

method supplementary(self) -> AnyAngle

Description: 补角:两角的和为180°。

Return: 补角

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

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

戻り値: 补角

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

@property

method degree(self) -> float

Description: 角度。

Return: 弧度

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

@property

method degree(self) -> float

説明: 角度。

戻り値: 弧度

ソースコード
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

Description: 最小正角。

Return: 最小正角度

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

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

戻り値: 最小正角度

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

@property

method maximum_negative(self) -> AnyAngle

Description: 最大负角。

Return: 最大负角度

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

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

戻り値: 最大负角度

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

@property

method sin(self) -> float

Description: 正弦值。

Return: 正弦值

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

@property

method sin(self) -> float

説明: 正弦值。

戻り値: 正弦值

ソースコード
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

method cos(self) -> float

Description: 余弦值。

Return: 余弦值

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

@property

method cos(self) -> float

説明: 余弦值。

戻り値: 余弦值

ソースコード
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

method tan(self) -> float

Description: 正切值。

Return: 正切值

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

@property

method tan(self) -> float

説明: 正切值。

戻り値: 正切值

ソースコード
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

method cot(self) -> float

Description: 余切值。

Return: 余切值

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

@property

method cot(self) -> float

説明: 余切值。

戻り値: 余切值

ソースコード
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

Description: 正割值。

Return: 正割值

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

@property

method sec(self) -> float

説明: 正割值。

戻り値: 正割值

ソースコード
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

Description: 余割值。

Return: 余割值

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

@property

method csc(self) -> float

説明: 余割值。

戻り値: 余割值

ソースコード
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

method self + other: AnyAngle => AnyAngle

ソースコード
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

Source code
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

method self / other

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

method self / other

ソースコード
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,78),l=[t];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; + return AnyAngle(self.radian / other, is_radian=True)
`,78),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const c=s(t,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/ja_api_mp_math_angle.md.DxBe_g0o.lean.js b/assets/ja_api_mp_math_angle.md.DL9J6RE2.lean.js similarity index 100% rename from assets/ja_api_mp_math_angle.md.DxBe_g0o.lean.js rename to assets/ja_api_mp_math_angle.md.DL9J6RE2.lean.js diff --git a/assets/en_api_mp_math_equation.md.DU8q_g4G.js b/assets/ja_api_mp_math_equation.md.tmRhsqm6.js similarity index 77% rename from assets/en_api_mp_math_equation.md.DU8q_g4G.js rename to assets/ja_api_mp_math_equation.md.tmRhsqm6.js index 5669c7c..db4cd31 100644 --- a/assets/en_api_mp_math_equation.md.DU8q_g4G.js +++ b/assets/ja_api_mp_math_equation.md.tmRhsqm6.js @@ -1,6 +1,9 @@ -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(`

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

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

Arguments:

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

Return: 偏导函数

Raises:

  • ValueError 无效变量类型
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 F=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(`

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

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

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

引数:

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

戻り値: 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -37,7 +40,7 @@ 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')

class CurveEquation

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

Description: 曲线方程。

Arguments:

  • x_func: x函数
  • y_func: y函数
  • z_func: z函数
Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +50,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

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

Description: 计算曲线上的点。

Arguments:

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

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

説明: 计算曲线上的点。

引数:

  • *t:
  • 参数:
ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,4 +62,4 @@ 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))])
`,19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const F=s(l,[["render",p]]);export{u as __pageData,F 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))])
`,20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_equation.md.-GejNICN.lean.js b/assets/ja_api_mp_math_equation.md.tmRhsqm6.lean.js similarity index 86% rename from assets/ja_api_mp_math_equation.md.-GejNICN.lean.js rename to assets/ja_api_mp_math_equation.md.tmRhsqm6.lean.js index cef2091..4ded0f5 100644 --- a/assets/ja_api_mp_math_equation.md.-GejNICN.lean.js +++ b/assets/ja_api_mp_math_equation.md.tmRhsqm6.lean.js @@ -1 +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.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("",19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u 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.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("",20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_line.md.CMfQT6TH.js b/assets/ja_api_mp_math_line.md.fj-_s5Ug.js similarity index 66% rename from assets/ja_api_mp_math_line.md.CMfQT6TH.js rename to assets/ja_api_mp_math_line.md.fj-_s5Ug.js index 701b590..7694534 100644 --- a/assets/ja_api_mp_math_line.md.CMfQT6TH.js +++ b/assets/ja_api_mp_math_line.md.fj-_s5Ug.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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

method __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 E=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"}'),t={name:"ja/api/mp_math/line.md"},l=n(`

class Line3

method __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 E
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

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

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

引数:

  • other: 另一条直线
  • epsilon: 误差

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

method 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 E
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
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 E
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

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

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

引数:

  • other: 平行直线或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

引数:

  • other: 平行直线或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
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 E
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

説明: 计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値: 交点

例外:

  • ValueError 直线平行
  • ValueError 直线不共面
ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

説明: 计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値: 交点

例外:

  • ValueError 直线平行
  • ValueError 直线不共面
ソースコード
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 E
         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

method cal_perpendicular(self, point: Point3) -> Line3

説明: 计算直线经过指定点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

method 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 E
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

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

引数:

  • t: 参数t

戻り値: 点

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method 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 E
         Returns:
 
         """
-    return self.point + t * self.direction

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

説明: 获取直线的参数方程。

戻り値: x(t), y(t), z(t)

ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

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

method 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:
+    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)

method 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 E
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

説明: 判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値: 是否平行

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

method 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 E
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

説明: 判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値: 是否共线

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

method 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 E
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method is_point_on(self, point: Point3) -> bool

説明: 判断点是否在直线上。

引数:

  • point: 点

戻り値: 是否在直线上

ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method 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 E
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

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

引数:

  • other: 另一条直线

戻り値: 是否共面

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

method 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 E
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

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

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

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method 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 E
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

引数:

  • p1: 点1
  • p2: 点2

戻り値: 直线

ソースコード
python
@classmethod
+        self.point.z = 0

@classmethod

method 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 E
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

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

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

引数:

  • other: 另一条直线

戻り値: 交点

ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __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 E
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

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

引数:

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

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

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

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,4 +175,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_line.md.CMfQT6TH.lean.js b/assets/ja_api_mp_math_line.md.fj-_s5Ug.lean.js similarity index 57% rename from assets/ja_api_mp_math_line.md.CMfQT6TH.lean.js rename to assets/ja_api_mp_math_line.md.fj-_s5Ug.lean.js index 8842389..f7adf8e 100644 --- a/assets/ja_api_mp_math_line.md.CMfQT6TH.lean.js +++ b/assets/ja_api_mp_math_line.md.fj-_s5Ug.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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("",105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"ja/api/mp_math/line.md"},l=n("",105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_plane.md.Buk-SLcC.js b/assets/ja_api_mp_math_plane.md.yLekgCvK.js similarity index 75% rename from assets/zht_api_mp_math_plane.md.Buk-SLcC.js rename to assets/ja_api_mp_math_plane.md.yLekgCvK.js index e958288..8f6ea20 100644 --- a/assets/zht_api_mp_math_plane.md.Buk-SLcC.js +++ b/assets/ja_api_mp_math_plane.md.yLekgCvK.js @@ -1,4 +1,4 @@ -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":"zht/api/mp_math/plane.md","filePath":"zht/api/mp_math/plane.md"}'),l={name:"zht/api/mp_math/plane.md"},h=n(`

class Plane3

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

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

變數説明:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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":"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

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

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

引数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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 F
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

method approx(self, other: Plane3) -> bool

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

變數説明:

  • other: 另一个平面

返回: 是否近似相等

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

method approx(self, other: Plane3) -> bool

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

引数:

  • other: 另一个平面

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -28,7 +28,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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

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

説明: 计算平面与平面之间的夹角。

變數説明:

  • other: 另一个平面

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

説明: 计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -43,7 +43,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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)}')

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

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

變數説明:

  • other: 另一个平面或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

引数:

  • other: 另一个平面或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -58,7 +58,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

變數説明:

  • other: 另一个平面

返回: 两平面的交线

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

引数:

  • other: 另一个平面

戻り値: 两平面的交线

ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -83,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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)

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

説明: 计算平面与直线的交点。

變數説明:

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

返回: 交点

抛出:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

説明: 计算平面与直线的交点。

引数:

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

戻り値: 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -97,7 +97,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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))

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

變數説明:

  • point: 指定点

返回: 所求平面

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

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

引数:

  • point: 指定点

戻り値: 所求平面

ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -105,7 +105,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

變數説明:

  • other: 另一个平面

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値: 是否平行

ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -113,14 +113,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

返回: 法向量

源碼
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

戻り値: 法向量

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

@classmethod

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

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

變數説明:

  • point: 平面上的一点
  • normal: 法向量

返回: 平面

源碼
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

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

變數説明:

  • p1: 点1
  • p2: 点2
  • p3: 点3

返回: 平面

源碼
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

變數説明:

  • l1: 直线1
  • l2: 直线2

返回: 平面

源碼
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

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

變數説明:

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

返回: 平面

源碼
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -170,11 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

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

源碼
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

ソースコード
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

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

源碼
python
@overload
+    ...

@overload

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

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

method __and__(self, other)

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

變數説明:

  • other:

返回: 不平行平面的交线,平面平行返回None

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

method __and__(self, other)

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

引数:

  • other:

戻り値: 不平行平面的交线,平面平行返回None

ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -191,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
`,103),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.Cm4a8eqF.lean.js b/assets/ja_api_mp_math_plane.md.yLekgCvK.lean.js similarity index 100% rename from assets/ja_api_mp_math_plane.md.Cm4a8eqF.lean.js rename to assets/ja_api_mp_math_plane.md.yLekgCvK.lean.js diff --git a/assets/ja_api_mp_math_point.md.CQAIjHfb.js b/assets/ja_api_mp_math_point.md.CpHHrSk8.js similarity index 64% rename from assets/ja_api_mp_math_point.md.CQAIjHfb.js rename to assets/ja_api_mp_math_point.md.CpHHrSk8.js index 89c98b5..8348b94 100644 --- a/assets/ja_api_mp_math_point.md.CQAIjHfb.js +++ b/assets/ja_api_mp_math_point.md.CpHHrSk8.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"ja/api/mp_math/point.md"},l=t(`

class Point3

method __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 t}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"}'),n={name:"ja/api/mp_math/point.md"},l=t(`

class Point3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,11 +18,11 @@ import{_ as s,c as i,o as a,a2 as t}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])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

method self + other: Point3 => Point3

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

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: P + V -> P P + P -> P

引数:

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

method self + other

説明: P + V -> P P + P -> P

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -30,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

説明: 判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

説明: P - P -> V

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

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

説明: P - P -> V

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

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
diff --git a/assets/ja_api_mp_math_point.md.CQAIjHfb.lean.js b/assets/ja_api_mp_math_point.md.CpHHrSk8.lean.js
similarity index 100%
rename from assets/ja_api_mp_math_point.md.CQAIjHfb.lean.js
rename to assets/ja_api_mp_math_point.md.CpHHrSk8.lean.js
diff --git a/assets/ja_api_mp_math_segment.md.D0U5bMSu.js b/assets/ja_api_mp_math_segment.md.CB1_z-rn.js
similarity index 81%
rename from assets/ja_api_mp_math_segment.md.D0U5bMSu.js
rename to assets/ja_api_mp_math_segment.md.CB1_z-rn.js
index 522a58c..c807dfc 100644
--- a/assets/ja_api_mp_math_segment.md.D0U5bMSu.js
+++ b/assets/ja_api_mp_math_segment.md.CB1_z-rn.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":"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

method __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 o=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

method __init__(self, p1: Point3, p2: Point3)

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

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
diff --git a/assets/ja_api_mp_math_segment.md.D0U5bMSu.lean.js b/assets/ja_api_mp_math_segment.md.CB1_z-rn.lean.js
similarity index 100%
rename from assets/ja_api_mp_math_segment.md.D0U5bMSu.lean.js
rename to assets/ja_api_mp_math_segment.md.CB1_z-rn.lean.js
diff --git a/assets/en_api_mp_math_utils.md.aavLLFMy.js b/assets/ja_api_mp_math_utils.md.BrfEEfl-.js
similarity index 65%
rename from assets/en_api_mp_math_utils.md.aavLLFMy.js
rename to assets/ja_api_mp_math_utils.md.BrfEEfl-.js
index 6cd6f3b..6ab1432 100644
--- a/assets/en_api_mp_math_utils.md.aavLLFMy.js
+++ b/assets/ja_api_mp_math_utils.md.BrfEEfl-.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"en/api/mp_math/utils.md"},l=n(`

func clamp() -> float

Description: 区间限定函数

Arguments:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

Return: 限制后的值

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

func 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 E
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

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

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

Arguments:

  • x: 数1
  • y: 数2
  • epsilon: 误差

Return: 是否近似相等

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

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

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

引数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

戻り値: 是否近似相等

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

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

Description: 获取数的符号。

Arguments:

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

Return: 符号 + - ""

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

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

説明: 获取数的符号。

引数:

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

戻り値: 符号 + - ""

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

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

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

Arguments:

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

Return: 符号 + - ""

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

func 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
@@ -48,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

Source code
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -59,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         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)

method raise_type_error(self, other)

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

method __ne__(self, other)

Source code
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,33),h=[l];function p(e,k,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; + self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_utils.md.CXGqGLUs.lean.js b/assets/ja_api_mp_math_utils.md.BrfEEfl-.lean.js similarity index 57% rename from assets/ja_api_mp_math_utils.md.CXGqGLUs.lean.js rename to assets/ja_api_mp_math_utils.md.BrfEEfl-.lean.js index 33263b4..b58e91e 100644 --- a/assets/ja_api_mp_math_utils.md.CXGqGLUs.lean.js +++ b/assets/ja_api_mp_math_utils.md.BrfEEfl-.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"},t=n("",33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=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"}'),t={name:"ja/api/mp_math/utils.md"},l=n("",33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_vector.md.C9TtayJk.js b/assets/ja_api_mp_math_vector.md.p54TKACE.js similarity index 70% rename from assets/ja_api_mp_math_vector.md.C9TtayJk.js rename to assets/ja_api_mp_math_vector.md.p54TKACE.js index ff942bd..9e30d60 100644 --- a/assets/ja_api_mp_math_vector.md.C9TtayJk.js +++ b/assets/ja_api_mp_math_vector.md.p54TKACE.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"ja/api/mp_math/vector.md"},h=t(`

class Vector3

method __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 t}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"}'),n={name:"ja/api/mp_math/vector.md"},h=t(`

class Vector3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method 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 t}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])

method cal_angle(self, other: Vector3) -> AnyAngle

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

引数:

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

引数:

  • other:

戻り値: 行列式的结果

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

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

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

引数:

  • other:

戻り値: 行列式的结果

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

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

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

引数:

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

説明: 判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値: 是否平行

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

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

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

@property

method np_array(self) -> np.ndarray

ソースコード
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

説明: 向量的模。

戻り値: 模

ソースコード
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

説明: 向量的模。

戻り値: 模

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

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

戻り値: 单位向量

ソースコード
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

戻り値: 单位向量

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

method __abs__(self)

ソースコード
python
def __abs__(self):
-    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
+    return self / self.length

method __abs__(self)

ソースコード
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self + other: Point3 => Point3

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

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: V + P -> P

V + V -> V

引数:

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

method 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 t}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)}'")

method __eq__(self, other)

説明: 判断两个向量是否相等。

引数:

  • other:

戻り値: 是否相等

ソースコード
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __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 t}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)

method self + other: Point3 => 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)

method 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 t}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

method self - other: Vector3 => Vector3

ソースコード
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

ソースコード
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self - other: Point3 => Point3

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

@overload

method self - other: Point3 => Point3

ソースコード
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

method self - other

説明: V - P -> P

V - V -> V

引数:

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

method 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 t}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)}"')

method 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)}"')

method 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 t}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

method self * other: Vector3 => Vector3

ソースコード
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

ソースコード
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self * other: RealNumber => Vector3

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

@overload

method self * other: RealNumber => Vector3

ソースコード
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

method self * other: int | float | Vector3 => Vector3

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

引数:

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

method self * other: int | float | Vector3 => Vector3

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

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,14 +174,14 @@ import{_ as s,c as i,o as a,a2 as t}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)}'")

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

説明: 点乘。

引数:

  • other:
ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

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

method 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

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • タイプ: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • タイプ: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • タイプ: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • タイプ: Vector3

  • 説明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • タイプ: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • タイプ: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • タイプ: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • タイプ: Vector3

  • 説明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_vector.md.C9TtayJk.lean.js b/assets/ja_api_mp_math_vector.md.p54TKACE.lean.js similarity index 85% rename from assets/ja_api_mp_math_vector.md.C9TtayJk.lean.js rename to assets/ja_api_mp_math_vector.md.p54TKACE.lean.js index a9174df..78815d4 100644 --- a/assets/ja_api_mp_math_vector.md.C9TtayJk.lean.js +++ b/assets/ja_api_mp_math_vector.md.p54TKACE.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"ja/api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as t}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"}'),n={name:"ja/api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.DAVK1sDI.js b/assets/ja_api_presets_model_index.md.D8yZmO5R.js similarity index 88% rename from assets/ja_api_presets_model_index.md.DAVK1sDI.js rename to assets/ja_api_presets_model_index.md.D8yZmO5R.js index f234eaa..cec2b23 100644 --- a/assets/ja_api_presets_model_index.md.DAVK1sDI.js +++ b/assets/ja_api_presets_model_index.md.D8yZmO5R.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"}'),t={name:"ja/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

引数:

  • radius:
  • density:

戻り値: List[Point3]: 球体上的点集。

ソースコード
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"}'),t={name:"ja/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

引数:

  • radius:
  • density:

戻り値: List[Point3]: 球体上的点集。

ソースコード
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=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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)]
`,8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.DAVK1sDI.lean.js b/assets/ja_api_presets_model_index.md.D8yZmO5R.lean.js similarity index 86% rename from assets/ja_api_presets_model_index.md.DAVK1sDI.lean.js rename to assets/ja_api_presets_model_index.md.D8yZmO5R.lean.js index 8f9992c..6239e6f 100644 --- a/assets/ja_api_presets_model_index.md.DAVK1sDI.lean.js +++ b/assets/ja_api_presets_model_index.md.D8yZmO5R.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"}'),t={name:"ja/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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"}'),t={name:"ja/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/zht_api_mp_math_angle.md._4N19GGe.js b/assets/zht_api_mp_math_angle.md.B4T6L25M.js similarity index 66% rename from assets/zht_api_mp_math_angle.md._4N19GGe.js rename to assets/zht_api_mp_math_angle.md.B4T6L25M.js index 7c2b91f..0fc8940 100644 --- a/assets/zht_api_mp_math_angle.md._4N19GGe.js +++ b/assets/zht_api_mp_math_angle.md.B4T6L25M.js @@ -1,4 +1,4 @@ -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":"zht/api/mp_math/angle.md","filePath":"zht/api/mp_math/angle.md"}'),t={name:"zht/api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

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

class Angle

class AnyAngle(Angle)

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

説明: 任意角度。

變數説明:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
源碼
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,92 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

返回: 余角

源碼
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

返回: 余角

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

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

返回: 补角

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

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

返回: 补角

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

@property

method degree(self) -> float

説明: 角度。

返回: 弧度

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

@property

method degree(self) -> float

説明: 角度。

返回: 弧度

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

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

返回: 最小正角度

源碼
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

返回: 最小正角度

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

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

返回: 最大负角度

源碼
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

返回: 最大负角度

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

@property

method sin(self) -> float

説明: 正弦值。

返回: 正弦值

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

@property

method sin(self) -> float

説明: 正弦值。

返回: 正弦值

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

@property

method cos(self) -> float

説明: 余弦值。

返回: 余弦值

源碼
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

説明: 余弦值。

返回: 余弦值

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

@property

method tan(self) -> float

説明: 正切值。

返回: 正切值

源碼
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

説明: 正切值。

返回: 正切值

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

@property

method cot(self) -> float

説明: 余切值。

返回: 余切值

源碼
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

説明: 余切值。

返回: 余切值

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

@property

method sec(self) -> float

説明: 正割值。

返回: 正割值

源碼
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

説明: 正割值。

返回: 正割值

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

@property

method csc(self) -> float

説明: 余割值。

返回: 余割值

源碼
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

説明: 余割值。

返回: 余割值

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

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

源碼
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

源碼
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

method self / other

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

method self / other

源碼
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
`,78),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const c=s(t,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/zht_api_mp_math_angle.md._4N19GGe.lean.js b/assets/zht_api_mp_math_angle.md.B4T6L25M.lean.js similarity index 100% rename from assets/zht_api_mp_math_angle.md._4N19GGe.lean.js rename to assets/zht_api_mp_math_angle.md.B4T6L25M.lean.js diff --git a/assets/zht_api_mp_math_equation.md.MGSqd_Ep.js b/assets/zht_api_mp_math_equation.md.5p50czv3.js similarity index 72% rename from assets/zht_api_mp_math_equation.md.MGSqd_Ep.js rename to assets/zht_api_mp_math_equation.md.5p50czv3.js index c29835b..085f9de 100644 --- a/assets/zht_api_mp_math_equation.md.MGSqd_Ep.js +++ b/assets/zht_api_mp_math_equation.md.5p50czv3.js @@ -1,6 +1,9 @@ -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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zht/api/mp_math/equation.md","filePath":"zht/api/mp_math/equation.md"}'),l={name:"zht/api/mp_math/equation.md"},t=n(`

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

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

變數説明:

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

返回: 偏导函数

抛出:

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

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

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

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

變數説明:

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

返回: 偏导函数

抛出:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -37,7 +40,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +50,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

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

説明: 计算曲线上的点。

變數説明:

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

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

説明: 计算曲线上的点。

變數説明:

  • *t:
  • 参数:
源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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))])
`,19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F 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))])
`,20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/zht_api_mp_math_equation.md.MGSqd_Ep.lean.js b/assets/zht_api_mp_math_equation.md.5p50czv3.lean.js similarity index 86% rename from assets/zht_api_mp_math_equation.md.MGSqd_Ep.lean.js rename to assets/zht_api_mp_math_equation.md.5p50czv3.lean.js index 7559bab..3a53c98 100644 --- a/assets/zht_api_mp_math_equation.md.MGSqd_Ep.lean.js +++ b/assets/zht_api_mp_math_equation.md.5p50czv3.lean.js @@ -1 +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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zht/api/mp_math/equation.md","filePath":"zht/api/mp_math/equation.md"}'),l={name:"zht/api/mp_math/equation.md"},t=n("",19),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u 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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zht/api/mp_math/equation.md","filePath":"zht/api/mp_math/equation.md"}'),l={name:"zht/api/mp_math/equation.md"},t=n("",20),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{F as __pageData,u as default}; diff --git a/assets/zht_api_mp_math_line.md.4ncoPmkZ.js b/assets/zht_api_mp_math_line.md.DYC1X0oD.js similarity index 65% rename from assets/zht_api_mp_math_line.md.4ncoPmkZ.js rename to assets/zht_api_mp_math_line.md.DYC1X0oD.js index 3242cf3..fb70858 100644 --- a/assets/zht_api_mp_math_line.md.4ncoPmkZ.js +++ b/assets/zht_api_mp_math_line.md.DYC1X0oD.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),l={name:"zht/api/mp_math/line.md"},t=n(`

class Line3

method __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 E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),t={name:"zht/api/mp_math/line.md"},l=n(`

class Line3

method __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 E
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

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

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

變數説明:

  • other: 另一条直线
  • epsilon: 误差

返回: 是否近似相等

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

method 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 E
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

變數説明:

  • other: 另一条直线

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

變數説明:

  • other: 另一条直线

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
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 E
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

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

説明: 计算直线和直线或点之间的距离。

變數説明:

  • other: 平行直线或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

説明: 计算直线和直线或点之间的距离。

變數説明:

  • other: 平行直线或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
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 E
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

變數説明:

  • other: 另一条直线

返回: 交点

抛出:

  • ValueError 直线平行
  • ValueError 直线不共面
源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

變數説明:

  • other: 另一条直线

返回: 交点

抛出:

  • ValueError 直线平行
  • ValueError 直线不共面
源碼
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 E
         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

method cal_perpendicular(self, point: Point3) -> Line3

説明: 计算直线经过指定点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

method 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 E
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

説明: 获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

變數説明:

  • t: 参数t

返回: 点

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method 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 E
         Returns:
 
         """
-    return self.point + t * self.direction

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

説明: 获取直线的参数方程。

返回: x(t), y(t), z(t)

源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

method 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)

method 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:
+    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)

method 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 E
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

説明: 判断两条直线是否平行。

變數説明:

  • other: 另一条直线

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method 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 E
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

説明: 判断两条直线是否共线。

變數説明:

  • other: 另一条直线

返回: 是否共线

源碼
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method 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 E
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method is_point_on(self, point: Point3) -> bool

説明: 判断点是否在直线上。

變數説明:

  • point: 点

返回: 是否在直线上

源碼
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method 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 E
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

説明: 判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

變數説明:

  • other: 另一条直线

返回: 是否共面

源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

method 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 E
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

説明: 简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method 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 E
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

説明: 工厂函数 由两点构造直线。

變數説明:

  • p1: 点1
  • p2: 点2

返回: 直线

源碼
python
@classmethod
+        self.point.z = 0

@classmethod

method 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 E
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

説明: 计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

變數説明:

  • other: 另一条直线

返回: 交点

源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __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 E
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

變數説明:

  • other:
源碼
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

變數説明:

  • other:
源碼
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -175,4 +175,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_line.md.4ncoPmkZ.lean.js b/assets/zht_api_mp_math_line.md.DYC1X0oD.lean.js similarity index 57% rename from assets/zht_api_mp_math_line.md.4ncoPmkZ.lean.js rename to assets/zht_api_mp_math_line.md.DYC1X0oD.lean.js index 8d2d9e6..3bb8bdc 100644 --- a/assets/zht_api_mp_math_line.md.4ncoPmkZ.lean.js +++ b/assets/zht_api_mp_math_line.md.DYC1X0oD.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),l={name:"zht/api/mp_math/line.md"},t=n("",105),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),t={name:"zht/api/mp_math/line.md"},l=n("",105),h=[l];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_plane.md.cxytQLD4.js b/assets/zht_api_mp_math_plane.md.B6GWRRF6.js similarity index 76% rename from assets/en_api_mp_math_plane.md.cxytQLD4.js rename to assets/zht_api_mp_math_plane.md.B6GWRRF6.js index 3d6016e..592fc51 100644 --- a/assets/en_api_mp_math_plane.md.cxytQLD4.js +++ b/assets/zht_api_mp_math_plane.md.B6GWRRF6.js @@ -1,4 +1,4 @@ -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

method __init__(self, a: float, b: float, c: float, d: float)

Description: 平面方程:ax + by + cz + d = 0

Arguments:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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":"zht/api/mp_math/plane.md","filePath":"zht/api/mp_math/plane.md"}'),l={name:"zht/api/mp_math/plane.md"},h=n(`

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

説明: 平面方程:ax + by + cz + d = 0

變數説明:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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 F
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

method approx(self, other: Plane3) -> bool

Description: 判断两个平面是否近似相等。

Arguments:

  • other: 另一个平面

Return: 是否近似相等

Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

method approx(self, other: Plane3) -> bool

説明: 判断两个平面是否近似相等。

變數説明:

  • other: 另一个平面

返回: 是否近似相等

源碼
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -28,7 +28,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

Description: 计算平面与平面之间的夹角。

Arguments:

  • other: 另一个平面

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

説明: 计算平面与平面之间的夹角。

變數説明:

  • other: 另一个平面

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -43,7 +43,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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)}')

method cal_distance(self, other: Plane3 | Point3) -> float

Description: 计算平面与平面或点之间的距离。

Arguments:

  • other: 另一个平面或点

Return: 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

説明: 计算平面与平面或点之间的距离。

變數説明:

  • other: 另一个平面或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -58,7 +58,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

Description: 计算两平面的交线。

Arguments:

  • other: 另一个平面

Return: 两平面的交线

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

變數説明:

  • other: 另一个平面

返回: 两平面的交线

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -83,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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)

method cal_intersection_point3(self, other: Line3) -> Point3

Description: 计算平面与直线的交点。

Arguments:

  • other: 不与平面平行或在平面上的直线

Return: 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

説明: 计算平面与直线的交点。

變數説明:

  • other: 不与平面平行或在平面上的直线

返回: 交点

抛出:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -97,7 +97,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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))

method cal_parallel_plane3(self, point: Point3) -> Plane3

Description: 计算平行于该平面且过指定点的平面。

Arguments:

  • point: 指定点

Return: 所求平面

Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

説明: 计算平行于该平面且过指定点的平面。

變數説明:

  • point: 指定点

返回: 所求平面

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -105,7 +105,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

Description: 判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

變數説明:

  • other: 另一个平面

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -113,14 +113,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

Description: 平面的法向量。

Return: 法向量

Source code
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

返回: 法向量

源碼
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

Description: 工厂函数 由点和法向量构造平面(点法式构造)。

Arguments:

  • point: 平面上的一点
  • normal: 法向量

Return: 平面

Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method 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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -132,7 +132,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

Description: 工厂函数 由三点构造平面。

Arguments:

  • p1: 点1
  • p2: 点2
  • p3: 点3

Return: 平面

Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

Description: 工厂函数 由两直线构造平面。

Arguments:

  • l1: 直线1
  • l2: 直线2

Return: 平面

Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method 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':
     """
         工厂函数 由两直线构造平面。
@@ -160,7 +160,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

Description: 工厂函数 由点和直线构造平面。

Arguments:

  • point: 面上一点
  • line: 面上直线,不包含点

Return: 平面

Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -170,11 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

Source code
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

源碼
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

Source code
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

源碼
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

method __and__(self, other)

Description: 取两平面的交集(人话:交线)

Arguments:

  • other:

Return: 不平行平面的交线,平面平行返回None

Source code
python
def __and__(self, other):
+    ...

method __and__(self, other)

説明: 取两平面的交集(人话:交线)

變數説明:

  • other:

返回: 不平行平面的交线,平面平行返回None

源碼
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -191,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)
`,103),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}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,103),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/zht_api_mp_math_plane.md.Buk-SLcC.lean.js b/assets/zht_api_mp_math_plane.md.B6GWRRF6.lean.js similarity index 100% rename from assets/zht_api_mp_math_plane.md.Buk-SLcC.lean.js rename to assets/zht_api_mp_math_plane.md.B6GWRRF6.lean.js diff --git a/assets/zht_api_mp_math_point.md.Bb3tyGv-.js b/assets/zht_api_mp_math_point.md.Bm1IEwlI.js similarity index 63% rename from assets/zht_api_mp_math_point.md.Bb3tyGv-.js rename to assets/zht_api_mp_math_point.md.Bm1IEwlI.js index da6c851..52ae783 100644 --- a/assets/zht_api_mp_math_point.md.Bb3tyGv-.js +++ b/assets/zht_api_mp_math_point.md.Bm1IEwlI.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zht/api/mp_math/point.md","filePath":"zht/api/mp_math/point.md"}'),n={name:"zht/api/mp_math/point.md"},l=t(`

class Point3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zht/api/mp_math/point.md","filePath":"zht/api/mp_math/point.md"}'),n={name:"zht/api/mp_math/point.md"},l=t(`

class Point3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,11 +18,11 @@ import{_ as s,c as i,o as a,a2 as t}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])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    ...

method self + other

説明: P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -30,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

説明: 判断两个点是否相等。

變數説明:

  • other:
源碼
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
diff --git a/assets/zht_api_mp_math_point.md.Bb3tyGv-.lean.js b/assets/zht_api_mp_math_point.md.Bm1IEwlI.lean.js
similarity index 100%
rename from assets/zht_api_mp_math_point.md.Bb3tyGv-.lean.js
rename to assets/zht_api_mp_math_point.md.Bm1IEwlI.lean.js
diff --git a/assets/zht_api_mp_math_segment.md.U_lS4vUA.js b/assets/zht_api_mp_math_segment.md.Bop8t2IE.js
similarity index 81%
rename from assets/zht_api_mp_math_segment.md.U_lS4vUA.js
rename to assets/zht_api_mp_math_segment.md.Bop8t2IE.js
index 4e078d7..69a3d5c 100644
--- a/assets/zht_api_mp_math_segment.md.U_lS4vUA.js
+++ b/assets/zht_api_mp_math_segment.md.Bop8t2IE.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":"zht/api/mp_math/segment.md","filePath":"zht/api/mp_math/segment.md"}'),t={name:"zht/api/mp_math/segment.md"},h=n(`

class Segment3

method __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 o=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"zht/api/mp_math/segment.md","filePath":"zht/api/mp_math/segment.md"}'),t={name:"zht/api/mp_math/segment.md"},h=n(`

class Segment3

method __init__(self, p1: Point3, p2: Point3)

説明: 三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
diff --git a/assets/zht_api_mp_math_segment.md.U_lS4vUA.lean.js b/assets/zht_api_mp_math_segment.md.Bop8t2IE.lean.js
similarity index 100%
rename from assets/zht_api_mp_math_segment.md.U_lS4vUA.lean.js
rename to assets/zht_api_mp_math_segment.md.Bop8t2IE.lean.js
diff --git a/assets/zht_api_mp_math_utils.md.ig9jQkoA.js b/assets/zht_api_mp_math_utils.md.CERv8c-M.js
similarity index 64%
rename from assets/zht_api_mp_math_utils.md.ig9jQkoA.js
rename to assets/zht_api_mp_math_utils.md.CERv8c-M.js
index c0fd388..2f7a9f6 100644
--- a/assets/zht_api_mp_math_utils.md.ig9jQkoA.js
+++ b/assets/zht_api_mp_math_utils.md.CERv8c-M.js
@@ -1,4 +1,4 @@
-import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),l={name:"zht/api/mp_math/utils.md"},t=n(`

func clamp() -> float

説明: 区间限定函数

變數説明:

  • 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 E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),t={name:"zht/api/mp_math/utils.md"},l=n(`

func 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 E
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -19,7 +19,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

變數説明:

  • x: 数
  • only_neg: 是否只返回负数的符号

返回: 符号 + - ""

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

變數説明:

  • x: 数
  • only_neg: 是否只返回负数的符号

返回: 符号 + - ""

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -32,7 +32,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     elif x < 0:
         return '-'
     else:
-        return ''

func 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:
+        return ''

func 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
@@ -48,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
-    self.value = value

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -59,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E
         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)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; + self.raise_type_error(other)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_utils.md.ig9jQkoA.lean.js b/assets/zht_api_mp_math_utils.md.CERv8c-M.lean.js similarity index 57% rename from assets/zht_api_mp_math_utils.md.ig9jQkoA.lean.js rename to assets/zht_api_mp_math_utils.md.CERv8c-M.lean.js index 32646d9..2a6f2c3 100644 --- a/assets/zht_api_mp_math_utils.md.ig9jQkoA.lean.js +++ b/assets/zht_api_mp_math_utils.md.CERv8c-M.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),l={name:"zht/api/mp_math/utils.md"},t=n("",33),h=[t];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),t={name:"zht/api/mp_math/utils.md"},l=n("",33),h=[l];function p(k,e,r,d,o,g){return a(),i("div",null,h)}const y=s(t,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_vector.md.CDyAXuJb.js b/assets/zht_api_mp_math_vector.md.BTWxlpB1.js similarity index 69% rename from assets/zht_api_mp_math_vector.md.CDyAXuJb.js rename to assets/zht_api_mp_math_vector.md.BTWxlpB1.js index 9a1a703..6306e26 100644 --- a/assets/zht_api_mp_math_vector.md.CDyAXuJb.js +++ b/assets/zht_api_mp_math_vector.md.BTWxlpB1.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t(`

class Vector3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t(`

class Vector3

method __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 t}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method 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 t}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])

method cal_angle(self, other: Vector3) -> AnyAngle

説明: 计算两个向量之间的夹角。

變數説明:

  • 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])

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回: 行列式的结果

源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回: 行列式的结果

源碼
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 t}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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似平行。

變數説明:

  • 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)

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

説明: 判断两个向量是否平行。

變數説明:

  • other: 另一个向量

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method 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 t}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

method np_array(self) -> np.ndarray

源碼
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

説明: 向量的模。

返回: 模

源碼
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

説明: 向量的模。

返回: 模

源碼
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

返回: 单位向量

源碼
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

返回: 单位向量

源碼
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
-    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
+    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: V + P -> P

V + V -> V

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    ...

method 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 t}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)}'")

method __eq__(self, other)

説明: 判断两个向量是否相等。

變數説明:

  • other:

返回: 是否相等

源碼
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __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 t}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)

method self + other: Point3 => 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)

method 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 t}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

method self - other: Vector3 => Vector3

源碼
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

源碼
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self - other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

源碼
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

method self - other

説明: V - P -> P

V - V -> V

變數説明:

  • other:
源碼
python
def __sub__(self, other):
+    ...

method 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 t}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)}"')

method 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)}"')

method 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 t}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

method self * other: Vector3 => Vector3

源碼
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

源碼
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self * other: RealNumber => Vector3

源碼
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

源碼
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,14 +174,14 @@ import{_ as s,c as i,o as a,a2 as t}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)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

説明: 点乘。

變數説明:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method 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

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • 類型: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 類型: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 類型: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 類型: Vector3

  • 説明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • 類型: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 類型: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 類型: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 類型: Vector3

  • 説明: z轴单位向量

`,125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_mp_math_vector.md.CDyAXuJb.lean.js b/assets/zht_api_mp_math_vector.md.BTWxlpB1.lean.js similarity index 85% rename from assets/zht_api_mp_math_vector.md.CDyAXuJb.lean.js rename to assets/zht_api_mp_math_vector.md.BTWxlpB1.lean.js index 38a3194..28e1cd9 100644 --- a/assets/zht_api_mp_math_vector.md.CDyAXuJb.lean.js +++ b/assets/zht_api_mp_math_vector.md.BTWxlpB1.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t("",125),l=[h];function e(p,k,r,o,d,g){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_presets_model_index.md.CrdAyyCM.js b/assets/zht_api_presets_model_index.md.SQ5PPdaL.js similarity index 88% rename from assets/zht_api_presets_model_index.md.CrdAyyCM.js rename to assets/zht_api_presets_model_index.md.SQ5PPdaL.js index 0340a3a..dfc5749 100644 --- a/assets/zht_api_presets_model_index.md.CrdAyyCM.js +++ b/assets/zht_api_presets_model_index.md.SQ5PPdaL.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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

變數説明:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源碼
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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

變數説明:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源碼
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=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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)]
`,8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/assets/zht_api_presets_model_index.md.CrdAyyCM.lean.js b/assets/zht_api_presets_model_index.md.SQ5PPdaL.lean.js similarity index 86% rename from assets/zht_api_presets_model_index.md.CrdAyyCM.lean.js rename to assets/zht_api_presets_model_index.md.SQ5PPdaL.lean.js index 8e76554..6adfabc 100644 --- a/assets/zht_api_presets_model_index.md.CrdAyyCM.lean.js +++ b/assets/zht_api_presets_model_index.md.SQ5PPdaL.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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n("",8),l=[h];function k(p,e,r,d,E,g){return a(),i("div",null,l)}const F=s(t,[["render",k]]);export{o as __pageData,F as default}; diff --git a/en/api/index.html b/en/api/index.html index 9914944..d23e7d9 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 9d07d0b..aac9a9b 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(Angle)

method __init__(self, value: float, is_radian: bool = False)

Description: 任意角度。

Arguments:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
Source code
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle(Angle)

method __init__(self, value: float, is_radian: bool = False)

Description: 任意角度。

Arguments:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,96 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

Description: 余角:两角的和为90°。

Return: 余角

Source code
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

Description: 余角:两角的和为90°。

Return: 余角

Source code
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

Description: 补角:两角的和为180°。

Return: 补角

Source code
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

Description: 补角:两角的和为180°。

Return: 补角

Source code
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

Description: 角度。

Return: 弧度

Source code
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

Description: 角度。

Return: 弧度

Source code
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

Description: 最小正角。

Return: 最小正角度

Source code
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

Description: 最小正角。

Return: 最小正角度

Source code
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

Description: 最大负角。

Return: 最大负角度

Source code
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

Description: 最大负角。

Return: 最大负角度

Source code
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

Description: 正弦值。

Return: 正弦值

Source code
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

Description: 正弦值。

Return: 正弦值

Source code
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

method cos(self) -> float

Description: 余弦值。

Return: 余弦值

Source code
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

Description: 余弦值。

Return: 余弦值

Source code
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

method tan(self) -> float

Description: 正切值。

Return: 正切值

Source code
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

Description: 正切值。

Return: 正切值

Source code
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

method cot(self) -> float

Description: 余切值。

Return: 余切值

Source code
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

Description: 余切值。

Return: 余切值

Source code
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

Description: 正割值。

Return: 正割值

Source code
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

Description: 正割值。

Return: 正割值

Source code
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

Description: 余割值。

Return: 余割值

Source code
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

Description: 余割值。

Return: 余割值

Source code
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

Source code
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

Source code
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

Source code
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

Source code
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

method self / other: AnyAngle => float

Source code
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

Source code
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

method self / other

Source code
python
def __truediv__(self, other):
+    ...

method 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 2689be7..7e53814 100644 --- a/en/api/mp_math/const.html +++ b/en/api/mp_math/const.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/en/api/mp_math/equation.html b/en/api/mp_math/equation.html index acbde78..ab1c6a8 100644 --- a/en/api/mp_math/equation.html +++ b/en/api/mp_math/equation.html @@ -12,14 +12,17 @@ - + -
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

Description: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

Arguments:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

Return: 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

Description: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

Arguments:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

Return: 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -56,7 +59,7 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

Description: 曲线方程。

Arguments:

  • x_func: x函数
  • y_func: y函数
  • z_func: z函数
Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+        raise ValueError('Invalid var type')

class CurveEquation

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

Description: 曲线方程。

Arguments:

  • 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 +69,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

Description: 计算曲线上的点。

Arguments:

  • *t:
  • 参数:
Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

Description: 计算曲线上的点。

Arguments:

  • *t:
  • 参数:
Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -79,7 +82,7 @@
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
- + \ No newline at end of file diff --git a/en/api/mp_math/index.html b/en/api/mp_math/index.html index 551254d..18744e4 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 147d978..c170f70 100644 --- a/en/api/mp_math/line.html +++ b/en/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

Description: 三维空间中的直线。由一个点和一个方向向量确定。

Arguments:

  • point: 直线上的一点
  • direction: 直线的方向向量
Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

Description: 三维空间中的直线。由一个点和一个方向向量确定。

Arguments:

  • point: 直线上的一点
  • direction: 直线的方向向量
Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

Description: 判断两条直线是否近似相等。

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似相等

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

Description: 判断两条直线是否近似相等。

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似相等

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)

method cal_angle(self, other: Line3) -> AnyAngle

Description: 计算直线和直线之间的夹角。

Arguments:

  • other: 另一条直线

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
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)

method cal_angle(self, other: Line3) -> AnyAngle

Description: 计算直线和直线之间的夹角。

Arguments:

  • other: 另一条直线

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

Description: 计算直线和直线或点之间的距离。

Arguments:

  • other: 平行直线或点

Return: 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

Description: 计算直线和直线或点之间的距离。

Arguments:

  • other: 平行直线或点

Return: 距离

Raises:

  • TypeError 不支持的类型
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.')

method cal_intersection(self, other: Line3) -> Point3

Description: 计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return: 交点

Raises:

  • ValueError 直线平行
  • ValueError 直线不共面
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

Description: 计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return: 交点

Raises:

  • ValueError 直线平行
  • ValueError 直线不共面
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

method cal_perpendicular(self, point: Point3) -> Line3

Description: 计算直线经过指定点p的垂线。

Arguments:

  • point: 指定点

Return: 垂线

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

method cal_perpendicular(self, point: Point3) -> Line3

Description: 计算直线经过指定点p的垂线。

Arguments:

  • point: 指定点

Return: 垂线

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))

method get_point(self, t: RealNumber) -> Point3

Description: 获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Arguments:

  • t: 参数t

Return: 点

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

Description: 获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Arguments:

  • t: 参数t

Return: 点

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -98,13 +98,13 @@
         Returns:
 
         """
-    return self.point + t * self.direction

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

Description: 获取直线的参数方程。

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

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

Description: 获取直线的参数方程。

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)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

Description: 判断两条直线是否近似平行。

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似平行

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)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

Description: 判断两条直线是否近似平行。

Arguments:

  • other: 另一条直线
  • epsilon: 误差

Return: 是否近似平行

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)

method is_parallel(self, other: Line3) -> bool

Description: 判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

Description: 判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

Description: 判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return: 是否共线

Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

Description: 判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return: 是否共线

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)

method is_point_on(self, point: Point3) -> bool

Description: 判断点是否在直线上。

Arguments:

  • point: 点

Return: 是否在直线上

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)

method is_point_on(self, point: Point3) -> bool

Description: 判断点是否在直线上。

Arguments:

  • point: 点

Return: 是否在直线上

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)

method is_coplanar(self, other: Line3) -> bool

Description: 判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Arguments:

  • other: 另一条直线

Return: 是否共面

Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

Description: 判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Arguments:

  • other: 另一条直线

Return: 是否共面

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

method simplify(self)

Description: 简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

Source code
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

Description: 简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对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

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

Description: 工厂函数 由两点构造直线。

Arguments:

  • p1: 点1
  • p2: 点2

Return: 直线

Source code
python
@classmethod
+        self.point.z = 0

@classmethod

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

Description: 工厂函数 由两点构造直线。

Arguments:

  • p1: 点1
  • p2: 点2

Return: 直线

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)

method __and__(self, other: Line3) -> Line3 | Point3 | None

Description: 计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Arguments:

  • other: 另一条直线

Return: 交点

Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

Description: 计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Arguments:

  • other: 另一条直线

Return: 交点

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)

method __eq__(self, other) -> bool

Description: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

Arguments:

  • other:
Source code
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

Description: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

Arguments:

  • other:
Source code
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -195,7 +195,7 @@
 
         """
     return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
- + \ No newline at end of file diff --git a/en/api/mp_math/mp_math_typing.html b/en/api/mp_math/mp_math_typing.html index b8e1636..65f0b38 100644 --- a/en/api/mp_math/mp_math_typing.html +++ b/en/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • Type: TypeAlias

  • Description: 实数

var Number = RealNumber | complex

  • Type: TypeAlias

  • Description: 数

var SingleVar = TypeVar('SingleVar', bound=Number)

  • Description: 单变量

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

  • Description: 数组变量

var Var = SingleVar | ArrayVar

  • Type: TypeAlias

  • Description: 变量

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • Type: TypeAlias

  • Description: 一元单变量函数

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • Type: TypeAlias

  • Description: 一元数组函数

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • Type: TypeAlias

  • Description: 一元函数

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

  • Description: 二元单变量函数

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

  • Description: 二元数组函数

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • Type: TypeAlias

  • Description: 二元函数

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

  • Description: 三元单变量函数

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

  • Description: 三元数组函数

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • Type: TypeAlias

  • Description: 三元函数

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • Type: TypeAlias

  • Description: 多元单变量函数

var MultiArraysFunc = Callable[..., ArrayVar]

  • Type: TypeAlias

  • Description: 多元数组函数

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • Type: TypeAlias

  • Description: 多元函数

- + \ No newline at end of file diff --git a/en/api/mp_math/plane.html b/en/api/mp_math/plane.html index b5e713d..8a0487b 100644 --- a/en/api/mp_math/plane.html +++ b/en/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

Description: 平面方程:ax + by + cz + d = 0

Arguments:

  • a: x系数
  • b: y系数
  • c: z系数
  • d: 常数项
Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

Description: 平面方程:ax + by + cz + d = 0

Arguments:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

method approx(self, other: Plane3) -> bool

Description: 判断两个平面是否近似相等。

Arguments:

  • other: 另一个平面

Return: 是否近似相等

Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

method approx(self, other: Plane3) -> bool

Description: 判断两个平面是否近似相等。

Arguments:

  • other: 另一个平面

Return: 是否近似相等

Source code
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -47,7 +47,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

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

Description: 计算平面与平面之间的夹角。

Arguments:

  • other: 另一个平面

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

Description: 计算平面与平面之间的夹角。

Arguments:

  • other: 另一个平面

Return: 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -62,7 +62,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)}')

method cal_distance(self, other: Plane3 | Point3) -> float

Description: 计算平面与平面或点之间的距离。

Arguments:

  • other: 另一个平面或点

Return: 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

Description: 计算平面与平面或点之间的距离。

Arguments:

  • other: 另一个平面或点

Return: 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -77,7 +77,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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

Description: 计算两平面的交线。

Arguments:

  • other: 另一个平面

Return: 两平面的交线

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

Description: 计算两平面的交线。

Arguments:

  • other: 另一个平面

Return: 两平面的交线

Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -102,7 +102,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)

method cal_intersection_point3(self, other: Line3) -> Point3

Description: 计算平面与直线的交点。

Arguments:

  • other: 不与平面平行或在平面上的直线

Return: 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

Description: 计算平面与直线的交点。

Arguments:

  • other: 不与平面平行或在平面上的直线

Return: 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -116,7 +116,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))

method cal_parallel_plane3(self, point: Point3) -> Plane3

Description: 计算平行于该平面且过指定点的平面。

Arguments:

  • point: 指定点

Return: 所求平面

Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

Description: 计算平行于该平面且过指定点的平面。

Arguments:

  • point: 指定点

Return: 所求平面

Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -124,7 +124,7 @@
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

Description: 判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

Description: 判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -132,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

Description: 平面的法向量。

Return: 法向量

Source code
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

Description: 平面的法向量。

Return: 法向量

Source code
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

Description: 工厂函数 由点和法向量构造平面(点法式构造)。

Arguments:

  • point: 平面上的一点
  • normal: 法向量

Return: 平面

Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

Description: 工厂函数 由点和法向量构造平面(点法式构造)。

Arguments:

  • point: 平面上的一点
  • normal: 法向量

Return: 平面

Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -151,7 +151,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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

Description: 工厂函数 由三点构造平面。

Arguments:

  • p1: 点1
  • p2: 点2
  • p3: 点3

Return: 平面

Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

Description: 工厂函数 由三点构造平面。

Arguments:

  • p1: 点1
  • p2: 点2
  • p3: 点3

Return: 平面

Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -165,7 +165,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

Description: 工厂函数 由两直线构造平面。

Arguments:

  • l1: 直线1
  • l2: 直线2

Return: 平面

Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

Description: 工厂函数 由两直线构造平面。

Arguments:

  • l1: 直线1
  • l2: 直线2

Return: 平面

Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -179,7 +179,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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

Description: 工厂函数 由点和直线构造平面。

Arguments:

  • point: 面上一点
  • line: 面上直线,不包含点

Return: 平面

Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

Description: 工厂函数 由点和直线构造平面。

Arguments:

  • point: 面上一点
  • line: 面上直线,不包含点

Return: 平面

Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -189,11 +189,11 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

Source code
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

Source code
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

Source code
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

Source code
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

method __and__(self, other)

Description: 取两平面的交集(人话:交线)

Arguments:

  • other:

Return: 不平行平面的交线,平面平行返回None

Source code
python
def __and__(self, other):
+    ...

method __and__(self, other)

Description: 取两平面的交集(人话:交线)

Arguments:

  • other:

Return: 不平行平面的交线,平面平行返回None

Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -210,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/point.html b/en/api/mp_math/point.html index f7c46a7..41cf088 100644 --- a/en/api/mp_math/point.html +++ b/en/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

method __init__(self, x: float, y: float, z: float)

Description: 笛卡尔坐标系中的点。

Arguments:

  • x: x 坐标
  • y: y 坐标
  • z: z 坐标
Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

method __init__(self, x: float, y: float, z: float)

Description: 笛卡尔坐标系中的点。

Arguments:

  • 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

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

Description: 判断两个点是否近似相等。

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

Description: 判断两个点是否近似相等。

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,11 +37,11 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

Source code
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

Description: P + V -> P P + P -> P

Arguments:

  • other:
Source code
python
def __add__(self, other):
+    ...

method self + other

Description: P + V -> P P + P -> P

Arguments:

  • other:
Source code
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -49,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

Description: 判断两个点是否相等。

Arguments:

  • other:
Source code
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

Description: 判断两个点是否相等。

Arguments:

  • 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)

method self - other: Point3 => Vector3

Description: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

Description: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -68,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/en/api/mp_math/segment.html b/en/api/mp_math/segment.html index 18a3997..8b069d9 100644 --- a/en/api/mp_math/segment.html +++ b/en/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

Description: 三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

Description: 三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -31,7 +31,7 @@
     self.length = self.direction.length
     '中心点'
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
- + \ No newline at end of file diff --git a/en/api/mp_math/utils.html b/en/api/mp_math/utils.html index 5e3c700..44850e5 100644 --- a/en/api/mp_math/utils.html +++ b/en/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

func clamp() -> float

Description: 区间限定函数

Arguments:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

Return: 限制后的值

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func clamp() -> float

Description: 区间限定函数

Arguments:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

Return: 限制后的值

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间限定函数
     Args:
@@ -28,7 +28,7 @@
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

Description: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

Arguments:

  • x: 数1
  • y: 数2
  • epsilon: 误差

Return: 是否近似相等

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

Description: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

Arguments:

  • x: 数1
  • y: 数2
  • epsilon: 误差

Return: 是否近似相等

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -38,7 +38,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

func sign(x: float = False) -> str

Description: 获取数的符号。

Arguments:

  • x: 数
  • only_neg: 是否只返回负数的符号

Return: 符号 + - ""

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

Description: 获取数的符号。

Arguments:

  • x: 数
  • only_neg: 是否只返回负数的符号

Return: 符号 + - ""

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -51,7 +51,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

func sign_format(x: float = False) -> str

Description: 格式化符号数 -1 -> -1 1 -> +1 0 -> ""

Arguments:

  • x: 数
  • only_neg: 是否只返回负数的符号

Return: 符号 + - ""

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

func sign_format(x: float = False) -> str

Description: 格式化符号数 -1 -> -1 1 -> +1 0 -> ""

Arguments:

  • x: 数
  • only_neg: 是否只返回负数的符号

Return: 符号 + - ""

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -67,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
-    self.value = value

method __eq__(self, other)

Source code
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -78,10 +78,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)

method raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

Source code
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

Source code
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/vector.html b/en/api/mp_math/vector.html index bf25036..e942af2 100644 --- a/en/api/mp_math/vector.html +++ b/en/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

method __init__(self, x: float, y: float, z: float)

Description: 3维向量

Arguments:

  • x: x轴分量
  • y: y轴分量
  • z: z轴分量
Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Vector3

method __init__(self, x: float, y: float, z: float)

Description: 3维向量

Arguments:

  • 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

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

Description: 判断两个向量是否近似相等。

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

Description: 判断两个向量是否近似相等。

Arguments:

  • other:
  • epsilon:

Return: 是否近似相等

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])

method cal_angle(self, other: Vector3) -> AnyAngle

Description: 计算两个向量之间的夹角。

Arguments:

  • other: 另一个向量

Return: 夹角

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])

method cal_angle(self, other: Vector3) -> AnyAngle

Description: 计算两个向量之间的夹角。

Arguments:

  • other: 另一个向量

Return: 夹角

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)

method cross(self, other: Vector3) -> Vector3

Description: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Arguments:

  • other:

Return: 行列式的结果

Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

Description: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Arguments:

  • other:

Return: 行列式的结果

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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

Description: 判断两个向量是否近似平行。

Arguments:

  • other: 另一个向量
  • epsilon: 允许的误差

Return: 是否近似平行

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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

Description: 判断两个向量是否近似平行。

Arguments:

  • other: 另一个向量
  • epsilon: 允许的误差

Return: 是否近似平行

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

method is_parallel(self, other: Vector3) -> bool

Description: 判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

Description: 判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return: 是否平行

Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -82,7 +82,7 @@
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

method normalize(self)

Description: 将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

Description: 将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

method np_array(self) -> np.ndarray

Source code
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

Description: 向量的模。

Return: 模

Source code
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

Description: 向量的模。

Return: 模

Source code
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

Description: 获取该向量的单位向量。

Return: 单位向量

Source code
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

Description: 获取该向量的单位向量。

Return: 单位向量

Source code
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

method __abs__(self)

Source code
python
def __abs__(self):
-    return self.length

@overload

method self + other: Vector3 => Vector3

Source code
python
@overload
+    return self / self.length

method __abs__(self)

Source code
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

Description: V + P -> P

V + V -> V

Arguments:

  • other:
Source code
python
def __add__(self, other):
+    ...

method self + other

Description: V + P -> P

V + V -> V

Arguments:

  • 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)}'")

method __eq__(self, other)

Description: 判断两个向量是否相等。

Arguments:

  • other:

Return: 是否相等

Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __eq__(self, other)

Description: 判断两个向量是否相等。

Arguments:

  • other:

Return: 是否相等

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)

method self + other: Point3 => Point3

Description: 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)

method self + other: Point3 => Point3

Description: 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

method self - other: Vector3 => Vector3

Source code
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

Source code
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self - other: Point3 => Point3

Source code
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

Source code
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

method self - other

Description: V - P -> P

V - V -> V

Arguments:

  • other:
Source code
python
def __sub__(self, other):
+    ...

method self - other

Description: V - P -> P

V - V -> V

Arguments:

  • 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)}"')

method self - other: Point3

Description: P - V -> P

Arguments:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

method self - other: Point3

Description: P - V -> P

Arguments:

  • 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

method self * other: Vector3 => Vector3

Source code
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

Source code
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self * other: RealNumber => Vector3

Source code
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

Source code
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

method self * other: int | float | Vector3 => Vector3

Description: 数组运算 非点乘。点乘使用@,叉乘使用cross。

Arguments:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

Description: 数组运算 非点乘。点乘使用@,叉乘使用cross。

Arguments:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,18 +193,18 @@
     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)}'")

method self * other: RealNumber => Vector3

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

Description: 点乘。

Arguments:

  • other:
Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

Description: 点乘。

Arguments:

  • 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

method self / other: RealNumber => Vector3

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

Source code
python
def __neg__(self):
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

Source code
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • Type: Vector3

  • Description: 零向量

var x_axis = Vector3(1, 0, 0)

  • Type: Vector3

  • Description: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • Type: Vector3

  • Description: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • Type: Vector3

  • Description: z轴单位向量

- + \ No newline at end of file diff --git a/en/api/particle/index.html b/en/api/particle/index.html index 7690671..89d3a71 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 5111229..26c4680 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 ba4b9f3..e2b2ef9 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

method sphere(radius: float, density: float)

Description: 生成球体上的点集。

Arguments:

  • radius:
  • density:

Return: List[Point3]: 球体上的点集。

Source code
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

Description: 生成球体上的点集。

Arguments:

  • radius:
  • density:

Return: List[Point3]: 球体上的点集。

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/guide/index.html b/guide/index.html index ff58711..35c6c69 100644 --- a/guide/index.html +++ b/guide/index.html @@ -18,7 +18,7 @@
Skip to content

开始不了一点

- + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index 60c9fd1..aabbd0a 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"B8w0LP6o","api_mp_math_const.md":"D9zs7__H","api_mp_math_equation.md":"Cn4Dbi_N","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"B1jAKPr1","api_mp_math_mp_math_typing.md":"COrE_fd3","api_mp_math_plane.md":"DLB54RNP","api_mp_math_point.md":"BwXaSbuz","api_mp_math_segment.md":"C6i78ST1","api_mp_math_utils.md":"Bkx3QJ6f","api_mp_math_vector.md":"Efti6kdT","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"DY6YMRqf","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DmK_A9xI","en_api_mp_math_const.md":"D_Flpj8t","en_api_mp_math_equation.md":"DU8q_g4G","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"BBlzflWh","en_api_mp_math_mp_math_typing.md":"CyXXFdS4","en_api_mp_math_plane.md":"cxytQLD4","en_api_mp_math_point.md":"CXQGh5Zt","en_api_mp_math_segment.md":"CxreVgqR","en_api_mp_math_utils.md":"aavLLFMy","en_api_mp_math_vector.md":"BvKJEw7_","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"DBfUZUBC","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"DxBe_g0o","ja_api_mp_math_const.md":"CyaIJkFx","ja_api_mp_math_equation.md":"-GejNICN","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"CMfQT6TH","ja_api_mp_math_mp_math_typing.md":"Bl5kyhpI","ja_api_mp_math_plane.md":"Cm4a8eqF","ja_api_mp_math_point.md":"CQAIjHfb","ja_api_mp_math_segment.md":"D0U5bMSu","ja_api_mp_math_utils.md":"CXGqGLUs","ja_api_mp_math_vector.md":"C9TtayJk","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"DAVK1sDI","md-ex.md":"BX0WqOqv","zht_api_index.md":"Dq4XPUKZ","zht_api_mp_math_angle.md":"_4N19GGe","zht_api_mp_math_const.md":"B8uQOIr_","zht_api_mp_math_equation.md":"MGSqd_Ep","zht_api_mp_math_index.md":"D09y2ubg","zht_api_mp_math_line.md":"4ncoPmkZ","zht_api_mp_math_mp_math_typing.md":"DLx0IibM","zht_api_mp_math_plane.md":"Buk-SLcC","zht_api_mp_math_point.md":"Bb3tyGv-","zht_api_mp_math_segment.md":"U_lS4vUA","zht_api_mp_math_utils.md":"ig9jQkoA","zht_api_mp_math_vector.md":"CDyAXuJb","zht_api_particle_index.md":"kAm9VAEw","zht_api_presets_index.md":"BmouaEaT","zht_api_presets_model_index.md":"CrdAyyCM"} +{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"eAy7w1HN","api_mp_math_const.md":"D9zs7__H","api_mp_math_equation.md":"Cug6-NqN","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"DsJQDchM","api_mp_math_mp_math_typing.md":"COrE_fd3","api_mp_math_plane.md":"CmoVvPiw","api_mp_math_point.md":"ClJD85mP","api_mp_math_segment.md":"7jBtS4F1","api_mp_math_utils.md":"BMwtm7TJ","api_mp_math_vector.md":"CROCIDXX","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"DUZx13AW","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"BuhpKHnt","en_api_mp_math_const.md":"D_Flpj8t","en_api_mp_math_equation.md":"YQDGr03a","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"BEvxdWYQ","en_api_mp_math_mp_math_typing.md":"CyXXFdS4","en_api_mp_math_plane.md":"DUu9P3nM","en_api_mp_math_point.md":"DMig0FI1","en_api_mp_math_segment.md":"CcaokAF8","en_api_mp_math_utils.md":"DZohqw2b","en_api_mp_math_vector.md":"Sd_IZsgE","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"Cs8vON2C","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"DL9J6RE2","ja_api_mp_math_const.md":"CyaIJkFx","ja_api_mp_math_equation.md":"tmRhsqm6","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"fj-_s5Ug","ja_api_mp_math_mp_math_typing.md":"Bl5kyhpI","ja_api_mp_math_plane.md":"yLekgCvK","ja_api_mp_math_point.md":"CpHHrSk8","ja_api_mp_math_segment.md":"CB1_z-rn","ja_api_mp_math_utils.md":"BrfEEfl-","ja_api_mp_math_vector.md":"p54TKACE","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"D8yZmO5R","md-ex.md":"BX0WqOqv","zht_api_index.md":"Dq4XPUKZ","zht_api_mp_math_angle.md":"B4T6L25M","zht_api_mp_math_const.md":"B8uQOIr_","zht_api_mp_math_equation.md":"5p50czv3","zht_api_mp_math_index.md":"D09y2ubg","zht_api_mp_math_line.md":"DYC1X0oD","zht_api_mp_math_mp_math_typing.md":"DLx0IibM","zht_api_mp_math_plane.md":"B6GWRRF6","zht_api_mp_math_point.md":"Bm1IEwlI","zht_api_mp_math_segment.md":"Bop8t2IE","zht_api_mp_math_utils.md":"CERv8c-M","zht_api_mp_math_vector.md":"BTWxlpB1","zht_api_particle_index.md":"kAm9VAEw","zht_api_presets_index.md":"BmouaEaT","zht_api_presets_model_index.md":"SQ5PPdaL"} diff --git a/index.html b/index.html index 8948c40..ef91fca 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 fa91241..a31ce57 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 884a3da..a6529a0 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(Angle)

method __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(Angle)

method __init__(self, value: float, is_radian: bool = False)

説明: 任意角度。

引数:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,96 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

戻り値: 余角

ソースコード
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

戻り値: 余角

ソースコード
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

戻り値: 补角

ソースコード
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

戻り値: 补角

ソースコード
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

説明: 角度。

戻り値: 弧度

ソースコード
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

説明: 角度。

戻り値: 弧度

ソースコード
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

戻り値: 最小正角度

ソースコード
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

戻り値: 最小正角度

ソースコード
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

戻り値: 最大负角度

ソースコード
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

戻り値: 最大负角度

ソースコード
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

説明: 正弦值。

戻り値: 正弦值

ソースコード
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

説明: 正弦值。

戻り値: 正弦值

ソースコード
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

method cos(self) -> float

説明: 余弦值。

戻り値: 余弦值

ソースコード
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

説明: 余弦值。

戻り値: 余弦值

ソースコード
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

method tan(self) -> float

説明: 正切值。

戻り値: 正切值

ソースコード
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

説明: 正切值。

戻り値: 正切值

ソースコード
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

method cot(self) -> float

説明: 余切值。

戻り値: 余切值

ソースコード
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

説明: 余切值。

戻り値: 余切值

ソースコード
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

説明: 正割值。

戻り値: 正割值

ソースコード
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

説明: 正割值。

戻り値: 正割值

ソースコード
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

説明: 余割值。

戻り値: 余割值

ソースコード
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

説明: 余割值。

戻り値: 余割值

ソースコード
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

ソースコード
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

ソースコード
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

ソースコード
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

ソースコード
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

ソースコード
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

ソースコード
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

ソースコード
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

ソースコード
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

method self / other: AnyAngle => float

ソースコード
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

ソースコード
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

method self / other

ソースコード
python
def __truediv__(self, other):
+    ...

method 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 9061a09..ff1573e 100644 --- a/ja/api/mp_math/const.html +++ b/ja/api/mp_math/const.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/ja/api/mp_math/equation.html b/ja/api/mp_math/equation.html index 17c0e18..c68af43 100644 --- a/ja/api/mp_math/equation.html +++ b/ja/api/mp_math/equation.html @@ -12,14 +12,17 @@ - + -
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

説明: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

引数:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

戻り値: 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

説明: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

引数:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

戻り値: 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -56,7 +59,7 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +69,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

説明: 计算曲线上的点。

引数:

  • *t:
  • 参数:
ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

説明: 计算曲线上的点。

引数:

  • *t:
  • 参数:
ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -79,7 +82,7 @@
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
- + \ No newline at end of file diff --git a/ja/api/mp_math/index.html b/ja/api/mp_math/index.html index 25802c3..73edead 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 d9510df..055eaa7 100644 --- a/ja/api/mp_math/line.html +++ b/ja/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

説明: 三维空间中的直线。由一个点和一个方向向量确定。

引数:

  • point: 直线上的一点
  • direction: 直线的方向向量
ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

method __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

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

説明: 判断两条直线是否近似相等。

引数:

  • other: 另一条直线
  • epsilon: 误差

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

method 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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

説明: 计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

説明: 计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
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.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値: 交点

例外:

  • ValueError 直线平行
  • ValueError 直线不共面
ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値: 交点

例外:

  • ValueError 直线平行
  • ValueError 直线不共面
ソースコード
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

method cal_perpendicular(self, point: Point3) -> Line3

説明: 计算直线经过指定点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

method 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))

method get_point(self, t: RealNumber) -> Point3

説明: 获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

引数:

  • t: 参数t

戻り値: 点

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method 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

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

説明: 获取直线的参数方程。

戻り値: x(t), y(t), z(t)

ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

method 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)

method 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:
+    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)

method 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)

method is_parallel(self, other: Line3) -> bool

説明: 判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値: 是否平行

ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method 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)

method is_collinear(self, other: Line3) -> bool

説明: 判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値: 是否共线

ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method 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)

method is_point_on(self, point: Point3) -> bool

説明: 判断点是否在直线上。

引数:

  • point: 点

戻り値: 是否在直线上

ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method 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)

method is_coplanar(self, other: Line3) -> bool

説明: 判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

引数:

  • other: 另一条直线

戻り値: 是否共面

ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

method 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

method simplify(self)

説明: 简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method 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

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

説明: 工厂函数 由两点构造直线。

引数:

  • p1: 点1
  • p2: 点2

戻り値: 直线

ソースコード
python
@classmethod
+        self.point.z = 0

@classmethod

method 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)

method __and__(self, other: Line3) -> Line3 | Point3 | None

説明: 计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

引数:

  • other: 另一条直线

戻り値: 交点

ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __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)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -195,7 +195,7 @@
 
         """
     return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
- + \ No newline at end of file diff --git a/ja/api/mp_math/mp_math_typing.html b/ja/api/mp_math/mp_math_typing.html index 83ec983..f3661f0 100644 --- a/ja/api/mp_math/mp_math_typing.html +++ b/ja/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • タイプ: TypeAlias

  • 説明: 实数

var Number = RealNumber | complex

  • タイプ: TypeAlias

  • 説明: 数

var SingleVar = TypeVar('SingleVar', bound=Number)

  • 説明: 单变量

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

  • 説明: 数组变量

var Var = SingleVar | ArrayVar

  • タイプ: TypeAlias

  • 説明: 变量

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • タイプ: TypeAlias

  • 説明: 一元单变量函数

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • タイプ: TypeAlias

  • 説明: 一元数组函数

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • タイプ: TypeAlias

  • 説明: 一元函数

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

  • 説明: 二元单变量函数

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

  • 説明: 二元数组函数

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • タイプ: TypeAlias

  • 説明: 二元函数

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

  • 説明: 三元单变量函数

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

  • 説明: 三元数组函数

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • タイプ: TypeAlias

  • 説明: 三元函数

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • タイプ: TypeAlias

  • 説明: 多元单变量函数

var MultiArraysFunc = Callable[..., ArrayVar]

  • タイプ: TypeAlias

  • 説明: 多元数组函数

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • タイプ: TypeAlias

  • 説明: 多元函数

- + \ No newline at end of file diff --git a/ja/api/mp_math/plane.html b/ja/api/mp_math/plane.html index 7195266..9e57b66 100644 --- a/ja/api/mp_math/plane.html +++ b/ja/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

説明: 平面方程:ax + by + cz + d = 0

引数:

  • a: x系数
  • b: y系数
  • c: z系数
  • d: 常数项
ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

説明: 平面方程:ax + by + cz + d = 0

引数:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

method approx(self, other: Plane3) -> bool

説明: 判断两个平面是否近似相等。

引数:

  • other: 另一个平面

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

method approx(self, other: Plane3) -> bool

説明: 判断两个平面是否近似相等。

引数:

  • other: 另一个平面

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -47,7 +47,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

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

説明: 计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

説明: 计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値: 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -62,7 +62,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)}')

method cal_distance(self, other: Plane3 | Point3) -> float

説明: 计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

説明: 计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値: 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -77,7 +77,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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

引数:

  • other: 另一个平面

戻り値: 两平面的交线

ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

引数:

  • other: 另一个平面

戻り値: 两平面的交线

ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -102,7 +102,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)

method cal_intersection_point3(self, other: Line3) -> Point3

説明: 计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値: 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

説明: 计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値: 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -116,7 +116,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))

method cal_parallel_plane3(self, point: Point3) -> Plane3

説明: 计算平行于该平面且过指定点的平面。

引数:

  • point: 指定点

戻り値: 所求平面

ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

説明: 计算平行于该平面且过指定点的平面。

引数:

  • point: 指定点

戻り値: 所求平面

ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -124,7 +124,7 @@
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値: 是否平行

ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値: 是否平行

ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -132,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

戻り値: 法向量

ソースコード
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

戻り値: 法向量

ソースコード
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

説明: 工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点
  • normal: 法向量

戻り値: 平面

ソースコード
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method 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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -151,7 +151,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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

説明: 工厂函数 由三点构造平面。

引数:

  • p1: 点1
  • p2: 点2
  • p3: 点3

戻り値: 平面

ソースコード
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -165,7 +165,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

説明: 工厂函数 由两直线构造平面。

引数:

  • l1: 直线1
  • l2: 直线2

戻り値: 平面

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method 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':
     """
         工厂函数 由两直线构造平面。
@@ -179,7 +179,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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

説明: 工厂函数 由点和直线构造平面。

引数:

  • point: 面上一点
  • line: 面上直线,不包含点

戻り値: 平面

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -189,11 +189,11 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

ソースコード
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

ソースコード
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

method __and__(self, other)

説明: 取两平面的交集(人话:交线)

引数:

  • other:

戻り値: 不平行平面的交线,平面平行返回None

ソースコード
python
def __and__(self, other):
+    ...

method __and__(self, other)

説明: 取两平面的交集(人话:交线)

引数:

  • other:

戻り値: 不平行平面的交线,平面平行返回None

ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -210,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/point.html b/ja/api/mp_math/point.html index 15f6dad..a3126d1 100644 --- a/ja/api/mp_math/point.html +++ b/ja/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

method __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

method __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

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,11 +37,11 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: P + V -> P P + P -> P

引数:

  • other:
ソースコード
python
def __add__(self, other):
+    ...

method self + other

説明: P + V -> P P + P -> P

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -49,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

説明: 判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -68,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/ja/api/mp_math/segment.html b/ja/api/mp_math/segment.html index c1a9a42..79251f0 100644 --- a/ja/api/mp_math/segment.html +++ b/ja/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

説明: 三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

説明: 三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -31,7 +31,7 @@
     self.length = self.direction.length
     '中心点'
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
- + \ No newline at end of file diff --git a/ja/api/mp_math/utils.html b/ja/api/mp_math/utils.html index 3daceaf..5916786 100644 --- a/ja/api/mp_math/utils.html +++ b/ja/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

func clamp() -> float

説明: 区间限定函数

引数:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

戻り値: 限制后的值

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func 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_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

戻り値: 是否近似相等

ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x: 数1
  • y: 数2
  • epsilon: 误差

戻り値: 是否近似相等

ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -38,7 +38,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

引数:

  • x: 数
  • only_neg: 是否只返回负数的符号

戻り値: 符号 + - ""

ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

引数:

  • x: 数
  • only_neg: 是否只返回负数的符号

戻り値: 符号 + - ""

ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -51,7 +51,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

func 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:
+        return ''

func 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
@@ -67,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
-    self.value = value

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -78,10 +78,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)

method raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/vector.html b/ja/api/mp_math/vector.html index 4b7b445..7e38615 100644 --- a/ja/api/mp_math/vector.html +++ b/ja/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

method __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

method __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

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似相等。

引数:

  • other:
  • epsilon:

戻り値: 是否近似相等

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method 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])

method cal_angle(self, other: Vector3) -> AnyAngle

説明: 计算两个向量之间的夹角。

引数:

  • 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])

method 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)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • other:

戻り値: 行列式的结果

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • other:

戻り値: 行列式的结果

ソースコード
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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似平行。

引数:

  • 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)

method 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

method is_parallel(self, other: Vector3) -> bool

説明: 判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値: 是否平行

ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method 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)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

method np_array(self) -> np.ndarray

ソースコード
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

説明: 向量的模。

戻り値: 模

ソースコード
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

説明: 向量的模。

戻り値: 模

ソースコード
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

戻り値: 单位向量

ソースコード
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

戻り値: 单位向量

ソースコード
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

method __abs__(self)

ソースコード
python
def __abs__(self):
-    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
+    return self / self.length

method __abs__(self)

ソースコード
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: V + P -> P

V + V -> V

引数:

  • other:
ソースコード
python
def __add__(self, other):
+    ...

method 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)}'")

method __eq__(self, other)

説明: 判断两个向量是否相等。

引数:

  • other:

戻り値: 是否相等

ソースコード
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __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)

method self + other: Point3 => 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)

method 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

method self - other: Vector3 => Vector3

ソースコード
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

ソースコード
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self - other: Point3 => Point3

ソースコード
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

ソースコード
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

method self - other

説明: V - P -> P

V - V -> V

引数:

  • other:
ソースコード
python
def __sub__(self, other):
+    ...

method 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)}"')

method 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)}"')

method 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

method self * other: Vector3 => Vector3

ソースコード
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

ソースコード
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self * other: RealNumber => Vector3

ソースコード
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

ソースコード
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,18 +193,18 @@
     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)}'")

method self * other: RealNumber => Vector3

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

説明: 点乘。

引数:

  • other:
ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method 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

method self / other: RealNumber => Vector3

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

ソースコード
python
def __neg__(self):
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

ソースコード
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • タイプ: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • タイプ: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • タイプ: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • タイプ: Vector3

  • 説明: z轴单位向量

- + \ No newline at end of file diff --git a/ja/api/particle/index.html b/ja/api/particle/index.html index 558924a..7390b96 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 020f74a..c5e598a 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 c509dc3..e86d806 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

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

引数:

  • radius:
  • density:

戻り値: List[Point3]: 球体上的点集。

ソースコード
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

引数:

  • radius:
  • density:

戻り値: List[Point3]: 球体上的点集。

ソースコード
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 8ce2e4b..577f142 100644 --- a/md-ex.html +++ b/md-ex.html @@ -50,7 +50,7 @@ ::: details This is a details block. :::

Output

INFO

This is an info box.

TIP

This is a tip.

WARNING

This is a warning.

DANGER

This is a dangerous warning.

Details

This is a details block.

More

Check out the documentation for the full list of markdown extensions.

- + \ No newline at end of file diff --git a/zht/api/index.html b/zht/api/index.html index d9da8e8..02b1c23 100644 --- a/zht/api/index.html +++ b/zht/api/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/zht/api/mp_math/angle.html b/zht/api/mp_math/angle.html index 2a124b9..e6c28e9 100644 --- a/zht/api/mp_math/angle.html +++ b/zht/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle(Angle)

method __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(Angle)

method __init__(self, value: float, is_radian: bool = False)

説明: 任意角度。

變數説明:

  • value: 角度或弧度值
  • is_radian: 是否为弧度,默认为否
源碼
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,96 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

返回: 余角

源碼
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

説明: 余角:两角的和为90°。

返回: 余角

源碼
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

返回: 补角

源碼
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

説明: 补角:两角的和为180°。

返回: 补角

源碼
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

説明: 角度。

返回: 弧度

源碼
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

説明: 角度。

返回: 弧度

源碼
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

返回: 最小正角度

源碼
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

説明: 最小正角。

返回: 最小正角度

源碼
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

返回: 最大负角度

源碼
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

説明: 最大负角。

返回: 最大负角度

源碼
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

説明: 正弦值。

返回: 正弦值

源碼
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

説明: 正弦值。

返回: 正弦值

源碼
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

method cos(self) -> float

説明: 余弦值。

返回: 余弦值

源碼
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

説明: 余弦值。

返回: 余弦值

源碼
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

method tan(self) -> float

説明: 正切值。

返回: 正切值

源碼
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

説明: 正切值。

返回: 正切值

源碼
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

method cot(self) -> float

説明: 余切值。

返回: 余切值

源碼
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

説明: 余切值。

返回: 余切值

源碼
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

説明: 正割值。

返回: 正割值

源碼
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

説明: 正割值。

返回: 正割值

源碼
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

説明: 余割值。

返回: 余割值

源碼
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

説明: 余割值。

返回: 余割值

源碼
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

源碼
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

源碼
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

源碼
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

method self / other: AnyAngle => float

源碼
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

源碼
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

method self / other

源碼
python
def __truediv__(self, other):
+    ...

method 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/zht/api/mp_math/const.html b/zht/api/mp_math/const.html index 3eb0bcc..eae6c25 100644 --- a/zht/api/mp_math/const.html +++ b/zht/api/mp_math/const.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/zht/api/mp_math/equation.html b/zht/api/mp_math/equation.html index 9c1287a..0b2c29c 100644 --- a/zht/api/mp_math/equation.html +++ b/zht/api/mp_math/equation.html @@ -12,14 +12,17 @@ - + -
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

説明: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

變數説明:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

返回: 偏导函数

抛出:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

説明: 求N元函数一阶偏导函数。这玩意不太稳定,慎用。

WARNING

目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。

變數説明:

  • func: 函数
  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
  • epsilon: 偏移量

返回: 偏导函数

抛出:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    > [!warning]
+    > 目前数学界对于数值微分的稳定性问题还没有很好的解决方案,因此这个函数的稳定性也不是很好。
+
     Args:
         func: 函数
         var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
@@ -56,7 +59,7 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

class CurveEquation

method __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):
+        raise ValueError('Invalid var type')

class CurveEquation

method __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 +69,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

説明: 计算曲线上的点。

變數説明:

  • *t:
  • 参数:
源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

説明: 计算曲线上的点。

變數説明:

  • *t:
  • 参数:
源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -79,7 +82,7 @@
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
- + \ No newline at end of file diff --git a/zht/api/mp_math/index.html b/zht/api/mp_math/index.html index 3c8528c..73bb453 100644 --- a/zht/api/mp_math/index.html +++ b/zht/api/mp_math/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/zht/api/mp_math/line.html b/zht/api/mp_math/line.html index 5d7f851..7aa91a4 100644 --- a/zht/api/mp_math/line.html +++ b/zht/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

説明: 三维空间中的直线。由一个点和一个方向向量确定。

變數説明:

  • point: 直线上的一点
  • direction: 直线的方向向量
源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

method __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

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

説明: 判断两条直线是否近似相等。

變數説明:

  • other: 另一条直线
  • epsilon: 误差

返回: 是否近似相等

源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

method 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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

變數説明:

  • other: 另一条直线

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
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)

method cal_angle(self, other: Line3) -> AnyAngle

説明: 计算直线和直线之间的夹角。

變數説明:

  • other: 另一条直线

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

説明: 计算直线和直线或点之间的距离。

變數説明:

  • other: 平行直线或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

説明: 计算直线和直线或点之间的距离。

變數説明:

  • other: 平行直线或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
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.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

變數説明:

  • other: 另一条直线

返回: 交点

抛出:

  • ValueError 直线平行
  • ValueError 直线不共面
源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

説明: 计算两条直线的交点。

變數説明:

  • other: 另一条直线

返回: 交点

抛出:

  • ValueError 直线平行
  • ValueError 直线不共面
源碼
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

method cal_perpendicular(self, point: Point3) -> Line3

説明: 计算直线经过指定点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

method 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))

method get_point(self, t: RealNumber) -> Point3

説明: 获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

變數説明:

  • t: 参数t

返回: 点

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method 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

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

説明: 获取直线的参数方程。

返回: x(t), y(t), z(t)

源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

method 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)

method 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:
+    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)

method 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)

method is_parallel(self, other: Line3) -> bool

説明: 判断两条直线是否平行。

變數説明:

  • other: 另一条直线

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method 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)

method is_collinear(self, other: Line3) -> bool

説明: 判断两条直线是否共线。

變數説明:

  • other: 另一条直线

返回: 是否共线

源碼
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method 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)

method is_point_on(self, point: Point3) -> bool

説明: 判断点是否在直线上。

變數説明:

  • point: 点

返回: 是否在直线上

源碼
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method 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)

method is_coplanar(self, other: Line3) -> bool

説明: 判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

變數説明:

  • other: 另一条直线

返回: 是否共面

源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

method 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

method simplify(self)

説明: 简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method 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

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

説明: 工厂函数 由两点构造直线。

變數説明:

  • p1: 点1
  • p2: 点2

返回: 直线

源碼
python
@classmethod
+        self.point.z = 0

@classmethod

method 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)

method __and__(self, other: Line3) -> Line3 | Point3 | None

説明: 计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

變數説明:

  • other: 另一条直线

返回: 交点

源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __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)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

變數説明:

  • other:
源碼
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

説明: 判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

變數説明:

  • other:
源碼
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -195,7 +195,7 @@
 
         """
     return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
- + \ No newline at end of file diff --git a/zht/api/mp_math/mp_math_typing.html b/zht/api/mp_math/mp_math_typing.html index b5f2010..f871790 100644 --- a/zht/api/mp_math/mp_math_typing.html +++ b/zht/api/mp_math/mp_math_typing.html @@ -18,7 +18,7 @@
Skip to content

var RealNumber = int | float

  • 類型: TypeAlias

  • 説明: 实数

var Number = RealNumber | complex

  • 類型: TypeAlias

  • 説明: 数

var SingleVar = TypeVar('SingleVar', bound=Number)

  • 説明: 单变量

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

  • 説明: 数组变量

var Var = SingleVar | ArrayVar

  • 類型: TypeAlias

  • 説明: 变量

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 類型: TypeAlias

  • 説明: 一元单变量函数

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 類型: TypeAlias

  • 説明: 一元数组函数

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 類型: TypeAlias

  • 説明: 一元函数

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

  • 説明: 二元单变量函数

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

  • 説明: 二元数组函数

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 類型: TypeAlias

  • 説明: 二元函数

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

  • 説明: 三元单变量函数

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

  • 説明: 三元数组函数

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 類型: TypeAlias

  • 説明: 三元函数

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 類型: TypeAlias

  • 説明: 多元单变量函数

var MultiArraysFunc = Callable[..., ArrayVar]

  • 類型: TypeAlias

  • 説明: 多元数组函数

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 類型: TypeAlias

  • 説明: 多元函数

- + \ No newline at end of file diff --git a/zht/api/mp_math/plane.html b/zht/api/mp_math/plane.html index 93c99bf..c750250 100644 --- a/zht/api/mp_math/plane.html +++ b/zht/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

説明: 平面方程:ax + by + cz + d = 0

變數説明:

  • a: x系数
  • b: y系数
  • c: z系数
  • d: 常数项
源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

説明: 平面方程:ax + by + cz + d = 0

變數説明:

  • a: x系数
  • b: y系数
  • c: z系数
  • 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

method approx(self, other: Plane3) -> bool

説明: 判断两个平面是否近似相等。

變數説明:

  • other: 另一个平面

返回: 是否近似相等

源碼
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

method approx(self, other: Plane3) -> bool

説明: 判断两个平面是否近似相等。

變數説明:

  • other: 另一个平面

返回: 是否近似相等

源碼
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -47,7 +47,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

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

説明: 计算平面与平面之间的夹角。

變數説明:

  • other: 另一个平面

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

説明: 计算平面与平面之间的夹角。

變數説明:

  • other: 另一个平面

返回: 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -62,7 +62,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)}')

method cal_distance(self, other: Plane3 | Point3) -> float

説明: 计算平面与平面或点之间的距离。

變數説明:

  • other: 另一个平面或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

説明: 计算平面与平面或点之间的距离。

變數説明:

  • other: 另一个平面或点

返回: 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -77,7 +77,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)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

變數説明:

  • other: 另一个平面

返回: 两平面的交线

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

説明: 计算两平面的交线。

變數説明:

  • other: 另一个平面

返回: 两平面的交线

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。
         Args:
@@ -102,7 +102,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)

method cal_intersection_point3(self, other: Line3) -> Point3

説明: 计算平面与直线的交点。

變數説明:

  • other: 不与平面平行或在平面上的直线

返回: 交点

抛出:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

説明: 计算平面与直线的交点。

變數説明:

  • other: 不与平面平行或在平面上的直线

返回: 交点

抛出:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -116,7 +116,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))

method cal_parallel_plane3(self, point: Point3) -> Plane3

説明: 计算平行于该平面且过指定点的平面。

變數説明:

  • point: 指定点

返回: 所求平面

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

説明: 计算平行于该平面且过指定点的平面。

變數説明:

  • point: 指定点

返回: 所求平面

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -124,7 +124,7 @@
         Returns:
             所求平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

變數説明:

  • other: 另一个平面

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

説明: 判断两个平面是否平行。

變數説明:

  • other: 另一个平面

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -132,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

返回: 法向量

源碼
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

説明: 平面的法向量。

返回: 法向量

源碼
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

説明: 工厂函数 由点和法向量构造平面(点法式构造)。

變數説明:

  • point: 平面上的一点
  • normal: 法向量

返回: 平面

源碼
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method 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':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -151,7 +151,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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

説明: 工厂函数 由三点构造平面。

變數説明:

  • p1: 点1
  • p2: 点2
  • p3: 点3

返回: 平面

源碼
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method 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':
     """
         工厂函数 由三点构造平面。
@@ -165,7 +165,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

説明: 工厂函数 由两直线构造平面。

變數説明:

  • l1: 直线1
  • l2: 直线2

返回: 平面

源碼
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method 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':
     """
         工厂函数 由两直线构造平面。
@@ -179,7 +179,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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

説明: 工厂函数 由点和直线构造平面。

變數説明:

  • point: 面上一点
  • line: 面上直线,不包含点

返回: 平面

源碼
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method 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':
     """
         工厂函数 由点和直线构造平面。
@@ -189,11 +189,11 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

源碼
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

源碼
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

源碼
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

源碼
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

method __and__(self, other)

説明: 取两平面的交集(人话:交线)

變數説明:

  • other:

返回: 不平行平面的交线,平面平行返回None

源碼
python
def __and__(self, other):
+    ...

method __and__(self, other)

説明: 取两平面的交集(人话:交线)

變數説明:

  • other:

返回: 不平行平面的交线,平面平行返回None

源碼
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -210,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
-    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)
- + \ No newline at end of file diff --git a/zht/api/mp_math/point.html b/zht/api/mp_math/point.html index 9f80feb..3ea19c6 100644 --- a/zht/api/mp_math/point.html +++ b/zht/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

method __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

method __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

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

説明: 判断两个点是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,11 +37,11 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    ...

method self + other

説明: P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -49,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

説明: 判断两个点是否相等。

變數説明:

  • other:
源碼
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __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)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

説明: P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -68,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/zht/api/mp_math/segment.html b/zht/api/mp_math/segment.html index 0a16cdf..c161f8a 100644 --- a/zht/api/mp_math/segment.html +++ b/zht/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

説明: 三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

説明: 三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -31,7 +31,7 @@
     self.length = self.direction.length
     '中心点'
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
- + \ No newline at end of file diff --git a/zht/api/mp_math/utils.html b/zht/api/mp_math/utils.html index ac841c8..cad97d7 100644 --- a/zht/api/mp_math/utils.html +++ b/zht/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

func clamp() -> float

説明: 区间限定函数

變數説明:

  • x: 待限定的值
  • min_: 最小值
  • max_: 最大值

返回: 限制后的值

源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func 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_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

説明: 判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1
  • y: 数2
  • epsilon: 误差

返回: 是否近似相等

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -38,7 +38,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

變數説明:

  • x: 数
  • only_neg: 是否只返回负数的符号

返回: 符号 + - ""

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

説明: 获取数的符号。

變數説明:

  • x: 数
  • only_neg: 是否只返回负数的符号

返回: 符号 + - ""

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -51,7 +51,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

func 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:
+        return ''

func 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
@@ -67,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
-    self.value = value

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

method __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
@@ -78,10 +78,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)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/zht/api/mp_math/vector.html b/zht/api/mp_math/vector.html index 92a6df9..4166fa4 100644 --- a/zht/api/mp_math/vector.html +++ b/zht/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

method __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

method __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

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似相等。

變數説明:

  • other:
  • epsilon:

返回: 是否近似相等

源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method 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])

method cal_angle(self, other: Vector3) -> AnyAngle

説明: 计算两个向量之间的夹角。

變數説明:

  • 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])

method 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)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回: 行列式的结果

源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

説明: 向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回: 行列式的结果

源碼
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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

説明: 判断两个向量是否近似平行。

變數説明:

  • 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)

method 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

method is_parallel(self, other: Vector3) -> bool

説明: 判断两个向量是否平行。

變數説明:

  • other: 另一个向量

返回: 是否平行

源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method 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)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

説明: 将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

method np_array(self) -> np.ndarray

源碼
python
@property
+    self.z /= length

@property

method 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

method length(self) -> float

説明: 向量的模。

返回: 模

源碼
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

説明: 向量的模。

返回: 模

源碼
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

返回: 单位向量

源碼
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

説明: 获取该向量的单位向量。

返回: 单位向量

源碼
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
-    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
+    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

method self + other

説明: V + P -> P

V + V -> V

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    ...

method 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)}'")

method __eq__(self, other)

説明: 判断两个向量是否相等。

變數説明:

  • other:

返回: 是否相等

源碼
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __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)

method self + other: Point3 => 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)

method 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

method self - other: Vector3 => Vector3

源碼
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

源碼
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self - other: Point3 => Point3

源碼
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

源碼
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

method self - other

説明: V - P -> P

V - V -> V

變數説明:

  • other:
源碼
python
def __sub__(self, other):
+    ...

method 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)}"')

method 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)}"')

method 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

method self * other: Vector3 => Vector3

源碼
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

源碼
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

method self * other: RealNumber => Vector3

源碼
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

源碼
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

説明: 数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,18 +193,18 @@
     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)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

説明: 点乘。

變數説明:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method 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

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
     return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • 類型: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 類型: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 類型: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 類型: Vector3

  • 説明: z轴单位向量

- + \ No newline at end of file diff --git a/zht/api/particle/index.html b/zht/api/particle/index.html index a451923..5d9221f 100644 --- a/zht/api/particle/index.html +++ b/zht/api/particle/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/zht/api/presets/index.html b/zht/api/presets/index.html index d944da4..58245ee 100644 --- a/zht/api/presets/index.html +++ b/zht/api/presets/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/zht/api/presets/model/index.html b/zht/api/presets/model/index.html index 758f498..929eb62 100644 --- a/zht/api/presets/model/index.html +++ b/zht/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

變數説明:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源碼
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

説明: 生成球体上的点集。

變數説明:

  • radius:
  • density:

返回: List[Point3]: 球体上的点集。

源碼
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