From a224bf2517c09091895dcdf9586bf4089b285091 Mon Sep 17 00:00:00 2001 From: snowykami Date: Wed, 28 Aug 2024 14:08:21 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20snowykami/mb?= =?UTF-8?q?cp@0d3511edd2b12d16a1be5a1d014454059c5f202c=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 | 109 +++++++- api/index.html | 4 +- api/mp_math/angle.html | 4 +- api/mp_math/const.html | 4 +- api/mp_math/equation.html | 6 +- api/mp_math/index.html | 4 +- api/mp_math/line.html | 32 +-- api/mp_math/mp_math_typing.html | 4 +- api/mp_math/plane.html | 30 +-- api/mp_math/point.html | 8 +- api/mp_math/segment.html | 4 +- api/mp_math/utils.html | 12 +- api/mp_math/vector.html | 18 +- api/particle/index.html | 4 +- api/presets/index.html | 4 +- api/presets/model/index.html | 6 +- ...js => api_mp_math_equation.md.CZgns297.js} | 4 +- ... api_mp_math_equation.md.CZgns297.lean.js} | 2 +- ...ksR.js => api_mp_math_line.md.DHofgyJO.js} | 28 +-- ...s => api_mp_math_line.md.DHofgyJO.lean.js} | 2 +- ...G4.js => api_mp_math_plane.md.DZBu-HIq.js} | 26 +- ... => api_mp_math_plane.md.DZBu-HIq.lean.js} | 2 +- ...pE.js => api_mp_math_point.md.CGqzS8ew.js} | 4 +- ... => api_mp_math_point.md.CGqzS8ew.lean.js} | 2 +- ...hx.js => api_mp_math_utils.md.C9bdphO4.js} | 10 +- ... => api_mp_math_utils.md.C9bdphO4.lean.js} | 2 +- ...G.js => api_mp_math_vector.md.BEh63_ZE.js} | 16 +- ...=> api_mp_math_vector.md.BEh63_ZE.lean.js} | 2 +- ...=> api_presets_model_index.md.DLrch_Ju.js} | 4 +- ...i_presets_model_index.md.DLrch_Ju.lean.js} | 2 +- ...=> en_api_mp_math_equation.md.BQv4WWiJ.js} | 4 +- ..._api_mp_math_equation.md.BQv4WWiJ.lean.js} | 2 +- ....js => en_api_mp_math_line.md.CAJnDKCu.js} | 28 +-- ...> en_api_mp_math_line.md.CAJnDKCu.lean.js} | 2 +- ...js => en_api_mp_math_plane.md.B-VJJllR.js} | 26 +- ... en_api_mp_math_plane.md.B-VJJllR.lean.js} | 2 +- ...js => en_api_mp_math_point.md.CCE-yfrm.js} | 4 +- ... en_api_mp_math_point.md.CCE-yfrm.lean.js} | 2 +- ...js => en_api_mp_math_utils.md.CuiyHRtY.js} | 10 +- ... en_api_mp_math_utils.md.CuiyHRtY.lean.js} | 2 +- ...s => en_api_mp_math_vector.md.3xep9oDm.js} | 16 +- ...en_api_mp_math_vector.md.3xep9oDm.lean.js} | 2 +- ...en_api_presets_model_index.md.1ewGi0do.js} | 4 +- ...i_presets_model_index.md.1ewGi0do.lean.js} | 2 +- assets/guide_index.md.BE2yloik.js | 1 + assets/guide_index.md.BE2yloik.lean.js | 1 + assets/index.md.BE1qChTt.js | 1 + assets/index.md.BE1qChTt.lean.js | 1 + assets/index.md.CJvRmMfL.js | 1 - assets/index.md.CJvRmMfL.lean.js | 1 - ...=> ja_api_mp_math_equation.md.BETlifwh.js} | 4 +- ..._api_mp_math_equation.md.BETlifwh.lean.js} | 2 +- ....js => ja_api_mp_math_line.md.Ck5uy5Cp.js} | 28 +-- ...> ja_api_mp_math_line.md.Ck5uy5Cp.lean.js} | 2 +- ...js => ja_api_mp_math_plane.md.C5qFtY92.js} | 26 +- ... ja_api_mp_math_plane.md.C5qFtY92.lean.js} | 2 +- ...js => ja_api_mp_math_point.md.Cc_RLeth.js} | 4 +- ... ja_api_mp_math_point.md.Cc_RLeth.lean.js} | 2 +- ...js => ja_api_mp_math_utils.md.Dgzoi9ec.js} | 10 +- ... ja_api_mp_math_utils.md.Dgzoi9ec.lean.js} | 2 +- ...s => ja_api_mp_math_vector.md.kN2P6bpC.js} | 16 +- ...ja_api_mp_math_vector.md.kN2P6bpC.lean.js} | 2 +- ...ja_api_presets_model_index.md.QP3v3mpP.js} | 4 +- ...i_presets_model_index.md.QP3v3mpP.lean.js} | 2 +- assets/zh-Hant_api_index.md.D-iBkJb-.js | 1 + assets/zh-Hant_api_index.md.D-iBkJb-.lean.js | 1 + .../zh-Hant_api_mp_math_angle.md.eKQSpiMX.js | 101 ++++++++ ...Hant_api_mp_math_angle.md.eKQSpiMX.lean.js | 1 + .../zh-Hant_api_mp_math_const.md.B_tZ9wL7.js | 1 + ...Hant_api_mp_math_const.md.B_tZ9wL7.lean.js | 1 + ...h-Hant_api_mp_math_equation.md.DPinrp8_.js | 63 +++++ ...t_api_mp_math_equation.md.DPinrp8_.lean.js | 1 + .../zh-Hant_api_mp_math_index.md.B8NLV8Cf.js | 1 + ...Hant_api_mp_math_index.md.B8NLV8Cf.lean.js | 1 + .../zh-Hant_api_mp_math_line.md.B-s8aLxY.js | 192 +++++++++++++++ ...-Hant_api_mp_math_line.md.B-s8aLxY.lean.js | 1 + ..._api_mp_math_mp_math_typing.md.DOwDUOu8.js | 1 + ...mp_math_mp_math_typing.md.DOwDUOu8.lean.js | 1 + .../zh-Hant_api_mp_math_plane.md.B60Bzq3i.js | 209 ++++++++++++++++ ...Hant_api_mp_math_plane.md.B60Bzq3i.lean.js | 1 + .../zh-Hant_api_mp_math_point.md.BEsHV_8G.js | 52 ++++ ...Hant_api_mp_math_point.md.BEsHV_8G.lean.js | 1 + ...zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js | 16 ++ ...nt_api_mp_math_segment.md.C-4eJk-Y.lean.js | 1 + .../zh-Hant_api_mp_math_utils.md.z2lMMpnT.js | 65 +++++ ...Hant_api_mp_math_utils.md.z2lMMpnT.lean.js | 1 + .../zh-Hant_api_mp_math_vector.md.n5Efae6D.js | 189 ++++++++++++++ ...ant_api_mp_math_vector.md.n5Efae6D.lean.js | 1 + .../zh-Hant_api_particle_index.md.BlduIPtw.js | 1 + ...ant_api_particle_index.md.BlduIPtw.lean.js | 1 + .../zh-Hant_api_presets_index.md.CDyg87e9.js | 1 + ...Hant_api_presets_index.md.CDyg87e9.lean.js | 1 + ...ant_api_presets_model_index.md.DCHpjjZ_.js | 18 ++ ...pi_presets_model_index.md.DCHpjjZ_.lean.js | 1 + en/api/index.html | 4 +- en/api/mp_math/angle.html | 4 +- en/api/mp_math/const.html | 4 +- en/api/mp_math/equation.html | 6 +- en/api/mp_math/index.html | 4 +- en/api/mp_math/line.html | 32 +-- en/api/mp_math/mp_math_typing.html | 4 +- en/api/mp_math/plane.html | 30 +-- en/api/mp_math/point.html | 8 +- en/api/mp_math/segment.html | 4 +- en/api/mp_math/utils.html | 12 +- en/api/mp_math/vector.html | 18 +- en/api/particle/index.html | 4 +- en/api/presets/index.html | 4 +- en/api/presets/model/index.html | 6 +- guide/index.html | 24 ++ hashmap.json | 2 +- index.html | 6 +- ja/api/index.html | 8 +- ja/api/mp_math/angle.html | 8 +- ja/api/mp_math/const.html | 8 +- ja/api/mp_math/equation.html | 10 +- ja/api/mp_math/index.html | 8 +- ja/api/mp_math/line.html | 36 +-- ja/api/mp_math/mp_math_typing.html | 8 +- ja/api/mp_math/plane.html | 34 +-- ja/api/mp_math/point.html | 12 +- ja/api/mp_math/segment.html | 8 +- ja/api/mp_math/utils.html | 16 +- ja/api/mp_math/vector.html | 22 +- ja/api/particle/index.html | 8 +- ja/api/presets/index.html | 8 +- ja/api/presets/model/index.html | 10 +- md-ex.html | 4 +- zh-Hant/api/index.html | 24 ++ zh-Hant/api/mp_math/angle.html | 124 ++++++++++ zh-Hant/api/mp_math/const.html | 24 ++ zh-Hant/api/mp_math/equation.html | 86 +++++++ zh-Hant/api/mp_math/index.html | 24 ++ zh-Hant/api/mp_math/line.html | 215 ++++++++++++++++ zh-Hant/api/mp_math/mp_math_typing.html | 24 ++ zh-Hant/api/mp_math/plane.html | 232 ++++++++++++++++++ zh-Hant/api/mp_math/point.html | 75 ++++++ zh-Hant/api/mp_math/segment.html | 39 +++ zh-Hant/api/mp_math/utils.html | 88 +++++++ zh-Hant/api/mp_math/vector.html | 212 ++++++++++++++++ zh-Hant/api/particle/index.html | 24 ++ zh-Hant/api/presets/index.html | 24 ++ zh-Hant/api/presets/model/index.html | 41 ++++ 144 files changed, 2728 insertions(+), 417 deletions(-) rename assets/{api_mp_math_equation.md.BXP6BUSg.js => api_mp_math_equation.md.CZgns297.js} (93%) rename assets/{api_mp_math_equation.md.BXP6BUSg.lean.js => api_mp_math_equation.md.CZgns297.lean.js} (57%) rename assets/{api_mp_math_line.md.CzpblksR.js => api_mp_math_line.md.DHofgyJO.js} (83%) rename assets/{api_mp_math_line.md.CzpblksR.lean.js => api_mp_math_line.md.DHofgyJO.lean.js} (58%) rename assets/{api_mp_math_plane.md.CZDq9vG4.js => api_mp_math_plane.md.DZBu-HIq.js} (91%) rename assets/{api_mp_math_plane.md.CZDq9vG4.lean.js => api_mp_math_plane.md.DZBu-HIq.lean.js} (85%) rename assets/{api_mp_math_point.md.BJ9u2OpE.js => api_mp_math_point.md.CGqzS8ew.js} (94%) rename assets/{api_mp_math_point.md.BJ9u2OpE.lean.js => api_mp_math_point.md.CGqzS8ew.lean.js} (85%) rename assets/{api_mp_math_utils.md.DPDde5hx.js => api_mp_math_utils.md.C9bdphO4.js} (82%) rename assets/{api_mp_math_utils.md.DPDde5hx.lean.js => api_mp_math_utils.md.C9bdphO4.lean.js} (85%) rename assets/{api_mp_math_vector.md.BBiKQwmG.js => api_mp_math_vector.md.BEh63_ZE.js} (93%) rename assets/{api_mp_math_vector.md.BBiKQwmG.lean.js => api_mp_math_vector.md.BEh63_ZE.lean.js} (57%) rename assets/{api_presets_model_index.md.BNeuRwjr.js => api_presets_model_index.md.DLrch_Ju.js} (92%) rename assets/{api_presets_model_index.md.BNeuRwjr.lean.js => api_presets_model_index.md.DLrch_Ju.lean.js} (71%) rename assets/{en_api_mp_math_equation.md.Bsq2lQHW.js => en_api_mp_math_equation.md.BQv4WWiJ.js} (94%) rename assets/{en_api_mp_math_equation.md.Bsq2lQHW.lean.js => en_api_mp_math_equation.md.BQv4WWiJ.lean.js} (86%) rename assets/{en_api_mp_math_line.md.CP3RuJkk.js => en_api_mp_math_line.md.CAJnDKCu.js} (83%) rename assets/{en_api_mp_math_line.md.CP3RuJkk.lean.js => en_api_mp_math_line.md.CAJnDKCu.lean.js} (57%) rename assets/{en_api_mp_math_plane.md.eYXZ3wvh.js => en_api_mp_math_plane.md.B-VJJllR.js} (91%) rename assets/{en_api_mp_math_plane.md.eYXZ3wvh.lean.js => en_api_mp_math_plane.md.B-VJJllR.lean.js} (85%) rename assets/{en_api_mp_math_point.md.DNEIRDFB.js => en_api_mp_math_point.md.CCE-yfrm.js} (94%) rename assets/{en_api_mp_math_point.md.DNEIRDFB.lean.js => en_api_mp_math_point.md.CCE-yfrm.lean.js} (85%) rename assets/{en_api_mp_math_utils.md.D6PiZ35J.js => en_api_mp_math_utils.md.CuiyHRtY.js} (83%) rename assets/{en_api_mp_math_utils.md.D6PiZ35J.lean.js => en_api_mp_math_utils.md.CuiyHRtY.lean.js} (85%) rename assets/{en_api_mp_math_vector.md.BaY0-PMv.js => en_api_mp_math_vector.md.3xep9oDm.js} (92%) rename assets/{en_api_mp_math_vector.md.BaY0-PMv.lean.js => en_api_mp_math_vector.md.3xep9oDm.lean.js} (57%) rename assets/{en_api_presets_model_index.md.gEUCj87b.js => en_api_presets_model_index.md.1ewGi0do.js} (92%) rename assets/{en_api_presets_model_index.md.gEUCj87b.lean.js => en_api_presets_model_index.md.1ewGi0do.lean.js} (72%) create mode 100644 assets/guide_index.md.BE2yloik.js create mode 100644 assets/guide_index.md.BE2yloik.lean.js create mode 100644 assets/index.md.BE1qChTt.js create mode 100644 assets/index.md.BE1qChTt.lean.js delete mode 100644 assets/index.md.CJvRmMfL.js delete mode 100644 assets/index.md.CJvRmMfL.lean.js rename assets/{ja_api_mp_math_equation.md.DVrOBmbN.js => ja_api_mp_math_equation.md.BETlifwh.js} (93%) rename assets/{ja_api_mp_math_equation.md.DVrOBmbN.lean.js => ja_api_mp_math_equation.md.BETlifwh.lean.js} (55%) rename assets/{ja_api_mp_math_line.md.B4_v4TOY.js => ja_api_mp_math_line.md.Ck5uy5Cp.js} (84%) rename assets/{ja_api_mp_math_line.md.B4_v4TOY.lean.js => ja_api_mp_math_line.md.Ck5uy5Cp.lean.js} (57%) rename assets/{ja_api_mp_math_plane.md.BSSDxRzL.js => ja_api_mp_math_plane.md.C5qFtY92.js} (91%) rename assets/{ja_api_mp_math_plane.md.BSSDxRzL.lean.js => ja_api_mp_math_plane.md.C5qFtY92.lean.js} (85%) rename assets/{ja_api_mp_math_point.md.DvD45PEI.js => ja_api_mp_math_point.md.Cc_RLeth.js} (94%) rename assets/{ja_api_mp_math_point.md.DvD45PEI.lean.js => ja_api_mp_math_point.md.Cc_RLeth.lean.js} (85%) rename assets/{ja_api_mp_math_utils.md.Bc0yJ70T.js => ja_api_mp_math_utils.md.Dgzoi9ec.js} (82%) rename assets/{ja_api_mp_math_utils.md.Bc0yJ70T.lean.js => ja_api_mp_math_utils.md.Dgzoi9ec.lean.js} (85%) rename assets/{ja_api_mp_math_vector.md.TVqfIGHG.js => ja_api_mp_math_vector.md.kN2P6bpC.js} (92%) rename assets/{ja_api_mp_math_vector.md.TVqfIGHG.lean.js => ja_api_mp_math_vector.md.kN2P6bpC.lean.js} (57%) rename assets/{ja_api_presets_model_index.md.DJGptHhw.js => ja_api_presets_model_index.md.QP3v3mpP.js} (92%) rename assets/{ja_api_presets_model_index.md.DJGptHhw.lean.js => ja_api_presets_model_index.md.QP3v3mpP.lean.js} (72%) create mode 100644 assets/zh-Hant_api_index.md.D-iBkJb-.js create mode 100644 assets/zh-Hant_api_index.md.D-iBkJb-.lean.js create mode 100644 assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js create mode 100644 assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js create mode 100644 assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js create mode 100644 assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js create mode 100644 assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js create mode 100644 assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js create mode 100644 assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js create mode 100644 assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js create mode 100644 assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js create mode 100644 assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js create mode 100644 assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js create mode 100644 assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js create mode 100644 assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js create mode 100644 assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js create mode 100644 assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js create mode 100644 assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js create mode 100644 assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js create mode 100644 assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js create mode 100644 assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js create mode 100644 assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js create mode 100644 assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js create mode 100644 assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js create mode 100644 assets/zh-Hant_api_particle_index.md.BlduIPtw.js create mode 100644 assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js create mode 100644 assets/zh-Hant_api_presets_index.md.CDyg87e9.js create mode 100644 assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js create mode 100644 assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js create mode 100644 assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js create mode 100644 guide/index.html create mode 100644 zh-Hant/api/index.html create mode 100644 zh-Hant/api/mp_math/angle.html create mode 100644 zh-Hant/api/mp_math/const.html create mode 100644 zh-Hant/api/mp_math/equation.html create mode 100644 zh-Hant/api/mp_math/index.html create mode 100644 zh-Hant/api/mp_math/line.html create mode 100644 zh-Hant/api/mp_math/mp_math_typing.html create mode 100644 zh-Hant/api/mp_math/plane.html create mode 100644 zh-Hant/api/mp_math/point.html create mode 100644 zh-Hant/api/mp_math/segment.html create mode 100644 zh-Hant/api/mp_math/utils.html create mode 100644 zh-Hant/api/mp_math/vector.html create mode 100644 zh-Hant/api/particle/index.html create mode 100644 zh-Hant/api/presets/index.html create mode 100644 zh-Hant/api/presets/model/index.html diff --git a/404.html b/404.html index 6456764..f630ad0 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 14155b2..951a2b4 100644 --- a/api-ex.html +++ b/api-ex.html @@ -17,7 +17,7 @@ -
Skip to content

Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:

md
<script setup>
+    
Skip to content

Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:

md
<script setup>
 import { useData } from 'vitepress'
 
 const { theme, page, frontmatter } = useData()
@@ -127,6 +127,17 @@
         ]
       }
     ],
+    "/guide/": [
+      {
+        "text": "guide",
+        "items": [
+          {
+            "text": "开始不了一点",
+            "link": "/guide/index.md"
+          }
+        ]
+      }
+    ],
     "/en/": [
       {
         "text": "en",
@@ -311,6 +322,98 @@
         ]
       }
     ],
+    "/zh-Hant/": [
+      {
+        "text": "zh-hant",
+        "items": [
+          {
+            "text": "api",
+            "items": [
+              {
+                "text": "mbcp",
+                "link": "/zh-Hant/api/index.md"
+              },
+              {
+                "text": "mp_math",
+                "items": [
+                  {
+                    "text": "mbcp.mp_math",
+                    "link": "/zh-Hant/api/mp_math/index.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.angle",
+                    "link": "/zh-Hant/api/mp_math/angle.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.const",
+                    "link": "/zh-Hant/api/mp_math/const.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.equation",
+                    "link": "/zh-Hant/api/mp_math/equation.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.line",
+                    "link": "/zh-Hant/api/mp_math/line.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.mp_math_typing",
+                    "link": "/zh-Hant/api/mp_math/mp_math_typing.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.plane",
+                    "link": "/zh-Hant/api/mp_math/plane.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.point",
+                    "link": "/zh-Hant/api/mp_math/point.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.segment",
+                    "link": "/zh-Hant/api/mp_math/segment.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.utils",
+                    "link": "/zh-Hant/api/mp_math/utils.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.vector",
+                    "link": "/zh-Hant/api/mp_math/vector.md"
+                  }
+                ]
+              },
+              {
+                "text": "particle",
+                "items": [
+                  {
+                    "text": "mbcp.particle",
+                    "link": "/zh-Hant/api/particle/index.md"
+                  }
+                ]
+              },
+              {
+                "text": "presets",
+                "items": [
+                  {
+                    "text": "mbcp.presets",
+                    "link": "/zh-Hant/api/presets/index.md"
+                  },
+                  {
+                    "text": "model",
+                    "items": [
+                      {
+                        "text": "mbcp.presets.model",
+                        "link": "/zh-Hant/api/presets/model/index.md"
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    ],
     "/api-ex.md/": [
       {
         "text": "Runtime API Examples",
@@ -327,7 +430,7 @@
   "nav": [
     {
       "text": "快速开始",
-      "link": "/guide"
+      "link": "/guide/"
     },
     {
       "text": "API文档",
@@ -350,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 22198b2..8c20492 100644 --- a/api/index.html +++ b/api/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/api/mp_math/angle.html b/api/mp_math/angle.html index 2dc22d9..ba42b03 100644 --- a/api/mp_math/angle.html +++ b/api/mp_math/angle.html @@ -17,7 +17,7 @@ -
Skip to content

class Angle

class AnyAngle

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

任意角度。

参数:

  • value: 角度或弧度值

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

源码
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle

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

任意角度。

参数:

  • value: 角度或弧度值

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

源码
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -118,7 +118,7 @@
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/api/mp_math/const.html b/api/mp_math/const.html index faa3dbd..503eafa 100644 --- a/api/mp_math/const.html +++ b/api/mp_math/const.html @@ -17,8 +17,8 @@ -
Skip to content

var PI = math.pi

var E = math.e

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

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

- +
Skip to content

var PI = math.pi

var E = math.e

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

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

+ \ No newline at end of file diff --git a/api/mp_math/equation.html b/api/mp_math/equation.html index 6fee931..605a325 100644 --- a/api/mp_math/equation.html +++ b/api/mp_math/equation.html @@ -12,12 +12,12 @@ - + -
Skip to content

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

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

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

返回:

  • 偏导函数

引发:

  • ValueError 无效变量类型
源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -80,7 +80,7 @@
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

源码
python
def __str__(self):
     return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

- + \ No newline at end of file diff --git a/api/mp_math/index.html b/api/mp_math/index.html index 0535d61..7d231b0 100644 --- a/api/mp_math/index.html +++ b/api/mp_math/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/api/mp_math/line.html b/api/mp_math/line.html index 87f518b..122b301 100644 --- a/api/mp_math/line.html +++ b/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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

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

参数:

  • other: 另一条直线
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

参数:

  • other: 另一条直线

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 平行直线或点
源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点

返回:

  • 距离

引发:

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

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

计算两条直线的交点。

参数:

  • other: 另一条直线
源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

def 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

def 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

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

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

参数:

  • point: 指定点

返回:

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

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

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

参数:

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

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

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

参数:

  • t: 参数t

返回:

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

源码
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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

判断两条直线是否平行。

参数:

  • other: 另一条直线
源码
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

参数:

  • other: 另一条直线

返回:

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

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

判断两条直线是否共线。

参数:

  • other: 另一条直线
源码
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

参数:

  • other: 另一条直线

返回:

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

def is_point_on(self, point: 'Point3') -> 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)

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

判断点是否在直线上。

参数:

  • point: 点

返回:

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

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

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

参数:

  • other: 另一条直线
源码
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

参数:

  • other: 另一条直线

返回:

  • 是否共面
源码
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

返回:

  • 直线
源码
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

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

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

参数:

  • other: 另一条直线
源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

参数:

  • other: 另一条直线

返回:

  • 交点
源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -209,7 +209,7 @@
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

源码
python
def __repr__(self):
     return f'Line3({self.point}, {self.direction})'
- + \ No newline at end of file diff --git a/api/mp_math/mp_math_typing.html b/api/mp_math/mp_math_typing.html index 2db996f..5ec3185 100644 --- a/api/mp_math/mp_math_typing.html +++ b/api/mp_math/mp_math_typing.html @@ -17,8 +17,8 @@ -
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

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

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

var Var: TypeAlias = SingleVar | ArrayVar

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

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

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

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

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

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

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

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

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

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

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

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

- +
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

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

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

var Var: TypeAlias = SingleVar | ArrayVar

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

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

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

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

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

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

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

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

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

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

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

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

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

class Plane3

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

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

参数:

  • a:

  • b:

  • c:

  • d:

源码
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

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

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

参数:

  • a:

  • b:

  • c:

  • d:

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

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

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

参数:

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

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

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

参数:

  • other:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -49,7 +49,7 @@
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

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

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

参数:

  • other: 另一个平面
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

参数:

  • other: 另一个平面

返回:

  • 夹角弧度

引发:

  • TypeError 不支持的类型
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -64,7 +64,7 @@
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点
源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点

返回:

  • 距离

引发:

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

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

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

参数:

  • other: 另一个平面
源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面

返回:

  • 交线
源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -104,7 +104,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

  • other: 不与平面平行或在平面上的直线
源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

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

返回:

  • 交点

引发:

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

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

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

参数:

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

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

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

参数:

  • point: 指定点

返回:

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

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

判断两个平面是否平行。

参数:

  • other: 另一个平面
源码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

参数:

  • other: 另一个平面

返回:

  • 是否平行
源码
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -141,7 +141,7 @@
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

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

@classmethod

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

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

参数:

  • l1: 直线1

  • l2: 直线2

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

@classmethod

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

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

参数:

  • l1: 直线1

  • l2: 直线2

返回:

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

@classmethod

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

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

参数:

  • point: 面上一点

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

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

@classmethod

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

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

参数:

  • point: 面上一点

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

返回:

  • 平面
源码
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -206,7 +206,7 @@
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

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

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

def __and__(self, other)

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

参数:

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

def __and__(self, other)

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

参数:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源码
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -226,7 +226,7 @@
         raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

- + \ No newline at end of file diff --git a/api/mp_math/point.html b/api/mp_math/point.html index 1cf9dd6..dd1a173 100644 --- a/api/mp_math/point.html +++ b/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

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

笛卡尔坐标系中的点。

参数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源码
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

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

笛卡尔坐标系中的点。

参数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

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

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

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

参数:

  • other:

  • epsilon:

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

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

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

参数:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -69,7 +69,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 c1186e8..e4d0db1 100644 --- a/api/mp_math/segment.html +++ b/api/mp_math/segment.html @@ -17,7 +17,7 @@ -
Skip to content

class Segment3

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

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

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

class Segment3

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

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

源码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -33,7 +33,7 @@
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

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

def __str__(self)

源码
python
def __str__(self):
     return f'Segment3({self.p1} -> {self.p2})'
- + \ No newline at end of file diff --git a/api/mp_math/utils.html b/api/mp_math/utils.html index 69edafe..73d9817 100644 --- a/api/mp_math/utils.html +++ b/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

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

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

返回:

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

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

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

参数:

  • x:

  • y:

  • epsilon:

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

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

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

参数:

  • x:

  • y:

  • epsilon:

返回:

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

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

获取数的符号。

参数:

  • x: 数

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

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

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

获取数的符号。

参数:

  • x: 数

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

返回:

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

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

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

参数:

  • x: 数

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

源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

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

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

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -82,7 +82,7 @@
             self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

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

class Vector3

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源码
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Vector3

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源码
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

参数:

  • other:

  • epsilon:

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

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

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

参数:

  • other:

  • epsilon:

返回:

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

def cal_angle(self, other: 'Vector3') -> '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])

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

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

参数:

  • other: 另一个向量

返回:

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

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

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

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

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

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

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

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

参数:

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

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

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

参数:

  • other: 另一个向量

  • epsilon: 允许的误差

源码
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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

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

参数:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源码
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

参数:

  • other: 另一个向量
源码
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

参数:

  • other: 另一个向量

返回:

  • 是否平行
源码
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

参数:

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

def __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:

返回:

  • 是否相等
源码
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -206,7 +206,7 @@
     return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

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

def __str__(self)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/api/particle/index.html b/api/particle/index.html index fe6980f..ce276df 100644 --- a/api/particle/index.html +++ b/api/particle/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/api/presets/index.html b/api/presets/index.html index dd61db7..dddfb71 100644 --- a/api/presets/index.html +++ b/api/presets/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/api/presets/model/index.html b/api/presets/model/index.html index 4f3df63..1c753fe 100644 --- a/api/presets/model/index.html +++ b/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

源码
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

返回:

  • 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_equation.md.BXP6BUSg.js b/assets/api_mp_math_equation.md.CZgns297.js similarity index 93% rename from assets/api_mp_math_equation.md.BXP6BUSg.js rename to assets/api_mp_math_equation.md.CZgns297.js index fc6d4de..689d313 100644 --- a/assets/api_mp_math_equation.md.BXP6BUSg.js +++ b/assets/api_mp_math_equation.md.CZgns297.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n(`

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

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

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

返回:

  • 偏导函数

引发:

  • ValueError 无效变量类型
源码
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -60,4 +60,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

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

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; + return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/api_mp_math_equation.md.BXP6BUSg.lean.js b/assets/api_mp_math_equation.md.CZgns297.lean.js similarity index 57% rename from assets/api_mp_math_equation.md.BXP6BUSg.lean.js rename to assets/api_mp_math_equation.md.CZgns297.lean.js index 72c38e7..c846164 100644 --- a/assets/api_mp_math_equation.md.BXP6BUSg.lean.js +++ b/assets/api_mp_math_equation.md.CZgns297.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n("",23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; +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":"api/mp_math/equation.md","filePath":"api/mp_math/equation.md"}'),l={name:"api/mp_math/equation.md"},t=n("",27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/api_mp_math_line.md.CzpblksR.js b/assets/api_mp_math_line.md.DHofgyJO.js similarity index 83% rename from assets/api_mp_math_line.md.CzpblksR.js rename to assets/api_mp_math_line.md.DHofgyJO.js index 689d4fd..159b82c 100644 --- a/assets/api_mp_math_line.md.CzpblksR.js +++ b/assets/api_mp_math_line.md.DHofgyJO.js @@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g direction: 直线的方向向量 """ self.point = point - self.direction = direction

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -15,7 +15,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

参数:

  • other: 另一条直线
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

参数:

  • other: 另一条直线

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 平行直线或点
源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

参数:

  • other: 平行直线或点

返回:

  • 距离

引发:

  • TypeError 不支持的类型
源码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -48,7 +48,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

参数:

  • other: 另一条直线
源码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

def 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 g
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> '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

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

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

参数:

  • point: 指定点

返回:

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

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

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

参数:

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

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

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

参数:

  • t: 参数t

返回:

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

源码
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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

判断两条直线是否平行。

参数:

  • other: 另一条直线
源码
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

参数:

  • other: 另一条直线

返回:

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

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

判断两条直线是否共线。

参数:

  • other: 另一条直线
源码
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

参数:

  • other: 另一条直线

返回:

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

def is_point_on(self, point: 'Point3') -> 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)

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

判断点是否在直线上。

参数:

  • point: 点

返回:

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

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

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

参数:

  • other: 另一条直线
源码
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

参数:

  • other: 另一条直线

返回:

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

返回:

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

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

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

参数:

  • other: 另一条直线
源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

参数:

  • other: 另一条直线

返回:

  • 交点
源码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -189,4 +189,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     if self.direction.z != 0:
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

源码
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; + return f'Line3({self.point}, {self.direction})'
`,123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/api_mp_math_line.md.CzpblksR.lean.js b/assets/api_mp_math_line.md.DHofgyJO.lean.js similarity index 58% rename from assets/api_mp_math_line.md.CzpblksR.lean.js rename to assets/api_mp_math_line.md.DHofgyJO.lean.js index 5616832..db774ff 100644 --- a/assets/api_mp_math_line.md.CzpblksR.lean.js +++ b/assets/api_mp_math_line.md.DHofgyJO.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n("",91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n("",123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/api_mp_math_plane.md.CZDq9vG4.js b/assets/api_mp_math_plane.md.DZBu-HIq.js similarity index 91% rename from assets/api_mp_math_plane.md.CZDq9vG4.js rename to assets/api_mp_math_plane.md.DZBu-HIq.js index 1388466..adf2d19 100644 --- a/assets/api_mp_math_plane.md.CZDq9vG4.js +++ b/assets/api_mp_math_plane.md.DZBu-HIq.js @@ -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

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

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

参数:

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

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

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

参数:

  • other:

返回:

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

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

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

参数:

  • other: 另一个平面
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

参数:

  • other: 另一个平面

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 另一个平面或点
源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面或点

返回:

  • 距离

引发:

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

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

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

参数:

  • other: 另一个平面
源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

参数:

  • other: 另一个平面

返回:

  • 交线
源码
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -85,7 +85,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)

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

计算平面与直线的交点。

参数:

  • other: 不与平面平行或在平面上的直线
源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

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

返回:

  • 交点

引发:

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

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

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

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

参数:

  • point: 指定点

返回:

  • 平面
源码
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -107,7 +107,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)

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

判断两个平面是否平行。

参数:

  • other: 另一个平面
源码
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

参数:

  • other: 另一个平面

返回:

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源码
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +134,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

def 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

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

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

参数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

  • 平面
源码
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -148,7 +148,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

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

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

参数:

  • l1: 直线1

  • l2: 直线2

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

@classmethod

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

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

参数:

  • l1: 直线1

  • l2: 直线2

返回:

  • 平面
源码
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +162,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

def 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

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

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

参数:

  • point: 面上一点

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

返回:

  • 平面
源码
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -187,7 +187,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

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

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

def __and__(self, other)

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

参数:

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

def __and__(self, other)

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

参数:

  • other:

返回:

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

def __eq__(self, other) -> bool

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

`,130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/api_mp_math_plane.md.CZDq9vG4.lean.js b/assets/api_mp_math_plane.md.DZBu-HIq.lean.js similarity index 85% rename from assets/api_mp_math_plane.md.CZDq9vG4.lean.js rename to assets/api_mp_math_plane.md.DZBu-HIq.lean.js index 14763bd..af445f4 100644 --- a/assets/api_mp_math_plane.md.CZDq9vG4.lean.js +++ b/assets/api_mp_math_plane.md.DZBu-HIq.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":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n("",100),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; +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("",130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/api_mp_math_point.md.BJ9u2OpE.js b/assets/api_mp_math_point.md.CGqzS8ew.js similarity index 94% rename from assets/api_mp_math_point.md.BJ9u2OpE.js rename to assets/api_mp_math_point.md.CGqzS8ew.js index f8c5428..2035e7d 100644 --- a/assets/api_mp_math_point.md.BJ9u2OpE.js +++ b/assets/api_mp_math_point.md.CGqzS8ew.js @@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F """ self.x = x self.y = y - self.z = z

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

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

参数:

  • other:

  • epsilon:

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

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

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

参数:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -49,4 +49,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 
         """
     from .vector import Vector3
-    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/api_mp_math_point.md.BJ9u2OpE.lean.js b/assets/api_mp_math_point.md.CGqzS8ew.lean.js similarity index 85% rename from assets/api_mp_math_point.md.BJ9u2OpE.lean.js rename to assets/api_mp_math_point.md.CGqzS8ew.lean.js index e80f7d5..671d756 100644 --- a/assets/api_mp_math_point.md.BJ9u2OpE.lean.js +++ b/assets/api_mp_math_point.md.CGqzS8ew.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.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},l=n("",35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},l=n("",37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/api_mp_math_utils.md.DPDde5hx.js b/assets/api_mp_math_utils.md.C9bdphO4.js similarity index 82% rename from assets/api_mp_math_utils.md.DPDde5hx.js rename to assets/api_mp_math_utils.md.C9bdphO4.js index f4feeb5..32c3e97 100644 --- a/assets/api_mp_math_utils.md.DPDde5hx.js +++ b/assets/api_mp_math_utils.md.C9bdphO4.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n(`

def clamp() -> 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 y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

返回:

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

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

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

参数:

  • x:

  • y:

  • epsilon:

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

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

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

参数:

  • x:

  • y:

  • epsilon:

返回:

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

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

获取数的符号。

参数:

  • x: 数

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

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

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

获取数的符号。

参数:

  • x: 数

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

返回:

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

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

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

参数:

  • x: 数

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

源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

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

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

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源码
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -62,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         else:
             self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

源码
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,29),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; + return not self.__eq__(other)
`,37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/api_mp_math_utils.md.DPDde5hx.lean.js b/assets/api_mp_math_utils.md.C9bdphO4.lean.js similarity index 85% rename from assets/api_mp_math_utils.md.DPDde5hx.lean.js rename to assets/api_mp_math_utils.md.C9bdphO4.lean.js index 9df1220..51aea95 100644 --- a/assets/api_mp_math_utils.md.DPDde5hx.lean.js +++ b/assets/api_mp_math_utils.md.C9bdphO4.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n("",29),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},h=n("",37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/api_mp_math_vector.md.BBiKQwmG.js b/assets/api_mp_math_vector.md.BEh63_ZE.js similarity index 93% rename from assets/api_mp_math_vector.md.BBiKQwmG.js rename to assets/api_mp_math_vector.md.BEh63_ZE.js index dbf18e2..4ebb1ef 100644 --- a/assets/api_mp_math_vector.md.BBiKQwmG.js +++ b/assets/api_mp_math_vector.md.BEh63_ZE.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),t={name:"api/mp_math/vector.md"},l=n(`

class Vector3

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源码
python
def __init__(self, x: float, y: float, z: float):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),l={name:"api/mp_math/vector.md"},t=n(`

class Vector3

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源码
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

参数:

  • other:

  • epsilon:

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

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

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

参数:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> '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])

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

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

参数:

  • other: 另一个向量

返回:

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

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

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

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

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

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

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

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

参数:

  • 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 n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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

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

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

参数:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

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

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

判断两个向量是否平行。

参数:

  • other: 另一个向量
源码
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

参数:

  • other: 另一个向量

返回:

  • 是否平行
源码
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

参数:

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

def __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:

返回:

  • 是否相等
源码
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -186,4 +186,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

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

def __repr__(self)

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

def __str__(self)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.BBiKQwmG.lean.js b/assets/api_mp_math_vector.md.BEh63_ZE.lean.js similarity index 57% rename from assets/api_mp_math_vector.md.BBiKQwmG.lean.js rename to assets/api_mp_math_vector.md.BEh63_ZE.lean.js index 4845af4..3838d2b 100644 --- a/assets/api_mp_math_vector.md.BBiKQwmG.lean.js +++ b/assets/api_mp_math_vector.md.BEh63_ZE.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),t={name:"api/mp_math/vector.md"},l=n("",119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),l={name:"api/mp_math/vector.md"},t=n("",133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.BNeuRwjr.js b/assets/api_presets_model_index.md.DLrch_Ju.js similarity index 92% rename from assets/api_presets_model_index.md.BNeuRwjr.js rename to assets/api_presets_model_index.md.DLrch_Ju.js index 667e064..3035559 100644 --- a/assets/api_presets_model_index.md.BNeuRwjr.js +++ b/assets/api_presets_model_index.md.DLrch_Ju.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

源码
python
@staticmethod
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

返回:

  • 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)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.BNeuRwjr.lean.js b/assets/api_presets_model_index.md.DLrch_Ju.lean.js similarity index 71% rename from assets/api_presets_model_index.md.BNeuRwjr.lean.js rename to assets/api_presets_model_index.md.DLrch_Ju.lean.js index 887b976..c6822d1 100644 --- a/assets/api_presets_model_index.md.BNeuRwjr.lean.js +++ b/assets/api_presets_model_index.md.DLrch_Ju.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"api/presets/model/index.md","filePath":"api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},t=n("",9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/en_api_mp_math_equation.md.Bsq2lQHW.js b/assets/en_api_mp_math_equation.md.BQv4WWiJ.js similarity index 94% rename from assets/en_api_mp_math_equation.md.Bsq2lQHW.js rename to assets/en_api_mp_math_equation.md.BQv4WWiJ.js index 56d2cb5..75dbb88 100644 --- a/assets/en_api_mp_math_equation.md.Bsq2lQHW.js +++ b/assets/en_api_mp_math_equation.md.BQv4WWiJ.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n(`

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

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

Args:

  • func: 函数

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

  • epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"en/api/mp_math/equation.md","filePath":"en/api/mp_math/equation.md"}'),l={name:"en/api/mp_math/equation.md"},t=n(`

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

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

Args:

  • func: 函数

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

  • epsilon: 偏移量

Return:

  • 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -60,4 +60,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

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

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,23),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; + return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,27),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js b/assets/en_api_mp_math_equation.md.BQv4WWiJ.lean.js similarity index 86% rename from assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js rename to assets/en_api_mp_math_equation.md.BQv4WWiJ.lean.js index 5c96c7b..d1c0fef 100644 --- a/assets/en_api_mp_math_equation.md.Bsq2lQHW.lean.js +++ b/assets/en_api_mp_math_equation.md.BQv4WWiJ.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("",23),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; +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("",27),h=[t];function p(e,k,r,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/en_api_mp_math_line.md.CP3RuJkk.js b/assets/en_api_mp_math_line.md.CAJnDKCu.js similarity index 83% rename from assets/en_api_mp_math_line.md.CP3RuJkk.js rename to assets/en_api_mp_math_line.md.CAJnDKCu.js index 5a1d7ba..9bb040a 100644 --- a/assets/en_api_mp_math_line.md.CP3RuJkk.js +++ b/assets/en_api_mp_math_line.md.CAJnDKCu.js @@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g direction: 直线的方向向量 """ self.point = point - self.direction = direction

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

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

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

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

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

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

Args:

  • other: 另一条直线
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

Args:

  • other: 另一条直线

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

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

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

Args:

  • other: 平行直线或点
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

Args:

  • 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 g
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

Args:

  • other: 另一条直线
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

Args:

  • other: 另一条直线

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 g
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

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

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

Args:

  • point: 指定点
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

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

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

Args:

  • point: 指定点

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

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

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

Args:

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

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

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

Args:

  • t: 参数t

Return:

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

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

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

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

判断两条直线是否平行。

Args:

  • other: 另一条直线
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

Args:

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

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

判断两条直线是否共线。

Args:

  • other: 另一条直线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

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

判断两条直线是否共线。

Args:

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

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

判断点是否在直线上。

Args:

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

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

判断点是否在直线上。

Args:

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

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

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

Args:

  • other: 另一条直线
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

Args:

  • other: 另一条直线

Return:

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

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

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

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

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

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

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

Args:

  • other: 另一条直线
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

Args:

  • other: 另一条直线

Return:

  • 交点
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -189,4 +189,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     if self.direction.z != 0:
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

Source code
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; + return f'Line3({self.point}, {self.direction})'
`,123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/en_api_mp_math_line.md.CP3RuJkk.lean.js b/assets/en_api_mp_math_line.md.CAJnDKCu.lean.js similarity index 57% rename from assets/en_api_mp_math_line.md.CP3RuJkk.lean.js rename to assets/en_api_mp_math_line.md.CAJnDKCu.lean.js index dd8b683..4cd598e 100644 --- a/assets/en_api_mp_math_line.md.CP3RuJkk.lean.js +++ b/assets/en_api_mp_math_line.md.CAJnDKCu.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n("",91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n("",123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/en_api_mp_math_plane.md.eYXZ3wvh.js b/assets/en_api_mp_math_plane.md.B-VJJllR.js similarity index 91% rename from assets/en_api_mp_math_plane.md.eYXZ3wvh.js rename to assets/en_api_mp_math_plane.md.B-VJJllR.js index 9b8e61e..e76b680 100644 --- a/assets/en_api_mp_math_plane.md.eYXZ3wvh.js +++ b/assets/en_api_mp_math_plane.md.B-VJJllR.js @@ -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

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

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

Args:

  • other:
Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

Args:

  • other:

Return:

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

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

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

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

Args:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

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

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

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

Args:

  • other: 另一个平面或点
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

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

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

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

Args:

  • other: 另一个平面
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面

Return:

  • 交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -85,7 +85,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)

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

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

Args:

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

Return:

  • 交点

Raises:

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

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

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

Args:

  • point: 指定点
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

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

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

Args:

  • point: 指定点

Return:

  • 平面
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -107,7 +107,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)

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

判断两个平面是否平行。

Args:

  • other: 另一个平面
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

Args:

  • other: 另一个平面

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -122,7 +122,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

Args:

  • point: 平面上的一点

  • normal: 法向量

Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

Args:

  • point: 平面上的一点

  • normal: 法向量

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +134,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

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

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

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Return:

  • 平面
Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -148,7 +148,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

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

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

Args:

  • l1: 直线1

  • l2: 直线2

Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

Args:

  • l1: 直线1

  • l2: 直线2

Return:

  • 平面
Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +162,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

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

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

Args:

  • point: 面上一点

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

Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

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

Args:

  • point: 面上一点

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

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -187,7 +187,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

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

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

def __and__(self, other)

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

Args:

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

def __and__(self, other)

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

Args:

  • other:

Return:

  • 不平行平面的交线,平面平行返回None
Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -206,4 +206,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     else:
         raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

`,130),t=[h];function p(e,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js b/assets/en_api_mp_math_plane.md.B-VJJllR.lean.js similarity index 85% rename from assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js rename to assets/en_api_mp_math_plane.md.B-VJJllR.lean.js index ccfd979..c20c049 100644 --- a/assets/en_api_mp_math_plane.md.eYXZ3wvh.lean.js +++ b/assets/en_api_mp_math_plane.md.B-VJJllR.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("",100),t=[h];function p(e,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; +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("",130),t=[h];function p(e,k,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/en_api_mp_math_point.md.DNEIRDFB.js b/assets/en_api_mp_math_point.md.CCE-yfrm.js similarity index 94% rename from assets/en_api_mp_math_point.md.DNEIRDFB.js rename to assets/en_api_mp_math_point.md.CCE-yfrm.js index 2b4a6b9..fac2914 100644 --- a/assets/en_api_mp_math_point.md.DNEIRDFB.js +++ b/assets/en_api_mp_math_point.md.CCE-yfrm.js @@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F """ self.x = x self.y = y - self.z = z

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

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

Args:

  • other:

  • epsilon:

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

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

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

Args:

  • other:

  • epsilon:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -49,4 +49,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 
         """
     from .vector import Vector3
-    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/en_api_mp_math_point.md.DNEIRDFB.lean.js b/assets/en_api_mp_math_point.md.CCE-yfrm.lean.js similarity index 85% rename from assets/en_api_mp_math_point.md.DNEIRDFB.lean.js rename to assets/en_api_mp_math_point.md.CCE-yfrm.lean.js index 5c60e43..a40890a 100644 --- a/assets/en_api_mp_math_point.md.DNEIRDFB.lean.js +++ b/assets/en_api_mp_math_point.md.CCE-yfrm.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.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},l=n("",35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},l=n("",37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/en_api_mp_math_utils.md.D6PiZ35J.js b/assets/en_api_mp_math_utils.md.CuiyHRtY.js similarity index 83% rename from assets/en_api_mp_math_utils.md.D6PiZ35J.js rename to assets/en_api_mp_math_utils.md.CuiyHRtY.js index 220cb3f..75e744f 100644 --- a/assets/en_api_mp_math_utils.md.D6PiZ35J.js +++ b/assets/en_api_mp_math_utils.md.CuiyHRtY.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

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

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

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

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

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

Args:

  • x:

  • y:

  • epsilon:

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

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

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

Args:

  • x:

  • y:

  • epsilon:

Return:

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

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

获取数的符号。

Args:

  • x: 数

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

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

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

获取数的符号。

Args:

  • x: 数

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

Return:

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

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

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

Args:

  • x: 数

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

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

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

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

Args:

  • x: 数

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

Return:

  • 符号 + - ""
Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -62,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
         else:
             self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

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

class Vector3

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

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

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

class Vector3

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

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

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

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

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

Args:

  • other:

  • epsilon:

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

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

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

Args:

  • 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 n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

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

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

Args:

  • other: 另一个向量
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

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

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

Args:

  • other: 另一个向量

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

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

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

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

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

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

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

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

Args:

  • 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 n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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

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

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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

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

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

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

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

判断两个向量是否平行。

Args:

  • other: 另一个向量
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

Args:

  • other: 另一个向量

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

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

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:

Return:

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

def __neg__(self)

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

def __repr__(self)

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

def __str__(self)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,133),e=[t];function h(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(l,[["render",h]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js b/assets/en_api_mp_math_vector.md.3xep9oDm.lean.js similarity index 57% rename from assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js rename to assets/en_api_mp_math_vector.md.3xep9oDm.lean.js index 365b150..0707a9a 100644 --- a/assets/en_api_mp_math_vector.md.BaY0-PMv.lean.js +++ b/assets/en_api_mp_math_vector.md.3xep9oDm.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),t={name:"en/api/mp_math/vector.md"},e=n("",119),l=[e];function h(p,k,r,d,o,E){return a(),i("div",null,l)}const F=s(t,[["render",h]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),l={name:"en/api/mp_math/vector.md"},t=n("",133),e=[t];function h(p,k,r,d,o,E){return a(),i("div",null,e)}const F=s(l,[["render",h]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.gEUCj87b.js b/assets/en_api_presets_model_index.md.1ewGi0do.js similarity index 92% rename from assets/en_api_presets_model_index.md.gEUCj87b.js rename to assets/en_api_presets_model_index.md.1ewGi0do.js index 7cfdfce..299d197 100644 --- a/assets/en_api_presets_model_index.md.gEUCj87b.js +++ b/assets/en_api_presets_model_index.md.1ewGi0do.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

Source code
python
@staticmethod
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

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)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.gEUCj87b.lean.js b/assets/en_api_presets_model_index.md.1ewGi0do.lean.js similarity index 72% rename from assets/en_api_presets_model_index.md.gEUCj87b.lean.js rename to assets/en_api_presets_model_index.md.1ewGi0do.lean.js index 2670e74..91d45a0 100644 --- a/assets/en_api_presets_model_index.md.gEUCj87b.lean.js +++ b/assets/en_api_presets_model_index.md.1ewGi0do.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),h={name:"en/api/presets/model/index.md"},t=n("",9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/guide_index.md.BE2yloik.js b/assets/guide_index.md.BE2yloik.js new file mode 100644 index 0000000..b53aa86 --- /dev/null +++ b/assets/guide_index.md.BE2yloik.js @@ -0,0 +1 @@ +import{_ as a,c as t,o as n,j as e,a as o}from"./chunks/framework.BV61Qrc0.js";const x=JSON.parse('{"title":"开始不了一点","description":"","frontmatter":{},"headers":[],"relativePath":"guide/index.md","filePath":"guide/index.md"}'),r={name:"guide/index.md"},s=e("h1",{id:"开始不了一点",tabindex:"-1"},[o("开始不了一点 "),e("a",{class:"header-anchor",href:"#开始不了一点","aria-label":'Permalink to "开始不了一点"'},"​")],-1),d=[s];function i(c,_,l,p,h,m){return n(),t("div",null,d)}const u=a(r,[["render",i]]);export{x as __pageData,u as default}; diff --git a/assets/guide_index.md.BE2yloik.lean.js b/assets/guide_index.md.BE2yloik.lean.js new file mode 100644 index 0000000..b53aa86 --- /dev/null +++ b/assets/guide_index.md.BE2yloik.lean.js @@ -0,0 +1 @@ +import{_ as a,c as t,o as n,j as e,a as o}from"./chunks/framework.BV61Qrc0.js";const x=JSON.parse('{"title":"开始不了一点","description":"","frontmatter":{},"headers":[],"relativePath":"guide/index.md","filePath":"guide/index.md"}'),r={name:"guide/index.md"},s=e("h1",{id:"开始不了一点",tabindex:"-1"},[o("开始不了一点 "),e("a",{class:"header-anchor",href:"#开始不了一点","aria-label":'Permalink to "开始不了一点"'},"​")],-1),d=[s];function i(c,_,l,p,h,m){return n(),t("div",null,d)}const u=a(r,[["render",i]]);export{x as __pageData,u as default}; diff --git a/assets/index.md.BE1qChTt.js b/assets/index.md.BE1qChTt.js new file mode 100644 index 0000000..27ccc20 --- /dev/null +++ b/assets/index.md.BE1qChTt.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"MBCP docs","text":"More basic change particle","tagline":"用于几何运算和粒子制作的库","actions":[{"theme":"brand","text":"快速开始","link":"guide/"},{"theme":"alt","text":"API文档","link":"api/"}]},"features":[{"title":"高可用性","details":"通过简单的接口,实现了大部分几何运算和粒子制作的需求"},{"title":"高集成度","details":"对numpyscipysumpy进行了封装和集成,使脚本编写像使用Geogebra一样简单"},{"title":"内置预设","details":"提供了大量的预设,包括常见的几何图形、粒子效果等,方便快速制作"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),o={name:"index.md"};function i(c,n,d,s,r,l){return a(),t("div")}const _=e(o,[["render",i]]);export{m as __pageData,_ as default}; diff --git a/assets/index.md.BE1qChTt.lean.js b/assets/index.md.BE1qChTt.lean.js new file mode 100644 index 0000000..27ccc20 --- /dev/null +++ b/assets/index.md.BE1qChTt.lean.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"MBCP docs","text":"More basic change particle","tagline":"用于几何运算和粒子制作的库","actions":[{"theme":"brand","text":"快速开始","link":"guide/"},{"theme":"alt","text":"API文档","link":"api/"}]},"features":[{"title":"高可用性","details":"通过简单的接口,实现了大部分几何运算和粒子制作的需求"},{"title":"高集成度","details":"对numpyscipysumpy进行了封装和集成,使脚本编写像使用Geogebra一样简单"},{"title":"内置预设","details":"提供了大量的预设,包括常见的几何图形、粒子效果等,方便快速制作"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),o={name:"index.md"};function i(c,n,d,s,r,l){return a(),t("div")}const _=e(o,[["render",i]]);export{m as __pageData,_ as default}; diff --git a/assets/index.md.CJvRmMfL.js b/assets/index.md.CJvRmMfL.js deleted file mode 100644 index 7162b9e..0000000 --- a/assets/index.md.CJvRmMfL.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const p=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"MBCP docs","text":"More basic change particle","tagline":"用于几何运算和粒子制作的库","actions":[{"theme":"brand","text":"快速开始","link":"md-ex"},{"theme":"alt","text":"API文档","link":"api/"}]},"features":[{"title":"高可用性","details":"通过简单的接口,实现了大部分几何运算和粒子制作的需求"},{"title":"高集成度","details":"对numpyscipysumpy进行了封装和集成,使脚本编写像使用Geogebra一样简单"},{"title":"内置预设","details":"提供了大量的预设,包括常见的几何图形、粒子效果等,方便快速制作"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),o={name:"index.md"};function i(c,n,d,s,r,l){return a(),t("div")}const x=e(o,[["render",i]]);export{p as __pageData,x as default}; diff --git a/assets/index.md.CJvRmMfL.lean.js b/assets/index.md.CJvRmMfL.lean.js deleted file mode 100644 index 7162b9e..0000000 --- a/assets/index.md.CJvRmMfL.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const p=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"MBCP docs","text":"More basic change particle","tagline":"用于几何运算和粒子制作的库","actions":[{"theme":"brand","text":"快速开始","link":"md-ex"},{"theme":"alt","text":"API文档","link":"api/"}]},"features":[{"title":"高可用性","details":"通过简单的接口,实现了大部分几何运算和粒子制作的需求"},{"title":"高集成度","details":"对numpyscipysumpy进行了封装和集成,使脚本编写像使用Geogebra一样简单"},{"title":"内置预设","details":"提供了大量的预设,包括常见的几何图形、粒子效果等,方便快速制作"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),o={name:"index.md"};function i(c,n,d,s,r,l){return a(),t("div")}const x=e(o,[["render",i]]);export{p as __pageData,x as default}; diff --git a/assets/ja_api_mp_math_equation.md.DVrOBmbN.js b/assets/ja_api_mp_math_equation.md.BETlifwh.js similarity index 93% rename from assets/ja_api_mp_math_equation.md.DVrOBmbN.js rename to assets/ja_api_mp_math_equation.md.BETlifwh.js index 985f48d..5a405dc 100644 --- a/assets/ja_api_mp_math_equation.md.DVrOBmbN.js +++ b/assets/ja_api_mp_math_equation.md.BETlifwh.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n(`

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

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

引数:

  • func: 函数

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

  • epsilon: 偏移量

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

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

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

引数:

  • func: 函数

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

  • epsilon: 偏移量

戻り値:

  • 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -60,4 +60,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

ソースコード
python
def __str__(self):
-    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; + return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js b/assets/ja_api_mp_math_equation.md.BETlifwh.lean.js similarity index 55% rename from assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js rename to assets/ja_api_mp_math_equation.md.BETlifwh.lean.js index 8516d78..d638e44 100644 --- a/assets/ja_api_mp_math_equation.md.DVrOBmbN.lean.js +++ b/assets/ja_api_mp_math_equation.md.BETlifwh.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n("",23),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; +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":"ja/api/mp_math/equation.md","filePath":"ja/api/mp_math/equation.md"}'),l={name:"ja/api/mp_math/equation.md"},t=n("",27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_line.md.B4_v4TOY.js b/assets/ja_api_mp_math_line.md.Ck5uy5Cp.js similarity index 84% rename from assets/ja_api_mp_math_line.md.B4_v4TOY.js rename to assets/ja_api_mp_math_line.md.Ck5uy5Cp.js index dec455b..2435a2b 100644 --- a/assets/ja_api_mp_math_line.md.B4_v4TOY.js +++ b/assets/ja_api_mp_math_line.md.Ck5uy5Cp.js @@ -6,7 +6,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g direction: 直线的方向向量 """ self.point = point - self.direction = direction

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -15,7 +15,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

引数:

  • other: 另一条直线
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

引数:

  • other: 另一条直线

戻り値:

  • 夹角弧度

例外:

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

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

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

引数:

  • other: 平行直线或点
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

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

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

引数:

  • other: 平行直线或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -48,7 +48,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

引数:

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

def 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 g
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> '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

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

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

引数:

  • point: 指定点

戻り値:

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

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

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

引数:

  • t: 参数t
ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

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

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

引数:

  • t: 参数t

戻り値:

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -85,7 +85,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

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

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

判断两条直线是否平行。

引数:

  • other: 另一条直线
ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

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

判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値:

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

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

判断两条直线是否共线。

引数:

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

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

判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値:

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

def is_point_on(self, point: 'Point3') -> 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)

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

判断点是否在直线上。

引数:

  • point: 点

戻り値:

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

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

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

引数:

  • other: 另一条直线
ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

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

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

引数:

  • other: 另一条直线

戻り値:

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

@classmethod

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

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

引数:

  • p1: 点1

  • p2: 点2

ソースコード
python
@classmethod
+        self.point.z = 0

@classmethod

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

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

引数:

  • p1: 点1

  • p2: 点2

戻り値:

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

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

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

引数:

  • other: 另一条直线
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

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

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

引数:

  • other: 另一条直线

戻り値:

  • 交点
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -189,4 +189,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     if self.direction.z != 0:
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

ソースコード
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
`,91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; + return f'Line3({self.point}, {self.direction})'
`,123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js b/assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js similarity index 57% rename from assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js rename to assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js index fba677c..8410758 100644 --- a/assets/ja_api_mp_math_line.md.B4_v4TOY.lean.js +++ b/assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n("",91),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n("",123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_plane.md.BSSDxRzL.js b/assets/ja_api_mp_math_plane.md.C5qFtY92.js similarity index 91% rename from assets/ja_api_mp_math_plane.md.BSSDxRzL.js rename to assets/ja_api_mp_math_plane.md.C5qFtY92.js index 572a682..9974486 100644 --- a/assets/ja_api_mp_math_plane.md.BSSDxRzL.js +++ b/assets/ja_api_mp_math_plane.md.C5qFtY92.js @@ -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

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

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

引数:

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

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

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

引数:

  • other:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -30,7 +30,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

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

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

引数:

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

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

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

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

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

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

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

引数:

  • other: 另一个平面或点
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

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

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

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

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

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

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

引数:

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

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

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

引数:

  • other: 另一个平面

戻り値:

  • 交线
ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -85,7 +85,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)

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

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

引数:

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

戻り値:

  • 交点

例外:

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

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

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

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

引数:

  • point: 指定点

戻り値:

  • 平面
ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -107,7 +107,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)

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

判断两个平面是否平行。

引数:

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

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

判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -122,7 +122,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

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

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

引数:

  • point: 平面上的一点

  • normal: 法向量

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

@classmethod

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

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

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +134,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

def 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

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

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

引数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -148,7 +148,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

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

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

引数:

  • l1: 直线1

  • l2: 直线2

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

@classmethod

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

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

引数:

  • l1: 直线1

  • l2: 直线2

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +162,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

def 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

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

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

引数:

  • point: 面上一点

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

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -187,7 +187,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

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

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

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

引数:

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

def __and__(self, other)

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

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -206,4 +206,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     else:
         raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

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

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

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
-    return self.cal_intersection_point3(other)

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

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

var k = other.a / self.a

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

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

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

var k = other.b / self.b

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

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

var k = other.c / self.c

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

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

`,130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js b/assets/ja_api_mp_math_plane.md.C5qFtY92.lean.js similarity index 85% rename from assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js rename to assets/ja_api_mp_math_plane.md.C5qFtY92.lean.js index 51e2aa5..99f7f9b 100644 --- a/assets/ja_api_mp_math_plane.md.BSSDxRzL.lean.js +++ b/assets/ja_api_mp_math_plane.md.C5qFtY92.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":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n("",100),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; +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("",130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_point.md.DvD45PEI.js b/assets/ja_api_mp_math_point.md.Cc_RLeth.js similarity index 94% rename from assets/ja_api_mp_math_point.md.DvD45PEI.js rename to assets/ja_api_mp_math_point.md.Cc_RLeth.js index e7f7681..0e3da2e 100644 --- a/assets/ja_api_mp_math_point.md.DvD45PEI.js +++ b/assets/ja_api_mp_math_point.md.Cc_RLeth.js @@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F """ self.x = x self.y = y - self.z = z

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

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

引数:

  • other:

  • epsilon:

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -49,4 +49,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
 
         """
     from .vector import Vector3
-    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_point.md.DvD45PEI.lean.js b/assets/ja_api_mp_math_point.md.Cc_RLeth.lean.js similarity index 85% rename from assets/ja_api_mp_math_point.md.DvD45PEI.lean.js rename to assets/ja_api_mp_math_point.md.Cc_RLeth.lean.js index 836f83b..06f7d4d 100644 --- a/assets/ja_api_mp_math_point.md.DvD45PEI.lean.js +++ b/assets/ja_api_mp_math_point.md.Cc_RLeth.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.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},l=n("",35),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},l=n("",37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_utils.md.Bc0yJ70T.js b/assets/ja_api_mp_math_utils.md.Dgzoi9ec.js similarity index 82% rename from assets/ja_api_mp_math_utils.md.Bc0yJ70T.js rename to assets/ja_api_mp_math_utils.md.Dgzoi9ec.js index 29a33c0..67787d7 100644 --- a/assets/ja_api_mp_math_utils.md.Bc0yJ70T.js +++ b/assets/ja_api_mp_math_utils.md.Dgzoi9ec.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

引数:

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

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

戻り値:

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

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

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

引数:

  • x:

  • y:

  • epsilon:

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

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

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

引数:

  • x:

  • y:

  • epsilon:

戻り値:

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

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

获取数的符号。

引数:

  • x: 数

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

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

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

获取数的符号。

引数:

  • x: 数

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

戻り値:

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

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

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

引数:

  • x: 数

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

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

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

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

引数:

  • x: 数

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

戻り値:

  • 符号 + - ""
ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -62,4 +62,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         else:
             self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

ソースコード
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,29),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; + return not self.__eq__(other)
`,37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js b/assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js similarity index 85% rename from assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js rename to assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js index 36c0189..da2c0fe 100644 --- a/assets/ja_api_mp_math_utils.md.Bc0yJ70T.lean.js +++ b/assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n("",29),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},h=n("",37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/ja_api_mp_math_vector.md.TVqfIGHG.js b/assets/ja_api_mp_math_vector.md.kN2P6bpC.js similarity index 92% rename from assets/ja_api_mp_math_vector.md.TVqfIGHG.js rename to assets/ja_api_mp_math_vector.md.kN2P6bpC.js index 59f6899..7aa7f49 100644 --- a/assets/ja_api_mp_math_vector.md.TVqfIGHG.js +++ b/assets/ja_api_mp_math_vector.md.kN2P6bpC.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),t={name:"ja/api/mp_math/vector.md"},l=n(`

class Vector3

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

3维向量

引数:

ソースコード
python
def __init__(self, x: float, y: float, z: float):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),l={name:"ja/api/mp_math/vector.md"},t=n(`

class Vector3

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

3维向量

引数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         """
     self.x = x
     self.y = y
-    self.z = z

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

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

引数:

  • other:

  • epsilon:

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> '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])

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

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

引数:

  • other: 另一个向量

戻り値:

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

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

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

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

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

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

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

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

引数:

  • 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 n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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

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

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

引数:

  • other: 另一个向量

  • epsilon: 允许的误差

戻り値:

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

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

判断两个向量是否平行。

引数:

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

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

判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:

戻り値:

  • 是否相等
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -186,4 +186,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

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

def __repr__(self)

ソースコード
python
def __repr__(self):
     return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

ソースコード
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

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

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js b/assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js similarity index 57% rename from assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js rename to assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js index f8188b5..e4802c6 100644 --- a/assets/ja_api_mp_math_vector.md.TVqfIGHG.lean.js +++ b/assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),t={name:"ja/api/mp_math/vector.md"},l=n("",119),h=[l];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(t,[["render",e]]);export{y as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),l={name:"ja/api/mp_math/vector.md"},t=n("",133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.DJGptHhw.js b/assets/ja_api_presets_model_index.md.QP3v3mpP.js similarity index 92% rename from assets/ja_api_presets_model_index.md.DJGptHhw.js rename to assets/ja_api_presets_model_index.md.QP3v3mpP.js index 48011b0..acb7677 100644 --- a/assets/ja_api_presets_model_index.md.DJGptHhw.js +++ b/assets/ja_api_presets_model_index.md.QP3v3mpP.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

ソースコード
python
@staticmethod
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • 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)]
`,7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.DJGptHhw.lean.js b/assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js similarity index 72% rename from assets/ja_api_presets_model_index.md.DJGptHhw.lean.js rename to assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js index a7af87a..3bf2a39 100644 --- a/assets/ja_api_presets_model_index.md.DJGptHhw.lean.js +++ b/assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n("",7),l=[t];function k(p,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",k]]);export{o as __pageData,F as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n("",9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/zh-Hant_api_index.md.D-iBkJb-.js b/assets/zh-Hant_api_index.md.D-iBkJb-.js new file mode 100644 index 0000000..3bbc9de --- /dev/null +++ b/assets/zh-Hant_api_index.md.D-iBkJb-.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp","description":"","frontmatter":{"title":"mbcp"},"headers":[],"relativePath":"zh-Hant/api/index.md","filePath":"zh-Hant/api/index.md"}'),n={name:"zh-Hant/api/index.md"};function i(r,c,o,p,s,d){return a(),t("div")}const f=e(n,[["render",i]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js b/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js new file mode 100644 index 0000000..3bbc9de --- /dev/null +++ b/assets/zh-Hant_api_index.md.D-iBkJb-.lean.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp","description":"","frontmatter":{"title":"mbcp"},"headers":[],"relativePath":"zh-Hant/api/index.md","filePath":"zh-Hant/api/index.md"}'),n={name:"zh-Hant/api/index.md"};function i(r,c,o,p,s,d){return a(),t("div")}const f=e(n,[["render",i]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js new file mode 100644 index 0000000..49a636b --- /dev/null +++ b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.js @@ -0,0 +1,101 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"zh-Hant/api/mp_math/angle.md","filePath":"zh-Hant/api/mp_math/angle.md"}'),e={name:"zh-Hant/api/mp_math/angle.md"},l=n(`

class Angle

class AnyAngle

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

任意角度。

參數:

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

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

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

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

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

@property

def degree(self) -> float

角度。

返回:

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

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

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

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

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

@property

def sin(self) -> float

正弦值。

返回:

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

@property

def cos(self) -> float

余弦值。

返回:

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

@property

def tan(self) -> float

正切值。

返回:

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

@property

def cot(self) -> float

余切值。

返回:

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

@property

def sec(self) -> float

正割值。

返回:

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

@property

def csc(self) -> float

余割值。

返回:

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

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

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

def __eq__(self, other)

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

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

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

def __mul__(self, other: float) -> 'AnyAngle'

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

源碼
python
def __str__(self):
+    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

def __truediv__(self, other: float) -> 'AnyAngle'

源碼
python
@overload
+def __truediv__(self, other: float) -> 'AnyAngle':
+    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

源碼
python
@overload
+def __truediv__(self, other: 'AnyAngle') -> float:
+    ...

def __truediv__(self, other)

源碼
python
def __truediv__(self, other):
+    if isinstance(other, AnyAngle):
+        return self.radian / other.radian
+    return AnyAngle(self.radian / other, is_radian=True)
`,93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js new file mode 100644 index 0000000..c5406a3 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_angle.md.eKQSpiMX.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"zh-Hant/api/mp_math/angle.md","filePath":"zh-Hant/api/mp_math/angle.md"}'),e={name:"zh-Hant/api/mp_math/angle.md"},l=n("",93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; diff --git a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js new file mode 100644 index 0000000..d637d48 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.js @@ -0,0 +1 @@ +import{_ as a,c as e,o as t,a2 as r}from"./chunks/framework.BV61Qrc0.js";const v=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zh-Hant/api/mp_math/const.md","filePath":"zh-Hant/api/mp_math/const.md"}'),o={name:"zh-Hant/api/mp_math/const.md"},n=r('

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

',6),s=[n];function h(m,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",h]]);export{v as __pageData,P as default}; diff --git a/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js new file mode 100644 index 0000000..71a259b --- /dev/null +++ b/assets/zh-Hant_api_mp_math_const.md.B_tZ9wL7.lean.js @@ -0,0 +1 @@ +import{_ as a,c as e,o as t,a2 as r}from"./chunks/framework.BV61Qrc0.js";const v=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zh-Hant/api/mp_math/const.md","filePath":"zh-Hant/api/mp_math/const.md"}'),o={name:"zh-Hant/api/mp_math/const.md"},n=r("",6),s=[n];function h(m,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",h]]);export{v as __pageData,P as default}; diff --git a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js new file mode 100644 index 0000000..660a9c3 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.js @@ -0,0 +1,63 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u=JSON.parse('{"title":"mbcp.mp_math.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zh-Hant/api/mp_math/equation.md","filePath":"zh-Hant/api/mp_math/equation.md"}'),l={name:"zh-Hant/api/mp_math/equation.md"},t=n(`

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

參數:

返回:

引發:

源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    """
+    求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    Args:
+        func: 函数
+        var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
+        epsilon: 偏移量
+    Returns:
+        偏导函数
+    Raises:
+        ValueError: 无效变量类型
+    """
+    if isinstance(var, int):
+
+        def partial_derivative_func(*args: Var) -> Var:
+            args_list_plus = list(args)
+            args_list_plus[var] += epsilon
+            args_list_minus = list(args)
+            args_list_minus[var] -= epsilon
+            return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)
+        return partial_derivative_func
+    elif isinstance(var, tuple):
+
+        def high_order_partial_derivative_func(*args: Var) -> Var:
+            result_func = func
+            for v in var:
+                result_func = get_partial_derivative_func(result_func, v, epsilon)
+            return result_func(*args)
+        return high_order_partial_derivative_func
+    else:
+        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

源碼
python
def partial_derivative_func(*args: Var) -> Var:
+    args_list_plus = list(args)
+    args_list_plus[var] += epsilon
+    args_list_minus = list(args)
+    args_list_minus[var] -= epsilon
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

源碼
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    result_func = func
+    for v in var:
+        result_func = get_partial_derivative_func(result_func, v, epsilon)
+    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

參數:

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    """
+        曲线方程。
+        Args:
+            x_func: x函数
+            y_func: y函数
+            z_func: z函数
+        """
+    self.x_func = x_func
+    self.y_func = y_func
+    self.z_func = z_func

def __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

參數:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    """
+        计算曲线上的点。
+        Args:
+            *t:
+                参数
+        Returns:
+
+        """
+    if len(t) == 1:
+        return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
+    else:
+        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

源碼
python
def __str__(self):
+    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

`,27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js new file mode 100644 index 0000000..06e1674 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_equation.md.DPinrp8_.lean.js @@ -0,0 +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":"zh-Hant/api/mp_math/equation.md","filePath":"zh-Hant/api/mp_math/equation.md"}'),l={name:"zh-Hant/api/mp_math/equation.md"},t=n("",27),h=[t];function p(e,k,r,E,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js new file mode 100644 index 0000000..901aa65 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.js @@ -0,0 +1 @@ +import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zh-Hant/api/mp_math/index.md","filePath":"zh-Hant/api/mp_math/index.md"}'),n={name:"zh-Hant/api/mp_math/index.md"};function m(p,i,r,c,o,s){return e(),a("div")}const h=t(n,[["render",m]]);export{d as __pageData,h as default}; diff --git a/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js new file mode 100644 index 0000000..901aa65 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_index.md.B8NLV8Cf.lean.js @@ -0,0 +1 @@ +import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zh-Hant/api/mp_math/index.md","filePath":"zh-Hant/api/mp_math/index.md"}'),n={name:"zh-Hant/api/mp_math/index.md"};function m(p,i,r,c,o,s){return e(),a("div")}const h=t(n,[["render",m]]);export{d as __pageData,h as default}; diff --git a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js new file mode 100644 index 0000000..a9339c5 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.js @@ -0,0 +1,192 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zh-Hant/api/mp_math/line.md","filePath":"zh-Hant/api/mp_math/line.md"}'),l={name:"zh-Hant/api/mp_math/line.md"},t=n(`

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

參數:

源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    """
+        三维空间中的直线。由一个点和一个方向向量确定。
+        Args:
+            point: 直线上的一点
+            direction: 直线的方向向量
+        """
+    self.point = point
+    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    """
+        判断两条直线是否近似相等。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似相等
+        """
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

參數:

返回:

引發:

源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    """
+        计算直线和直线之间的夹角。
+        Args:
+            other: 另一条直线
+        Returns:
+            夹角弧度
+        Raises:
+            TypeError: 不支持的类型
+        """
+    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

參數:

返回:

引發:

源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    """
+        计算直线和直线或点之间的距离。
+        Args:
+            other: 平行直线或点
+
+        Returns:
+            距离
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Line3):
+        if self == other:
+            return 0
+        elif self.is_parallel(other):
+            return (other.point - self.point).cross(self.direction).length / self.direction.length
+        elif not self.is_coplanar(other):
+            return abs(self.direction.cross(other.direction) @ (self.point - other.point) / self.direction.cross(other.direction).length)
+        else:
+            return 0
+    elif isinstance(other, Point3):
+        return (other - self.point).cross(self.direction).length / self.direction.length
+    else:
+        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

參數:

返回:

引發:

源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+    """
+        计算两条直线的交点。
+        Args:
+            other: 另一条直线
+        Returns:
+            交点
+        Raises:
+            ValueError: 直线平行
+            ValueError: 直线不共面
+        """
+    if self.is_parallel(other):
+        raise ValueError('Lines are parallel and do not intersect.')
+    if not self.is_coplanar(other):
+        raise ValueError('Lines are not coplanar and do not intersect.')
+    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

參數:

返回:

源碼
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    """
+        计算直线经过指定点p的垂线。
+        Args:
+            point: 指定点
+        Returns:
+            垂线
+        """
+    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

參數:

返回:

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
+    """
+        获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
+        Args:
+            t: 参数t
+        Returns:
+
+        """
+    return self.point + t * self.direction

def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    """
+        获取直线的参数方程。
+        Returns:
+            x(t), y(t), z(t)
+        """
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

參數:

返回:

源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    """
+        判断两条直线是否近似平行。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似平行
+        """
+    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否平行。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否平行
+        """
+    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

參數:

返回:

源碼
python
def is_collinear(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否共线。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否共线
+        """
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

參數:

返回:

源碼
python
def is_point_on(self, point: 'Point3') -> bool:
+    """
+        判断点是否在直线上。
+        Args:
+            point: 点
+        Returns:
+            是否在直线上
+        """
+    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

參數:

返回:

源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否共面。
+        充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否共面
+        """
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
+    """
+        简化直线方程,等价相等。
+        自体简化,不返回值。
+
+        按照可行性一次对x y z 化 0 处理,并对向量单位化
+        """
+    self.direction.normalize()
+    if self.direction.x == 0:
+        self.point.x = 0
+    if self.direction.y == 0:
+        self.point.y = 0
+    if self.direction.z == 0:
+        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

參數:

返回:

源碼
python
@classmethod
+def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
+    """
+        工厂函数 由两点构造直线。
+        Args:
+            p1: 点1
+            p2: 点2
+        Returns:
+            直线
+        """
+    direction = p2 - p1
+    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

參數:

返回:

源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    """
+        计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
+        Args:
+            other: 另一条直线
+        Returns:
+            交点
+        """
+    if self.is_collinear(other):
+        return self
+    elif self.is_parallel(other) or not self.is_coplanar(other):
+        return None
+    else:
+        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

參數:

源碼
python
def __eq__(self, other) -> bool:
+    """
+        判断两条直线是否等价。
+
+        v1 // v2 ∧ (p1 - p2) // v1
+        Args:
+            other:
+
+        Returns:
+
+        """
+    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

源碼
python
def __str__(self):
+    """
+        返回点向式(x-x0)
+        Returns:
+
+        """
+    s = 'Line3: '
+    if self.direction.x != 0:
+        s += f'(x{sign_format(-self.point.x)})/{self.direction.x}'
+    if self.direction.y != 0:
+        s += f' = (y{sign_format(-self.point.y)})/{self.direction.y}'
+    if self.direction.z != 0:
+        s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
+    return s

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Line3({self.point}, {self.direction})'
`,123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js new file mode 100644 index 0000000..cbe4865 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_line.md.B-s8aLxY.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zh-Hant/api/mp_math/line.md","filePath":"zh-Hant/api/mp_math/line.md"}'),l={name:"zh-Hant/api/mp_math/line.md"},t=n("",123),h=[t];function p(e,k,r,d,o,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{g as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js new file mode 100644 index 0000000..304c219 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.js @@ -0,0 +1 @@ +import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"zh-Hant/api/mp_math/mp_math_typing.md","filePath":"zh-Hant/api/mp_math/mp_math_typing.md"}'),n={name:"zh-Hant/api/mp_math/mp_math_typing.md"},i=l('

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

',17),s=[i];function t(o,c,u,y,v,g){return e(),r("div",null,s)}const d=a(n,[["render",t]]);export{m as __pageData,d as default}; diff --git a/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js new file mode 100644 index 0000000..14e4d8e --- /dev/null +++ b/assets/zh-Hant_api_mp_math_mp_math_typing.md.DOwDUOu8.lean.js @@ -0,0 +1 @@ +import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"zh-Hant/api/mp_math/mp_math_typing.md","filePath":"zh-Hant/api/mp_math/mp_math_typing.md"}'),n={name:"zh-Hant/api/mp_math/mp_math_typing.md"},i=l("",17),s=[i];function t(o,c,u,y,v,g){return e(),r("div",null,s)}const d=a(n,[["render",t]]);export{m as __pageData,d as default}; diff --git a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js new file mode 100644 index 0000000..eed11ae --- /dev/null +++ b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.js @@ -0,0 +1,209 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"zh-Hant/api/mp_math/plane.md","filePath":"zh-Hant/api/mp_math/plane.md"}'),l={name:"zh-Hant/api/mp_math/plane.md"},h=n(`

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

參數:

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
+    """
+        平面方程:ax + by + cz + d = 0
+        Args:
+            a:
+            b:
+            c:
+            d:
+        """
+    self.a = a
+    self.b = b
+    self.c = c
+    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Plane3') -> bool:
+    """
+        判断两个平面是否近似相等。
+        Args:
+            other:
+
+        Returns:
+            是否近似相等
+        """
+    a = 3
+    if self.a != 0:
+        k = other.a / self.a
+        return approx(other.b, self.b * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
+    elif self.b != 0:
+        k = other.b / self.b
+        return approx(other.a, self.a * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
+    elif self.c != 0:
+        k = other.c / self.c
+        return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
+    else:
+        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

參數:

返回:

引發:

源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+    """
+        计算平面与平面之间的夹角。
+        Args:
+            other: 另一个平面
+        Returns:
+            夹角弧度
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Line3):
+        return self.normal.cal_angle(other.direction).complementary
+    elif isinstance(other, Plane3):
+        return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
+    else:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

參數:

返回:

引發:

源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+    """
+        计算平面与平面或点之间的距离。
+        Args:
+            other: 另一个平面或点
+        Returns:
+            距离
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Plane3):
+        return 0
+    elif isinstance(other, Point3):
+        return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
+    else:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

參數:

返回:

源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+    """
+        计算两平面的交线。该方法有问题,待修复。
+        Args:
+            other: 另一个平面
+        Returns:
+            交线
+        Raises:
+        """
+    if self.normal.is_parallel(other.normal):
+        raise ValueError('Planes are parallel and have no intersection.')
+    direction = self.normal.cross(other.normal)
+    x, y, z = (0, 0, 0)
+    if self.a != 0 and other.a != 0:
+        A = np.array([[self.b, self.c], [other.b, other.c]])
+        B = np.array([-self.d, -other.d])
+        y, z = np.linalg.solve(A, B)
+    elif self.b != 0 and other.b != 0:
+        A = np.array([[self.a, self.c], [other.a, other.c]])
+        B = np.array([-self.d, -other.d])
+        x, z = np.linalg.solve(A, B)
+    elif self.c != 0 and other.c != 0:
+        A = np.array([[self.a, self.b], [other.a, other.b]])
+        B = np.array([-self.d, -other.d])
+        x, y = np.linalg.solve(A, B)
+    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

參數:

返回:

引發:

源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    """
+        计算平面与直线的交点。
+        Args:
+            other: 不与平面平行或在平面上的直线
+        Returns:
+            交点
+        Raises:
+            ValueError: 平面与直线平行或重合
+        """
+    if self.normal @ other.direction == 0:
+        raise ValueError('The plane and the line are parallel or coincident.')
+    x, y, z = other.get_parametric_equations()
+    t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
+    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

參數:

返回:

源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    """
+        计算平行于该平面且过指定点的平面。
+        Args:
+            point: 指定点
+        Returns:
+            平面
+        """
+    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
+    """
+        判断两个平面是否平行。
+        Args:
+            other: 另一个平面
+        Returns:
+            是否平行
+        """
+    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

源碼
python
@property
+def normal(self) -> 'Vector3':
+    """
+        平面的法向量。
+        Returns:
+            法向量
+        """
+    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

參數:

返回:

源碼
python
@classmethod
+def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
+    """
+        工厂函数 由点和法向量构造平面(点法式构造)。
+        Args:
+            point: 平面上的一点
+            normal: 法向量
+        Returns:
+            平面
+        """
+    a, b, c = (normal.x, normal.y, normal.z)
+    d = -a * point.x - b * point.y - c * point.z
+    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

參數:

返回:

源碼
python
@classmethod
+def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
+    """
+        工厂函数 由三点构造平面。
+        Args:
+            p1: 点1
+            p2: 点2
+            p3: 点3
+        Returns:
+            平面
+        """
+    v1 = p2 - p1
+    v2 = p3 - p1
+    normal = v1.cross(v2)
+    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

參數:

返回:

源碼
python
@classmethod
+def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由两直线构造平面。
+        Args:
+            l1: 直线1
+            l2: 直线2
+        Returns:
+            平面
+        """
+    v1 = l1.direction
+    v2 = l2.point - l1.point
+    if v2 == zero_vector3:
+        v2 = l2.get_point(1) - l1.point
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

參數:

返回:

源碼
python
@classmethod
+def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由点和直线构造平面。
+        Args:
+            point: 面上一点
+            line: 面上直线,不包含点
+        Returns:
+            平面
+        """
+    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

源碼
python
def __str__(self):
+    s = 'Plane3: '
+    if self.a != 0:
+        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
+    if self.b != 0:
+        s += f' {sign(self.b)} {abs(self.b)}y'
+    if self.c != 0:
+        s += f' {sign(self.c)} {abs(self.c)}z'
+    if self.d != 0:
+        s += f' {sign(self.d)} {abs(self.d)}'
+    return s + ' = 0'

@overload

def __and__(self, other: 'Line3') -> 'Point3 | None'

源碼
python
@overload
+def __and__(self, other: 'Line3') -> 'Point3 | None':
+    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

源碼
python
@overload
+def __and__(self, other: 'Plane3') -> 'Line3 | None':
+    ...

def __and__(self, other)

取两平面的交集(人话:交线)

參數:

返回:

源碼
python
def __and__(self, other):
+    """
+        取两平面的交集(人话:交线)
+        Args:
+            other:
+        Returns:
+            不平行平面的交线,平面平行返回None
+        """
+    if isinstance(other, Plane3):
+        if self.normal.is_parallel(other.normal):
+            return None
+        return self.cal_intersection_line3(other)
+    elif isinstance(other, Line3):
+        if self.normal @ other.direction == 0:
+            return None
+        return self.cal_intersection_point3(other)
+    else:
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

`,130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js new file mode 100644 index 0000000..b368dc9 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_plane.md.B60Bzq3i.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"zh-Hant/api/mp_math/plane.md","filePath":"zh-Hant/api/mp_math/plane.md"}'),l={name:"zh-Hant/api/mp_math/plane.md"},h=n("",130),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js new file mode 100644 index 0000000..30f76dc --- /dev/null +++ b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.js @@ -0,0 +1,52 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zh-Hant/api/mp_math/point.md","filePath":"zh-Hant/api/mp_math/point.md"}'),t={name:"zh-Hant/api/mp_math/point.md"},l=n(`

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

參數:

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        笛卡尔坐标系中的点。
+        Args:
+            x: x 坐标
+            y: y 坐标
+            z: z 坐标
+        """
+    self.x = x
+    self.y = y
+    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个点是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

源碼
python
def __str__(self):
+    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

def __add__(self, other: 'Vector3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Point3':
+    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

def __add__(self, other)

P + V -> P P + P -> P

參數:

源碼
python
def __add__(self, other):
+    """
+        P + V -> P
+        P + P -> P
+        Args:
+            other:
+        Returns:
+        """
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

參數:

源碼
python
def __eq__(self, other):
+    """
+        判断两个点是否相等。
+        Args:
+            other:
+        Returns:
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

參數:

源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    """
+        P - P -> V
+
+        P - V -> P  已在 :class:\`Vector3\` 中实现
+        Args:
+            other:
+        Returns:
+
+        """
+    from .vector import Vector3
+    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js new file mode 100644 index 0000000..ba83f1e --- /dev/null +++ b/assets/zh-Hant_api_mp_math_point.md.BEsHV_8G.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zh-Hant/api/mp_math/point.md","filePath":"zh-Hant/api/mp_math/point.md"}'),t={name:"zh-Hant/api/mp_math/point.md"},l=n("",37),h=[l];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{F as __pageData,y as default}; diff --git a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js new file mode 100644 index 0000000..0a31d63 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.js @@ -0,0 +1,16 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"zh-Hant/api/mp_math/segment.md","filePath":"zh-Hant/api/mp_math/segment.md"}'),t={name:"zh-Hant/api/mp_math/segment.md"},h=n(`

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    """
+        三维空间中的线段。
+        :param p1:
+        :param p2:
+        """
+    self.p1 = p1
+    self.p2 = p2
+    '方向向量'
+    self.direction = self.p2 - self.p1
+    '长度'
+    self.length = self.direction.length
+    '中心点'
+    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

源碼
python
def __str__(self):
+    return f'Segment3({self.p1} -> {self.p2})'
`,8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js new file mode 100644 index 0000000..1ab28dc --- /dev/null +++ b/assets/zh-Hant_api_mp_math_segment.md.C-4eJk-Y.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"zh-Hant/api/mp_math/segment.md","filePath":"zh-Hant/api/mp_math/segment.md"}'),t={name:"zh-Hant/api/mp_math/segment.md"},h=n("",8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js new file mode 100644 index 0000000..5b88f5d --- /dev/null +++ b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.js @@ -0,0 +1,65 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zh-Hant/api/mp_math/utils.md","filePath":"zh-Hant/api/mp_math/utils.md"}'),l={name:"zh-Hant/api/mp_math/utils.md"},h=n(`

def clamp() -> float

区间截断函数。

參數:

返回:

源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
+    """
+    区间截断函数。
+    Args:
+        x:
+        min_:
+        max_:
+
+    Returns:
+        限制后的值
+    """
+    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

參數:

返回:

源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    """
+    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
+    Args:
+        x:
+        y:
+        epsilon:
+
+    Returns:
+        是否近似相等
+    """
+    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

參數:

返回:

源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    """获取数的符号。
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return '+' if not only_neg else ''
+    elif x < 0:
+        return '-'
+    else:
+        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

參數:

返回:

源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
+    """格式化符号数
+    -1 -> -1
+    1 -> +1
+    0 -> ""
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return f'+{x}' if not only_neg else f'{x}'
+    elif x < 0:
+        return f'-{abs(x)}'
+    else:
+        return ''

class Approx

def __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

def __eq__(self, other)

源碼
python
def __eq__(self, other):
+    if isinstance(self.value, (float, int)):
+        if isinstance(other, (float, int)):
+            return abs(self.value - other) < APPROX
+        else:
+            self.raise_type_error(other)
+    elif isinstance(self.value, Vector3):
+        if isinstance(other, (Vector3, Point3, Plane3, Line3)):
+            return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
+        else:
+            self.raise_type_error(other)

def raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

源碼
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js new file mode 100644 index 0000000..0d11677 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_utils.md.z2lMMpnT.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zh-Hant/api/mp_math/utils.md","filePath":"zh-Hant/api/mp_math/utils.md"}'),l={name:"zh-Hant/api/mp_math/utils.md"},h=n("",37),t=[h];function p(e,k,r,d,F,E){return a(),i("div",null,t)}const o=s(l,[["render",p]]);export{y as __pageData,o as default}; diff --git a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js new file mode 100644 index 0000000..df99f43 --- /dev/null +++ b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.js @@ -0,0 +1,189 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zh-Hant/api/mp_math/vector.md","filePath":"zh-Hant/api/mp_math/vector.md"}'),l={name:"zh-Hant/api/mp_math/vector.md"},t=n(`

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

參數:

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        3维向量
+        Args:
+            x: x轴分量
+            y: y轴分量
+            z: z轴分量
+        """
+    self.x = x
+    self.y = y
+    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

參數:

返回:

源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

參數:

返回:

源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    """
+        计算两个向量之间的夹角。
+        Args:
+            other: 另一个向量
+        Returns:
+            夹角
+        """
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

參數:

返回:

源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    """
+        向量积 叉乘:v1 cross v2 -> v3
+
+        叉乘为0,则两向量平行。
+        其余结果的模为平行四边形的面积。
+
+        返回如下行列式的结果:
+
+        \`\`i  j  k\`\`
+
+        \`\`x1 y1 z1\`\`
+
+        \`\`x2 y2 z2\`\`
+
+        Args:
+            other:
+        Returns:
+            行列式的结果
+        """
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

參數:

返回:

源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似平行。
+        Args:
+            other: 另一个向量
+            epsilon: 允许的误差
+        Returns:
+            是否近似平行
+        """
+    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

參數:

返回:

源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
+    """
+        判断两个向量是否平行。
+        Args:
+            other: 另一个向量
+        Returns:
+            是否平行
+        """
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
+    """
+        将向量归一化。
+
+        自体归一化,不返回值。
+        """
+    length = self.length
+    self.x /= length
+    self.y /= length
+    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

源碼
python
@property
+def np_array(self) -> 'np.ndarray':
+    """
+        返回numpy数组
+        Returns:
+        """
+    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

返回:

源碼
python
@property
+def length(self) -> float:
+    """
+        向量的模。
+        Returns:
+
+        """
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

源碼
python
@property
+def unit(self) -> 'Vector3':
+    """
+        获取该向量的单位向量。
+        Returns:
+            单位向量
+        """
+    return self / self.length

def __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

參數:

源碼
python
def __add__(self, other):
+    """
+        V + P -> P
+
+        V + V -> V
+        Args:
+            other:
+        Returns:
+
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x + other.x, self.y + other.y, self.z + other.z)
+    elif isinstance(other, Point3):
+        return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
+    else:
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

參數:

返回:

源碼
python
def __eq__(self, other):
+    """
+        判断两个向量是否相等。
+        Args:
+            other:
+        Returns:
+            是否相等
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

源碼
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    """
+        P + V -> P
+
+        别去点那边实现了。
+        :param other:
+        :return:
+        """
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __sub__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __sub__(self, other: 'Point3') -> 'Point3':
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

參數:

源碼
python
def __sub__(self, other):
+    """
+        V - P -> P
+
+        V - V -> V
+        Args:
+            other:
+        Returns:
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
+    elif isinstance(other, Point3):
+        return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
+    else:
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

參數:

源碼
python
def __rsub__(self, other: 'Point3'):
+    """
+        P - V -> P
+        Args:
+            other:
+        Returns:
+
+        """
+    if isinstance(other, Point3):
+        return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
+    else:
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __mul__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

源碼
python
@overload
+def __mul__(self, other: RealNumber) -> 'Vector3':
+    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

參數:

源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    """
+        数组运算 非点乘。点乘使用@,叉乘使用cross。
+        Args:
+            other:
+
+        Returns:
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x * other.x, self.y * other.y, self.z * other.z)
+    elif isinstance(other, (float, int)):
+        return Vector3(self.x * other, self.y * other, self.z * other)
+    else:
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

參數:

源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+    """
+        点乘。
+        Args:
+            other:
+        Returns:
+        """
+    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

源碼
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

源碼
python
def __str__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js new file mode 100644 index 0000000..f16f6cd --- /dev/null +++ b/assets/zh-Hant_api_mp_math_vector.md.n5Efae6D.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zh-Hant/api/mp_math/vector.md","filePath":"zh-Hant/api/mp_math/vector.md"}'),l={name:"zh-Hant/api/mp_math/vector.md"},t=n("",133),h=[t];function e(p,k,r,d,o,E){return a(),i("div",null,h)}const F=s(l,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zh-Hant_api_particle_index.md.BlduIPtw.js b/assets/zh-Hant_api_particle_index.md.BlduIPtw.js new file mode 100644 index 0000000..de07182 --- /dev/null +++ b/assets/zh-Hant_api_particle_index.md.BlduIPtw.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.particle","description":"","frontmatter":{"title":"mbcp.particle"},"headers":[],"relativePath":"zh-Hant/api/particle/index.md","filePath":"zh-Hant/api/particle/index.md"}'),i={name:"zh-Hant/api/particle/index.md"};function r(c,n,p,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js b/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js new file mode 100644 index 0000000..de07182 --- /dev/null +++ b/assets/zh-Hant_api_particle_index.md.BlduIPtw.lean.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const m=JSON.parse('{"title":"mbcp.particle","description":"","frontmatter":{"title":"mbcp.particle"},"headers":[],"relativePath":"zh-Hant/api/particle/index.md","filePath":"zh-Hant/api/particle/index.md"}'),i={name:"zh-Hant/api/particle/index.md"};function r(c,n,p,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zh-Hant_api_presets_index.md.CDyg87e9.js b/assets/zh-Hant_api_presets_index.md.CDyg87e9.js new file mode 100644 index 0000000..364ad88 --- /dev/null +++ b/assets/zh-Hant_api_presets_index.md.CDyg87e9.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zh-Hant/api/presets/index.md","filePath":"zh-Hant/api/presets/index.md"}'),s={name:"zh-Hant/api/presets/index.md"};function r(n,p,i,c,o,d){return a(),t("div")}const f=e(s,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js b/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js new file mode 100644 index 0000000..364ad88 --- /dev/null +++ b/assets/zh-Hant_api_presets_index.md.CDyg87e9.lean.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as a}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zh-Hant/api/presets/index.md","filePath":"zh-Hant/api/presets/index.md"}'),s={name:"zh-Hant/api/presets/index.md"};function r(n,p,i,c,o,d){return a(),t("div")}const f=e(s,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js new file mode 100644 index 0000000..1e6ab6f --- /dev/null +++ b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.js @@ -0,0 +1,18 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"zh-Hant/api/presets/model/index.md","filePath":"zh-Hant/api/presets/model/index.md"}'),h={name:"zh-Hant/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

參數:

返回:

源碼
python
@staticmethod
+def sphere(radius: float, density: float):
+    """
+        生成球体上的点集。
+        Args:
+            radius:
+            density:
+        Returns:
+            List[Point3]: 球体上的点集。
+        """
+    area = 4 * np.pi * radius ** 2
+    num = int(area * density)
+    phi_list = np.arccos([clamp(-1 + (2.0 * _ - 1.0) / num, -1, 1) for _ in range(num)])
+    theta_list = np.sqrt(num * np.pi) * phi_list
+    x_array = radius * np.sin(phi_list) * np.cos(theta_list)
+    y_array = radius * np.sin(phi_list) * np.sin(theta_list)
+    z_array = radius * np.cos(phi_list)
+    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js new file mode 100644 index 0000000..420e83b --- /dev/null +++ b/assets/zh-Hant_api_presets_model_index.md.DCHpjjZ_.lean.js @@ -0,0 +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":"zh-Hant/api/presets/model/index.md","filePath":"zh-Hant/api/presets/model/index.md"}'),h={name:"zh-Hant/api/presets/model/index.md"},t=n("",9),l=[t];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(h,[["render",p]]);export{o as __pageData,F as default}; diff --git a/en/api/index.html b/en/api/index.html index 2e393ce..ee522a0 100644 --- a/en/api/index.html +++ b/en/api/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/en/api/mp_math/angle.html b/en/api/mp_math/angle.html index 18e71a3..b7dcb0f 100644 --- a/en/api/mp_math/angle.html +++ b/en/api/mp_math/angle.html @@ -17,7 +17,7 @@ -
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

Args:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

Source code
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

Args:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -118,7 +118,7 @@
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/en/api/mp_math/const.html b/en/api/mp_math/const.html index c95d459..fb99d22 100644 --- a/en/api/mp_math/const.html +++ b/en/api/mp_math/const.html @@ -17,8 +17,8 @@ -
Skip to content

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

- + + \ No newline at end of file diff --git a/en/api/mp_math/equation.html b/en/api/mp_math/equation.html index a80d592..79e7d5e 100644 --- a/en/api/mp_math/equation.html +++ b/en/api/mp_math/equation.html @@ -12,12 +12,12 @@ - + -
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

Args:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

Args:

  • 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元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -80,7 +80,7 @@
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

Source code
python
def __str__(self):
     return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

- + \ No newline at end of file diff --git a/en/api/mp_math/index.html b/en/api/mp_math/index.html index 6ab6560..89d31c5 100644 --- a/en/api/mp_math/index.html +++ b/en/api/mp_math/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/en/api/mp_math/line.html b/en/api/mp_math/line.html index f778013..86075ef 100644 --- a/en/api/mp_math/line.html +++ b/en/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

Args:

  • point: 直线上的一点

  • direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

Args:

  • point: 直线上的一点

  • direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

Args:

  • other: 另一条直线

  • epsilon: 误差

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)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

Args:

  • other: 另一条直线
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

Args:

  • other: 另一条直线

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)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

Args:

  • other: 平行直线或点
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

Args:

  • other: 平行直线或点

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.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

Args:

  • other: 另一条直线
Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

Args:

  • other: 另一条直线

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

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

Args:

  • point: 指定点
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

Args:

  • point: 指定点

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))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Args:

  • t: 参数t
Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Args:

  • t: 参数t

Return:

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -104,7 +104,7 @@
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

Args:

  • other: 另一条直线

  • epsilon: 误差

Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

Args:

  • other: 另一条直线

  • epsilon: 误差

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)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

Args:

  • other: 另一条直线
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

Args:

  • other: 另一条直线

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

Args:

  • other: 另一条直线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

Args:

  • other: 另一条直线

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)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

Args:

  • point: 点
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

Args:

  • point: 点

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)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Args:

  • other: 另一条直线
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Args:

  • other: 另一条直线

Return:

  • 是否共面
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

Args:

  • p1: 点1

  • p2: 点2

Source code
python
@classmethod
+        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

Args:

  • p1: 点1

  • p2: 点2

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)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Args:

  • other: 另一条直线
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Args:

  • other: 另一条直线

Return:

  • 交点
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -209,7 +209,7 @@
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

Source code
python
def __repr__(self):
     return f'Line3({self.point}, {self.direction})'
- + \ No newline at end of file diff --git a/en/api/mp_math/mp_math_typing.html b/en/api/mp_math/mp_math_typing.html index c64e780..259d120 100644 --- a/en/api/mp_math/mp_math_typing.html +++ b/en/api/mp_math/mp_math_typing.html @@ -17,8 +17,8 @@ -
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

- +
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

+ \ No newline at end of file diff --git a/en/api/mp_math/plane.html b/en/api/mp_math/plane.html index 40dcd83..2db3230 100644 --- a/en/api/mp_math/plane.html +++ b/en/api/mp_math/plane.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

Args:

  • a:

  • b:

  • c:

  • d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

Args:

  • a:

  • b:

  • c:

  • d:

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -29,7 +29,7 @@
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

Args:

  • other:
Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

Args:

  • other:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -49,7 +49,7 @@
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

Args:

  • other: 另一个平面
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

Args:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -64,7 +64,7 @@
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

Args:

  • other: 另一个平面或点
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

Args:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -79,7 +79,7 @@
     elif isinstance(other, Point3):
         return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

Args:

  • other: 另一个平面
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

Args:

  • other: 另一个平面

Return:

  • 交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -104,7 +104,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线

Return:

  • 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -118,7 +118,7 @@
         raise ValueError('The plane and the line are parallel or coincident.')
     x, y, z = other.get_parametric_equations()
     t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
-    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

Args:

  • point: 指定点
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

Args:

  • point: 指定点

Return:

  • 平面
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -126,7 +126,7 @@
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

Args:

  • other: 另一个平面
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

Args:

  • other: 另一个平面

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -141,7 +141,7 @@
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

Args:

  • point: 平面上的一点

  • normal: 法向量

Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

Args:

  • point: 平面上的一点

  • normal: 法向量

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -153,7 +153,7 @@
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Return:

  • 平面
Source code
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -167,7 +167,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

Args:

  • l1: 直线1

  • l2: 直线2

Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

Args:

  • l1: 直线1

  • l2: 直线2

Return:

  • 平面
Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -181,7 +181,7 @@
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

Args:

  • point: 面上一点

  • line: 面上直线,不包含点

Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

Args:

  • point: 面上一点

  • line: 面上直线,不包含点

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -206,7 +206,7 @@
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

Source code
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

Args:

  • other:
Source code
python
def __and__(self, other):
+    ...

def __and__(self, other)

取两平面的交集(人话:交线)

Args:

  • other:

Return:

  • 不平行平面的交线,平面平行返回None
Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -226,7 +226,7 @@
         raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
     return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

- + \ No newline at end of file diff --git a/en/api/mp_math/point.html b/en/api/mp_math/point.html index bc98769..a6671ce 100644 --- a/en/api/mp_math/point.html +++ b/en/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

Args:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

Args:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

Args:

  • other:

  • epsilon:

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

Args:

  • other:

  • epsilon:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -69,7 +69,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 52ca0ba..12b2366 100644 --- a/en/api/mp_math/segment.html +++ b/en/api/mp_math/segment.html @@ -17,7 +17,7 @@ -
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -33,7 +33,7 @@
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

Source code
python
def __repr__(self):
     return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

Source code
python
def __str__(self):
     return f'Segment3({self.p1} -> {self.p2})'
- + \ No newline at end of file diff --git a/en/api/mp_math/utils.html b/en/api/mp_math/utils.html index 48e7a19..7e49a43 100644 --- a/en/api/mp_math/utils.html +++ b/en/api/mp_math/utils.html @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

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_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

Args:

  • x:

  • y:

  • epsilon:

Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

Args:

  • x:

  • y:

  • epsilon:

Return:

  • 是否近似相等
Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -39,7 +39,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

Args:

  • x: 数

  • only_neg: 是否只返回负数的符号

Source code
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

Args:

  • x: 数

  • only_neg: 是否只返回负数的符号

Return:

  • 符号 + - ""
Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +52,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

Args:

  • x: 数

  • only_neg: 是否只返回负数的符号

Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

Args:

  • x: 数

  • only_neg: 是否只返回负数的符号

Return:

  • 符号 + - ""
Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -82,7 +82,7 @@
             self.raise_type_error(other)

def raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

Source code
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/vector.html b/en/api/mp_math/vector.html index 602a31e..52fe727 100644 --- a/en/api/mp_math/vector.html +++ b/en/api/mp_math/vector.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

Args:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

Args:

  • other:

  • epsilon:

Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

Args:

  • other:

  • epsilon:

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])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

Args:

  • other: 另一个向量
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

Args:

  • other: 另一个向量

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)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Args:

  • 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)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

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

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

Args:

  • other: 另一个向量
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

Args:

  • other: 另一个向量

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:
Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:

Return:

  • 是否相等
Source code
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -206,7 +206,7 @@
     return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

Source code
python
def __repr__(self):
     return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

Source code
python
def __str__(self):
     return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/en/api/particle/index.html b/en/api/particle/index.html index c5d095d..ebfad06 100644 --- a/en/api/particle/index.html +++ b/en/api/particle/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/en/api/presets/index.html b/en/api/presets/index.html index d2813a6..3fb8407 100644 --- a/en/api/presets/index.html +++ b/en/api/presets/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/en/api/presets/model/index.html b/en/api/presets/model/index.html index 003c338..c77b69e 100644 --- a/en/api/presets/model/index.html +++ b/en/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

Source code
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

Args:

  • radius:

  • density:

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 new file mode 100644 index 0000000..6c68e0e --- /dev/null +++ b/guide/index.html @@ -0,0 +1,24 @@ + + + + + + 开始不了一点 | MBCP docs + + + + + + + + + + + + + +
Skip to content

开始不了一点

+ + + + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index 76644d7..dc9ae90 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"DKMXAFbW","api_mp_math_const.md":"Bc1LxtcU","api_mp_math_equation.md":"BXP6BUSg","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"CzpblksR","api_mp_math_mp_math_typing.md":"BHJOAxTl","api_mp_math_plane.md":"CZDq9vG4","api_mp_math_point.md":"BJ9u2OpE","api_mp_math_segment.md":"B0wRl0bP","api_mp_math_utils.md":"DPDde5hx","api_mp_math_vector.md":"BBiKQwmG","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"BNeuRwjr","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DYZo7hBD","en_api_mp_math_const.md":"DfcWuGeV","en_api_mp_math_equation.md":"Bsq2lQHW","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"CP3RuJkk","en_api_mp_math_mp_math_typing.md":"Dh1by9kw","en_api_mp_math_plane.md":"eYXZ3wvh","en_api_mp_math_point.md":"DNEIRDFB","en_api_mp_math_segment.md":"CUQFMm0Q","en_api_mp_math_utils.md":"D6PiZ35J","en_api_mp_math_vector.md":"BaY0-PMv","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"gEUCj87b","index.md":"CJvRmMfL","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"_xBKQuir","ja_api_mp_math_const.md":"CQY-Qdbh","ja_api_mp_math_equation.md":"DVrOBmbN","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"B4_v4TOY","ja_api_mp_math_mp_math_typing.md":"CeASNaiE","ja_api_mp_math_plane.md":"BSSDxRzL","ja_api_mp_math_point.md":"DvD45PEI","ja_api_mp_math_segment.md":"oiONXysZ","ja_api_mp_math_utils.md":"Bc0yJ70T","ja_api_mp_math_vector.md":"TVqfIGHG","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"DJGptHhw","md-ex.md":"BX0WqOqv"} +{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"DKMXAFbW","api_mp_math_const.md":"Bc1LxtcU","api_mp_math_equation.md":"CZgns297","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"DHofgyJO","api_mp_math_mp_math_typing.md":"BHJOAxTl","api_mp_math_plane.md":"DZBu-HIq","api_mp_math_point.md":"CGqzS8ew","api_mp_math_segment.md":"B0wRl0bP","api_mp_math_utils.md":"C9bdphO4","api_mp_math_vector.md":"BEh63_ZE","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"DLrch_Ju","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"DYZo7hBD","en_api_mp_math_const.md":"DfcWuGeV","en_api_mp_math_equation.md":"BQv4WWiJ","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"CAJnDKCu","en_api_mp_math_mp_math_typing.md":"Dh1by9kw","en_api_mp_math_plane.md":"B-VJJllR","en_api_mp_math_point.md":"CCE-yfrm","en_api_mp_math_segment.md":"CUQFMm0Q","en_api_mp_math_utils.md":"CuiyHRtY","en_api_mp_math_vector.md":"3xep9oDm","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"1ewGi0do","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"_xBKQuir","ja_api_mp_math_const.md":"CQY-Qdbh","ja_api_mp_math_equation.md":"BETlifwh","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"Ck5uy5Cp","ja_api_mp_math_mp_math_typing.md":"CeASNaiE","ja_api_mp_math_plane.md":"C5qFtY92","ja_api_mp_math_point.md":"Cc_RLeth","ja_api_mp_math_segment.md":"oiONXysZ","ja_api_mp_math_utils.md":"Dgzoi9ec","ja_api_mp_math_vector.md":"kN2P6bpC","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"QP3v3mpP","md-ex.md":"BX0WqOqv","zh-hant_api_index.md":"D-iBkJb-","zh-hant_api_mp_math_angle.md":"eKQSpiMX","zh-hant_api_mp_math_const.md":"B_tZ9wL7","zh-hant_api_mp_math_equation.md":"DPinrp8_","zh-hant_api_mp_math_index.md":"B8NLV8Cf","zh-hant_api_mp_math_line.md":"B-s8aLxY","zh-hant_api_mp_math_mp_math_typing.md":"DOwDUOu8","zh-hant_api_mp_math_plane.md":"B60Bzq3i","zh-hant_api_mp_math_point.md":"BEsHV_8G","zh-hant_api_mp_math_segment.md":"C-4eJk-Y","zh-hant_api_mp_math_utils.md":"z2lMMpnT","zh-hant_api_mp_math_vector.md":"n5Efae6D","zh-hant_api_particle_index.md":"BlduIPtw","zh-hant_api_presets_index.md":"CDyg87e9","zh-hant_api_presets_model_index.md":"DCHpjjZ_"} diff --git a/index.html b/index.html index 1b00cc2..21de108 100644 --- a/index.html +++ b/index.html @@ -12,13 +12,13 @@ - + -
Skip to content

MBCP docs

More basic change particle

用于几何运算和粒子制作的库

- +
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 f5baa2c..c0ddb31 100644 --- a/ja/api/index.html +++ b/ja/api/index.html @@ -1,10 +1,10 @@ - + mbcp | MBCP docs - + @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/ja/api/mp_math/angle.html b/ja/api/mp_math/angle.html index 387cf9f..1417142 100644 --- a/ja/api/mp_math/angle.html +++ b/ja/api/mp_math/angle.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.angle | MBCP docs - + @@ -17,7 +17,7 @@ -
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

引数:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

引数:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -118,7 +118,7 @@
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/ja/api/mp_math/const.html b/ja/api/mp_math/const.html index ac360ae..3b75e21 100644 --- a/ja/api/mp_math/const.html +++ b/ja/api/mp_math/const.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.const | MBCP docs - + @@ -17,8 +17,8 @@ -
Skip to content

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

- + + \ No newline at end of file diff --git a/ja/api/mp_math/equation.html b/ja/api/mp_math/equation.html index 5d11ea7..3b2f485 100644 --- a/ja/api/mp_math/equation.html +++ b/ja/api/mp_math/equation.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.equation | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

引数:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

引数:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

戻り値:

  • 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -80,7 +80,7 @@
     else:
         return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

ソースコード
python
def __str__(self):
     return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

- + \ No newline at end of file diff --git a/ja/api/mp_math/index.html b/ja/api/mp_math/index.html index 7a682ca..06315a8 100644 --- a/ja/api/mp_math/index.html +++ b/ja/api/mp_math/index.html @@ -1,10 +1,10 @@ - + mbcp.mp_math | MBCP docs - + @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/ja/api/mp_math/line.html b/ja/api/mp_math/line.html index cf2b030..02c8c01 100644 --- a/ja/api/mp_math/line.html +++ b/ja/api/mp_math/line.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.line | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

引数:

  • other: 另一条直线

  • epsilon: 误差

ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -34,7 +34,7 @@
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

引数:

  • other: 另一条直线
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点

戻り値:

  • 距离

例外:

  • 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.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

引数:

  • other: 另一条直线
ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

def 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

def 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

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

引数:

  • point: 指定点

戻り値:

  • 垂线
ソースコード
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
     """
         计算直线经过指定点p的垂线。
         Args:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

引数:

  • t: 参数t
ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

引数:

  • t: 参数t

戻り値:

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -104,7 +104,7 @@
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

引数:

  • other: 另一条直线

  • epsilon: 误差

ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似平行
ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
     """
         判断两条直线是否近似平行。
         Args:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

引数:

  • other: 另一条直线
ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

引数:

  • other: 另一条直线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値:

  • 是否共线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -129,7 +129,7 @@
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> 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)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

引数:

  • point: 点

戻り値:

  • 是否在直线上
ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

引数:

  • other: 另一条直线
ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

引数:

  • other: 另一条直线

戻り値:

  • 是否共面
ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

引数:

  • p1: 点1

  • p2: 点2

ソースコード
python
@classmethod
+        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

引数:

  • p1: 点1

  • p2: 点2

戻り値:

  • 直线
ソースコード
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

引数:

  • other: 另一条直线
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -209,7 +209,7 @@
         s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
     return s

def __repr__(self)

ソースコード
python
def __repr__(self):
     return f'Line3({self.point}, {self.direction})'
- + \ No newline at end of file diff --git a/ja/api/mp_math/mp_math_typing.html b/ja/api/mp_math/mp_math_typing.html index b1fd838..6e5c1b7 100644 --- a/ja/api/mp_math/mp_math_typing.html +++ b/ja/api/mp_math/mp_math_typing.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.mp_math_typing | MBCP docs - + @@ -17,8 +17,8 @@ -
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

- +
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

+ \ No newline at end of file diff --git a/ja/api/mp_math/plane.html b/ja/api/mp_math/plane.html index ed81def..50fbdb7 100644 --- a/ja/api/mp_math/plane.html +++ b/ja/api/mp_math/plane.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.plane | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

引数:

  • a:

  • b:

  • c:

  • d:

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
+    
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

引数:

  • a:

  • b:

  • c:

  • d:

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
@@ -29,7 +29,7 @@
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

引数:

  • other:
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

引数:

  • other:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
@@ -49,7 +49,7 @@
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -64,7 +64,7 @@
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -79,7 +79,7 @@
     elif isinstance(other, Point3):
         return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

引数:

  • other: 另一个平面
ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

引数:

  • other: 另一个平面

戻り値:

  • 交线
ソースコード
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
         计算两平面的交线。该方法有问题,待修复。
         Args:
@@ -104,7 +104,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値:

  • 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -118,7 +118,7 @@
         raise ValueError('The plane and the line are parallel or coincident.')
     x, y, z = other.get_parametric_equations()
     t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
-    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

引数:

  • point: 指定点
ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

引数:

  • point: 指定点

戻り値:

  • 平面
ソースコード
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
     """
         计算平行于该平面且过指定点的平面。
         Args:
@@ -126,7 +126,7 @@
         Returns:
             平面
         """
-    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

引数:

  • other: 另一个平面
ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -141,7 +141,7 @@
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

ソースコード
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -153,7 +153,7 @@
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

引数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

ソースコード
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

引数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -167,7 +167,7 @@
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

引数:

  • l1: 直线1

  • l2: 直线2

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

引数:

  • l1: 直线1

  • l2: 直线2

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -181,7 +181,7 @@
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

引数:

  • point: 面上一点

  • line: 面上直线,不包含点

ソースコード
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

引数:

  • point: 面上一点

  • line: 面上直线,不包含点

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -206,7 +206,7 @@
 def __and__(self, other: 'Line3') -> 'Point3 | None':
     ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:
ソースコード
python
def __and__(self, other):
+    ...

def __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -226,7 +226,7 @@
         raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
     return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
     return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

- + \ No newline at end of file diff --git a/ja/api/mp_math/point.html b/ja/api/mp_math/point.html index 5e3592f..757297a 100644 --- a/ja/api/mp_math/point.html +++ b/ja/api/mp_math/point.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.point | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

引数:

  • other:

  • epsilon:

ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -69,7 +69,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 82d9f09..efec9d9 100644 --- a/ja/api/mp_math/segment.html +++ b/ja/api/mp_math/segment.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.segment | MBCP docs - + @@ -17,7 +17,7 @@ -
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -33,7 +33,7 @@
     self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

ソースコード
python
def __repr__(self):
     return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

ソースコード
python
def __str__(self):
     return f'Segment3({self.p1} -> {self.p2})'
- + \ No newline at end of file diff --git a/ja/api/mp_math/utils.html b/ja/api/mp_math/utils.html index ba59a9e..ffe9c8f 100644 --- a/ja/api/mp_math/utils.html +++ b/ja/api/mp_math/utils.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.utils | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

戻り値:

  • 限制后的值
ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
     区间截断函数。
     Args:
@@ -28,7 +28,7 @@
     Returns:
         限制后的值
     """
-    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x:

  • y:

  • epsilon:

ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x:

  • y:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
@@ -39,7 +39,7 @@
     Returns:
         是否近似相等
     """
-    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
+    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +52,7 @@
     elif x < 0:
         return '-'
     else:
-        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -82,7 +82,7 @@
             self.raise_type_error(other)

def raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
     raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

ソースコード
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/vector.html b/ja/api/mp_math/vector.html index 766af14..5482741 100644 --- a/ja/api/mp_math/vector.html +++ b/ja/api/mp_math/vector.html @@ -1,10 +1,10 @@ - + mbcp.mp_math.vector | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

引数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

ソースコード
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

引数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

引数:

  • other:

  • epsilon:

ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -37,7 +37,7 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> '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])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

引数:

  • other: 另一个向量

戻り値:

  • 夹角
ソースコード
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -45,7 +45,7 @@
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • 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)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

引数:

  • other: 另一个向量

  • epsilon: 允许的误差

ソースコード
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

引数:

  • other: 另一个向量

  • epsilon: 允许的误差

戻り値:

  • 是否近似平行
ソースコード
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

引数:

  • other: 另一个向量
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:

戻り値:

  • 是否相等
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -206,7 +206,7 @@
     return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

ソースコード
python
def __repr__(self):
     return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

ソースコード
python
def __str__(self):
     return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + \ No newline at end of file diff --git a/ja/api/particle/index.html b/ja/api/particle/index.html index bac07d5..6a98578 100644 --- a/ja/api/particle/index.html +++ b/ja/api/particle/index.html @@ -1,10 +1,10 @@ - + mbcp.particle | MBCP docs - + @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/ja/api/presets/index.html b/ja/api/presets/index.html index 8a82656..2faacb3 100644 --- a/ja/api/presets/index.html +++ b/ja/api/presets/index.html @@ -1,10 +1,10 @@ - + mbcp.presets | MBCP docs - + @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/ja/api/presets/model/index.html b/ja/api/presets/model/index.html index 60bb1f2..745f3c0 100644 --- a/ja/api/presets/model/index.html +++ b/ja/api/presets/model/index.html @@ -1,10 +1,10 @@ - + mbcp.presets.model | MBCP docs - + @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

ソースコード
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • 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 3ab7f1e..4eb2e74 100644 --- a/md-ex.html +++ b/md-ex.html @@ -17,7 +17,7 @@ -
Skip to content

Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

Syntax Highlighting

VitePress provides Syntax Highlighting powered by Shiki, with additional features like line-highlighting:

Input

md
```js{4}
+    
Skip to content

Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

Syntax Highlighting

VitePress provides Syntax Highlighting powered by Shiki, with additional features like line-highlighting:

Input

md
```js{4}
 export default {
   data () {
     return {
@@ -50,7 +50,7 @@
 ::: details
 This is a details block.
 :::

Output

INFO

This is an info box.

TIP

This is a tip.

WARNING

This is a warning.

DANGER

This is a dangerous warning.

Details

This is a details block.

More

Check out the documentation for the full list of markdown extensions.

- + \ No newline at end of file diff --git a/zh-Hant/api/index.html b/zh-Hant/api/index.html new file mode 100644 index 0000000..3fc95de --- /dev/null +++ b/zh-Hant/api/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/angle.html b/zh-Hant/api/mp_math/angle.html new file mode 100644 index 0000000..bbfc31f --- /dev/null +++ b/zh-Hant/api/mp_math/angle.html @@ -0,0 +1,124 @@ + + + + + + mbcp.mp_math.angle | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

參數:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

源碼
python
def __init__(self, value: float, is_radian: bool=False):
+    """
+        任意角度。
+        Args:
+            value: 角度或弧度值
+            is_radian: 是否为弧度,默认为否
+        """
+    if is_radian:
+        self.radian = value
+    else:
+        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

  • 余角
源碼
python
@property
+def complementary(self) -> 'AnyAngle':
+    """
+        余角:两角的和为90°。
+        Returns:
+            余角
+        """
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

  • 补角
源碼
python
@property
+def supplementary(self) -> 'AnyAngle':
+    """
+        补角:两角的和为180°。
+        Returns:
+            补角
+        """
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

返回:

  • 弧度
源碼
python
@property
+def degree(self) -> float:
+    """
+        角度。
+        Returns:
+            弧度
+        """
+    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

  • 最小正角度
源碼
python
@property
+def minimum_positive(self) -> 'AnyAngle':
+    """
+        最小正角。
+        Returns:
+            最小正角度
+        """
+    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

  • 最大负角度
源碼
python
@property
+def maximum_negative(self) -> 'AnyAngle':
+    """
+        最大负角。
+        Returns:
+            最大负角度
+        """
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

返回:

  • 正弦值
源碼
python
@property
+def sin(self) -> float:
+    """
+        正弦值。
+        Returns:
+            正弦值
+        """
+    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

返回:

  • 余弦值
源碼
python
@property
+def cos(self) -> float:
+    """
+        余弦值。
+        Returns:
+            余弦值
+        """
+    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

返回:

  • 正切值
源碼
python
@property
+def tan(self) -> float:
+    """
+        正切值。
+        Returns:
+            正切值
+        """
+    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

返回:

  • 余切值
源碼
python
@property
+def cot(self) -> float:
+    """
+        余切值。
+        Returns:
+            余切值
+        """
+    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

返回:

  • 正割值
源碼
python
@property
+def sec(self) -> float:
+    """
+        正割值。
+        Returns:
+            正割值
+        """
+    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

返回:

  • 余割值
源碼
python
@property
+def csc(self) -> float:
+    """
+        余割值。
+        Returns:
+            余割值
+        """
+    return 1 / math.sin(self.radian)

def __add__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

def __eq__(self, other)

源碼
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

def __sub__(self, other: 'AnyAngle') -> 'AnyAngle'

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

def __mul__(self, other: float) -> 'AnyAngle'

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

源碼
python
def __str__(self):
+    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

def __truediv__(self, other: float) -> 'AnyAngle'

源碼
python
@overload
+def __truediv__(self, other: float) -> 'AnyAngle':
+    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

源碼
python
@overload
+def __truediv__(self, other: 'AnyAngle') -> float:
+    ...

def __truediv__(self, other)

源碼
python
def __truediv__(self, other):
+    if isinstance(other, AnyAngle):
+        return self.radian / other.radian
+    return AnyAngle(self.radian / other, is_radian=True)
+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/const.html b/zh-Hant/api/mp_math/const.html new file mode 100644 index 0000000..ae7dca4 --- /dev/null +++ b/zh-Hant/api/mp_math/const.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math.const | MBCP docs + + + + + + + + + + + + + +
Skip to content

var PI = math.pi

var E = math.e

var GOLDEN_RATIO = (1 + math.sqrt(5)) / 2

var GAMMA = 0.5772156649015329

var EPSILON = 0.0001

var APPROX = 0.001

+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/equation.html b/zh-Hant/api/mp_math/equation.html new file mode 100644 index 0000000..a89f551 --- /dev/null +++ b/zh-Hant/api/mp_math/equation.html @@ -0,0 +1,86 @@ + + + + + + mbcp.mp_math.equation | MBCP docs + + + + + + + + + + + + + +
Skip to content

def get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

參數:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

返回:

  • 偏导函数

引發:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    """
+    求N元函数一阶偏导函数。这玩意不太稳定,慎用。
+    Args:
+        func: 函数
+        var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)
+        epsilon: 偏移量
+    Returns:
+        偏导函数
+    Raises:
+        ValueError: 无效变量类型
+    """
+    if isinstance(var, int):
+
+        def partial_derivative_func(*args: Var) -> Var:
+            args_list_plus = list(args)
+            args_list_plus[var] += epsilon
+            args_list_minus = list(args)
+            args_list_minus[var] -= epsilon
+            return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)
+        return partial_derivative_func
+    elif isinstance(var, tuple):
+
+        def high_order_partial_derivative_func(*args: Var) -> Var:
+            result_func = func
+            for v in var:
+                result_func = get_partial_derivative_func(result_func, v, epsilon)
+            return result_func(*args)
+        return high_order_partial_derivative_func
+    else:
+        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

源碼
python
def partial_derivative_func(*args: Var) -> Var:
+    args_list_plus = list(args)
+    args_list_plus[var] += epsilon
+    args_list_minus = list(args)
+    args_list_minus[var] -= epsilon
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

源碼
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    result_func = func
+    for v in var:
+        result_func = get_partial_derivative_func(result_func, v, epsilon)
+    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

參數:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    """
+        曲线方程。
+        Args:
+            x_func: x函数
+            y_func: y函数
+            z_func: z函数
+        """
+    self.x_func = x_func
+    self.y_func = y_func
+    self.z_func = z_func

def __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

參數:

  • *t:

  • 参数:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    """
+        计算曲线上的点。
+        Args:
+            *t:
+                参数
+        Returns:
+
+        """
+    if len(t) == 1:
+        return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
+    else:
+        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

源碼
python
def __str__(self):
+    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/index.html b/zh-Hant/api/mp_math/index.html new file mode 100644 index 0000000..3da4c2b --- /dev/null +++ b/zh-Hant/api/mp_math/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/line.html b/zh-Hant/api/mp_math/line.html new file mode 100644 index 0000000..64ed8ef --- /dev/null +++ b/zh-Hant/api/mp_math/line.html @@ -0,0 +1,215 @@ + + + + + + mbcp.mp_math.line | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

參數:

  • point: 直线上的一点

  • direction: 直线的方向向量

源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    """
+        三维空间中的直线。由一个点和一个方向向量确定。
+        Args:
+            point: 直线上的一点
+            direction: 直线的方向向量
+        """
+    self.point = point
+    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

參數:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    """
+        判断两条直线是否近似相等。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似相等
+        """
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

參數:

  • other: 另一条直线

返回:

  • 夹角弧度

引發:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    """
+        计算直线和直线之间的夹角。
+        Args:
+            other: 另一条直线
+        Returns:
+            夹角弧度
+        Raises:
+            TypeError: 不支持的类型
+        """
+    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

參數:

  • other: 平行直线或点

返回:

  • 距离

引發:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    """
+        计算直线和直线或点之间的距离。
+        Args:
+            other: 平行直线或点
+
+        Returns:
+            距离
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Line3):
+        if self == other:
+            return 0
+        elif self.is_parallel(other):
+            return (other.point - self.point).cross(self.direction).length / self.direction.length
+        elif not self.is_coplanar(other):
+            return abs(self.direction.cross(other.direction) @ (self.point - other.point) / self.direction.cross(other.direction).length)
+        else:
+            return 0
+    elif isinstance(other, Point3):
+        return (other - self.point).cross(self.direction).length / self.direction.length
+    else:
+        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

參數:

  • other: 另一条直线

返回:

  • 交点

引發:

  • ValueError 直线平行

  • ValueError 直线不共面

源碼
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+    """
+        计算两条直线的交点。
+        Args:
+            other: 另一条直线
+        Returns:
+            交点
+        Raises:
+            ValueError: 直线平行
+            ValueError: 直线不共面
+        """
+    if self.is_parallel(other):
+        raise ValueError('Lines are parallel and do not intersect.')
+    if not self.is_coplanar(other):
+        raise ValueError('Lines are not coplanar and do not intersect.')
+    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

參數:

  • point: 指定点

返回:

  • 垂线
源碼
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    """
+        计算直线经过指定点p的垂线。
+        Args:
+            point: 指定点
+        Returns:
+            垂线
+        """
+    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

參數:

  • t: 参数t

返回:

源碼
python
def get_point(self, t: RealNumber) -> 'Point3':
+    """
+        获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
+        Args:
+            t: 参数t
+        Returns:
+
+        """
+    return self.point + t * self.direction

def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    """
+        获取直线的参数方程。
+        Returns:
+            x(t), y(t), z(t)
+        """
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

參數:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    """
+        判断两条直线是否近似平行。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似平行
+        """
+    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

參數:

  • other: 另一条直线

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否平行。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否平行
+        """
+    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

參數:

  • other: 另一条直线

返回:

  • 是否共线
源碼
python
def is_collinear(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否共线。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否共线
+        """
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

參數:

  • point: 点

返回:

  • 是否在直线上
源碼
python
def is_point_on(self, point: 'Point3') -> bool:
+    """
+        判断点是否在直线上。
+        Args:
+            point: 点
+        Returns:
+            是否在直线上
+        """
+    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

參數:

  • other: 另一条直线

返回:

  • 是否共面
源碼
python
def is_coplanar(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否共面。
+        充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否共面
+        """
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

源碼
python
def simplify(self):
+    """
+        简化直线方程,等价相等。
+        自体简化,不返回值。
+
+        按照可行性一次对x y z 化 0 处理,并对向量单位化
+        """
+    self.direction.normalize()
+    if self.direction.x == 0:
+        self.point.x = 0
+    if self.direction.y == 0:
+        self.point.y = 0
+    if self.direction.z == 0:
+        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

參數:

  • p1: 点1

  • p2: 点2

返回:

  • 直线
源碼
python
@classmethod
+def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
+    """
+        工厂函数 由两点构造直线。
+        Args:
+            p1: 点1
+            p2: 点2
+        Returns:
+            直线
+        """
+    direction = p2 - p1
+    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

參數:

  • other: 另一条直线

返回:

  • 交点
源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    """
+        计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
+        Args:
+            other: 另一条直线
+        Returns:
+            交点
+        """
+    if self.is_collinear(other):
+        return self
+    elif self.is_parallel(other) or not self.is_coplanar(other):
+        return None
+    else:
+        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

參數:

  • other:
源碼
python
def __eq__(self, other) -> bool:
+    """
+        判断两条直线是否等价。
+
+        v1 // v2 ∧ (p1 - p2) // v1
+        Args:
+            other:
+
+        Returns:
+
+        """
+    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

源碼
python
def __str__(self):
+    """
+        返回点向式(x-x0)
+        Returns:
+
+        """
+    s = 'Line3: '
+    if self.direction.x != 0:
+        s += f'(x{sign_format(-self.point.x)})/{self.direction.x}'
+    if self.direction.y != 0:
+        s += f' = (y{sign_format(-self.point.y)})/{self.direction.y}'
+    if self.direction.z != 0:
+        s += f' = (z{sign_format(-self.point.z)})/{self.direction.z}'
+    return s

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Line3({self.point}, {self.direction})'
+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/mp_math_typing.html b/zh-Hant/api/mp_math/mp_math_typing.html new file mode 100644 index 0000000..d53800d --- /dev/null +++ b/zh-Hant/api/mp_math/mp_math_typing.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math.mp_math_typing | MBCP docs + + + + + + + + + + + + + +
Skip to content

var RealNumber: TypeAlias = int | float

var Number: TypeAlias = RealNumber | complex

var SingleVar = TypeVar('SingleVar', bound=Number)

var ArrayVar = TypeVar('ArrayVar', bound=Iterable[Number])

var Var: TypeAlias = SingleVar | ArrayVar

var OneSingleVarFunc: TypeAlias = Callable[[SingleVar], SingleVar]

var OneArrayFunc: TypeAlias = Callable[[ArrayVar], ArrayVar]

var OneVarFunc: TypeAlias = OneSingleVarFunc | OneArrayFunc

var TwoSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar], SingleVar]

var TwoArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar], ArrayVar]

var TwoVarsFunc: TypeAlias = TwoSingleVarsFunc | TwoArraysFunc

var ThreeSingleVarsFunc: TypeAlias = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

var ThreeArraysFunc: TypeAlias = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

var ThreeVarsFunc: TypeAlias = ThreeSingleVarsFunc | ThreeArraysFunc

var MultiSingleVarsFunc: TypeAlias = Callable[..., SingleVar]

var MultiArraysFunc: TypeAlias = Callable[..., ArrayVar]

var MultiVarsFunc: TypeAlias = MultiSingleVarsFunc | MultiArraysFunc

+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/plane.html b/zh-Hant/api/mp_math/plane.html new file mode 100644 index 0000000..ac1d097 --- /dev/null +++ b/zh-Hant/api/mp_math/plane.html @@ -0,0 +1,232 @@ + + + + + + mbcp.mp_math.plane | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

參數:

  • a:

  • b:

  • c:

  • d:

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
+    """
+        平面方程:ax + by + cz + d = 0
+        Args:
+            a:
+            b:
+            c:
+            d:
+        """
+    self.a = a
+    self.b = b
+    self.c = c
+    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

參數:

  • other:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Plane3') -> bool:
+    """
+        判断两个平面是否近似相等。
+        Args:
+            other:
+
+        Returns:
+            是否近似相等
+        """
+    a = 3
+    if self.a != 0:
+        k = other.a / self.a
+        return approx(other.b, self.b * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
+    elif self.b != 0:
+        k = other.b / self.b
+        return approx(other.a, self.a * k) and approx(other.c, self.c * k) and approx(other.d, self.d * k)
+    elif self.c != 0:
+        k = other.c / self.c
+        return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
+    else:
+        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

參數:

  • other: 另一个平面

返回:

  • 夹角弧度

引發:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+    """
+        计算平面与平面之间的夹角。
+        Args:
+            other: 另一个平面
+        Returns:
+            夹角弧度
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Line3):
+        return self.normal.cal_angle(other.direction).complementary
+    elif isinstance(other, Plane3):
+        return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
+    else:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

參數:

  • other: 另一个平面或点

返回:

  • 距离

引發:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+    """
+        计算平面与平面或点之间的距离。
+        Args:
+            other: 另一个平面或点
+        Returns:
+            距离
+        Raises:
+            TypeError: 不支持的类型
+        """
+    if isinstance(other, Plane3):
+        return 0
+    elif isinstance(other, Point3):
+        return abs(self.a * other.x + self.b * other.y + self.c * other.z + self.d) / (self.a ** 2 + self.b ** 2 + self.c ** 2) ** 0.5
+    else:
+        raise TypeError(f'Unsupported type: {type(other)}')

def cal_intersection_line3(self, other: 'Plane3') -> 'Line3'

计算两平面的交线。该方法有问题,待修复。

參數:

  • other: 另一个平面

返回:

  • 交线
源碼
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+    """
+        计算两平面的交线。该方法有问题,待修复。
+        Args:
+            other: 另一个平面
+        Returns:
+            交线
+        Raises:
+        """
+    if self.normal.is_parallel(other.normal):
+        raise ValueError('Planes are parallel and have no intersection.')
+    direction = self.normal.cross(other.normal)
+    x, y, z = (0, 0, 0)
+    if self.a != 0 and other.a != 0:
+        A = np.array([[self.b, self.c], [other.b, other.c]])
+        B = np.array([-self.d, -other.d])
+        y, z = np.linalg.solve(A, B)
+    elif self.b != 0 and other.b != 0:
+        A = np.array([[self.a, self.c], [other.a, other.c]])
+        B = np.array([-self.d, -other.d])
+        x, z = np.linalg.solve(A, B)
+    elif self.c != 0 and other.c != 0:
+        A = np.array([[self.a, self.b], [other.a, other.b]])
+        B = np.array([-self.d, -other.d])
+        x, y = np.linalg.solve(A, B)
+    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

參數:

  • other: 不与平面平行或在平面上的直线

返回:

  • 交点

引發:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    """
+        计算平面与直线的交点。
+        Args:
+            other: 不与平面平行或在平面上的直线
+        Returns:
+            交点
+        Raises:
+            ValueError: 平面与直线平行或重合
+        """
+    if self.normal @ other.direction == 0:
+        raise ValueError('The plane and the line are parallel or coincident.')
+    x, y, z = other.get_parametric_equations()
+    t = -(self.a * other.point.x + self.b * other.point.y + self.c * other.point.z + self.d) / (self.a * other.direction.x + self.b * other.direction.y + self.c * other.direction.z)
+    return Point3(x(t), y(t), z(t))

def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3'

计算平行于该平面且过指定点的平面。

參數:

  • point: 指定点

返回:

  • 平面
源碼
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    """
+        计算平行于该平面且过指定点的平面。
+        Args:
+            point: 指定点
+        Returns:
+            平面
+        """
+    return Plane3.from_point_and_normal(point, self.normal)

def is_parallel(self, other: 'Plane3') -> bool

判断两个平面是否平行。

參數:

  • other: 另一个平面

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
+    """
+        判断两个平面是否平行。
+        Args:
+            other: 另一个平面
+        Returns:
+            是否平行
+        """
+    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

  • 法向量
源碼
python
@property
+def normal(self) -> 'Vector3':
+    """
+        平面的法向量。
+        Returns:
+            法向量
+        """
+    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

參數:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源碼
python
@classmethod
+def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
+    """
+        工厂函数 由点和法向量构造平面(点法式构造)。
+        Args:
+            point: 平面上的一点
+            normal: 法向量
+        Returns:
+            平面
+        """
+    a, b, c = (normal.x, normal.y, normal.z)
+    d = -a * point.x - b * point.y - c * point.z
+    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

參數:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

  • 平面
源碼
python
@classmethod
+def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
+    """
+        工厂函数 由三点构造平面。
+        Args:
+            p1: 点1
+            p2: 点2
+            p3: 点3
+        Returns:
+            平面
+        """
+    v1 = p2 - p1
+    v2 = p3 - p1
+    normal = v1.cross(v2)
+    return cls.from_point_and_normal(p1, normal)

@classmethod

def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3'

工厂函数 由两直线构造平面。

參數:

  • l1: 直线1

  • l2: 直线2

返回:

  • 平面
源碼
python
@classmethod
+def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由两直线构造平面。
+        Args:
+            l1: 直线1
+            l2: 直线2
+        Returns:
+            平面
+        """
+    v1 = l1.direction
+    v2 = l2.point - l1.point
+    if v2 == zero_vector3:
+        v2 = l2.get_point(1) - l1.point
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

參數:

  • point: 面上一点

  • line: 面上直线,不包含点

返回:

  • 平面
源碼
python
@classmethod
+def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由点和直线构造平面。
+        Args:
+            point: 面上一点
+            line: 面上直线,不包含点
+        Returns:
+            平面
+        """
+    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

源碼
python
def __str__(self):
+    s = 'Plane3: '
+    if self.a != 0:
+        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
+    if self.b != 0:
+        s += f' {sign(self.b)} {abs(self.b)}y'
+    if self.c != 0:
+        s += f' {sign(self.c)} {abs(self.c)}z'
+    if self.d != 0:
+        s += f' {sign(self.d)} {abs(self.d)}'
+    return s + ' = 0'

@overload

def __and__(self, other: 'Line3') -> 'Point3 | None'

源碼
python
@overload
+def __and__(self, other: 'Line3') -> 'Point3 | None':
+    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

源碼
python
@overload
+def __and__(self, other: 'Plane3') -> 'Line3 | None':
+    ...

def __and__(self, other)

取两平面的交集(人话:交线)

參數:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源碼
python
def __and__(self, other):
+    """
+        取两平面的交集(人话:交线)
+        Args:
+            other:
+        Returns:
+            不平行平面的交线,平面平行返回None
+        """
+    if isinstance(other, Plane3):
+        if self.normal.is_parallel(other.normal):
+            return None
+        return self.cal_intersection_line3(other)
+    elif isinstance(other, Line3):
+        if self.normal @ other.direction == 0:
+            return None
+        return self.cal_intersection_point3(other)
+    else:
+        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

def __rand__(self, other: 'Line3') -> 'Point3'

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)

var k = other.a / self.a

var A = np.array([[self.b, self.c], [other.b, other.c]])

var B = np.array([-self.d, -other.d])

var v2 = l2.get_point(1) - l1.point

var k = other.b / self.b

var A = np.array([[self.a, self.c], [other.a, other.c]])

var B = np.array([-self.d, -other.d])

var k = other.c / self.c

var A = np.array([[self.a, self.b], [other.a, other.b]])

var B = np.array([-self.d, -other.d])

+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/point.html b/zh-Hant/api/mp_math/point.html new file mode 100644 index 0000000..cc5cf1e --- /dev/null +++ b/zh-Hant/api/mp_math/point.html @@ -0,0 +1,75 @@ + + + + + + mbcp.mp_math.point | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

參數:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        笛卡尔坐标系中的点。
+        Args:
+            x: x 坐标
+            y: y 坐标
+            z: z 坐标
+        """
+    self.x = x
+    self.y = y
+    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

參數:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个点是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

源碼
python
def __str__(self):
+    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

def __add__(self, other: 'Vector3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Point3':
+    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

def __add__(self, other)

P + V -> P P + P -> P

參數:

  • other:
源碼
python
def __add__(self, other):
+    """
+        P + V -> P
+        P + P -> P
+        Args:
+            other:
+        Returns:
+        """
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

參數:

  • other:
源碼
python
def __eq__(self, other):
+    """
+        判断两个点是否相等。
+        Args:
+            other:
+        Returns:
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

參數:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    """
+        P - P -> V
+
+        P - V -> P  已在 :class:`Vector3` 中实现
+        Args:
+            other:
+        Returns:
+
+        """
+    from .vector import Vector3
+    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/segment.html b/zh-Hant/api/mp_math/segment.html new file mode 100644 index 0000000..da90aaa --- /dev/null +++ b/zh-Hant/api/mp_math/segment.html @@ -0,0 +1,39 @@ + + + + + + mbcp.mp_math.segment | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    """
+        三维空间中的线段。
+        :param p1:
+        :param p2:
+        """
+    self.p1 = p1
+    self.p2 = p2
+    '方向向量'
+    self.direction = self.p2 - self.p1
+    '长度'
+    self.length = self.direction.length
+    '中心点'
+    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Segment3({self.p1}, {self.p2})'

def __str__(self)

源碼
python
def __str__(self):
+    return f'Segment3({self.p1} -> {self.p2})'
+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/utils.html b/zh-Hant/api/mp_math/utils.html new file mode 100644 index 0000000..c8359cd --- /dev/null +++ b/zh-Hant/api/mp_math/utils.html @@ -0,0 +1,88 @@ + + + + + + mbcp.mp_math.utils | MBCP docs + + + + + + + + + + + + + +
Skip to content

def clamp() -> float

区间截断函数。

參數:

  • x:

  • min_:

  • max_:

返回:

  • 限制后的值
源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
+    """
+    区间截断函数。
+    Args:
+        x:
+        min_:
+        max_:
+
+    Returns:
+        限制后的值
+    """
+    return max(min(x, max_), min_)

def approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

參數:

  • x:

  • y:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    """
+    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
+    Args:
+        x:
+        y:
+        epsilon:
+
+    Returns:
+        是否近似相等
+    """
+    return abs(x - y) < epsilon

def sign(x: float = False) -> str

获取数的符号。

參數:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    """获取数的符号。
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return '+' if not only_neg else ''
+    elif x < 0:
+        return '-'
+    else:
+        return ''

def sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

參數:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
+    """格式化符号数
+    -1 -> -1
+    1 -> +1
+    0 -> ""
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return f'+{x}' if not only_neg else f'{x}'
+    elif x < 0:
+        return f'-{abs(x)}'
+    else:
+        return ''

class Approx

def __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

def __eq__(self, other)

源碼
python
def __eq__(self, other):
+    if isinstance(self.value, (float, int)):
+        if isinstance(other, (float, int)):
+            return abs(self.value - other) < APPROX
+        else:
+            self.raise_type_error(other)
+    elif isinstance(self.value, Vector3):
+        if isinstance(other, (Vector3, Point3, Plane3, Line3)):
+            return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
+        else:
+            self.raise_type_error(other)

def raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

源碼
python
def __ne__(self, other):
+    return not self.__eq__(other)
+ + + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/vector.html b/zh-Hant/api/mp_math/vector.html new file mode 100644 index 0000000..d635c71 --- /dev/null +++ b/zh-Hant/api/mp_math/vector.html @@ -0,0 +1,212 @@ + + + + + + mbcp.mp_math.vector | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Vector3

def __init__(self, x: float, y: float, z: float)

3维向量

參數:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        3维向量
+        Args:
+            x: x轴分量
+            y: y轴分量
+            z: z轴分量
+        """
+    self.x = x
+    self.y = y
+    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

參數:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

參數:

  • other: 另一个向量

返回:

  • 夹角
源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    """
+        计算两个向量之间的夹角。
+        Args:
+            other: 另一个向量
+        Returns:
+            夹角
+        """
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

參數:

  • other:

返回:

  • 行列式的结果
源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    """
+        向量积 叉乘:v1 cross v2 -> v3
+
+        叉乘为0,则两向量平行。
+        其余结果的模为平行四边形的面积。
+
+        返回如下行列式的结果:
+
+        ``i  j  k``
+
+        ``x1 y1 z1``
+
+        ``x2 y2 z2``
+
+        Args:
+            other:
+        Returns:
+            行列式的结果
+        """
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

def is_approx_parallel(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

參數:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似平行。
+        Args:
+            other: 另一个向量
+            epsilon: 允许的误差
+        Returns:
+            是否近似平行
+        """
+    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

參數:

  • other: 另一个向量

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
+    """
+        判断两个向量是否平行。
+        Args:
+            other: 另一个向量
+        Returns:
+            是否平行
+        """
+    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
+    """
+        将向量归一化。
+
+        自体归一化,不返回值。
+        """
+    length = self.length
+    self.x /= length
+    self.y /= length
+    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

源碼
python
@property
+def np_array(self) -> 'np.ndarray':
+    """
+        返回numpy数组
+        Returns:
+        """
+    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

返回:

源碼
python
@property
+def length(self) -> float:
+    """
+        向量的模。
+        Returns:
+
+        """
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

  • 单位向量
源碼
python
@property
+def unit(self) -> 'Vector3':
+    """
+        获取该向量的单位向量。
+        Returns:
+            单位向量
+        """
+    return self / self.length

def __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

def __add__(self, other)

V + P -> P

V + V -> V

參數:

  • other:
源碼
python
def __add__(self, other):
+    """
+        V + P -> P
+
+        V + V -> V
+        Args:
+            other:
+        Returns:
+
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x + other.x, self.y + other.y, self.z + other.z)
+    elif isinstance(other, Point3):
+        return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
+    else:
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

參數:

  • other:

返回:

  • 是否相等
源碼
python
def __eq__(self, other):
+    """
+        判断两个向量是否相等。
+        Args:
+            other:
+        Returns:
+            是否相等
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

源碼
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    """
+        P + V -> P
+
+        别去点那边实现了。
+        :param other:
+        :return:
+        """
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __sub__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

源碼
python
@overload
+def __sub__(self, other: 'Point3') -> 'Point3':
+    ...

def __sub__(self, other)

V - P -> P

V - V -> V

參數:

  • other:
源碼
python
def __sub__(self, other):
+    """
+        V - P -> P
+
+        V - V -> V
+        Args:
+            other:
+        Returns:
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
+    elif isinstance(other, Point3):
+        return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
+    else:
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

參數:

  • other:
源碼
python
def __rsub__(self, other: 'Point3'):
+    """
+        P - V -> P
+        Args:
+            other:
+        Returns:
+
+        """
+    if isinstance(other, Point3):
+        return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
+    else:
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

源碼
python
@overload
+def __mul__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

源碼
python
@overload
+def __mul__(self, other: RealNumber) -> 'Vector3':
+    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

參數:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    """
+        数组运算 非点乘。点乘使用@,叉乘使用cross。
+        Args:
+            other:
+
+        Returns:
+        """
+    if isinstance(other, Vector3):
+        return Vector3(self.x * other.x, self.y * other.y, self.z * other.z)
+    elif isinstance(other, (float, int)):
+        return Vector3(self.x * other, self.y * other, self.z * other)
+    else:
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

參數:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+    """
+        点乘。
+        Args:
+            other:
+        Returns:
+        """
+    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

源碼
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

源碼
python
def __repr__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

源碼
python
def __str__(self):
+    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

+ + + + \ No newline at end of file diff --git a/zh-Hant/api/particle/index.html b/zh-Hant/api/particle/index.html new file mode 100644 index 0000000..2a194c9 --- /dev/null +++ b/zh-Hant/api/particle/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.particle | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zh-Hant/api/presets/index.html b/zh-Hant/api/presets/index.html new file mode 100644 index 0000000..6bccfc6 --- /dev/null +++ b/zh-Hant/api/presets/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.presets | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zh-Hant/api/presets/model/index.html b/zh-Hant/api/presets/model/index.html new file mode 100644 index 0000000..8e48256 --- /dev/null +++ b/zh-Hant/api/presets/model/index.html @@ -0,0 +1,41 @@ + + + + + + mbcp.presets.model | MBCP docs + + + + + + + + + + + + + +
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

參數:

  • radius:

  • density:

返回:

  • List[Point3]: 球体上的点集。
源碼
python
@staticmethod
+def sphere(radius: float, density: float):
+    """
+        生成球体上的点集。
+        Args:
+            radius:
+            density:
+        Returns:
+            List[Point3]: 球体上的点集。
+        """
+    area = 4 * np.pi * radius ** 2
+    num = int(area * density)
+    phi_list = np.arccos([clamp(-1 + (2.0 * _ - 1.0) / num, -1, 1) for _ in range(num)])
+    theta_list = np.sqrt(num * np.pi) * phi_list
+    x_array = radius * np.sin(phi_list) * np.cos(theta_list)
+    y_array = radius * np.sin(phi_list) * np.sin(theta_list)
+    z_array = radius * np.cos(phi_list)
+    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
+ + + + \ No newline at end of file