From d3a21b89fbe1b0b46e1ede6ef9addfcb9aac45ec Mon Sep 17 00:00:00 2001 From: snowykami Date: Thu, 29 Aug 2024 05:25:00 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20snowykami/mb?= =?UTF-8?q?cp@260a0f870921b642d9427d69abcc7c97d87ebd59=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 | 96 +++++++- api/index.html | 4 +- api/mp_math/angle.html | 44 ++-- api/mp_math/const.html | 6 +- api/mp_math/equation.html | 17 +- api/mp_math/index.html | 4 +- api/mp_math/line.html | 54 ++--- api/mp_math/mp_math_typing.html | 6 +- api/mp_math/plane.html | 71 +++--- api/mp_math/point.html | 19 +- api/mp_math/segment.html | 10 +- api/mp_math/utils.html | 35 ++- api/mp_math/vector.html | 62 +++-- api/particle/index.html | 4 +- api/presets/index.html | 4 +- api/presets/model/index.html | 6 +- assets/api_mp_math_angle.md.HvtyV1VE.js | 99 ++++++++ ... => api_mp_math_angle.md.HvtyV1VE.lean.js} | 2 +- assets/api_mp_math_const.md.Bc1LxtcU.js | 1 - assets/api_mp_math_const.md.Bc1LxtcU.lean.js | 1 - assets/api_mp_math_const.md.BzOZuyZq.js | 1 + assets/api_mp_math_const.md.BzOZuyZq.lean.js | 1 + ...js => api_mp_math_equation.md.C2RSv9WY.js} | 13 +- ... api_mp_math_equation.md.C2RSv9WY.lean.js} | 2 +- ...yJO.js => api_mp_math_line.md.BPnyTp_q.js} | 50 ++-- assets/api_mp_math_line.md.BPnyTp_q.lean.js | 1 + assets/api_mp_math_line.md.DHofgyJO.lean.js | 1 - .../api_mp_math_mp_math_typing.md.B0OaWJmF.js | 1 + ...p_math_mp_math_typing.md.B0OaWJmF.lean.js} | 2 +- .../api_mp_math_mp_math_typing.md.BHJOAxTl.js | 1 - assets/api_mp_math_plane.md.DLhf2OdI.js | 196 ++++++++++++++++ ... => api_mp_math_plane.md.DLhf2OdI.lean.js} | 2 +- assets/api_mp_math_point.md.0dOKpGzi.js | 51 ++++ assets/api_mp_math_point.md.0dOKpGzi.lean.js | 1 + assets/api_mp_math_point.md.CGqzS8ew.lean.js | 1 - ....js => api_mp_math_segment.md.9QWXtPbn.js} | 6 +- ...> api_mp_math_segment.md.9QWXtPbn.lean.js} | 2 +- assets/api_mp_math_utils.md.C9bdphO4.lean.js | 1 - ...O4.js => api_mp_math_utils.md.DdkUph5B.js} | 33 ++- assets/api_mp_math_utils.md.DdkUph5B.lean.js | 1 + assets/api_mp_math_vector.md.BEh63_ZE.lean.js | 1 - ...E.js => api_mp_math_vector.md.Bodba8jG.js} | 58 +++-- assets/api_mp_math_vector.md.Bodba8jG.lean.js | 1 + ...=> api_presets_model_index.md.YrmtLmca.js} | 4 +- ...i_presets_model_index.md.YrmtLmca.lean.js} | 2 +- .../en_api_mp_math_angle.md.DYZo7hBD.lean.js | 1 - ...js => en_api_mp_math_angle.md.fmci6qlC.js} | 42 ++-- .../en_api_mp_math_angle.md.fmci6qlC.lean.js | 1 + assets/en_api_mp_math_const.md.6yNmEodn.js | 1 + .../en_api_mp_math_const.md.6yNmEodn.lean.js | 1 + assets/en_api_mp_math_const.md.DfcWuGeV.js | 1 - .../en_api_mp_math_const.md.DfcWuGeV.lean.js | 1 - ...=> en_api_mp_math_equation.md.BwRlBW4s.js} | 13 +- ..._api_mp_math_equation.md.BwRlBW4s.lean.js} | 2 +- ....js => en_api_mp_math_line.md.B1oAhkHS.js} | 50 ++-- .../en_api_mp_math_line.md.B1oAhkHS.lean.js | 1 + .../en_api_mp_math_line.md.CAJnDKCu.lean.js | 1 - ..._api_mp_math_mp_math_typing.md.Ba9aYPR2.js | 1 + ...p_math_mp_math_typing.md.Ba9aYPR2.lean.js} | 2 +- ..._api_mp_math_mp_math_typing.md.Dh1by9kw.js | 1 - ...js => en_api_mp_math_plane.md.D3xHJy8e.js} | 67 +++--- ... en_api_mp_math_plane.md.D3xHJy8e.lean.js} | 2 +- .../en_api_mp_math_point.md.CCE-yfrm.lean.js | 1 - ...js => en_api_mp_math_point.md.P1GRdc2H.js} | 17 +- .../en_api_mp_math_point.md.P1GRdc2H.lean.js | 1 + ... => en_api_mp_math_segment.md.DqDvJpQR.js} | 6 +- ...n_api_mp_math_segment.md.DqDvJpQR.lean.js} | 2 +- ...js => en_api_mp_math_utils.md.B0nejTCy.js} | 33 ++- .../en_api_mp_math_utils.md.B0nejTCy.lean.js | 1 + .../en_api_mp_math_utils.md.CuiyHRtY.lean.js | 1 - .../en_api_mp_math_vector.md.3xep9oDm.lean.js | 1 - assets/en_api_mp_math_vector.md.BpRKRIGw.js | 187 +++++++++++++++ .../en_api_mp_math_vector.md.BpRKRIGw.lean.js | 1 + ...en_api_presets_model_index.md.j5zmPSwU.js} | 4 +- ...i_presets_model_index.md.j5zmPSwU.lean.js} | 2 +- ...js => ja_api_mp_math_angle.md.D2dStPZh.js} | 42 ++-- ... ja_api_mp_math_angle.md.D2dStPZh.lean.js} | 2 +- assets/ja_api_mp_math_const.md.CQY-Qdbh.js | 1 - .../ja_api_mp_math_const.md.CQY-Qdbh.lean.js | 1 - assets/ja_api_mp_math_const.md.CflutYeA.js | 1 + .../ja_api_mp_math_const.md.CflutYeA.lean.js | 1 + ...=> ja_api_mp_math_equation.md.Cj8tgo_3.js} | 13 +- ..._api_mp_math_equation.md.Cj8tgo_3.lean.js} | 2 +- .../ja_api_mp_math_line.md.Ck5uy5Cp.lean.js | 1 - ....js => ja_api_mp_math_line.md.Dg8duKLw.js} | 50 ++-- .../ja_api_mp_math_line.md.Dg8duKLw.lean.js | 1 + ..._api_mp_math_mp_math_typing.md.Bhy6h0r0.js | 1 + ...p_math_mp_math_typing.md.Bhy6h0r0.lean.js} | 2 +- ..._api_mp_math_mp_math_typing.md.CeASNaiE.js | 1 - ...js => ja_api_mp_math_plane.md.CTOkqSft.js} | 67 +++--- ... ja_api_mp_math_plane.md.CTOkqSft.lean.js} | 2 +- .../ja_api_mp_math_point.md.Cc_RLeth.lean.js | 1 - ...js => ja_api_mp_math_point.md.ZsmRVuaC.js} | 17 +- .../ja_api_mp_math_point.md.ZsmRVuaC.lean.js | 1 + ... => ja_api_mp_math_segment.md.D5ZKDDr_.js} | 6 +- ...a_api_mp_math_segment.md.D5ZKDDr_.lean.js} | 2 +- .../ja_api_mp_math_utils.md.Dgzoi9ec.lean.js | 1 - ...js => ja_api_mp_math_utils.md.jeRmCp2Q.js} | 33 ++- .../ja_api_mp_math_utils.md.jeRmCp2Q.lean.js | 1 + ...s => ja_api_mp_math_vector.md.DAXdHSjp.js} | 58 +++-- .../ja_api_mp_math_vector.md.DAXdHSjp.lean.js | 1 + .../ja_api_mp_math_vector.md.kN2P6bpC.lean.js | 1 - ...ja_api_presets_model_index.md.CleEI4sj.js} | 4 +- ...i_presets_model_index.md.CleEI4sj.lean.js} | 2 +- assets/zht_api_index.md.Dq4XPUKZ.js | 1 + assets/zht_api_index.md.Dq4XPUKZ.lean.js | 1 + ...s => zht_api_mp_math_angle.md.CMQhsVJf.js} | 42 ++-- .../zht_api_mp_math_angle.md.CMQhsVJf.lean.js | 1 + assets/zht_api_mp_math_const.md.CIhADrI2.js | 1 + .../zht_api_mp_math_const.md.CIhADrI2.lean.js | 1 + .../zht_api_mp_math_equation.md.BwlIZxDL.js | 62 +++++ ...t_api_mp_math_equation.md.BwlIZxDL.lean.js | 1 + assets/zht_api_mp_math_index.md.D09y2ubg.js | 1 + .../zht_api_mp_math_index.md.D09y2ubg.lean.js | 1 + assets/zht_api_mp_math_line.md.Czel-DYb.js | 178 ++++++++++++++ .../zht_api_mp_math_line.md.Czel-DYb.lean.js | 1 + ..._api_mp_math_mp_math_typing.md.DlxSozR9.js | 1 + ...mp_math_mp_math_typing.md.DlxSozR9.lean.js | 1 + ...s => zht_api_mp_math_plane.md.CxUaQCvU.js} | 67 +++--- .../zht_api_mp_math_plane.md.CxUaQCvU.lean.js | 1 + ...s => zht_api_mp_math_point.md.BmRy6Xj6.js} | 17 +- .../zht_api_mp_math_point.md.BmRy6Xj6.lean.js | 1 + assets/zht_api_mp_math_segment.md.Bn34DhAl.js | 14 ++ ...ht_api_mp_math_segment.md.Bn34DhAl.lean.js | 1 + assets/zht_api_mp_math_utils.md.BtiDgiKf.js | 64 +++++ .../zht_api_mp_math_utils.md.BtiDgiKf.lean.js | 1 + ... => zht_api_mp_math_vector.md.DmxfMXiN.js} | 58 +++-- ...zht_api_mp_math_vector.md.DmxfMXiN.lean.js | 1 + assets/zht_api_particle_index.md.kAm9VAEw.js | 1 + ...zht_api_particle_index.md.kAm9VAEw.lean.js | 1 + assets/zht_api_presets_index.md.BmouaEaT.js | 1 + .../zht_api_presets_index.md.BmouaEaT.lean.js | 1 + ...zht_api_presets_model_index.md.DDom2SLG.js | 18 ++ ...pi_presets_model_index.md.DDom2SLG.lean.js | 1 + en/api/index.html | 4 +- en/api/mp_math/angle.html | 44 ++-- en/api/mp_math/const.html | 6 +- en/api/mp_math/equation.html | 17 +- en/api/mp_math/index.html | 4 +- en/api/mp_math/line.html | 54 ++--- en/api/mp_math/mp_math_typing.html | 6 +- en/api/mp_math/plane.html | 71 +++--- en/api/mp_math/point.html | 19 +- en/api/mp_math/segment.html | 10 +- en/api/mp_math/utils.html | 35 ++- en/api/mp_math/vector.html | 62 +++-- en/api/particle/index.html | 4 +- en/api/presets/index.html | 4 +- en/api/presets/model/index.html | 6 +- guide/index.html | 4 +- hashmap.json | 2 +- index.html | 4 +- ja/api/index.html | 4 +- ja/api/mp_math/angle.html | 44 ++-- ja/api/mp_math/const.html | 6 +- ja/api/mp_math/equation.html | 17 +- ja/api/mp_math/index.html | 4 +- ja/api/mp_math/line.html | 54 ++--- ja/api/mp_math/mp_math_typing.html | 6 +- ja/api/mp_math/plane.html | 71 +++--- ja/api/mp_math/point.html | 19 +- ja/api/mp_math/segment.html | 10 +- ja/api/mp_math/utils.html | 35 ++- ja/api/mp_math/vector.html | 62 +++-- ja/api/particle/index.html | 4 +- ja/api/presets/index.html | 4 +- ja/api/presets/model/index.html | 6 +- md-ex.html | 4 +- zh-Hant/api/index.html | 4 +- zh-Hant/api/mp_math/angle.html | 4 +- zh-Hant/api/mp_math/const.html | 4 +- zh-Hant/api/mp_math/equation.html | 4 +- zh-Hant/api/mp_math/index.html | 4 +- zh-Hant/api/mp_math/line.html | 4 +- zh-Hant/api/mp_math/mp_math_typing.html | 4 +- zh-Hant/api/mp_math/plane.html | 4 +- zh-Hant/api/mp_math/point.html | 4 +- zh-Hant/api/mp_math/segment.html | 4 +- zh-Hant/api/mp_math/utils.html | 4 +- zh-Hant/api/mp_math/vector.html | 4 +- zh-Hant/api/particle/index.html | 4 +- zh-Hant/api/presets/index.html | 4 +- zh-Hant/api/presets/model/index.html | 4 +- zht/api/index.html | 24 ++ zht/api/mp_math/angle.html | 122 ++++++++++ zht/api/mp_math/const.html | 24 ++ zht/api/mp_math/equation.html | 85 +++++++ zht/api/mp_math/index.html | 24 ++ zht/api/mp_math/line.html | 201 ++++++++++++++++ zht/api/mp_math/mp_math_typing.html | 24 ++ zht/api/mp_math/plane.html | 219 ++++++++++++++++++ zht/api/mp_math/point.html | 74 ++++++ zht/api/mp_math/segment.html | 37 +++ zht/api/mp_math/utils.html | 87 +++++++ zht/api/mp_math/vector.html | 210 +++++++++++++++++ zht/api/particle/index.html | 24 ++ zht/api/presets/index.html | 24 ++ zht/api/presets/model/index.html | 41 ++++ 199 files changed, 3127 insertions(+), 1141 deletions(-) create mode 100644 assets/api_mp_math_angle.md.HvtyV1VE.js rename assets/{api_mp_math_angle.md.DKMXAFbW.lean.js => api_mp_math_angle.md.HvtyV1VE.lean.js} (58%) delete mode 100644 assets/api_mp_math_const.md.Bc1LxtcU.js delete mode 100644 assets/api_mp_math_const.md.Bc1LxtcU.lean.js create mode 100644 assets/api_mp_math_const.md.BzOZuyZq.js create mode 100644 assets/api_mp_math_const.md.BzOZuyZq.lean.js rename assets/{api_mp_math_equation.md.CZgns297.js => api_mp_math_equation.md.C2RSv9WY.js} (67%) rename assets/{api_mp_math_equation.md.CZgns297.lean.js => api_mp_math_equation.md.C2RSv9WY.lean.js} (57%) rename assets/{api_mp_math_line.md.DHofgyJO.js => api_mp_math_line.md.BPnyTp_q.js} (58%) create mode 100644 assets/api_mp_math_line.md.BPnyTp_q.lean.js delete mode 100644 assets/api_mp_math_line.md.DHofgyJO.lean.js create mode 100644 assets/api_mp_math_mp_math_typing.md.B0OaWJmF.js rename assets/{api_mp_math_mp_math_typing.md.BHJOAxTl.lean.js => api_mp_math_mp_math_typing.md.B0OaWJmF.lean.js} (66%) delete mode 100644 assets/api_mp_math_mp_math_typing.md.BHJOAxTl.js create mode 100644 assets/api_mp_math_plane.md.DLhf2OdI.js rename assets/{api_mp_math_plane.md.DZBu-HIq.lean.js => api_mp_math_plane.md.DLhf2OdI.lean.js} (85%) create mode 100644 assets/api_mp_math_point.md.0dOKpGzi.js create mode 100644 assets/api_mp_math_point.md.0dOKpGzi.lean.js delete mode 100644 assets/api_mp_math_point.md.CGqzS8ew.lean.js rename assets/{api_mp_math_segment.md.B0wRl0bP.js => api_mp_math_segment.md.9QWXtPbn.js} (54%) rename assets/{api_mp_math_segment.md.B0wRl0bP.lean.js => api_mp_math_segment.md.9QWXtPbn.lean.js} (85%) delete mode 100644 assets/api_mp_math_utils.md.C9bdphO4.lean.js rename assets/{api_mp_math_utils.md.C9bdphO4.js => api_mp_math_utils.md.DdkUph5B.js} (59%) create mode 100644 assets/api_mp_math_utils.md.DdkUph5B.lean.js delete mode 100644 assets/api_mp_math_vector.md.BEh63_ZE.lean.js rename assets/{api_mp_math_vector.md.BEh63_ZE.js => api_mp_math_vector.md.Bodba8jG.js} (63%) create mode 100644 assets/api_mp_math_vector.md.Bodba8jG.lean.js rename assets/{api_presets_model_index.md.DLrch_Ju.js => api_presets_model_index.md.YrmtLmca.js} (82%) rename assets/{api_presets_model_index.md.DLrch_Ju.lean.js => api_presets_model_index.md.YrmtLmca.lean.js} (57%) delete mode 100644 assets/en_api_mp_math_angle.md.DYZo7hBD.lean.js rename assets/{en_api_mp_math_angle.md.DYZo7hBD.js => en_api_mp_math_angle.md.fmci6qlC.js} (61%) create mode 100644 assets/en_api_mp_math_angle.md.fmci6qlC.lean.js create mode 100644 assets/en_api_mp_math_const.md.6yNmEodn.js create mode 100644 assets/en_api_mp_math_const.md.6yNmEodn.lean.js delete mode 100644 assets/en_api_mp_math_const.md.DfcWuGeV.js delete mode 100644 assets/en_api_mp_math_const.md.DfcWuGeV.lean.js rename assets/{en_api_mp_math_equation.md.BQv4WWiJ.js => en_api_mp_math_equation.md.BwRlBW4s.js} (67%) rename assets/{en_api_mp_math_equation.md.BQv4WWiJ.lean.js => en_api_mp_math_equation.md.BwRlBW4s.lean.js} (86%) rename assets/{en_api_mp_math_line.md.CAJnDKCu.js => en_api_mp_math_line.md.B1oAhkHS.js} (59%) create mode 100644 assets/en_api_mp_math_line.md.B1oAhkHS.lean.js delete mode 100644 assets/en_api_mp_math_line.md.CAJnDKCu.lean.js create mode 100644 assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.js rename assets/{en_api_mp_math_mp_math_typing.md.Dh1by9kw.lean.js => en_api_mp_math_mp_math_typing.md.Ba9aYPR2.lean.js} (51%) delete mode 100644 assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.js rename assets/{en_api_mp_math_plane.md.B-VJJllR.js => en_api_mp_math_plane.md.D3xHJy8e.js} (64%) rename assets/{en_api_mp_math_plane.md.B-VJJllR.lean.js => en_api_mp_math_plane.md.D3xHJy8e.lean.js} (85%) delete mode 100644 assets/en_api_mp_math_point.md.CCE-yfrm.lean.js rename assets/{en_api_mp_math_point.md.CCE-yfrm.js => en_api_mp_math_point.md.P1GRdc2H.js} (56%) create mode 100644 assets/en_api_mp_math_point.md.P1GRdc2H.lean.js rename assets/{en_api_mp_math_segment.md.CUQFMm0Q.js => en_api_mp_math_segment.md.DqDvJpQR.js} (50%) rename assets/{en_api_mp_math_segment.md.CUQFMm0Q.lean.js => en_api_mp_math_segment.md.DqDvJpQR.lean.js} (57%) rename assets/{ja_api_mp_math_utils.md.Dgzoi9ec.js => en_api_mp_math_utils.md.B0nejTCy.js} (60%) create mode 100644 assets/en_api_mp_math_utils.md.B0nejTCy.lean.js delete mode 100644 assets/en_api_mp_math_utils.md.CuiyHRtY.lean.js delete mode 100644 assets/en_api_mp_math_vector.md.3xep9oDm.lean.js create mode 100644 assets/en_api_mp_math_vector.md.BpRKRIGw.js create mode 100644 assets/en_api_mp_math_vector.md.BpRKRIGw.lean.js rename assets/{en_api_presets_model_index.md.1ewGi0do.js => en_api_presets_model_index.md.j5zmPSwU.js} (82%) rename assets/{en_api_presets_model_index.md.1ewGi0do.lean.js => en_api_presets_model_index.md.j5zmPSwU.lean.js} (58%) rename assets/{ja_api_mp_math_angle.md._xBKQuir.js => ja_api_mp_math_angle.md.D2dStPZh.js} (61%) rename assets/{ja_api_mp_math_angle.md._xBKQuir.lean.js => ja_api_mp_math_angle.md.D2dStPZh.lean.js} (57%) delete mode 100644 assets/ja_api_mp_math_const.md.CQY-Qdbh.js delete mode 100644 assets/ja_api_mp_math_const.md.CQY-Qdbh.lean.js create mode 100644 assets/ja_api_mp_math_const.md.CflutYeA.js create mode 100644 assets/ja_api_mp_math_const.md.CflutYeA.lean.js rename assets/{ja_api_mp_math_equation.md.BETlifwh.js => ja_api_mp_math_equation.md.Cj8tgo_3.js} (67%) rename assets/{ja_api_mp_math_equation.md.BETlifwh.lean.js => ja_api_mp_math_equation.md.Cj8tgo_3.lean.js} (55%) delete mode 100644 assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js rename assets/{ja_api_mp_math_line.md.Ck5uy5Cp.js => ja_api_mp_math_line.md.Dg8duKLw.js} (58%) create mode 100644 assets/ja_api_mp_math_line.md.Dg8duKLw.lean.js create mode 100644 assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.js rename assets/{ja_api_mp_math_mp_math_typing.md.CeASNaiE.lean.js => ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.lean.js} (64%) delete mode 100644 assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.js rename assets/{api_mp_math_plane.md.DZBu-HIq.js => ja_api_mp_math_plane.md.CTOkqSft.js} (64%) rename assets/{ja_api_mp_math_plane.md.C5qFtY92.lean.js => ja_api_mp_math_plane.md.CTOkqSft.lean.js} (85%) delete mode 100644 assets/ja_api_mp_math_point.md.Cc_RLeth.lean.js rename assets/{ja_api_mp_math_point.md.Cc_RLeth.js => ja_api_mp_math_point.md.ZsmRVuaC.js} (58%) create mode 100644 assets/ja_api_mp_math_point.md.ZsmRVuaC.lean.js rename assets/{ja_api_mp_math_segment.md.oiONXysZ.js => ja_api_mp_math_segment.md.D5ZKDDr_.js} (51%) rename assets/{ja_api_mp_math_segment.md.oiONXysZ.lean.js => ja_api_mp_math_segment.md.D5ZKDDr_.lean.js} (85%) delete mode 100644 assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js rename assets/{en_api_mp_math_utils.md.CuiyHRtY.js => ja_api_mp_math_utils.md.jeRmCp2Q.js} (60%) create mode 100644 assets/ja_api_mp_math_utils.md.jeRmCp2Q.lean.js rename assets/{en_api_mp_math_vector.md.3xep9oDm.js => ja_api_mp_math_vector.md.DAXdHSjp.js} (63%) create mode 100644 assets/ja_api_mp_math_vector.md.DAXdHSjp.lean.js delete mode 100644 assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js rename assets/{ja_api_presets_model_index.md.QP3v3mpP.js => ja_api_presets_model_index.md.CleEI4sj.js} (82%) rename assets/{ja_api_presets_model_index.md.QP3v3mpP.lean.js => ja_api_presets_model_index.md.CleEI4sj.lean.js} (58%) create mode 100644 assets/zht_api_index.md.Dq4XPUKZ.js create mode 100644 assets/zht_api_index.md.Dq4XPUKZ.lean.js rename assets/{api_mp_math_angle.md.DKMXAFbW.js => zht_api_mp_math_angle.md.CMQhsVJf.js} (61%) create mode 100644 assets/zht_api_mp_math_angle.md.CMQhsVJf.lean.js create mode 100644 assets/zht_api_mp_math_const.md.CIhADrI2.js create mode 100644 assets/zht_api_mp_math_const.md.CIhADrI2.lean.js create mode 100644 assets/zht_api_mp_math_equation.md.BwlIZxDL.js create mode 100644 assets/zht_api_mp_math_equation.md.BwlIZxDL.lean.js create mode 100644 assets/zht_api_mp_math_index.md.D09y2ubg.js create mode 100644 assets/zht_api_mp_math_index.md.D09y2ubg.lean.js create mode 100644 assets/zht_api_mp_math_line.md.Czel-DYb.js create mode 100644 assets/zht_api_mp_math_line.md.Czel-DYb.lean.js create mode 100644 assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.js create mode 100644 assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.lean.js rename assets/{ja_api_mp_math_plane.md.C5qFtY92.js => zht_api_mp_math_plane.md.CxUaQCvU.js} (64%) create mode 100644 assets/zht_api_mp_math_plane.md.CxUaQCvU.lean.js rename assets/{api_mp_math_point.md.CGqzS8ew.js => zht_api_mp_math_point.md.BmRy6Xj6.js} (57%) create mode 100644 assets/zht_api_mp_math_point.md.BmRy6Xj6.lean.js create mode 100644 assets/zht_api_mp_math_segment.md.Bn34DhAl.js create mode 100644 assets/zht_api_mp_math_segment.md.Bn34DhAl.lean.js create mode 100644 assets/zht_api_mp_math_utils.md.BtiDgiKf.js create mode 100644 assets/zht_api_mp_math_utils.md.BtiDgiKf.lean.js rename assets/{ja_api_mp_math_vector.md.kN2P6bpC.js => zht_api_mp_math_vector.md.DmxfMXiN.js} (64%) create mode 100644 assets/zht_api_mp_math_vector.md.DmxfMXiN.lean.js create mode 100644 assets/zht_api_particle_index.md.kAm9VAEw.js create mode 100644 assets/zht_api_particle_index.md.kAm9VAEw.lean.js create mode 100644 assets/zht_api_presets_index.md.BmouaEaT.js create mode 100644 assets/zht_api_presets_index.md.BmouaEaT.lean.js create mode 100644 assets/zht_api_presets_model_index.md.DDom2SLG.js create mode 100644 assets/zht_api_presets_model_index.md.DDom2SLG.lean.js create mode 100644 zht/api/index.html create mode 100644 zht/api/mp_math/angle.html create mode 100644 zht/api/mp_math/const.html create mode 100644 zht/api/mp_math/equation.html create mode 100644 zht/api/mp_math/index.html create mode 100644 zht/api/mp_math/line.html create mode 100644 zht/api/mp_math/mp_math_typing.html create mode 100644 zht/api/mp_math/plane.html create mode 100644 zht/api/mp_math/point.html create mode 100644 zht/api/mp_math/segment.html create mode 100644 zht/api/mp_math/utils.html create mode 100644 zht/api/mp_math/vector.html create mode 100644 zht/api/particle/index.html create mode 100644 zht/api/presets/index.html create mode 100644 zht/api/presets/model/index.html diff --git a/404.html b/404.html index f630ad0..2554cb3 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 951a2b4..62cefdd 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()
@@ -414,6 +414,98 @@
         ]
       }
     ],
+    "/zht/": [
+      {
+        "text": "zht",
+        "items": [
+          {
+            "text": "api",
+            "items": [
+              {
+                "text": "mbcp",
+                "link": "/zht/api/index.md"
+              },
+              {
+                "text": "mp_math",
+                "items": [
+                  {
+                    "text": "mbcp.mp_math",
+                    "link": "/zht/api/mp_math/index.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.angle",
+                    "link": "/zht/api/mp_math/angle.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.const",
+                    "link": "/zht/api/mp_math/const.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.equation",
+                    "link": "/zht/api/mp_math/equation.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.line",
+                    "link": "/zht/api/mp_math/line.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.mp_math_typing",
+                    "link": "/zht/api/mp_math/mp_math_typing.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.plane",
+                    "link": "/zht/api/mp_math/plane.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.point",
+                    "link": "/zht/api/mp_math/point.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.segment",
+                    "link": "/zht/api/mp_math/segment.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.utils",
+                    "link": "/zht/api/mp_math/utils.md"
+                  },
+                  {
+                    "text": "mbcp.mp_math.vector",
+                    "link": "/zht/api/mp_math/vector.md"
+                  }
+                ]
+              },
+              {
+                "text": "particle",
+                "items": [
+                  {
+                    "text": "mbcp.particle",
+                    "link": "/zht/api/particle/index.md"
+                  }
+                ]
+              },
+              {
+                "text": "presets",
+                "items": [
+                  {
+                    "text": "mbcp.presets",
+                    "link": "/zht/api/presets/index.md"
+                  },
+                  {
+                    "text": "model",
+                    "items": [
+                      {
+                        "text": "mbcp.presets.model",
+                        "link": "/zht/api/presets/model/index.md"
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    ],
     "/api-ex.md/": [
       {
         "text": "Runtime API Examples",
@@ -453,7 +545,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 8c20492..208d596 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 ba42b03..75bdcf4 100644 --- a/api/mp_math/angle.html +++ b/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle

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

任意角度。

参数:

  • value: 角度或弧度值

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

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

class Angle

class AnyAngle(Angle)

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

任意角度。

参数:

  • value: 角度或弧度值

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

源代码
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,98 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

  • 余角
源码
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

返回:

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

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

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

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

返回:

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

@property

def degree(self) -> float

角度。

返回:

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

@property

method degree(self) -> float

角度。

返回:

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

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

  • 最小正角度
源码
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

返回:

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

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

  • 最大负角度
源码
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

返回:

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

@property

def sin(self) -> float

正弦值。

返回:

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

@property

method sin(self) -> float

正弦值。

返回:

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

@property

def cos(self) -> float

余弦值。

返回:

  • 余弦值
源码
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

返回:

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

@property

def tan(self) -> float

正切值。

返回:

  • 正切值
源码
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

返回:

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

@property

def cot(self) -> float

余切值。

返回:

  • 余切值
源码
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

返回:

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

@property

def sec(self) -> float

正割值。

返回:

  • 正割值
源码
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

正割值。

返回:

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

@property

def csc(self) -> float

余割值。

返回:

  • 余割值
源码
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

余割值。

返回:

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

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
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

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

源码
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

def __truediv__(self, other)

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

method self / other

源代码
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/api/mp_math/const.html b/api/mp_math/const.html index 503eafa..86ab636 100644 --- a/api/mp_math/const.html +++ b/api/mp_math/const.html @@ -12,13 +12,13 @@ - + -
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 605a325..947617d 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: 偏移量

返回:

  • 偏导函数

引发:

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

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

返回:

  • 偏导函数

引发:

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

def partial_derivative_func() -> Var

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

func 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:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

func high_order_partial_derivative_func() -> Var

源代码
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

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

曲线方程。

参数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

class CurveEquation

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

曲线方程。

参数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

源代码
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
     """
         曲线方程。
         Args:
@@ -66,7 +66,7 @@
         """
     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, ...]:
+    self.z_func = z_func

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

计算曲线上的点。

参数:

  • *t:

  • 参数:

源代码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,8 @@
     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)

- + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
+ \ No newline at end of file diff --git a/api/mp_math/index.html b/api/mp_math/index.html index 7d231b0..cbc7ef9 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 122b301..65d7e30 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

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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

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

参数:

  • other: 另一条直线

返回:

  • 夹角弧度

引发:

  • TypeError 不支持的类型
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

参数:

  • other: 另一条直线

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 平行直线或点

返回:

  • 距离

引发:

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

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

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

参数:

  • other: 平行直线或点

返回:

  • 距离

引发:

  • TypeError 不支持的类型
源代码
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

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

计算两条直线的交点。

参数:

  • other: 另一条直线

返回:

  • 交点

引发:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

计算两条直线的交点。

参数:

  • other: 另一条直线

返回:

  • 交点

引发:

  • ValueError 直线平行

  • ValueError 直线不共面

源代码
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

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

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

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

参数:

  • point: 指定点

返回:

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

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

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

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

参数:

  • t: 参数t

返回:

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

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]:
+    return self.point + t * self.direction

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

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源代码
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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)

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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)

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

判断两条直线是否平行。

参数:

  • other: 另一条直线

返回:

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

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

判断两条直线是否共线。

参数:

  • other: 另一条直线

返回:

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

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

判断两条直线是否共线。

参数:

  • other: 另一条直线

返回:

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

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)

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

判断点是否在直线上。

参数:

  • point: 点

返回:

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

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)

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

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

参数:

  • other: 另一条直线

返回:

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

def simplify(self)

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

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

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

method simplify(self)

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

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

源代码
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

返回:

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

@classmethod

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

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

参数:

  • p1: 点1

  • p2: 点2

返回:

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

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

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

参数:

  • other: 另一条直线

返回:

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

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

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

参数:

  • other: 另一条直线

返回:

  • 交点
源代码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -183,7 +183,7 @@
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

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

参数:

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

method __eq__(self, other) -> bool

判断两条直线是否等价。

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

参数:

  • other:
源代码
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,22 +194,8 @@
         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})'
- + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
+ \ No newline at end of file diff --git a/api/mp_math/mp_math_typing.html b/api/mp_math/mp_math_typing.html index 5ec3185..94a3adc 100644 --- a/api/mp_math/mp_math_typing.html +++ b/api/mp_math/mp_math_typing.html @@ -12,13 +12,13 @@ - + -
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 = int | float

  • 类型: TypeAlias

var Number = RealNumber | complex

  • 类型: TypeAlias

var Var = SingleVar | ArrayVar

  • 类型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 类型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 类型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 类型: TypeAlias

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

  • 类型: TypeAlias

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

  • 类型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 类型: TypeAlias

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

  • 类型: TypeAlias

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

  • 类型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 类型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 类型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 类型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 类型: TypeAlias
+ \ No newline at end of file diff --git a/api/mp_math/plane.html b/api/mp_math/plane.html index 44135c2..d917112 100644 --- a/api/mp_math/plane.html +++ b/api/mp_math/plane.html @@ -12,33 +12,31 @@ - + -
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

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

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

参数:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

源代码
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            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:
+    self.d = d

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

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

参数:

  • other: 另一个平面

返回:

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

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

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

参数:

  • other: 另一个平面

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 另一个平面

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 另一个平面或点

返回:

  • 距离

引发:

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

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

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

参数:

  • other: 另一个平面或点

返回:

  • 距离

引发:

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

method 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):
@@ -104,7 +102,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

参数:

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

返回:

  • 交点

引发:

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

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

计算平面与直线的交点。

参数:

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

返回:

  • 交点

引发:

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

method 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:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

参数:

  • other: 另一个平面

返回:

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

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

  • 法向量
源码
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

返回:

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

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

@classmethod

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

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

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

参数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

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

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

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

参数:

  • l1: 直线1

  • l2: 直线2

返回:

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

@classmethod

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

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

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

参数:

  • point: 面上一点

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

返回:

  • 平面
源代码
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -191,22 +189,11 @@
         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
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

源码
python
@overload
+    ...

@overload

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

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

def __and__(self, other)

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

参数:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源码
python
def __and__(self, other):
+    ...

method __and__(self, other)

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

参数:

  • other:

返回:

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

def __eq__(self, other) -> 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])

- + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
+ \ No newline at end of file diff --git a/api/mp_math/point.html b/api/mp_math/point.html index dd1a173..600bf8b 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

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

笛卡尔坐标系中的点。

参数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

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

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

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

参数:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

参数:

  • other:

  • epsilon:

返回:

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

@overload

method self + other: Vector3 => Point3

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

@overload

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

源码
python
@overload
+    ...

@overload

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

method self + other

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

参数:

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

def __eq__(self, other)

判断两个点是否相等。

参数:

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

method __eq__(self, other)

判断两个点是否相等。

参数:

  • other:
源代码
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

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

P - P -> V

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

参数:

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

method self - other: Point3 => Vector3

P - P -> V

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

参数:

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

class Segment3

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

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

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

class Segment3

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

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

源代码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -30,10 +30,8 @@
     '长度'
     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})'
- + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
+ \ No newline at end of file diff --git a/api/mp_math/utils.html b/api/mp_math/utils.html index 73d9817..7ba994e 100644 --- a/api/mp_math/utils.html +++ b/api/mp_math/utils.html @@ -12,34 +12,33 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

参数:

  • x:

  • min_:

  • max_:

返回:

  • 限制后的值
源码
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func clamp() -> float

区间限定函数

参数:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

返回:

  • 限制后的值
源代码
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        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:
+    return max(min(x, max_), min_)

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

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

参数:

  • x: 数1

  • y: 数2

  • epsilon: 误差

返回:

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

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

获取数的符号。

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源代码
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +51,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 ''

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

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

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源代码
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -68,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

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

def __eq__(self, other)

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

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -79,10 +78,10 @@
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

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

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/api/mp_math/vector.html b/api/mp_math/vector.html index b693b11..4b965b4 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

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

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

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

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

参数:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

参数:

  • other:

  • epsilon:

返回:

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

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

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

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

参数:

  • other: 另一个向量

返回:

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

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

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

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

参数:

  • other:

返回:

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

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

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

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

参数:

  • other:

返回:

  • 行列式的结果
源代码
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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)

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

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

参数:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

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

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

判断两个向量是否平行。

参数:

  • other: 另一个向量

返回:

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

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

判断两个向量是否平行。

参数:

  • other: 另一个向量

返回:

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

def normalize(self)

将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

将向量归一化。

自体归一化,不返回值。

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

@property

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

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

@property

method np_array(self) -> np.ndarray

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

@property

def length(self) -> float

向量的模。

返回:

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

@property

method length(self) -> float

向量的模。

返回:

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

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

  • 单位向量
源码
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

返回:

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

def __abs__(self)

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

@overload

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

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

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

method self + other

V + P -> P

V + V -> V

参数:

  • other:
源代码
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:

返回:

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

method __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:

返回:

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

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

P + V -> P

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

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

method self + other: Point3 => Point3

P + V -> P

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

源代码
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

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

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

@overload

method self - other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

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

method self - other

V - P -> P

V - V -> V

参数:

  • other:
源代码
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
     else:
-        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

参数:

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

method self - other: Point3

P - V -> P

参数:

  • other:
源代码
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -176,11 +176,11 @@
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

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

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

@overload

method self * other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

method 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':
+    ...

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

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

参数:

  • other:
源代码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,18 @@
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

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':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

点乘。

参数:

  • other:
源代码
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

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)

- + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • 类型: Vector3

  • 说明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 类型: Vector3

  • 说明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 类型: Vector3

  • 说明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 类型: Vector3

  • 说明: z轴单位向量

+ \ No newline at end of file diff --git a/api/particle/index.html b/api/particle/index.html index ce276df..68b1671 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 dddfb71..c9e3bf5 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 1c753fe..6f4d6a2 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:

返回:

  • List[Point3]: 球体上的点集。
源码
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

返回:

  • List[Point3]: 球体上的点集。
源代码
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -35,7 +35,7 @@
     y_array = radius * np.sin(phi_list) * np.sin(theta_list)
     z_array = radius * np.cos(phi_list)
     return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
- + \ No newline at end of file diff --git a/assets/api_mp_math_angle.md.HvtyV1VE.js b/assets/api_mp_math_angle.md.HvtyV1VE.js new file mode 100644 index 0000000..481299c --- /dev/null +++ b/assets/api_mp_math_angle.md.HvtyV1VE.js @@ -0,0 +1,99 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),t={name:"api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

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

任意角度。

参数:

  • value: 角度或弧度值

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

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

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

返回:

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

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

返回:

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

@property

method degree(self) -> float

角度。

返回:

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

@property

method minimum_positive(self) -> AnyAngle

最小正角。

返回:

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

@property

method maximum_negative(self) -> AnyAngle

最大负角。

返回:

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

@property

method sin(self) -> float

正弦值。

返回:

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

@property

method cos(self) -> float

余弦值。

返回:

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

@property

method tan(self) -> float

正切值。

返回:

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

@property

method cot(self) -> float

余切值。

返回:

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

@property

method sec(self) -> float

正割值。

返回:

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

@property

method csc(self) -> float

余割值。

返回:

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

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

method self / other: AnyAngle => float

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

method self / other

源代码
python
def __truediv__(self, other):
+    if isinstance(other, AnyAngle):
+        return self.radian / other.radian
+    return AnyAngle(self.radian / other, is_radian=True)
`,89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/api_mp_math_angle.md.DKMXAFbW.lean.js b/assets/api_mp_math_angle.md.HvtyV1VE.lean.js similarity index 58% rename from assets/api_mp_math_angle.md.DKMXAFbW.lean.js rename to assets/api_mp_math_angle.md.HvtyV1VE.lean.js index 97c8210..3589a07 100644 --- a/assets/api_mp_math_angle.md.DKMXAFbW.lean.js +++ b/assets/api_mp_math_angle.md.HvtyV1VE.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.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"api/mp_math/angle.md"},l=n("",93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),t={name:"api/mp_math/angle.md"},e=n("",89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/api_mp_math_const.md.Bc1LxtcU.js b/assets/api_mp_math_const.md.Bc1LxtcU.js deleted file mode 100644 index 74807f8..0000000 --- a/assets/api_mp_math_const.md.Bc1LxtcU.js +++ /dev/null @@ -1 +0,0 @@ -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":"api/mp_math/const.md","filePath":"api/mp_math/const.md"}'),o={name:"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 m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/api_mp_math_const.md.Bc1LxtcU.lean.js b/assets/api_mp_math_const.md.Bc1LxtcU.lean.js deleted file mode 100644 index c5d9a74..0000000 --- a/assets/api_mp_math_const.md.Bc1LxtcU.lean.js +++ /dev/null @@ -1 +0,0 @@ -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":"api/mp_math/const.md","filePath":"api/mp_math/const.md"}'),o={name:"api/mp_math/const.md"},n=r("",6),s=[n];function m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/api_mp_math_const.md.BzOZuyZq.js b/assets/api_mp_math_const.md.BzOZuyZq.js new file mode 100644 index 0000000..c3e009c --- /dev/null +++ b/assets/api_mp_math_const.md.BzOZuyZq.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.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"api/mp_math/const.md","filePath":"api/mp_math/const.md"}'),c={name:"api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const h=t(c,[["render",o]]);export{d as __pageData,h as default}; diff --git a/assets/api_mp_math_const.md.BzOZuyZq.lean.js b/assets/api_mp_math_const.md.BzOZuyZq.lean.js new file mode 100644 index 0000000..c3e009c --- /dev/null +++ b/assets/api_mp_math_const.md.BzOZuyZq.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.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"api/mp_math/const.md","filePath":"api/mp_math/const.md"}'),c={name:"api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const h=t(c,[["render",o]]);export{d as __pageData,h as default}; diff --git a/assets/api_mp_math_equation.md.CZgns297.js b/assets/api_mp_math_equation.md.C2RSv9WY.js similarity index 67% rename from assets/api_mp_math_equation.md.CZgns297.js rename to assets/api_mp_math_equation.md.C2RSv9WY.js index 689d313..1f306b3 100644 --- a/assets/api_mp_math_equation.md.CZgns297.js +++ b/assets/api_mp_math_equation.md.C2RSv9WY.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":"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:
+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(`

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

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

参数:

  • func: 函数

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

  • epsilon: 偏移量

返回:

  • 偏导函数

引发:

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

def partial_derivative_func() -> Var

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

func 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:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

func high_order_partial_derivative_func() -> Var

源代码
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

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

曲线方程。

参数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

class CurveEquation

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

曲线方程。

参数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

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

计算曲线上的点。

参数:

  • *t:

  • 参数:

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

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

计算曲线上的点。

参数:

  • *t:

  • 参数:

源代码
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
     if len(t) == 1:
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
-        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

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}; + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
`,24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/api_mp_math_equation.md.CZgns297.lean.js b/assets/api_mp_math_equation.md.C2RSv9WY.lean.js similarity index 57% rename from assets/api_mp_math_equation.md.CZgns297.lean.js rename to assets/api_mp_math_equation.md.C2RSv9WY.lean.js index c846164..72ef7c6 100644 --- a/assets/api_mp_math_equation.md.CZgns297.lean.js +++ b/assets/api_mp_math_equation.md.C2RSv9WY.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":"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}; +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("",24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/api_mp_math_line.md.DHofgyJO.js b/assets/api_mp_math_line.md.BPnyTp_q.js similarity index 58% rename from assets/api_mp_math_line.md.DHofgyJO.js rename to assets/api_mp_math_line.md.BPnyTp_q.js index 159b82c..b6fcabc 100644 --- a/assets/api_mp_math_line.md.DHofgyJO.js +++ b/assets/api_mp_math_line.md.BPnyTp_q.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n(`

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

class Line3

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

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

参数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源码
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

返回:

  • 夹角弧度

引发:

  • TypeError 不支持的类型
源码
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

参数:

  • other: 另一条直线

返回:

  • 夹角弧度

引发:

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

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

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

参数:

  • other: 平行直线或点

返回:

  • 距离

引发:

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

返回:

  • 交点

引发:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

计算两条直线的交点。

参数:

  • other: 另一条直线

返回:

  • 交点

引发:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

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

参数:

  • point: 指定点

返回:

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

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

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

参数:

  • t: 参数t

返回:

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

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

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源代码
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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)

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

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

参数:

  • other: 另一条直线

  • epsilon: 误差

返回:

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

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

判断两条直线是否平行。

参数:

  • other: 另一条直线

返回:

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

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

判断两条直线是否共线。

参数:

  • other: 另一条直线

返回:

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

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

判断点是否在直线上。

参数:

  • point: 点

返回:

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

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

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

参数:

  • other: 另一条直线

返回:

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

def simplify(self)

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

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

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

method simplify(self)

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

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

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

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

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

参数:

  • p1: 点1

  • p2: 点2

返回:

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

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

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

参数:

  • other: 另一条直线

返回:

  • 交点
源代码
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -164,7 +164,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

判断两条直线是否等价。

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

参数:

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

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}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_line.md.BPnyTp_q.lean.js b/assets/api_mp_math_line.md.BPnyTp_q.lean.js new file mode 100644 index 0000000..cc6392a --- /dev/null +++ b/assets/api_mp_math_line.md.BPnyTp_q.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"api/mp_math/line.md","filePath":"api/mp_math/line.md"}'),l={name:"api/mp_math/line.md"},t=n("",119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_line.md.DHofgyJO.lean.js b/assets/api_mp_math_line.md.DHofgyJO.lean.js deleted file mode 100644 index db774ff..0000000 --- a/assets/api_mp_math_line.md.DHofgyJO.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.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_mp_math_typing.md.B0OaWJmF.js b/assets/api_mp_math_mp_math_typing.md.B0OaWJmF.js new file mode 100644 index 0000000..49c5158 --- /dev/null +++ b/assets/api_mp_math_mp_math_typing.md.B0OaWJmF.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":"api/mp_math/mp_math_typing.md","filePath":"api/mp_math/mp_math_typing.md"}'),n={name:"api/mp_math/mp_math_typing.md"},o=l('

var RealNumber = int | float

  • 类型: TypeAlias

var Number = RealNumber | complex

  • 类型: TypeAlias

var Var = SingleVar | ArrayVar

  • 类型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 类型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 类型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 类型: TypeAlias

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

  • 类型: TypeAlias

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

  • 类型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 类型: TypeAlias

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

  • 类型: TypeAlias

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

  • 类型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 类型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 类型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 类型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 类型: TypeAlias
',30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/api_mp_math_mp_math_typing.md.BHJOAxTl.lean.js b/assets/api_mp_math_mp_math_typing.md.B0OaWJmF.lean.js similarity index 66% rename from assets/api_mp_math_mp_math_typing.md.BHJOAxTl.lean.js rename to assets/api_mp_math_mp_math_typing.md.B0OaWJmF.lean.js index c657b53..39bde04 100644 --- a/assets/api_mp_math_mp_math_typing.md.BHJOAxTl.lean.js +++ b/assets/api_mp_math_mp_math_typing.md.B0OaWJmF.lean.js @@ -1 +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":"api/mp_math/mp_math_typing.md","filePath":"api/mp_math/mp_math_typing.md"}'),n={name:"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}; +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":"api/mp_math/mp_math_typing.md","filePath":"api/mp_math/mp_math_typing.md"}'),n={name:"api/mp_math/mp_math_typing.md"},o=l("",30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/api_mp_math_mp_math_typing.md.BHJOAxTl.js b/assets/api_mp_math_mp_math_typing.md.BHJOAxTl.js deleted file mode 100644 index 3a682b3..0000000 --- a/assets/api_mp_math_mp_math_typing.md.BHJOAxTl.js +++ /dev/null @@ -1 +0,0 @@ -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":"api/mp_math/mp_math_typing.md","filePath":"api/mp_math/mp_math_typing.md"}'),n={name:"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/api_mp_math_plane.md.DLhf2OdI.js b/assets/api_mp_math_plane.md.DLhf2OdI.js new file mode 100644 index 0000000..2678270 --- /dev/null +++ b/assets/api_mp_math_plane.md.DLhf2OdI.js @@ -0,0 +1,196 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n(`

class Plane3

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

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

参数:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

源代码
python
def __init__(self, a: float, b: float, c: float, d: float):
+    """
+        平面方程:ax + by + cz + d = 0
+        Args:
+            a: x系数
+            b: y系数
+            c: z系数
+            d: 常数项
+        """
+    self.a = a
+    self.b = b
+    self.c = c
+    self.d = d

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

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

参数:

  • other: 另一个平面

返回:

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

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

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

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

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

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

method 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

method normal(self) -> Vector3

平面的法向量。

返回:

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

@classmethod

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

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

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源代码
python
@classmethod
+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

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

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

参数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

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

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

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

参数:

  • l1: 直线1

  • l2: 直线2

返回:

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

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

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

参数:

  • point: 面上一点

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

返回:

  • 平面
源代码
python
@classmethod
+def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由点和直线构造平面。
+        Args:
+            point: 面上一点
+            line: 面上直线,不包含点
+        Returns:
+            平面
+        """
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

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

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

method __eq__(self, other) -> bool

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

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

源代码
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,116),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.DZBu-HIq.lean.js b/assets/api_mp_math_plane.md.DLhf2OdI.lean.js similarity index 85% rename from assets/api_mp_math_plane.md.DZBu-HIq.lean.js rename to assets/api_mp_math_plane.md.DLhf2OdI.lean.js index af445f4..f2f27fd 100644 --- a/assets/api_mp_math_plane.md.DZBu-HIq.lean.js +++ b/assets/api_mp_math_plane.md.DLhf2OdI.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("",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}; +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("",116),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.0dOKpGzi.js b/assets/api_mp_math_point.md.0dOKpGzi.js new file mode 100644 index 0000000..12ce1d5 --- /dev/null +++ b/assets/api_mp_math_point.md.0dOKpGzi.js @@ -0,0 +1,51 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),n={name:"api/mp_math/point.md"},h=t(`

class Point3

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

笛卡尔坐标系中的点。

参数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

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

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

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

参数:

  • other:

  • epsilon:

返回:

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

@overload

method self + other: Vector3 => Point3

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

@overload

method self + other: Point3 => Point3

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

method self + other

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

参数:

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

method __eq__(self, other)

判断两个点是否相等。

参数:

  • other:
源代码
python
def __eq__(self, other):
+    """
+        判断两个点是否相等。
+        Args:
+            other:
+        Returns:
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

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

参数:

  • other:
源代码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    """
+        P - P -> V
+
+        P - V -> P  已在 :class:\`Vector3\` 中实现
+        Args:
+            other:
+        Returns:
+
+        """
+    from .vector import Vector3
+    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_point.md.0dOKpGzi.lean.js b/assets/api_mp_math_point.md.0dOKpGzi.lean.js new file mode 100644 index 0000000..2052d03 --- /dev/null +++ b/assets/api_mp_math_point.md.0dOKpGzi.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),n={name:"api/mp_math/point.md"},h=t("",35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_point.md.CGqzS8ew.lean.js b/assets/api_mp_math_point.md.CGqzS8ew.lean.js deleted file mode 100644 index 671d756..0000000 --- a/assets/api_mp_math_point.md.CGqzS8ew.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_segment.md.B0wRl0bP.js b/assets/api_mp_math_segment.md.9QWXtPbn.js similarity index 54% rename from assets/api_mp_math_segment.md.B0wRl0bP.js rename to assets/api_mp_math_segment.md.9QWXtPbn.js index 9ec5df3..4eab4c2 100644 --- a/assets/api_mp_math_segment.md.B0wRl0bP.js +++ b/assets/api_mp_math_segment.md.9QWXtPbn.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"api/mp_math/segment.md"},h=n(`

class Segment3

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

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

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

class Segment3

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

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

源代码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -11,6 +11,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     '长度'
     self.length = self.direction.length
     '中心点'
-    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

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}; + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
`,4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/api_mp_math_segment.md.B0wRl0bP.lean.js b/assets/api_mp_math_segment.md.9QWXtPbn.lean.js similarity index 85% rename from assets/api_mp_math_segment.md.B0wRl0bP.lean.js rename to assets/api_mp_math_segment.md.9QWXtPbn.lean.js index 650fdb4..d7a0a0b 100644 --- a/assets/api_mp_math_segment.md.B0wRl0bP.lean.js +++ b/assets/api_mp_math_segment.md.9QWXtPbn.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"api/mp_math/segment.md"},h=n("",8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"api/mp_math/segment.md","filePath":"api/mp_math/segment.md"}'),t={name:"api/mp_math/segment.md"},h=n("",4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/api_mp_math_utils.md.C9bdphO4.lean.js b/assets/api_mp_math_utils.md.C9bdphO4.lean.js deleted file mode 100644 index 51aea95..0000000 --- a/assets/api_mp_math_utils.md.C9bdphO4.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_utils.md.C9bdphO4.js b/assets/api_mp_math_utils.md.DdkUph5B.js similarity index 59% rename from assets/api_mp_math_utils.md.C9bdphO4.js rename to assets/api_mp_math_utils.md.DdkUph5B.js index 32c3e97..fe3378f 100644 --- a/assets/api_mp_math_utils.md.C9bdphO4.js +++ b/assets/api_mp_math_utils.md.DdkUph5B.js @@ -1,26 +1,25 @@ -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 E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},t=n(`

func clamp() -> float

区间限定函数

参数:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

返回:

  • 限制后的值
源代码
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        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:
+    return max(min(x, max_), min_)

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

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

参数:

  • x: 数1

  • y: 数2

  • epsilon: 误差

返回:

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

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

获取数的符号。

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源代码
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -33,7 +32,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 ''

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

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

参数:

  • x: 数

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

返回:

  • 符号 + - ""
源代码
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -49,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

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

def __eq__(self, other)

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

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

源代码
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -60,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

源码
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,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}; + self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

源代码
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_utils.md.DdkUph5B.lean.js b/assets/api_mp_math_utils.md.DdkUph5B.lean.js new file mode 100644 index 0000000..8559b88 --- /dev/null +++ b/assets/api_mp_math_utils.md.DdkUph5B.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"api/mp_math/utils.md","filePath":"api/mp_math/utils.md"}'),l={name:"api/mp_math/utils.md"},t=n("",37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/api_mp_math_vector.md.BEh63_ZE.lean.js b/assets/api_mp_math_vector.md.BEh63_ZE.lean.js deleted file mode 100644 index 3838d2b..0000000 --- a/assets/api_mp_math_vector.md.BEh63_ZE.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_mp_math_vector.md.BEh63_ZE.js b/assets/api_mp_math_vector.md.Bodba8jG.js similarity index 63% rename from assets/api_mp_math_vector.md.BEh63_ZE.js rename to assets/api_mp_math_vector.md.Bodba8jG.js index 4ebb1ef..0428b35 100644 --- a/assets/api_mp_math_vector.md.BEh63_ZE.js +++ b/assets/api_mp_math_vector.md.Bodba8jG.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"}'),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):
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),n={name:"api/mp_math/vector.md"},h=t(`

class Vector3

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

3维向量

参数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源代码
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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

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

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

参数:

  • other:

  • epsilon:

返回:

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

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

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

参数:

  • other: 另一个向量

返回:

  • 夹角
源代码
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -26,7 +26,7 @@ import{_ as s,c as i,o as a,a2 as 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,则两向量平行。 其余结果的模为平行四边形的面积。

参数:

  • other:

返回:

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

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

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

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

参数:

  • other:

返回:

  • 行列式的结果
源代码
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -46,7 +46,7 @@ import{_ as s,c as i,o as a,a2 as 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)

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

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

参数:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源代码
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -55,7 +55,7 @@ import{_ as s,c as i,o as a,a2 as 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

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

判断两个向量是否平行。

参数:

  • other: 另一个向量

返回:

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

def normalize(self)

将向量归一化。

自体归一化,不返回值。

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

method normalize(self)

将向量归一化。

自体归一化,不返回值。

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

@property

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

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

@property

method np_array(self) -> np.ndarray

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

@property

def length(self) -> float

向量的模。

返回:

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

@property

method length(self) -> float

向量的模。

返回:

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

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

返回:

  • 单位向量
源码
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

返回:

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

def __abs__(self)

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

@overload

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

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

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

method self + other

V + P -> P

V + V -> V

参数:

  • other:
源代码
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as 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)}'")

method __eq__(self, other)

判断两个向量是否相等。

参数:

  • other:

返回:

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

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

P + V -> P

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

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

method self + other: Point3 => Point3

P + V -> P

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

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

@overload

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

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

@overload

method self - other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

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

method self - other

V - P -> P

V - V -> V

参数:

  • other:
源代码
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as 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 __rsub__(self, other: 'Point3')

P - V -> P

参数:

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

method self - other: Point3

P - V -> P

参数:

  • other:
源代码
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

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

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

@overload

method self * other: Vector3 => Vector3

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

@overload

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

源码
python
@overload
+    ...

@overload

method 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':
+    ...

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

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

参数:

  • other:
源代码
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> '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':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

点乘。

参数:

  • other:
源代码
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

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}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • 类型: Vector3

  • 说明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 类型: Vector3

  • 说明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 类型: Vector3

  • 说明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 类型: Vector3

  • 说明: z轴单位向量

`,133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_mp_math_vector.md.Bodba8jG.lean.js b/assets/api_mp_math_vector.md.Bodba8jG.lean.js new file mode 100644 index 0000000..43c5e0a --- /dev/null +++ b/assets/api_mp_math_vector.md.Bodba8jG.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"api/mp_math/vector.md","filePath":"api/mp_math/vector.md"}'),n={name:"api/mp_math/vector.md"},h=t("",133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/api_presets_model_index.md.DLrch_Ju.js b/assets/api_presets_model_index.md.YrmtLmca.js similarity index 82% rename from assets/api_presets_model_index.md.DLrch_Ju.js rename to assets/api_presets_model_index.md.YrmtLmca.js index 3035559..d66832e 100644 --- a/assets/api_presets_model_index.md.DLrch_Ju.js +++ b/assets/api_presets_model_index.md.YrmtLmca.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:

返回:

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

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

参数:

  • radius:

  • density:

返回:

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

class Angle

class AnyAngle

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

任意角度。

Args:

  • value: 角度或弧度值

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

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

class Angle

class AnyAngle(Angle)

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

任意角度。

Arguments:

  • value: 角度或弧度值

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

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

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

Return:

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

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

Return:

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

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

Return:

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

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

Return:

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

@property

def degree(self) -> float

角度。

Return:

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

@property

method degree(self) -> float

角度。

Return:

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

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

Return:

  • 最小正角度
Source code
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

Return:

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

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

Return:

  • 最大负角度
Source code
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

Return:

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

@property

def sin(self) -> float

正弦值。

Return:

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

@property

method sin(self) -> float

正弦值。

Return:

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

@property

def cos(self) -> float

余弦值。

Return:

  • 余弦值
Source code
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

Return:

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

@property

def tan(self) -> float

正切值。

Return:

  • 正切值
Source code
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

Return:

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

@property

def cot(self) -> float

余切值。

Return:

  • 余切值
Source code
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

Return:

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

@property

def sec(self) -> float

正割值。

Return:

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

@property

method sec(self) -> float

正割值。

Return:

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

@property

def csc(self) -> float

余割值。

Return:

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

@property

method csc(self) -> float

余割值。

Return:

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

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

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

def __eq__(self, other)

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

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

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

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

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

def __repr__(self)

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

def __str__(self)

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

@overload

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

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

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

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

Source code
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

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

def __truediv__(self, other)

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

method self / other

Source code
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const F=s(n,[["render",h]]);export{c as __pageData,F as default}; + return AnyAngle(self.radian / other, is_radian=True)
`,89),l=[t];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/en_api_mp_math_angle.md.fmci6qlC.lean.js b/assets/en_api_mp_math_angle.md.fmci6qlC.lean.js new file mode 100644 index 0000000..3b6207d --- /dev/null +++ b/assets/en_api_mp_math_angle.md.fmci6qlC.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const c=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),e={name:"en/api/mp_math/angle.md"},t=n("",89),l=[t];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const F=s(e,[["render",h]]);export{c as __pageData,F as default}; diff --git a/assets/en_api_mp_math_const.md.6yNmEodn.js b/assets/en_api_mp_math_const.md.6yNmEodn.js new file mode 100644 index 0000000..05197b6 --- /dev/null +++ b/assets/en_api_mp_math_const.md.6yNmEodn.js @@ -0,0 +1 @@ +import{_ as t,c as e,o as a}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"en/api/mp_math/const.md","filePath":"en/api/mp_math/const.md"}'),n={name:"en/api/mp_math/const.md"};function c(o,s,m,p,r,_){return a(),e("div")}const h=t(n,[["render",c]]);export{d as __pageData,h as default}; diff --git a/assets/en_api_mp_math_const.md.6yNmEodn.lean.js b/assets/en_api_mp_math_const.md.6yNmEodn.lean.js new file mode 100644 index 0000000..05197b6 --- /dev/null +++ b/assets/en_api_mp_math_const.md.6yNmEodn.lean.js @@ -0,0 +1 @@ +import{_ as t,c as e,o as a}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"en/api/mp_math/const.md","filePath":"en/api/mp_math/const.md"}'),n={name:"en/api/mp_math/const.md"};function c(o,s,m,p,r,_){return a(),e("div")}const h=t(n,[["render",c]]);export{d as __pageData,h as default}; diff --git a/assets/en_api_mp_math_const.md.DfcWuGeV.js b/assets/en_api_mp_math_const.md.DfcWuGeV.js deleted file mode 100644 index b1cbd9e..0000000 --- a/assets/en_api_mp_math_const.md.DfcWuGeV.js +++ /dev/null @@ -1 +0,0 @@ -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":"en/api/mp_math/const.md","filePath":"en/api/mp_math/const.md"}'),o={name:"en/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 m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/en_api_mp_math_const.md.DfcWuGeV.lean.js b/assets/en_api_mp_math_const.md.DfcWuGeV.lean.js deleted file mode 100644 index 10a095f..0000000 --- a/assets/en_api_mp_math_const.md.DfcWuGeV.lean.js +++ /dev/null @@ -1 +0,0 @@ -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":"en/api/mp_math/const.md","filePath":"en/api/mp_math/const.md"}'),o={name:"en/api/mp_math/const.md"},n=r("",6),s=[n];function m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/en_api_mp_math_equation.md.BQv4WWiJ.js b/assets/en_api_mp_math_equation.md.BwRlBW4s.js similarity index 67% rename from assets/en_api_mp_math_equation.md.BQv4WWiJ.js rename to assets/en_api_mp_math_equation.md.BwRlBW4s.js index 75dbb88..e693d2a 100644 --- a/assets/en_api_mp_math_equation.md.BQv4WWiJ.js +++ b/assets/en_api_mp_math_equation.md.BwRlBW4s.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: 偏移量

Return:

  • 偏导函数

Raises:

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

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

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

Arguments:

  • func: 函数

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

  • epsilon: 偏移量

Return:

  • 偏导函数

Raises:

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

def partial_derivative_func() -> Var

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

func partial_derivative_func() -> Var

Source code
python
def partial_derivative_func(*args: Var) -> Var:
     args_list_plus = list(args)
     args_list_plus[var] += epsilon
     args_list_minus = list(args)
     args_list_minus[var] -= epsilon
-    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

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

func high_order_partial_derivative_func() -> Var

Source code
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

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

曲线方程。

Args:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

class CurveEquation

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

曲线方程。

Arguments:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

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

计算曲线上的点。

Args:

  • *t:

  • 参数:

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

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

计算曲线上的点。

Arguments:

  • *t:

  • 参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
     if len(t) == 1:
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
-        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

def __str__(self)

Source code
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,d,E,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{u as __pageData,y as default}; + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
`,24),h=[t];function p(k,e,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/en_api_mp_math_equation.md.BQv4WWiJ.lean.js b/assets/en_api_mp_math_equation.md.BwRlBW4s.lean.js similarity index 86% rename from assets/en_api_mp_math_equation.md.BQv4WWiJ.lean.js rename to assets/en_api_mp_math_equation.md.BwRlBW4s.lean.js index d1c0fef..4c7a6bf 100644 --- a/assets/en_api_mp_math_equation.md.BQv4WWiJ.lean.js +++ b/assets/en_api_mp_math_equation.md.BwRlBW4s.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("",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}; +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("",24),h=[t];function p(k,e,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/en_api_mp_math_line.md.CAJnDKCu.js b/assets/en_api_mp_math_line.md.B1oAhkHS.js similarity index 59% rename from assets/en_api_mp_math_line.md.CAJnDKCu.js rename to assets/en_api_mp_math_line.md.B1oAhkHS.js index 9bb040a..ed13bff 100644 --- a/assets/en_api_mp_math_line.md.CAJnDKCu.js +++ b/assets/en_api_mp_math_line.md.B1oAhkHS.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n(`

class Line3

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

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

Args:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

class Line3

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

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

Arguments:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

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

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

Arguments:

  • other: 另一条直线

  • epsilon: 误差

Return:

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

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

Arguments:

  • other: 另一条直线

Return:

  • 夹角弧度

Raises:

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

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

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

Arguments:

  • other: 平行直线或点

Return:

  • 距离

Raises:

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

Return:

  • 交点

Raises:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return:

  • 交点

Raises:

  • ValueError 直线平行

  • ValueError 直线不共面

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

Return:

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

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

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

Arguments:

  • point: 指定点

Return:

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

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

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

Arguments:

  • t: 参数t

Return:

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

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

获取直线的参数方程。

Return:

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

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

获取直线的参数方程。

Return:

  • x(t), y(t), z(t)
Source code
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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

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

Args:

  • other: 另一条直线

  • epsilon: 误差

Return:

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

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

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

Arguments:

  • other: 另一条直线

  • epsilon: 误差

Return:

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

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

判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return:

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

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

判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return:

  • 是否共线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -110,7 +110,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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: 点

Return:

  • 是否在直线上
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

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

判断点是否在直线上。

Arguments:

  • point: 点

Return:

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

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

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

Arguments:

  • other: 另一条直线

Return:

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

def simplify(self)

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

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

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

method simplify(self)

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

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

Source code
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -140,7 +140,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

Return:

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

@classmethod

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

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

Arguments:

  • p1: 点1

  • p2: 点2

Return:

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

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

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

Arguments:

  • other: 另一条直线

Return:

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

Args:

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

method __eq__(self, other) -> bool

判断两条直线是否等价。

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

Arguments:

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

def __str__(self)

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

Source code
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}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,119),h=[t];function e(p,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",e]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_line.md.B1oAhkHS.lean.js b/assets/en_api_mp_math_line.md.B1oAhkHS.lean.js new file mode 100644 index 0000000..bd73715 --- /dev/null +++ b/assets/en_api_mp_math_line.md.B1oAhkHS.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"en/api/mp_math/line.md","filePath":"en/api/mp_math/line.md"}'),l={name:"en/api/mp_math/line.md"},t=n("",119),h=[t];function e(p,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",e]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_line.md.CAJnDKCu.lean.js b/assets/en_api_mp_math_line.md.CAJnDKCu.lean.js deleted file mode 100644 index 4cd598e..0000000 --- a/assets/en_api_mp_math_line.md.CAJnDKCu.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.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_mp_math_typing.md.Ba9aYPR2.js b/assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.js new file mode 100644 index 0000000..9e75697 --- /dev/null +++ b/assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.js @@ -0,0 +1 @@ +import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"en/api/mp_math/mp_math_typing.md","filePath":"en/api/mp_math/mp_math_typing.md"}'),n={name:"en/api/mp_math/mp_math_typing.md"},o=l('

var RealNumber = int | float

  • Type: TypeAlias

var Number = RealNumber | complex

  • Type: TypeAlias

var Var = SingleVar | ArrayVar

  • Type: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • Type: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • Type: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • Type: TypeAlias

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

  • Type: TypeAlias

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

  • Type: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • Type: TypeAlias

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

  • Type: TypeAlias

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

  • Type: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • Type: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • Type: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • Type: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • Type: TypeAlias
',30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const m=a(n,[["render",s]]);export{y as __pageData,m as default}; diff --git a/assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.lean.js b/assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.lean.js similarity index 51% rename from assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.lean.js rename to assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.lean.js index d129413..3683ece 100644 --- a/assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.lean.js +++ b/assets/en_api_mp_math_mp_math_typing.md.Ba9aYPR2.lean.js @@ -1 +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":"en/api/mp_math/mp_math_typing.md","filePath":"en/api/mp_math/mp_math_typing.md"}'),n={name:"en/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}; +import{_ as a,c as r,o as e,a2 as l}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.mp_math_typing","description":"","frontmatter":{"title":"mbcp.mp_math.mp_math_typing"},"headers":[],"relativePath":"en/api/mp_math/mp_math_typing.md","filePath":"en/api/mp_math/mp_math_typing.md"}'),n={name:"en/api/mp_math/mp_math_typing.md"},o=l("",30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const m=a(n,[["render",s]]);export{y as __pageData,m as default}; diff --git a/assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.js b/assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.js deleted file mode 100644 index 05df201..0000000 --- a/assets/en_api_mp_math_mp_math_typing.md.Dh1by9kw.js +++ /dev/null @@ -1 +0,0 @@ -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":"en/api/mp_math/mp_math_typing.md","filePath":"en/api/mp_math/mp_math_typing.md"}'),n={name:"en/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/en_api_mp_math_plane.md.B-VJJllR.js b/assets/en_api_mp_math_plane.md.D3xHJy8e.js similarity index 64% rename from assets/en_api_mp_math_plane.md.B-VJJllR.js rename to assets/en_api_mp_math_plane.md.D3xHJy8e.js index e76b680..38887e1 100644 --- a/assets/en_api_mp_math_plane.md.B-VJJllR.js +++ b/assets/en_api_mp_math_plane.md.D3xHJy8e.js @@ -1,25 +1,23 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"en/api/mp_math/plane.md","filePath":"en/api/mp_math/plane.md"}'),l={name:"en/api/mp_math/plane.md"},h=n(`

class Plane3

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

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

Args:

  • a:

  • b:

  • c:

  • d:

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

class Plane3

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

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

Arguments:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            d: 常数项
         """
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

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

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

Args:

  • other:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

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

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

Arguments:

  • other: 另一个平面

Return:

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

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

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

Args:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

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

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

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

Arguments:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -45,7 +43,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

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

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

Args:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

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

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

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

Arguments:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

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

Return:

  • 交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

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

计算两平面的交线。

Arguments:

  • other: 另一个平面

Return:

  • 两平面的交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
-        计算两平面的交线。该方法有问题,待修复。
+        计算两平面的交线。
         Args:
             other: 另一个平面
         Returns:
-            交线
+            两平面的交线
         Raises:
         """
     if self.normal.is_parallel(other.normal):
@@ -85,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

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

计算平面与直线的交点。

Args:

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

Return:

  • 交点

Raises:

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

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

计算平面与直线的交点。

Arguments:

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

Return:

  • 交点

Raises:

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

Return:

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

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

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

Arguments:

  • point: 指定点

Return:

  • 所求平面
Source code
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

判断两个平面是否平行。

Args:

  • other: 另一个平面

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

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

判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return:

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

@property

def normal(self) -> 'Vector3'

平面的法向量。

Return:

  • 法向量
Source code
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

Return:

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

@classmethod

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

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

Args:

  • point: 平面上的一点

  • normal: 法向量

Return:

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

@classmethod

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

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

Arguments:

  • point: 平面上的一点

  • normal: 法向量

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +132,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

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

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

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Return:

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

@classmethod

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

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

Arguments:

  • 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 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

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

Args:

  • l1: 直线1

  • l2: 直线2

Return:

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

@classmethod

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

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

Arguments:

  • l1: 直线1

  • l2: 直线2

Return:

  • 平面
Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +160,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

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

Args:

  • point: 面上一点

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

Return:

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

@classmethod

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

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

Arguments:

  • point: 面上一点

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

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -172,22 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

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

def __str__(self)

Source code
python
def __str__(self):
-    s = 'Plane3: '
-    if self.a != 0:
-        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
-    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'

Source code
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

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

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

@overload

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

Source code
python
@overload
+    ...

@overload

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

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

def __and__(self, other)

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

Args:

  • other:

Return:

  • 不平行平面的交线,平面平行返回None
Source code
python
def __and__(self, other):
+    ...

method __and__(self, other)

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

Arguments:

  • other:

Return:

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

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

`,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}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

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

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

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,116),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.B-VJJllR.lean.js b/assets/en_api_mp_math_plane.md.D3xHJy8e.lean.js similarity index 85% rename from assets/en_api_mp_math_plane.md.B-VJJllR.lean.js rename to assets/en_api_mp_math_plane.md.D3xHJy8e.lean.js index c20c049..b1f0e83 100644 --- a/assets/en_api_mp_math_plane.md.B-VJJllR.lean.js +++ b/assets/en_api_mp_math_plane.md.D3xHJy8e.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("",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}; +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("",116),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.CCE-yfrm.lean.js b/assets/en_api_mp_math_point.md.CCE-yfrm.lean.js deleted file mode 100644 index a40890a..0000000 --- a/assets/en_api_mp_math_point.md.CCE-yfrm.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_point.md.CCE-yfrm.js b/assets/en_api_mp_math_point.md.P1GRdc2H.js similarity index 56% rename from assets/en_api_mp_math_point.md.CCE-yfrm.js rename to assets/en_api_mp_math_point.md.P1GRdc2H.js index fac2914..dfd3fc3 100644 --- a/assets/en_api_mp_math_point.md.CCE-yfrm.js +++ b/assets/en_api_mp_math_point.md.P1GRdc2H.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),t={name:"en/api/mp_math/point.md"},l=n(`

class Point3

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

笛卡尔坐标系中的点。

Args:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

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

class Point3

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

笛卡尔坐标系中的点。

Arguments:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

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

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

Arguments:

  • other:

  • epsilon:

Return:

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

def __str__(self)

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

@overload

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

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

@overload

method self + other: Vector3 => Point3

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

@overload

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

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

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

def __add__(self, other)

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

Args:

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

method self + other

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

Arguments:

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

def __eq__(self, other)

判断两个点是否相等。

Args:

  • other:
Source code
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

Arguments:

  • other:
Source code
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

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

P - P -> V

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

Args:

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

method self - other: Point3 => Vector3

P - P -> V

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

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -49,4 +48,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)
`,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}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_point.md.P1GRdc2H.lean.js b/assets/en_api_mp_math_point.md.P1GRdc2H.lean.js new file mode 100644 index 0000000..90dba7c --- /dev/null +++ b/assets/en_api_mp_math_point.md.P1GRdc2H.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),n={name:"en/api/mp_math/point.md"},h=t("",35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_segment.md.CUQFMm0Q.js b/assets/en_api_mp_math_segment.md.DqDvJpQR.js similarity index 50% rename from assets/en_api_mp_math_segment.md.CUQFMm0Q.js rename to assets/en_api_mp_math_segment.md.DqDvJpQR.js index 66345f9..eb3dad5 100644 --- a/assets/en_api_mp_math_segment.md.CUQFMm0Q.js +++ b/assets/en_api_mp_math_segment.md.DqDvJpQR.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),t={name:"en/api/mp_math/segment.md"},h=n(`

class Segment3

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

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

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

class Segment3

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

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

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -11,6 +11,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     '长度'
     self.length = self.direction.length
     '中心点'
-    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

def __repr__(self)

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

def __str__(self)

Source code
python
def __str__(self):
-    return f'Segment3({self.p1} -> {self.p2})'
`,8),e=[h];function p(l,k,d,r,E,g){return a(),i("div",null,e)}const o=s(t,[["render",p]]);export{y as __pageData,o as default}; + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
`,4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const y=s(t,[["render",l]]);export{o as __pageData,y as default}; diff --git a/assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js b/assets/en_api_mp_math_segment.md.DqDvJpQR.lean.js similarity index 57% rename from assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js rename to assets/en_api_mp_math_segment.md.DqDvJpQR.lean.js index c25d96b..10ebc2f 100644 --- a/assets/en_api_mp_math_segment.md.CUQFMm0Q.lean.js +++ b/assets/en_api_mp_math_segment.md.DqDvJpQR.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),t={name:"en/api/mp_math/segment.md"},h=n("",8),e=[h];function p(l,k,d,r,E,g){return a(),i("div",null,e)}const o=s(t,[["render",p]]);export{y as __pageData,o as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),t={name:"en/api/mp_math/segment.md"},h=n("",4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const y=s(t,[["render",l]]);export{o as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_utils.md.Dgzoi9ec.js b/assets/en_api_mp_math_utils.md.B0nejTCy.js similarity index 60% rename from assets/ja_api_mp_math_utils.md.Dgzoi9ec.js rename to assets/en_api_mp_math_utils.md.B0nejTCy.js index 67787d7..641859c 100644 --- a/assets/ja_api_mp_math_utils.md.Dgzoi9ec.js +++ b/assets/en_api_mp_math_utils.md.B0nejTCy.js @@ -1,26 +1,25 @@ -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:
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},t=n(`

func clamp() -> float

区间限定函数

Arguments:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

Return:

  • 限制后的值
Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        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:
+    return max(min(x, max_), min_)

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

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

Arguments:

  • x: 数1

  • y: 数2

  • epsilon: 误差

Return:

  • 是否近似相等
Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
-        x:
-        y:
-        epsilon:
-
+        x: 数1
+        y: 数2
+        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:
+    return abs(x - y) < epsilon

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

获取数的符号。

Arguments:

  • x: 数

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

Return:

  • 符号 + - ""
Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -33,7 +32,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 ''

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

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

Arguments:

  • x: 数

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

Return:

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

class Approx

def __init__(self, value: RealNumber)

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

def __eq__(self, other)

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

class Approx

method __init__(self, value: RealNumber)

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

method __eq__(self, other)

Source code
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -60,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

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

def __ne__(self, other)

ソースコード
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,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}; + self.raise_type_error(other)

method raise_type_error(self, other)

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

method __ne__(self, other)

Source code
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,37),h=[t];function p(e,k,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_utils.md.B0nejTCy.lean.js b/assets/en_api_mp_math_utils.md.B0nejTCy.lean.js new file mode 100644 index 0000000..f3abe36 --- /dev/null +++ b/assets/en_api_mp_math_utils.md.B0nejTCy.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"en/api/mp_math/utils.md","filePath":"en/api/mp_math/utils.md"}'),l={name:"en/api/mp_math/utils.md"},t=n("",37),h=[t];function p(e,k,r,d,o,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_utils.md.CuiyHRtY.lean.js b/assets/en_api_mp_math_utils.md.CuiyHRtY.lean.js deleted file mode 100644 index 77222ad..0000000 --- a/assets/en_api_mp_math_utils.md.CuiyHRtY.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.mp_math.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.3xep9oDm.lean.js b/assets/en_api_mp_math_vector.md.3xep9oDm.lean.js deleted file mode 100644 index 0707a9a..0000000 --- a/assets/en_api_mp_math_vector.md.3xep9oDm.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_mp_math_vector.md.BpRKRIGw.js b/assets/en_api_mp_math_vector.md.BpRKRIGw.js new file mode 100644 index 0000000..a1687d7 --- /dev/null +++ b/assets/en_api_mp_math_vector.md.BpRKRIGw.js @@ -0,0 +1,187 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),n={name:"en/api/mp_math/vector.md"},h=t(`

class Vector3

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

3维向量

Arguments:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

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

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

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

Arguments:

  • other:

  • epsilon:

Return:

  • 是否近似相等
Source code
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])

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

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

Arguments:

  • other: 另一个向量

Return:

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

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

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

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

Arguments:

  • other:

Return:

  • 行列式的结果
Source code
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)

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

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

Arguments:

  • other: 另一个向量

  • epsilon: 允许的误差

Return:

  • 是否近似平行
Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似平行。
+        Args:
+            other: 另一个向量
+            epsilon: 允许的误差
+        Returns:
+            是否近似平行
+        """
+    return self.cross(other).length < epsilon

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

判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return:

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

method normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    """
+        将向量归一化。
+
+        自体归一化,不返回值。
+        """
+    length = self.length
+    self.x /= length
+    self.y /= length
+    self.z /= length

@property

method np_array(self) -> np.ndarray

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

@property

method length(self) -> float

向量的模。

Return:

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

@property

method unit(self) -> Vector3

获取该向量的单位向量。

Return:

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

method __abs__(self)

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

@overload

method self + other: Vector3 => Vector3

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

@overload

method self + other: Point3 => Point3

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

method self + other

V + P -> P

V + V -> V

Arguments:

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

method __eq__(self, other)

判断两个向量是否相等。

Arguments:

  • other:

Return:

  • 是否相等
Source code
python
def __eq__(self, other):
+    """
+        判断两个向量是否相等。
+        Args:
+            other:
+        Returns:
+            是否相等
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => Point3

P + V -> P

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

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

method self - other: Vector3 => Vector3

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

@overload

method self - other: Point3 => Point3

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

method self - other

V - P -> P

V - V -> V

Arguments:

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

method self - other: Point3

P - V -> P

Arguments:

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

method self * other: Vector3 => Vector3

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

@overload

method self * other: RealNumber => Vector3

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

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

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

Arguments:

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

method self * other: RealNumber => Vector3

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

method self @ other: Vector3 => RealNumber

点乘。

Arguments:

  • other:
Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+    """
+        点乘。
+        Args:
+            other:
+        Returns:
+        """
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

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

method - self

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

var zero_vector3 = Vector3(0, 0, 0)

  • Type: Vector3

  • Description: 零向量

var x_axis = Vector3(1, 0, 0)

  • Type: Vector3

  • Description: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • Type: Vector3

  • Description: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • Type: Vector3

  • Description: z轴单位向量

`,133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_mp_math_vector.md.BpRKRIGw.lean.js b/assets/en_api_mp_math_vector.md.BpRKRIGw.lean.js new file mode 100644 index 0000000..d177c3f --- /dev/null +++ b/assets/en_api_mp_math_vector.md.BpRKRIGw.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"en/api/mp_math/vector.md","filePath":"en/api/mp_math/vector.md"}'),n={name:"en/api/mp_math/vector.md"},h=t("",133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.1ewGi0do.js b/assets/en_api_presets_model_index.md.j5zmPSwU.js similarity index 82% rename from assets/en_api_presets_model_index.md.1ewGi0do.js rename to assets/en_api_presets_model_index.md.j5zmPSwU.js index 299d197..205228e 100644 --- a/assets/en_api_presets_model_index.md.1ewGi0do.js +++ b/assets/en_api_presets_model_index.md.j5zmPSwU.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:

Return:

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

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

Arguments:

  • radius:

  • density:

Return:

  • List[Point3]: 球体上的点集。
Source code
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -15,4 +15,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     x_array = radius * np.sin(phi_list) * np.cos(theta_list)
     y_array = radius * np.sin(phi_list) * np.sin(theta_list)
     z_array = radius * np.cos(phi_list)
-    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,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}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/en_api_presets_model_index.md.1ewGi0do.lean.js b/assets/en_api_presets_model_index.md.j5zmPSwU.lean.js similarity index 58% rename from assets/en_api_presets_model_index.md.1ewGi0do.lean.js rename to assets/en_api_presets_model_index.md.j5zmPSwU.lean.js index 91d45a0..69c8af9 100644 --- a/assets/en_api_presets_model_index.md.1ewGi0do.lean.js +++ b/assets/en_api_presets_model_index.md.j5zmPSwU.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("",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}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"en/api/presets/model/index.md","filePath":"en/api/presets/model/index.md"}'),t={name:"en/api/presets/model/index.md"},h=n("",9),l=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_angle.md._xBKQuir.js b/assets/ja_api_mp_math_angle.md.D2dStPZh.js similarity index 61% rename from assets/ja_api_mp_math_angle.md._xBKQuir.js rename to assets/ja_api_mp_math_angle.md.D2dStPZh.js index e87acc2..01d7a73 100644 --- a/assets/ja_api_mp_math_angle.md._xBKQuir.js +++ b/assets/ja_api_mp_math_angle.md.D2dStPZh.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/api/mp_math/angle.md"},l=n(`

class Angle

class AnyAngle

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

任意角度。

引数:

  • value: 角度或弧度值

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

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

class Angle

class AnyAngle(Angle)

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

任意角度。

引数:

  • value: 角度或弧度值

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

ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,94 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

戻り値:

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

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

戻り値:

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

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

戻り値:

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

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

戻り値:

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

@property

def degree(self) -> float

角度。

戻り値:

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

@property

method degree(self) -> float

角度。

戻り値:

  • 弧度
ソースコード
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

戻り値:

  • 最小正角度
ソースコード
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

戻り値:

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

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

戻り値:

  • 最大负角度
ソースコード
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

戻り値:

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

@property

def sin(self) -> float

正弦值。

戻り値:

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

@property

method sin(self) -> float

正弦值。

戻り値:

  • 正弦值
ソースコード
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

戻り値:

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

@property

method cos(self) -> float

余弦值。

戻り値:

  • 余弦值
ソースコード
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

戻り値:

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

@property

method tan(self) -> float

正切值。

戻り値:

  • 正切值
ソースコード
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

戻り値:

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

@property

method cot(self) -> float

余切值。

戻り値:

  • 余切值
ソースコード
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

戻り値:

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

@property

method sec(self) -> float

正割值。

戻り値:

  • 正割值
ソースコード
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

戻り値:

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

@property

method csc(self) -> float

余割值。

戻り値:

  • 余割值
ソースコード
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

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
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

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

method __eq__(self, other)

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

method self - other: AnyAngle => AnyAngle

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

method self * other: float => AnyAngle

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

@overload

method self / other: float => AnyAngle

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

@overload

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

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

@overload

method self / other: AnyAngle => float

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

def __truediv__(self, other)

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

method self / other

ソースコード
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,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}; + return AnyAngle(self.radian / other, is_radian=True)
`,89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/ja_api_mp_math_angle.md._xBKQuir.lean.js b/assets/ja_api_mp_math_angle.md.D2dStPZh.lean.js similarity index 57% rename from assets/ja_api_mp_math_angle.md._xBKQuir.lean.js rename to assets/ja_api_mp_math_angle.md.D2dStPZh.lean.js index 528de95..48dff8f 100644 --- a/assets/ja_api_mp_math_angle.md._xBKQuir.lean.js +++ b/assets/ja_api_mp_math_angle.md.D2dStPZh.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.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),e={name:"ja/api/mp_math/angle.md"},l=n("",93),t=[l];function h(p,k,r,d,o,g){return a(),i("div",null,t)}const c=s(e,[["render",h]]);export{F as __pageData,c as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"ja/api/mp_math/angle.md","filePath":"ja/api/mp_math/angle.md"}'),t={name:"ja/api/mp_math/angle.md"},e=n("",89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/ja_api_mp_math_const.md.CQY-Qdbh.js b/assets/ja_api_mp_math_const.md.CQY-Qdbh.js deleted file mode 100644 index b18014b..0000000 --- a/assets/ja_api_mp_math_const.md.CQY-Qdbh.js +++ /dev/null @@ -1 +0,0 @@ -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":"ja/api/mp_math/const.md","filePath":"ja/api/mp_math/const.md"}'),o={name:"ja/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 m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/ja_api_mp_math_const.md.CQY-Qdbh.lean.js b/assets/ja_api_mp_math_const.md.CQY-Qdbh.lean.js deleted file mode 100644 index 69d79c5..0000000 --- a/assets/ja_api_mp_math_const.md.CQY-Qdbh.lean.js +++ /dev/null @@ -1 +0,0 @@ -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":"ja/api/mp_math/const.md","filePath":"ja/api/mp_math/const.md"}'),o={name:"ja/api/mp_math/const.md"},n=r("",6),s=[n];function m(h,c,i,d,l,_){return t(),e("div",null,s)}const P=a(o,[["render",m]]);export{v as __pageData,P as default}; diff --git a/assets/ja_api_mp_math_const.md.CflutYeA.js b/assets/ja_api_mp_math_const.md.CflutYeA.js new file mode 100644 index 0000000..9244728 --- /dev/null +++ b/assets/ja_api_mp_math_const.md.CflutYeA.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.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"ja/api/mp_math/const.md","filePath":"ja/api/mp_math/const.md"}'),c={name:"ja/api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const h=t(c,[["render",o]]);export{d as __pageData,h as default}; diff --git a/assets/ja_api_mp_math_const.md.CflutYeA.lean.js b/assets/ja_api_mp_math_const.md.CflutYeA.lean.js new file mode 100644 index 0000000..9244728 --- /dev/null +++ b/assets/ja_api_mp_math_const.md.CflutYeA.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.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"ja/api/mp_math/const.md","filePath":"ja/api/mp_math/const.md"}'),c={name:"ja/api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const h=t(c,[["render",o]]);export{d as __pageData,h as default}; diff --git a/assets/ja_api_mp_math_equation.md.BETlifwh.js b/assets/ja_api_mp_math_equation.md.Cj8tgo_3.js similarity index 67% rename from assets/ja_api_mp_math_equation.md.BETlifwh.js rename to assets/ja_api_mp_math_equation.md.Cj8tgo_3.js index 5a405dc..dc6213e 100644 --- a/assets/ja_api_mp_math_equation.md.BETlifwh.js +++ b/assets/ja_api_mp_math_equation.md.Cj8tgo_3.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":"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:
+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(`

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

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

引数:

  • func: 函数

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

  • epsilon: 偏移量

戻り値:

  • 偏导函数

例外:

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

def partial_derivative_func() -> Var

ソースコード
python
def partial_derivative_func(*args: Var) -> Var:
+        raise ValueError('Invalid var type')

func 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:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

func high_order_partial_derivative_func() -> Var

ソースコード
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

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

曲线方程。

引数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

ソースコード
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    return result_func(*args)

class CurveEquation

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

曲线方程。

引数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

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

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

计算曲线上的点。

引数:

  • *t:

  • 参数:

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

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

计算曲线上的点。

引数:

  • *t:

  • 参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -59,5 +59,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const u
     if len(t) == 1:
         return Point3(self.x_func(t[0]), self.y_func(t[0]), self.z_func(t[0]))
     else:
-        return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])

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}; + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
`,24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_equation.md.BETlifwh.lean.js b/assets/ja_api_mp_math_equation.md.Cj8tgo_3.lean.js similarity index 55% rename from assets/ja_api_mp_math_equation.md.BETlifwh.lean.js rename to assets/ja_api_mp_math_equation.md.Cj8tgo_3.lean.js index d638e44..e34836e 100644 --- a/assets/ja_api_mp_math_equation.md.BETlifwh.lean.js +++ b/assets/ja_api_mp_math_equation.md.Cj8tgo_3.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":"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}; +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("",24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js b/assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js deleted file mode 100644 index 8410758..0000000 --- a/assets/ja_api_mp_math_line.md.Ck5uy5Cp.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.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_line.md.Ck5uy5Cp.js b/assets/ja_api_mp_math_line.md.Dg8duKLw.js similarity index 58% rename from assets/ja_api_mp_math_line.md.Ck5uy5Cp.js rename to assets/ja_api_mp_math_line.md.Dg8duKLw.js index 2435a2b..2b18144 100644 --- a/assets/ja_api_mp_math_line.md.Ck5uy5Cp.js +++ b/assets/ja_api_mp_math_line.md.Dg8duKLw.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n(`

class Line3

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

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

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n(`

class Line3

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

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

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

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

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

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

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

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

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

引数:

  • other: 另一条直线

戻り値:

  • 夹角弧度

例外:

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

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

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

引数:

  • other: 平行直线或点

戻り値:

  • 距离

例外:

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

戻り値:

  • 交点

例外:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点

例外:

  • ValueError 直线平行

  • ValueError 直线不共面

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

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

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

引数:

  • point: 指定点

戻り値:

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

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

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

引数:

  • t: 参数t

戻り値:

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

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

获取直线的参数方程。

戻り値:

  • x(t), y(t), z(t)
ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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)

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

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

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

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

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

判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値:

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

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

判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値:

  • 是否共线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -110,7 +110,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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)

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

判断点是否在直线上。

引数:

  • point: 点

戻り値:

  • 是否在直线上
ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -118,7 +118,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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)

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

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

引数:

  • other: 另一条直线

戻り値:

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

def simplify(self)

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

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

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

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

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

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

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

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

引数:

  • p1: 点1

  • p2: 点2

戻り値:

  • 直线
ソースコード
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -151,7 +151,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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)

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

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

引数:

  • other: 另一条直线

戻り値:

  • 交点
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -164,7 +164,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const g
     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:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

判断两条直线是否等价。

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

引数:

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

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}; + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
`,119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_line.md.Dg8duKLw.lean.js b/assets/ja_api_mp_math_line.md.Dg8duKLw.lean.js new file mode 100644 index 0000000..d3a0964 --- /dev/null +++ b/assets/ja_api_mp_math_line.md.Dg8duKLw.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"ja/api/mp_math/line.md","filePath":"ja/api/mp_math/line.md"}'),l={name:"ja/api/mp_math/line.md"},t=n("",119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.js b/assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.js new file mode 100644 index 0000000..d4fb03b --- /dev/null +++ b/assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.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":"ja/api/mp_math/mp_math_typing.md","filePath":"ja/api/mp_math/mp_math_typing.md"}'),n={name:"ja/api/mp_math/mp_math_typing.md"},o=l('

var RealNumber = int | float

  • タイプ: TypeAlias

var Number = RealNumber | complex

  • タイプ: TypeAlias

var Var = SingleVar | ArrayVar

  • タイプ: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • タイプ: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • タイプ: TypeAlias

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

  • タイプ: TypeAlias

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

  • タイプ: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • タイプ: TypeAlias

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

  • タイプ: TypeAlias

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

  • タイプ: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • タイプ: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • タイプ: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • タイプ: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • タイプ: TypeAlias
',30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.lean.js b/assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.lean.js similarity index 64% rename from assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.lean.js rename to assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.lean.js index eb78d6f..84b4d0d 100644 --- a/assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.lean.js +++ b/assets/ja_api_mp_math_mp_math_typing.md.Bhy6h0r0.lean.js @@ -1 +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":"ja/api/mp_math/mp_math_typing.md","filePath":"ja/api/mp_math/mp_math_typing.md"}'),n={name:"ja/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}; +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":"ja/api/mp_math/mp_math_typing.md","filePath":"ja/api/mp_math/mp_math_typing.md"}'),n={name:"ja/api/mp_math/mp_math_typing.md"},o=l("",30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.js b/assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.js deleted file mode 100644 index d95316e..0000000 --- a/assets/ja_api_mp_math_mp_math_typing.md.CeASNaiE.js +++ /dev/null @@ -1 +0,0 @@ -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":"ja/api/mp_math/mp_math_typing.md","filePath":"ja/api/mp_math/mp_math_typing.md"}'),n={name:"ja/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/api_mp_math_plane.md.DZBu-HIq.js b/assets/ja_api_mp_math_plane.md.CTOkqSft.js similarity index 64% rename from assets/api_mp_math_plane.md.DZBu-HIq.js rename to assets/ja_api_mp_math_plane.md.CTOkqSft.js index adf2d19..75198d9 100644 --- a/assets/api_mp_math_plane.md.DZBu-HIq.js +++ b/assets/ja_api_mp_math_plane.md.CTOkqSft.js @@ -1,25 +1,23 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"api/mp_math/plane.md","filePath":"api/mp_math/plane.md"}'),l={name:"api/mp_math/plane.md"},h=n(`

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

参数:

  • a:

  • b:

  • c:

  • d:

源码
python
def __init__(self, a: float, b: float, c: float, d: float):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n(`

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

引数:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            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:
+    self.d = d

method approx(self, other: Plane3) -> bool

判断两个平面是否近似相等。

引数:

  • other: 另一个平面

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
-            other:
-
+            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)
@@ -30,7 +28,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

参数:

  • other: 另一个平面

返回:

  • 夹角弧度

引发:

  • TypeError 不支持的类型
源码
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -45,7 +43,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

参数:

  • other: 另一个平面或点

返回:

  • 距离

引发:

  • TypeError 不支持的类型
源码
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -60,13 +58,13 @@ 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)}')

method 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):
@@ -85,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

参数:

  • other: 不与平面平行或在平面上的直线

返回:

  • 交点

引发:

  • ValueError 平面与直线平行或重合
源码
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値:

  • 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -99,15 +97,15 @@ 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))

method 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:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -115,14 +113,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

返回:

  • 法向量
源码
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

戻り値:

  • 法向量
ソースコード
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

参数:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源码
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +132,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

工厂函数 由三点构造平面。

引数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -148,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

工厂函数 由两直线构造平面。

引数:

  • l1: 直线1

  • l2: 直线2

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +160,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

工厂函数 由点和直线构造平面。

引数:

  • point: 面上一点

  • line: 面上直线,不包含点

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -172,22 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

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
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

源码
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

参数:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源码
python
def __and__(self, other):
+    ...

method __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -204,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

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}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,116),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.C5qFtY92.lean.js b/assets/ja_api_mp_math_plane.md.CTOkqSft.lean.js similarity index 85% rename from assets/ja_api_mp_math_plane.md.C5qFtY92.lean.js rename to assets/ja_api_mp_math_plane.md.CTOkqSft.lean.js index 99f7f9b..f7f0be9 100644 --- a/assets/ja_api_mp_math_plane.md.C5qFtY92.lean.js +++ b/assets/ja_api_mp_math_plane.md.CTOkqSft.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("",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}; +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("",116),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.Cc_RLeth.lean.js b/assets/ja_api_mp_math_point.md.Cc_RLeth.lean.js deleted file mode 100644 index 06f7d4d..0000000 --- a/assets/ja_api_mp_math_point.md.Cc_RLeth.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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_point.md.Cc_RLeth.js b/assets/ja_api_mp_math_point.md.ZsmRVuaC.js similarity index 58% rename from assets/ja_api_mp_math_point.md.Cc_RLeth.js rename to assets/ja_api_mp_math_point.md.ZsmRVuaC.js index 0e3da2e..f953953 100644 --- a/assets/ja_api_mp_math_point.md.Cc_RLeth.js +++ b/assets/ja_api_mp_math_point.md.ZsmRVuaC.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),t={name:"ja/api/mp_math/point.md"},l=n(`

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),n={name:"ja/api/mp_math/point.md"},h=t(`

class Point3

method __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,12 +18,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self + other

P + V -> P P + P -> P

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -31,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -49,4 +48,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)
`,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}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_point.md.ZsmRVuaC.lean.js b/assets/ja_api_mp_math_point.md.ZsmRVuaC.lean.js new file mode 100644 index 0000000..3466d9a --- /dev/null +++ b/assets/ja_api_mp_math_point.md.ZsmRVuaC.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"ja/api/mp_math/point.md","filePath":"ja/api/mp_math/point.md"}'),n={name:"ja/api/mp_math/point.md"},h=t("",35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_segment.md.oiONXysZ.js b/assets/ja_api_mp_math_segment.md.D5ZKDDr_.js similarity index 51% rename from assets/ja_api_mp_math_segment.md.oiONXysZ.js rename to assets/ja_api_mp_math_segment.md.D5ZKDDr_.js index 3bea08e..afc42da 100644 --- a/assets/ja_api_mp_math_segment.md.oiONXysZ.js +++ b/assets/ja_api_mp_math_segment.md.D5ZKDDr_.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/api/mp_math/segment.md"},h=n(`

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/api/mp_math/segment.md"},h=n(`

class Segment3

method __init__(self, p1: Point3, p2: Point3)

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -11,6 +11,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     '长度'
     self.length = self.direction.length
     '中心点'
-    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)

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}; + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
`,4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js b/assets/ja_api_mp_math_segment.md.D5ZKDDr_.lean.js similarity index 85% rename from assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js rename to assets/ja_api_mp_math_segment.md.D5ZKDDr_.lean.js index e0ff302..91c8dde 100644 --- a/assets/ja_api_mp_math_segment.md.oiONXysZ.lean.js +++ b/assets/ja_api_mp_math_segment.md.D5ZKDDr_.lean.js @@ -1 +1 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/api/mp_math/segment.md"},h=n("",8),p=[h];function l(e,k,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment"},"headers":[],"relativePath":"ja/api/mp_math/segment.md","filePath":"ja/api/mp_math/segment.md"}'),t={name:"ja/api/mp_math/segment.md"},h=n("",4),p=[h];function l(k,e,d,r,E,g){return a(),i("div",null,p)}const o=s(t,[["render",l]]);export{y as __pageData,o as default}; diff --git a/assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js b/assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js deleted file mode 100644 index da2c0fe..0000000 --- a/assets/ja_api_mp_math_utils.md.Dgzoi9ec.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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/en_api_mp_math_utils.md.CuiyHRtY.js b/assets/ja_api_mp_math_utils.md.jeRmCp2Q.js similarity index 60% rename from assets/en_api_mp_math_utils.md.CuiyHRtY.js rename to assets/ja_api_mp_math_utils.md.jeRmCp2Q.js index 75e744f..0c0c990 100644 --- a/assets/en_api_mp_math_utils.md.CuiyHRtY.js +++ b/assets/ja_api_mp_math_utils.md.jeRmCp2Q.js @@ -1,26 +1,25 @@ -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:
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},t=n(`

func clamp() -> float

区间限定函数

引数:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

戻り値:

  • 限制后的值
ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        x: 待限定的值
+        min_: 最小值
+        max_: 最大值
 
     Returns:
         限制后的值
     """
-    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:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x: 数1

  • y: 数2

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
-        x:
-        y:
-        epsilon:
-
+        x: 数1
+        y: 数2
+        epsilon: 误差
     Returns:
         是否近似相等
     """
-    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:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

获取数的符号。

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -33,7 +32,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: 是否只返回负数的符号

Return:

  • 符号 + - ""
Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
+        return ''

func sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -49,8 +48,8 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
-    self.value = value

def __eq__(self, other)

Source code
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
+    self.value = value

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -60,6 +59,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

Source code
python
def __ne__(self, other):
-    return not self.__eq__(other)
`,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}; + self.raise_type_error(other)

method raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_utils.md.jeRmCp2Q.lean.js b/assets/ja_api_mp_math_utils.md.jeRmCp2Q.lean.js new file mode 100644 index 0000000..627f47a --- /dev/null +++ b/assets/ja_api_mp_math_utils.md.jeRmCp2Q.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"ja/api/mp_math/utils.md","filePath":"ja/api/mp_math/utils.md"}'),l={name:"ja/api/mp_math/utils.md"},t=n("",37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/en_api_mp_math_vector.md.3xep9oDm.js b/assets/ja_api_mp_math_vector.md.DAXdHSjp.js similarity index 63% rename from assets/en_api_mp_math_vector.md.3xep9oDm.js rename to assets/ja_api_mp_math_vector.md.DAXdHSjp.js index 1a7b2b2..71d30c1 100644 --- a/assets/en_api_mp_math_vector.md.3xep9oDm.js +++ b/assets/ja_api_mp_math_vector.md.DAXdHSjp.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"}'),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):
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),n={name:"ja/api/mp_math/vector.md"},h=t(`

class Vector3

method __init__(self, x: float, y: float, z: float)

3维向量

引数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

引数:

  • 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'

计算两个向量之间的夹角。

Args:

  • other: 另一个向量

Return:

  • 夹角
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

method cal_angle(self, other: Vector3) -> AnyAngle

计算两个向量之间的夹角。

引数:

  • 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,则两向量平行。 其余结果的模为平行四边形的面积。

Args:

  • other:

Return:

  • 行列式的结果
Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

向量积 叉乘: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

判断两个向量是否近似平行。

Args:

  • other: 另一个向量

  • epsilon: 允许的误差

Return:

  • 是否近似平行
Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

引数:

  • 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

判断两个向量是否平行。

Args:

  • other: 另一个向量

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

Source code
python
@property
+    self.z /= length

@property

method np_array(self) -> np.ndarray

ソースコード
python
@property
 def np_array(self) -> 'np.ndarray':
     """
         返回numpy数组
         Returns:
         """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

Return:

Source code
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

向量的模。

戻り値:

ソースコード
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

Return:

  • 单位向量
Source code
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

戻り値:

  • 单位向量
ソースコード
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

def __abs__(self)

Source code
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+    return self / self.length

method __abs__(self)

ソースコード
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

V + P -> P

V + V -> V

Args:

  • other:
Source code
python
def __add__(self, other):
+    ...

method self + other

V + P -> P

V + V -> V

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as 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:

Return:

  • 是否相等
Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:

戻り値:

  • 是否相等
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => Point3

P + V -> P

别去点那边实现了。 :param other: :return:

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -128,11 +128,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

ソースコード
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

Source code
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

ソースコード
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

def __sub__(self, other)

V - P -> P

V - V -> V

Args:

  • other:
Source code
python
def __sub__(self, other):
+    ...

method self - other

V - P -> P

V - V -> V

引数:

  • other:
ソースコード
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as 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 __rsub__(self, other: 'Point3')

P - V -> P

Args:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

method self - other: Point3

P - V -> P

引数:

  • other:
ソースコード
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

ソースコード
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

Source code
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

ソースコード
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

Args:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

数组运算 非点乘。点乘使用@,叉乘使用cross。

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

Args:

  • other:
Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

点乘。

引数:

  • other:
ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

Source code
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

Source code
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

Source code
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

`,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}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

ソースコード
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • タイプ: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • タイプ: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • タイプ: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • タイプ: Vector3

  • 説明: z轴单位向量

`,133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_vector.md.DAXdHSjp.lean.js b/assets/ja_api_mp_math_vector.md.DAXdHSjp.lean.js new file mode 100644 index 0000000..f6ef7be --- /dev/null +++ b/assets/ja_api_mp_math_vector.md.DAXdHSjp.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"ja/api/mp_math/vector.md","filePath":"ja/api/mp_math/vector.md"}'),n={name:"ja/api/mp_math/vector.md"},h=t("",133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js b/assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js deleted file mode 100644 index e4802c6..0000000 --- a/assets/ja_api_mp_math_vector.md.kN2P6bpC.lean.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const 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.QP3v3mpP.js b/assets/ja_api_presets_model_index.md.CleEI4sj.js similarity index 82% rename from assets/ja_api_presets_model_index.md.QP3v3mpP.js rename to assets/ja_api_presets_model_index.md.CleEI4sj.js index acb7677..699e103 100644 --- a/assets/ja_api_presets_model_index.md.QP3v3mpP.js +++ b/assets/ja_api_presets_model_index.md.CleEI4sj.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),h={name:"ja/api/presets/model/index.md"},t=n(`

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • List[Point3]: 球体上的点集。
ソースコード
python
@staticmethod
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),t={name:"ja/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • List[Point3]: 球体上的点集。
ソースコード
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -15,4 +15,4 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o
     x_array = radius * np.sin(phi_list) * np.cos(theta_list)
     y_array = radius * np.sin(phi_list) * np.sin(theta_list)
     z_array = radius * np.cos(phi_list)
-    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,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}; + return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,9),l=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js b/assets/ja_api_presets_model_index.md.CleEI4sj.lean.js similarity index 58% rename from assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js rename to assets/ja_api_presets_model_index.md.CleEI4sj.lean.js index 3bf2a39..9f1e55f 100644 --- a/assets/ja_api_presets_model_index.md.QP3v3mpP.lean.js +++ b/assets/ja_api_presets_model_index.md.CleEI4sj.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("",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}; +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const o=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model"},"headers":[],"relativePath":"ja/api/presets/model/index.md","filePath":"ja/api/presets/model/index.md"}'),t={name:"ja/api/presets/model/index.md"},h=n("",9),l=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/zht_api_index.md.Dq4XPUKZ.js b/assets/zht_api_index.md.Dq4XPUKZ.js new file mode 100644 index 0000000..b84af4b --- /dev/null +++ b/assets/zht_api_index.md.Dq4XPUKZ.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":"zht/api/index.md","filePath":"zht/api/index.md"}'),n={name:"zht/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/zht_api_index.md.Dq4XPUKZ.lean.js b/assets/zht_api_index.md.Dq4XPUKZ.lean.js new file mode 100644 index 0000000..b84af4b --- /dev/null +++ b/assets/zht_api_index.md.Dq4XPUKZ.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":"zht/api/index.md","filePath":"zht/api/index.md"}'),n={name:"zht/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/api_mp_math_angle.md.DKMXAFbW.js b/assets/zht_api_mp_math_angle.md.CMQhsVJf.js similarity index 61% rename from assets/api_mp_math_angle.md.DKMXAFbW.js rename to assets/zht_api_mp_math_angle.md.CMQhsVJf.js index 95d0f6b..b29a4c0 100644 --- a/assets/api_mp_math_angle.md.DKMXAFbW.js +++ b/assets/zht_api_mp_math_angle.md.CMQhsVJf.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"api/mp_math/angle.md","filePath":"api/mp_math/angle.md"}'),e={name:"api/mp_math/angle.md"},l=n(`

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

参数:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

源码
python
def __init__(self, value: float, is_radian: bool=False):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle"},"headers":[],"relativePath":"zht/api/mp_math/angle.md","filePath":"zht/api/mp_math/angle.md"}'),t={name:"zht/api/mp_math/angle.md"},e=n(`

class Angle

class AnyAngle(Angle)

method __init__(self, value: float, is_radian: bool = False)

任意角度。

變數説明:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

源碼
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -8,94 +8,92 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

返回:

  • 余角
源码
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

返回:

  • 余角
源碼
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

返回:

  • 补角
源码
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

返回:

  • 补角
源碼
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

返回:

  • 弧度
源码
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

角度。

返回:

  • 弧度
源碼
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

返回:

  • 最小正角度
源码
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

返回:

  • 最小正角度
源碼
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

返回:

  • 最大负角度
源码
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

返回:

  • 最大负角度
源碼
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

返回:

  • 正弦值
源码
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

正弦值。

返回:

  • 正弦值
源碼
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

返回:

  • 余弦值
源码
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

返回:

  • 余弦值
源碼
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

返回:

  • 正切值
源码
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

返回:

  • 正切值
源碼
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

返回:

  • 余切值
源码
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

返回:

  • 余切值
源碼
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

返回:

  • 正割值
源码
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

正割值。

返回:

  • 正割值
源碼
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

返回:

  • 余割值
源码
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

余割值。

返回:

  • 余割值
源碼
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

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
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

源碼
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

源码
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

源碼
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

def __truediv__(self, other)

源码
python
def __truediv__(self, other):
+    ...

method self / other

源碼
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
-    return AnyAngle(self.radian / other, is_radian=True)
`,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}; + return AnyAngle(self.radian / other, is_radian=True)
`,89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/zht_api_mp_math_angle.md.CMQhsVJf.lean.js b/assets/zht_api_mp_math_angle.md.CMQhsVJf.lean.js new file mode 100644 index 0000000..32e4911 --- /dev/null +++ b/assets/zht_api_mp_math_angle.md.CMQhsVJf.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":"zht/api/mp_math/angle.md","filePath":"zht/api/mp_math/angle.md"}'),t={name:"zht/api/mp_math/angle.md"},e=n("",89),l=[e];function h(p,k,r,d,o,g){return a(),i("div",null,l)}const E=s(t,[["render",h]]);export{F as __pageData,E as default}; diff --git a/assets/zht_api_mp_math_const.md.CIhADrI2.js b/assets/zht_api_mp_math_const.md.CIhADrI2.js new file mode 100644 index 0000000..8ee1750 --- /dev/null +++ b/assets/zht_api_mp_math_const.md.CIhADrI2.js @@ -0,0 +1 @@ +import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const h=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zht/api/mp_math/const.md","filePath":"zht/api/mp_math/const.md"}'),c={name:"zht/api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const d=t(c,[["render",o]]);export{h as __pageData,d as default}; diff --git a/assets/zht_api_mp_math_const.md.CIhADrI2.lean.js b/assets/zht_api_mp_math_const.md.CIhADrI2.lean.js new file mode 100644 index 0000000..8ee1750 --- /dev/null +++ b/assets/zht_api_mp_math_const.md.CIhADrI2.lean.js @@ -0,0 +1 @@ +import{_ as t,c as a,o as e}from"./chunks/framework.BV61Qrc0.js";const h=JSON.parse('{"title":"mbcp.mp_math.const","description":"","frontmatter":{"title":"mbcp.mp_math.const"},"headers":[],"relativePath":"zht/api/mp_math/const.md","filePath":"zht/api/mp_math/const.md"}'),c={name:"zht/api/mp_math/const.md"};function o(s,m,n,p,r,_){return e(),a("div")}const d=t(c,[["render",o]]);export{h as __pageData,d as default}; diff --git a/assets/zht_api_mp_math_equation.md.BwlIZxDL.js b/assets/zht_api_mp_math_equation.md.BwlIZxDL.js new file mode 100644 index 0000000..0a0da10 --- /dev/null +++ b/assets/zht_api_mp_math_equation.md.BwlIZxDL.js @@ -0,0 +1,62 @@ +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":"zht/api/mp_math/equation.md","filePath":"zht/api/mp_math/equation.md"}'),l={name:"zht/api/mp_math/equation.md"},t=n(`

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

變數説明:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

返回:

  • 偏导函数

抛出:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    """
+    求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')

func 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)

func 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

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

變數説明:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    """
+        曲线方程。
+        Args:
+            x_func: x函数
+            y_func: y函数
+            z_func: z函数
+        """
+    self.x_func = x_func
+    self.y_func = y_func
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

變數説明:

  • *t:

  • 参数:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    """
+        计算曲线上的点。
+        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))])
`,24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/zht_api_mp_math_equation.md.BwlIZxDL.lean.js b/assets/zht_api_mp_math_equation.md.BwlIZxDL.lean.js new file mode 100644 index 0000000..e2e34f2 --- /dev/null +++ b/assets/zht_api_mp_math_equation.md.BwlIZxDL.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.equation","description":"","frontmatter":{"title":"mbcp.mp_math.equation"},"headers":[],"relativePath":"zht/api/mp_math/equation.md","filePath":"zht/api/mp_math/equation.md"}'),l={name:"zht/api/mp_math/equation.md"},t=n("",24),h=[t];function p(k,e,r,E,d,g){return a(),i("div",null,h)}const u=s(l,[["render",p]]);export{y as __pageData,u as default}; diff --git a/assets/zht_api_mp_math_index.md.D09y2ubg.js b/assets/zht_api_mp_math_index.md.D09y2ubg.js new file mode 100644 index 0000000..7a1293e --- /dev/null +++ b/assets/zht_api_mp_math_index.md.D09y2ubg.js @@ -0,0 +1 @@ +import{_ as t,c as e,o as a}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zht/api/mp_math/index.md","filePath":"zht/api/mp_math/index.md"}'),m={name:"zht/api/mp_math/index.md"};function p(n,i,r,c,o,s){return a(),e("div")}const h=t(m,[["render",p]]);export{d as __pageData,h as default}; diff --git a/assets/zht_api_mp_math_index.md.D09y2ubg.lean.js b/assets/zht_api_mp_math_index.md.D09y2ubg.lean.js new file mode 100644 index 0000000..7a1293e --- /dev/null +++ b/assets/zht_api_mp_math_index.md.D09y2ubg.lean.js @@ -0,0 +1 @@ +import{_ as t,c as e,o as a}from"./chunks/framework.BV61Qrc0.js";const d=JSON.parse('{"title":"mbcp.mp_math","description":"","frontmatter":{"title":"mbcp.mp_math"},"headers":[],"relativePath":"zht/api/mp_math/index.md","filePath":"zht/api/mp_math/index.md"}'),m={name:"zht/api/mp_math/index.md"};function p(n,i,r,c,o,s){return a(),e("div")}const h=t(m,[["render",p]]);export{d as __pageData,h as default}; diff --git a/assets/zht_api_mp_math_line.md.Czel-DYb.js b/assets/zht_api_mp_math_line.md.Czel-DYb.js new file mode 100644 index 0000000..db37b00 --- /dev/null +++ b/assets/zht_api_mp_math_line.md.Czel-DYb.js @@ -0,0 +1,178 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),l={name:"zht/api/mp_math/line.md"},t=n(`

class Line3

method __init__(self, point: Point3, direction: Vector3)

三维空间中的直线。由一个点和一个方向向量确定。

變數説明:

  • point: 直线上的一点

  • direction: 直线的方向向量

源碼
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    """
+        三维空间中的直线。由一个点和一个方向向量确定。
+        Args:
+            point: 直线上的一点
+            direction: 直线的方向向量
+        """
+    self.point = point
+    self.direction = direction

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

變數説明:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    """
+        判断两条直线是否近似相等。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似相等
+        """
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

计算直线和直线之间的夹角。

變數説明:

  • other: 另一条直线

返回:

  • 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    """
+        计算直线和直线之间的夹角。
+        Args:
+            other: 另一条直线
+        Returns:
+            夹角弧度
+        Raises:
+            TypeError: 不支持的类型
+        """
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

计算直线和直线或点之间的距离。

變數説明:

  • other: 平行直线或点

返回:

  • 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    """
+        计算直线和直线或点之间的距离。
+        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.')

method 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

method 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))

method 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

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    """
+        获取直线的参数方程。
+        Returns:
+            x(t), y(t), z(t)
+        """
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

變數説明:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    """
+        判断两条直线是否近似平行。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似平行
+        """
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

判断两条直线是否平行。

變數説明:

  • other: 另一条直线

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否平行。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否平行
+        """
+    return self.direction.is_parallel(other.direction)

method 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)

method 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)

method 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

method 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

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

工厂函数 由两点构造直线。

變數説明:

  • p1: 点1

  • p2: 点2

返回:

  • 直线
源碼
python
@classmethod
+def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
+    """
+        工厂函数 由两点构造直线。
+        Args:
+            p1: 点1
+            p2: 点2
+        Returns:
+            直线
+        """
+    direction = p2 - p1
+    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

變數説明:

  • other: 另一条直线

返回:

  • 交点
源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    """
+        计算两条直线点集合的交集。重合线返回自身,平行线返回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)

method __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)
`,119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_line.md.Czel-DYb.lean.js b/assets/zht_api_mp_math_line.md.Czel-DYb.lean.js new file mode 100644 index 0000000..1502b9d --- /dev/null +++ b/assets/zht_api_mp_math_line.md.Czel-DYb.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.line","description":"","frontmatter":{"title":"mbcp.mp_math.line"},"headers":[],"relativePath":"zht/api/mp_math/line.md","filePath":"zht/api/mp_math/line.md"}'),l={name:"zht/api/mp_math/line.md"},t=n("",119),h=[t];function p(e,k,r,o,d,g){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.js b/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.js new file mode 100644 index 0000000..cf3b8ce --- /dev/null +++ b/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.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":"zht/api/mp_math/mp_math_typing.md","filePath":"zht/api/mp_math/mp_math_typing.md"}'),n={name:"zht/api/mp_math/mp_math_typing.md"},o=l('

var RealNumber = int | float

  • 類型: TypeAlias

var Number = RealNumber | complex

  • 類型: TypeAlias

var Var = SingleVar | ArrayVar

  • 類型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 類型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 類型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 類型: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 類型: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 類型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 類型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 類型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 類型: TypeAlias
',30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.lean.js b/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.lean.js new file mode 100644 index 0000000..41dc56e --- /dev/null +++ b/assets/zht_api_mp_math_mp_math_typing.md.DlxSozR9.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":"zht/api/mp_math/mp_math_typing.md","filePath":"zht/api/mp_math/mp_math_typing.md"}'),n={name:"zht/api/mp_math/mp_math_typing.md"},o=l("",30),i=[o];function s(t,c,u,g,v,d){return e(),r("div",null,i)}const y=a(n,[["render",s]]);export{m as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_plane.md.C5qFtY92.js b/assets/zht_api_mp_math_plane.md.CxUaQCvU.js similarity index 64% rename from assets/ja_api_mp_math_plane.md.C5qFtY92.js rename to assets/zht_api_mp_math_plane.md.CxUaQCvU.js index 9974486..f626c3f 100644 --- a/assets/ja_api_mp_math_plane.md.C5qFtY92.js +++ b/assets/zht_api_mp_math_plane.md.CxUaQCvU.js @@ -1,25 +1,23 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"ja/api/mp_math/plane.md","filePath":"ja/api/mp_math/plane.md"}'),l={name:"ja/api/mp_math/plane.md"},h=n(`

class Plane3

def __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

引数:

  • a:

  • b:

  • c:

  • d:

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
+import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.plane","description":"","frontmatter":{"title":"mbcp.mp_math.plane"},"headers":[],"relativePath":"zht/api/mp_math/plane.md","filePath":"zht/api/mp_math/plane.md"}'),l={name:"zht/api/mp_math/plane.md"},h=n(`

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

變數説明:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            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:
+    self.d = d

method approx(self, other: Plane3) -> bool

判断两个平面是否近似相等。

變數説明:

  • other: 另一个平面

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
-            other:
-
+            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)
@@ -30,7 +28,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

计算平面与平面之间的夹角。

變數説明:

  • other: 另一个平面

返回:

  • 夹角弧度

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -45,7 +43,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

计算平面与平面或点之间的距离。

變數説明:

  • other: 另一个平面或点

返回:

  • 距离

抛出:

  • TypeError 不支持的类型
源碼
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -60,13 +58,13 @@ 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)}')

method 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):
@@ -85,7 +83,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値:

  • 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

计算平面与直线的交点。

變數説明:

  • other: 不与平面平行或在平面上的直线

返回:

  • 交点

抛出:

  • ValueError 平面与直线平行或重合
源碼
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -99,15 +97,15 @@ 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))

method 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:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

判断两个平面是否平行。

變數説明:

  • other: 另一个平面

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -115,14 +113,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

戻り値:

  • 法向量
ソースコード
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

返回:

  • 法向量
源碼
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

工厂函数 由点和法向量构造平面(点法式构造)。

變數説明:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源碼
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -134,7 +132,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

工厂函数 由三点构造平面。

變數説明:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

  • 平面
源碼
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -148,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v1 = p2 - p1
     v2 = p3 - p1
     normal = v1.cross(v2)
-    return cls.from_point_and_normal(p1, normal)

@classmethod

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

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

工厂函数 由两直线构造平面。

變數説明:

  • l1: 直线1

  • l2: 直线2

返回:

  • 平面
源碼
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -162,7 +160,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

工厂函数 由点和直线构造平面。

變數説明:

  • point: 面上一点

  • line: 面上直线,不包含点

返回:

  • 平面
源碼
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -172,22 +170,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

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
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

源碼
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

ソースコード
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

源碼
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
+    ...

method __and__(self, other)

取两平面的交集(人话:交线)

變數説明:

  • other:

返回:

  • 不平行平面的交线,平面平行返回None
源碼
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -204,6 +191,6 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

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}; + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
`,116),t=[h];function p(k,e,r,d,E,o){return a(),i("div",null,t)}const y=s(l,[["render",p]]);export{F as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_plane.md.CxUaQCvU.lean.js b/assets/zht_api_mp_math_plane.md.CxUaQCvU.lean.js new file mode 100644 index 0000000..8482a1d --- /dev/null +++ b/assets/zht_api_mp_math_plane.md.CxUaQCvU.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":"zht/api/mp_math/plane.md","filePath":"zht/api/mp_math/plane.md"}'),l={name:"zht/api/mp_math/plane.md"},h=n("",116),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.CGqzS8ew.js b/assets/zht_api_mp_math_point.md.BmRy6Xj6.js similarity index 57% rename from assets/api_mp_math_point.md.CGqzS8ew.js rename to assets/zht_api_mp_math_point.md.BmRy6Xj6.js index 2035e7d..09fd819 100644 --- a/assets/api_mp_math_point.md.CGqzS8ew.js +++ b/assets/zht_api_mp_math_point.md.BmRy6Xj6.js @@ -1,4 +1,4 @@ -import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"api/mp_math/point.md"}'),t={name:"api/mp_math/point.md"},l=n(`

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

参数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源码
python
def __init__(self, x: float, y: float, z: float):
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zht/api/mp_math/point.md","filePath":"zht/api/mp_math/point.md"}'),n={name:"zht/api/mp_math/point.md"},h=t(`

class Point3

method __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

變數説明:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源碼
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

變數説明:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -18,12 +18,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
         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
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

源码
python
@overload
+    ...

@overload

method 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):
+    ...

method self + other

P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -31,14 +30,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const F
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

参数:

  • other:
源码
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

變數説明:

  • other:
源碼
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

参数:

  • other:
源码
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -49,4 +48,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)
`,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}; + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
`,35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_mp_math_point.md.BmRy6Xj6.lean.js b/assets/zht_api_mp_math_point.md.BmRy6Xj6.lean.js new file mode 100644 index 0000000..71132cb --- /dev/null +++ b/assets/zht_api_mp_math_point.md.BmRy6Xj6.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point"},"headers":[],"relativePath":"zht/api/mp_math/point.md","filePath":"zht/api/mp_math/point.md"}'),n={name:"zht/api/mp_math/point.md"},h=t("",35),l=[h];function e(p,k,o,r,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_mp_math_segment.md.Bn34DhAl.js b/assets/zht_api_mp_math_segment.md.Bn34DhAl.js new file mode 100644 index 0000000..d30797a --- /dev/null +++ b/assets/zht_api_mp_math_segment.md.Bn34DhAl.js @@ -0,0 +1,14 @@ +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":"zht/api/mp_math/segment.md","filePath":"zht/api/mp_math/segment.md"}'),t={name:"zht/api/mp_math/segment.md"},h=n(`

class Segment3

method __init__(self, p1: Point3, p2: Point3)

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    """
+        三维空间中的线段。
+        :param p1:
+        :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)
`,4),p=[h];function l(k,e,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/zht_api_mp_math_segment.md.Bn34DhAl.lean.js b/assets/zht_api_mp_math_segment.md.Bn34DhAl.lean.js new file mode 100644 index 0000000..7b7a204 --- /dev/null +++ b/assets/zht_api_mp_math_segment.md.Bn34DhAl.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":"zht/api/mp_math/segment.md","filePath":"zht/api/mp_math/segment.md"}'),t={name:"zht/api/mp_math/segment.md"},h=n("",4),p=[h];function l(k,e,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/zht_api_mp_math_utils.md.BtiDgiKf.js b/assets/zht_api_mp_math_utils.md.BtiDgiKf.js new file mode 100644 index 0000000..6ee4438 --- /dev/null +++ b/assets/zht_api_mp_math_utils.md.BtiDgiKf.js @@ -0,0 +1,64 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),l={name:"zht/api/mp_math/utils.md"},t=n(`

func clamp() -> float

区间限定函数

變數説明:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

返回:

  • 限制后的值
源碼
python
def clamp(x: float, min_: float, max_: float) -> float:
+    """
+    区间限定函数
+    Args:
+        x: 待限定的值
+        min_: 最小值
+        max_: 最大值
+
+    Returns:
+        限制后的值
+    """
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1

  • y: 数2

  • epsilon: 误差

返回:

  • 是否近似相等
源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    """
+    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
+    Args:
+        x: 数1
+        y: 数2
+        epsilon: 误差
+    Returns:
+        是否近似相等
+    """
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

获取数的符号。

變數説明:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    """获取数的符号。
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return '+' if not only_neg else ''
+    elif x < 0:
+        return '-'
+    else:
+        return ''

func sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

變數説明:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
+    """格式化符号数
+    -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

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+    if isinstance(self.value, (float, int)):
+        if isinstance(other, (float, int)):
+            return abs(self.value - other) < APPROX
+        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)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
+    return not self.__eq__(other)
`,37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/zht_api_mp_math_utils.md.BtiDgiKf.lean.js b/assets/zht_api_mp_math_utils.md.BtiDgiKf.lean.js new file mode 100644 index 0000000..c055d01 --- /dev/null +++ b/assets/zht_api_mp_math_utils.md.BtiDgiKf.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const E=JSON.parse('{"title":"mbcp.mp_math.utils","description":"","frontmatter":{"title":"mbcp.mp_math.utils"},"headers":[],"relativePath":"zht/api/mp_math/utils.md","filePath":"zht/api/mp_math/utils.md"}'),l={name:"zht/api/mp_math/utils.md"},t=n("",37),h=[t];function p(k,e,r,d,g,F){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{E as __pageData,y as default}; diff --git a/assets/ja_api_mp_math_vector.md.kN2P6bpC.js b/assets/zht_api_mp_math_vector.md.DmxfMXiN.js similarity index 64% rename from assets/ja_api_mp_math_vector.md.kN2P6bpC.js rename to assets/zht_api_mp_math_vector.md.DmxfMXiN.js index 7aa7f49..f0bba58 100644 --- a/assets/ja_api_mp_math_vector.md.kN2P6bpC.js +++ b/assets/zht_api_mp_math_vector.md.DmxfMXiN.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"}'),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):
+import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t(`

class Vector3

method __init__(self, x: float, y: float, z: float)

3维向量

變數説明:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源碼
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -8,7 +8,7 @@ import{_ as s,c as i,o as a,a2 as 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

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

變數説明:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -18,7 +18,7 @@ import{_ as s,c as i,o as a,a2 as 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])

method cal_angle(self, other: Vector3) -> AnyAngle

计算两个向量之间的夹角。

變數説明:

  • other: 另一个向量

返回:

  • 夹角
源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -26,7 +26,7 @@ import{_ as s,c as i,o as a,a2 as 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,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • other:

戻り値:

  • 行列式的结果
ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回:

  • 行列式的结果
源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -46,7 +46,7 @@ import{_ as s,c as i,o as a,a2 as 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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

變數説明:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -55,7 +55,7 @@ import{_ as s,c as i,o as a,a2 as 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

method is_parallel(self, other: Vector3) -> bool

判断两个向量是否平行。

變數説明:

  • other: 另一个向量

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -63,7 +63,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
     """
         将向量归一化。
 
@@ -72,32 +72,32 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

ソースコード
python
@property
+    self.z /= length

@property

method np_array(self) -> np.ndarray

源碼
python
@property
 def np_array(self) -> 'np.ndarray':
     """
         返回numpy数组
         Returns:
         """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

戻り値:

ソースコード
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

向量的模。

返回:

源碼
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

戻り値:

  • 单位向量
ソースコード
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

返回:

  • 单位向量
源碼
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

def __abs__(self)

ソースコード
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self + other

V + P -> P

V + V -> V

變數説明:

  • other:
源碼
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -112,7 +112,7 @@ import{_ as s,c as i,o as a,a2 as 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)}'")

method __eq__(self, other)

判断两个向量是否相等。

變數説明:

  • other:

返回:

  • 是否相等
源碼
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -120,7 +120,7 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => Point3

P + V -> P

别去点那边实现了。 :param other: :return:

源碼
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -128,11 +128,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

源碼
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self - other

V - P -> P

V - V -> V

變數説明:

  • other:
源碼
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -146,7 +146,7 @@ import{_ as s,c as i,o as a,a2 as 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 __rsub__(self, other: 'Point3')

P - V -> P

引数:

  • other:
ソースコード
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

method self - other: Point3

P - V -> P

變數説明:

  • other:
源碼
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -157,11 +157,11 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

源碼
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

ソースコード
python
@overload
+    ...

@overload

method 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':
+    ...

method self * other: int | float | Vector3 => Vector3

数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -174,16 +174,14 @@ import{_ as s,c as i,o as a,a2 as n}from"./chunks/framework.BV61Qrc0.js";const y
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> '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':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

点乘。

變數説明:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

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}; + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • 類型: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 類型: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 類型: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 類型: Vector3

  • 説明: z轴单位向量

`,133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_mp_math_vector.md.DmxfMXiN.lean.js b/assets/zht_api_mp_math_vector.md.DmxfMXiN.lean.js new file mode 100644 index 0000000..5bbc640 --- /dev/null +++ b/assets/zht_api_mp_math_vector.md.DmxfMXiN.lean.js @@ -0,0 +1 @@ +import{_ as s,c as i,o as a,a2 as t}from"./chunks/framework.BV61Qrc0.js";const y=JSON.parse('{"title":"mbcp.mp_math.vector","description":"","frontmatter":{"title":"mbcp.mp_math.vector"},"headers":[],"relativePath":"zht/api/mp_math/vector.md","filePath":"zht/api/mp_math/vector.md"}'),n={name:"zht/api/mp_math/vector.md"},h=t("",133),l=[h];function e(p,k,r,o,d,E){return a(),i("div",null,l)}const F=s(n,[["render",e]]);export{y as __pageData,F as default}; diff --git a/assets/zht_api_particle_index.md.kAm9VAEw.js b/assets/zht_api_particle_index.md.kAm9VAEw.js new file mode 100644 index 0000000..371e4b1 --- /dev/null +++ b/assets/zht_api_particle_index.md.kAm9VAEw.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":"zht/api/particle/index.md","filePath":"zht/api/particle/index.md"}'),i={name:"zht/api/particle/index.md"};function r(c,p,n,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zht_api_particle_index.md.kAm9VAEw.lean.js b/assets/zht_api_particle_index.md.kAm9VAEw.lean.js new file mode 100644 index 0000000..371e4b1 --- /dev/null +++ b/assets/zht_api_particle_index.md.kAm9VAEw.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":"zht/api/particle/index.md","filePath":"zht/api/particle/index.md"}'),i={name:"zht/api/particle/index.md"};function r(c,p,n,o,s,d){return a(),t("div")}const _=e(i,[["render",r]]);export{m as __pageData,_ as default}; diff --git a/assets/zht_api_presets_index.md.BmouaEaT.js b/assets/zht_api_presets_index.md.BmouaEaT.js new file mode 100644 index 0000000..46ea01d --- /dev/null +++ b/assets/zht_api_presets_index.md.BmouaEaT.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as s}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zht/api/presets/index.md","filePath":"zht/api/presets/index.md"}'),a={name:"zht/api/presets/index.md"};function r(p,n,i,c,o,d){return s(),t("div")}const f=e(a,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zht_api_presets_index.md.BmouaEaT.lean.js b/assets/zht_api_presets_index.md.BmouaEaT.lean.js new file mode 100644 index 0000000..46ea01d --- /dev/null +++ b/assets/zht_api_presets_index.md.BmouaEaT.lean.js @@ -0,0 +1 @@ +import{_ as e,c as t,o as s}from"./chunks/framework.BV61Qrc0.js";const _=JSON.parse('{"title":"mbcp.presets","description":"","frontmatter":{"title":"mbcp.presets"},"headers":[],"relativePath":"zht/api/presets/index.md","filePath":"zht/api/presets/index.md"}'),a={name:"zht/api/presets/index.md"};function r(p,n,i,c,o,d){return s(),t("div")}const f=e(a,[["render",r]]);export{_ as __pageData,f as default}; diff --git a/assets/zht_api_presets_model_index.md.DDom2SLG.js b/assets/zht_api_presets_model_index.md.DDom2SLG.js new file mode 100644 index 0000000..b44f611 --- /dev/null +++ b/assets/zht_api_presets_model_index.md.DDom2SLG.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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n(`

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

變數説明:

  • radius:

  • density:

返回:

  • List[Point3]: 球体上的点集。
源碼
python
@staticmethod
+def sphere(radius: float, density: float):
+    """
+        生成球体上的点集。
+        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=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/assets/zht_api_presets_model_index.md.DDom2SLG.lean.js b/assets/zht_api_presets_model_index.md.DDom2SLG.lean.js new file mode 100644 index 0000000..2fc38dc --- /dev/null +++ b/assets/zht_api_presets_model_index.md.DDom2SLG.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":"zht/api/presets/model/index.md","filePath":"zht/api/presets/model/index.md"}'),t={name:"zht/api/presets/model/index.md"},h=n("",9),l=[h];function p(k,e,r,d,E,y){return a(),i("div",null,l)}const F=s(t,[["render",p]]);export{o as __pageData,F as default}; diff --git a/en/api/index.html b/en/api/index.html index ee522a0..d2c8ab1 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 b7dcb0f..5a259b8 100644 --- a/en/api/mp_math/angle.html +++ b/en/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

Args:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

Source code
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle(Angle)

method __init__(self, value: float, is_radian: bool = False)

任意角度。

Arguments:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

Source code
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,98 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

Return:

  • 余角
Source code
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

Return:

  • 余角
Source code
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

Return:

  • 补角
Source code
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

Return:

  • 补角
Source code
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

Return:

  • 弧度
Source code
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

角度。

Return:

  • 弧度
Source code
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

Return:

  • 最小正角度
Source code
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

Return:

  • 最小正角度
Source code
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

Return:

  • 最大负角度
Source code
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

Return:

  • 最大负角度
Source code
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

Return:

  • 正弦值
Source code
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

正弦值。

Return:

  • 正弦值
Source code
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

Return:

  • 余弦值
Source code
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

Return:

  • 余弦值
Source code
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

Return:

  • 正切值
Source code
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

Return:

  • 正切值
Source code
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

Return:

  • 余切值
Source code
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

Return:

  • 余切值
Source code
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

Return:

  • 正割值
Source code
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

正割值。

Return:

  • 正割值
Source code
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

Return:

  • 余割值
Source code
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

余割值。

Return:

  • 余割值
Source code
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

def __add__(self, other: 'AnyAngle') -> 'AnyAngle'

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian + other.radian, is_radian=True)

def __eq__(self, other)

Source code
python
def __eq__(self, other):
-    return approx(self.radian, other.radian)

def __sub__(self, other: 'AnyAngle') -> 'AnyAngle'

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
-    return AnyAngle(self.radian - other.radian, is_radian=True)

def __mul__(self, other: float) -> 'AnyAngle'

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
-    return AnyAngle(self.radian * other, is_radian=True)

def __repr__(self)

Source code
python
def __repr__(self):
-    return f'AnyAngle({self.radian}, is_radian=True)'

def __str__(self)

Source code
python
def __str__(self):
-    return f'AnyAngle({self.degree}° or {self.radian} rad)'

@overload

def __truediv__(self, other: float) -> 'AnyAngle'

Source code
python
@overload
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

Source code
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

Source code
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

Source code
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

Source code
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

Source code
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

Source code
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

Source code
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

def __truediv__(self, other)

Source code
python
def __truediv__(self, other):
+    ...

method self / other

Source code
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/en/api/mp_math/const.html b/en/api/mp_math/const.html index fb99d22..3bb0d7b 100644 --- a/en/api/mp_math/const.html +++ b/en/api/mp_math/const.html @@ -12,13 +12,13 @@ - + - - + + \ No newline at end of file diff --git a/en/api/mp_math/equation.html b/en/api/mp_math/equation.html index 79e7d5e..2b78516 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: 偏移量

Return:

  • 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

Arguments:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

Return:

  • 偏导函数

Raises:

  • ValueError 无效变量类型
Source code
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -47,16 +47,16 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

Source code
python
def partial_derivative_func(*args: Var) -> Var:
+        raise ValueError('Invalid var type')

func partial_derivative_func() -> Var

Source code
python
def partial_derivative_func(*args: Var) -> Var:
     args_list_plus = list(args)
     args_list_plus[var] += epsilon
     args_list_minus = list(args)
     args_list_minus[var] -= epsilon
-    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

def high_order_partial_derivative_func() -> Var

Source code
python
def high_order_partial_derivative_func(*args: Var) -> Var:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

func high_order_partial_derivative_func() -> Var

Source code
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

Args:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    return result_func(*args)

class CurveEquation

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

Arguments:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

Source code
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
     """
         曲线方程。
         Args:
@@ -66,7 +66,7 @@
         """
     self.x_func = x_func
     self.y_func = y_func
-    self.z_func = z_func

def __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

Args:

  • *t:

  • 参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

Arguments:

  • *t:

  • 参数:

Source code
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,8 @@
     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)

Source code
python
def __str__(self):
-    return 'CurveEquation()'

var result_func = get_partial_derivative_func(result_func, v, epsilon)

- + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
+ \ No newline at end of file diff --git a/en/api/mp_math/index.html b/en/api/mp_math/index.html index 89d31c5..b544708 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 86075ef..106c9ea 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

method __init__(self, point: Point3, direction: Vector3)

三维空间中的直线。由一个点和一个方向向量确定。

Arguments:

  • point: 直线上的一点

  • direction: 直线的方向向量

Source code
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

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:
+    self.direction = direction

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

Arguments:

  • other: 另一条直线

  • epsilon: 误差

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -34,7 +34,7 @@
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

Args:

  • other: 另一条直线

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

计算直线和直线之间的夹角。

Arguments:

  • other: 另一条直线

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

Args:

  • other: 平行直线或点

Return:

  • 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

计算直线和直线或点之间的距离。

Arguments:

  • other: 平行直线或点

Return:

  • 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

Args:

  • other: 另一条直线

Return:

  • 交点

Raises:

  • ValueError 直线平行

  • ValueError 直线不共面

Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

计算两条直线的交点。

Arguments:

  • other: 另一条直线

Return:

  • 交点

Raises:

  • ValueError 直线平行

  • ValueError 直线不共面

Source code
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

def cal_perpendicular(self, point: 'Point3') -> 'Line3'

计算直线经过指定点p的垂线。

Args:

  • point: 指定点

Return:

  • 垂线
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
+    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

method cal_perpendicular(self, point: Point3) -> Line3

计算直线经过指定点p的垂线。

Arguments:

  • point: 指定点

Return:

  • 垂线
Source code
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
     """
         计算直线经过指定点p的垂线。
         Args:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

def get_point(self, t: RealNumber) -> 'Point3'

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Args:

  • t: 参数t

Return:

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
+    return Line3(point, self.direction.cross(point - self.point))

method get_point(self, t: RealNumber) -> Point3

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

Arguments:

  • t: 参数t

Return:

Source code
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -98,13 +98,13 @@
         Returns:
 
         """
-    return self.point + t * self.direction

def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

Return:

  • x(t), y(t), z(t)
Source code
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    return self.point + t * self.direction

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

Return:

  • x(t), y(t), z(t)
Source code
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

def is_approx_parallel(self, other: 'Line3', epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

Args:

  • other: 另一条直线

  • epsilon: 误差

Return:

  • 是否近似平行
Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

Arguments:

  • other: 另一条直线

  • epsilon: 误差

Return:

  • 是否近似平行
Source code
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
     """
         判断两条直线是否近似平行。
         Args:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

def is_parallel(self, other: 'Line3') -> bool

判断两条直线是否平行。

Args:

  • other: 另一条直线

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

判断两条直线是否平行。

Arguments:

  • other: 另一条直线

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

Args:

  • other: 另一条直线

Return:

  • 是否共线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

判断两条直线是否共线。

Arguments:

  • other: 另一条直线

Return:

  • 是否共线
Source code
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -129,7 +129,7 @@
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

def is_point_on(self, point: 'Point3') -> bool

判断点是否在直线上。

Args:

  • point: 点

Return:

  • 是否在直线上
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
+    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

method is_point_on(self, point: Point3) -> bool

判断点是否在直线上。

Arguments:

  • point: 点

Return:

  • 是否在直线上
Source code
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

def is_coplanar(self, other: 'Line3') -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Args:

  • other: 另一条直线

Return:

  • 是否共面
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
+    return (point - self.point).is_parallel(self.direction)

method is_coplanar(self, other: Line3) -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

Arguments:

  • other: 另一条直线

Return:

  • 是否共面
Source code
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -146,7 +146,7 @@
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

Source code
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

Source code
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

Args:

  • p1: 点1

  • p2: 点2

Return:

  • 直线
Source code
python
@classmethod
+        self.point.z = 0

@classmethod

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

工厂函数 由两点构造直线。

Arguments:

  • p1: 点1

  • p2: 点2

Return:

  • 直线
Source code
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Args:

  • other: 另一条直线

Return:

  • 交点
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

Arguments:

  • other: 另一条直线

Return:

  • 交点
Source code
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -183,7 +183,7 @@
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

Args:

  • other:
Source code
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

Arguments:

  • other:
Source code
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,22 +194,8 @@
         Returns:
 
         """
-    return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)

def __str__(self)

Source code
python
def __str__(self):
-    """
-        返回点向式(x-x0)
-        Returns:
-
-        """
-    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)

Source code
python
def __repr__(self):
-    return f'Line3({self.point}, {self.direction})'
- + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
+ \ No newline at end of file diff --git a/en/api/mp_math/mp_math_typing.html b/en/api/mp_math/mp_math_typing.html index 259d120..2cc94d0 100644 --- a/en/api/mp_math/mp_math_typing.html +++ b/en/api/mp_math/mp_math_typing.html @@ -12,13 +12,13 @@ - + -
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 = int | float

  • Type: TypeAlias

var Number = RealNumber | complex

  • Type: TypeAlias

var Var = SingleVar | ArrayVar

  • Type: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • Type: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • Type: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • Type: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • Type: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • Type: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • Type: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • Type: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • Type: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • Type: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • Type: TypeAlias
+ \ No newline at end of file diff --git a/en/api/mp_math/plane.html b/en/api/mp_math/plane.html index 2db3230..1f363da 100644 --- a/en/api/mp_math/plane.html +++ b/en/api/mp_math/plane.html @@ -12,33 +12,31 @@ - + -
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

method __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

Arguments:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

Source code
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            d: 常数项
         """
     self.a = a
     self.b = b
     self.c = c
-    self.d = d

def approx(self, other: 'Plane3') -> bool

判断两个平面是否近似相等。

Args:

  • other:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Plane3') -> bool:
+    self.d = d

method approx(self, other: Plane3) -> bool

判断两个平面是否近似相等。

Arguments:

  • other: 另一个平面

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
-            other:
-
+            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)
@@ -49,7 +47,7 @@
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

Args:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

计算平面与平面之间的夹角。

Arguments:

  • other: 另一个平面

Return:

  • 夹角弧度

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -64,7 +62,7 @@
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

Args:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

计算平面与平面或点之间的距离。

Arguments:

  • other: 另一个平面或点

Return:

  • 距离

Raises:

  • TypeError 不支持的类型
Source code
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -79,13 +77,13 @@
     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: 另一个平面

Return:

  • 交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_intersection_line3(self, other: Plane3) -> Line3

计算两平面的交线。

Arguments:

  • other: 另一个平面

Return:

  • 两平面的交线
Source code
python
def cal_intersection_line3(self, other: 'Plane3') -> 'Line3':
     """
-        计算两平面的交线。该方法有问题,待修复。
+        计算两平面的交线。
         Args:
             other: 另一个平面
         Returns:
-            交线
+            两平面的交线
         Raises:
         """
     if self.normal.is_parallel(other.normal):
@@ -104,7 +102,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

Args:

  • other: 不与平面平行或在平面上的直线

Return:

  • 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

计算平面与直线的交点。

Arguments:

  • other: 不与平面平行或在平面上的直线

Return:

  • 交点

Raises:

  • ValueError 平面与直线平行或重合
Source code
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -118,15 +116,15 @@
         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: 指定点

Return:

  • 平面
Source code
python
def cal_parallel_plane3(self, point: 'Point3') -> 'Plane3':
+    return Point3(x(t), y(t), z(t))

method cal_parallel_plane3(self, point: Point3) -> Plane3

计算平行于该平面且过指定点的平面。

Arguments:

  • point: 指定点

Return:

  • 所求平面
Source code
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

判断两个平面是否平行。

Args:

  • other: 另一个平面

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

判断两个平面是否平行。

Arguments:

  • other: 另一个平面

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -134,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

Return:

  • 法向量
Source code
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

Return:

  • 法向量
Source code
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

Args:

  • point: 平面上的一点

  • normal: 法向量

Return:

  • 平面
Source code
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

工厂函数 由点和法向量构造平面(点法式构造)。

Arguments:

  • point: 平面上的一点

  • normal: 法向量

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -153,7 +151,7 @@
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3'

工厂函数 由三点构造平面。

Args:

  • p1: 点1

  • p2: 点2

  • p3: 点3

Return:

  • 平面
Source code
python
@classmethod
+    return cls(a, b, c, d)

@classmethod

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

工厂函数 由三点构造平面。

Arguments:

  • 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 +165,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

Return:

  • 平面
Source code
python
@classmethod
+    return cls.from_point_and_normal(p1, normal)

@classmethod

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

工厂函数 由两直线构造平面。

Arguments:

  • l1: 直线1

  • l2: 直线2

Return:

  • 平面
Source code
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -181,7 +179,7 @@
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3'

工厂函数 由点和直线构造平面。

Args:

  • point: 面上一点

  • line: 面上直线,不包含点

Return:

  • 平面
Source code
python
@classmethod
+    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

工厂函数 由点和直线构造平面。

Arguments:

  • point: 面上一点

  • line: 面上直线,不包含点

Return:

  • 平面
Source code
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -191,22 +189,11 @@
         Returns:
             平面
         """
-    return cls.from_point_and_normal(point, line.direction)

def __repr__(self)

Source code
python
def __repr__(self):
-    return f'Plane3({self.a}, {self.b}, {self.c}, {self.d})'

def __str__(self)

Source code
python
def __str__(self):
-    s = 'Plane3: '
-    if self.a != 0:
-        s += f'{sign(self.a, only_neg=True)}{abs(self.a)}x'
-    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'

Source code
python
@overload
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

Source code
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

Source code
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

Source code
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

Args:

  • other:

Return:

  • 不平行平面的交线,平面平行返回None
Source code
python
def __and__(self, other):
+    ...

method __and__(self, other)

取两平面的交集(人话:交线)

Arguments:

  • other:

Return:

  • 不平行平面的交线,平面平行返回None
Source code
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -223,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> 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])

- + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

Source code
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

Source code
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
+ \ No newline at end of file diff --git a/en/api/mp_math/point.html b/en/api/mp_math/point.html index a6671ce..91314cb 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

method __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

Arguments:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

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:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

Arguments:

  • other:

  • epsilon:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,12 +37,11 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def __str__(self)

Source code
python
def __str__(self):
-    return f'Point3({self.x}, {self.y}, {self.z})'

@overload

def __add__(self, other: 'Vector3') -> 'Point3'

Source code
python
@overload
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

P + V -> P P + P -> P

Args:

  • other:
Source code
python
def __add__(self, other):
+    ...

method self + other

P + V -> P P + P -> P

Arguments:

  • other:
Source code
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -50,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

Args:

  • other:
Source code
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

Arguments:

  • other:
Source code
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

Args:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

Arguments:

  • other:
Source code
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -69,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/en/api/mp_math/segment.html b/en/api/mp_math/segment.html index 12b2366..f46d684 100644 --- a/en/api/mp_math/segment.html +++ b/en/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

三维空间中的线段。 :param p1: :param p2:

Source code
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -30,10 +30,8 @@
     '长度'
     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)

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})'
- + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
+ \ No newline at end of file diff --git a/en/api/mp_math/utils.html b/en/api/mp_math/utils.html index 7e49a43..d206132 100644 --- a/en/api/mp_math/utils.html +++ b/en/api/mp_math/utils.html @@ -12,34 +12,33 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

Args:

  • x:

  • min_:

  • max_:

Return:

  • 限制后的值
Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func clamp() -> float

区间限定函数

Arguments:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

Return:

  • 限制后的值
Source code
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        x: 待限定的值
+        min_: 最小值
+        max_: 最大值
 
     Returns:
         限制后的值
     """
-    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:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

Arguments:

  • x: 数1

  • y: 数2

  • epsilon: 误差

Return:

  • 是否近似相等
Source code
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
-        x:
-        y:
-        epsilon:
-
+        x: 数1
+        y: 数2
+        epsilon: 误差
     Returns:
         是否近似相等
     """
-    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:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

获取数的符号。

Arguments:

  • x: 数

  • only_neg: 是否只返回负数的符号

Return:

  • 符号 + - ""
Source code
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +51,7 @@
     elif x < 0:
         return '-'
     else:
-        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:
+        return ''

func sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

Arguments:

  • x: 数

  • only_neg: 是否只返回负数的符号

Return:

  • 符号 + - ""
Source code
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -68,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
-    self.value = value

def __eq__(self, other)

Source code
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

Source code
python
def __init__(self, value: RealNumber):
+    self.value = value

method __eq__(self, other)

Source code
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -79,10 +78,10 @@
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

Source code
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

Source code
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

Source code
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/en/api/mp_math/vector.html b/en/api/mp_math/vector.html index 52fe727..2bd78d6 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

method __init__(self, x: float, y: float, z: float)

3维向量

Arguments:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

Source code
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

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:
+    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

Arguments:

  • other:

  • epsilon:

Return:

  • 是否近似相等
Source code
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -37,7 +37,7 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

def cal_angle(self, other: 'Vector3') -> 'AnyAngle'

计算两个向量之间的夹角。

Args:

  • other: 另一个向量

Return:

  • 夹角
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

method cal_angle(self, other: Vector3) -> AnyAngle

计算两个向量之间的夹角。

Arguments:

  • other: 另一个向量

Return:

  • 夹角
Source code
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -45,7 +45,7 @@
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Args:

  • other:

Return:

  • 行列式的结果
Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

Arguments:

  • other:

Return:

  • 行列式的结果
Source code
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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:
+    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

Arguments:

  • other: 另一个向量

  • epsilon: 允许的误差

Return:

  • 是否近似平行
Source code
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

Args:

  • other: 另一个向量

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

判断两个向量是否平行。

Arguments:

  • other: 另一个向量

Return:

  • 是否平行
Source code
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -82,7 +82,7 @@
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

将向量归一化。

自体归一化,不返回值。

Source code
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

Source code
python
@property
+    self.z /= length

@property

method np_array(self) -> np.ndarray

Source code
python
@property
 def np_array(self) -> 'np.ndarray':
     """
         返回numpy数组
         Returns:
         """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

Return:

Source code
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

向量的模。

Return:

Source code
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

Return:

  • 单位向量
Source code
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

Return:

  • 单位向量
Source code
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

def __abs__(self)

Source code
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+    return self / self.length

method __abs__(self)

Source code
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

Source code
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

Source code
python
@overload
+    ...

@overload

method self + other: Point3 => Point3

Source code
python
@overload
 def __add__(self, other: 'Point3') -> 'Point3':
-    ...

def __add__(self, other)

V + P -> P

V + V -> V

Args:

  • other:
Source code
python
def __add__(self, other):
+    ...

method self + other

V + P -> P

V + V -> V

Arguments:

  • other:
Source code
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

Args:

  • other:

Return:

  • 是否相等
Source code
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __eq__(self, other)

判断两个向量是否相等。

Arguments:

  • other:

Return:

  • 是否相等
Source code
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -139,7 +139,7 @@
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => Point3

P + V -> P

别去点那边实现了。 :param other: :return:

Source code
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

Source code
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

Source code
python
@overload
+    ...

@overload

method self - other: Point3 => Point3

Source code
python
@overload
 def __sub__(self, other: 'Point3') -> 'Point3':
-    ...

def __sub__(self, other)

V - P -> P

V - V -> V

Args:

  • other:
Source code
python
def __sub__(self, other):
+    ...

method self - other

V - P -> P

V - V -> V

Arguments:

  • other:
Source code
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
     else:
-        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

Args:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

method self - other: Point3

P - V -> P

Arguments:

  • other:
Source code
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -176,11 +176,11 @@
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

Source code
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

Source code
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

Source code
python
@overload
+    ...

@overload

method self * other: RealNumber => Vector3

Source code
python
@overload
 def __mul__(self, other: RealNumber) -> 'Vector3':
-    ...

def __mul__(self, other: 'int | float | Vector3') -> 'Vector3'

数组运算 非点乘。点乘使用@,叉乘使用cross。

Args:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

数组运算 非点乘。点乘使用@,叉乘使用cross。

Arguments:

  • other:
Source code
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,18 @@
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

def __rmul__(self, other: 'RealNumber') -> 'Vector3'

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
-    return self.__mul__(other)

def __matmul__(self, other: 'Vector3') -> 'RealNumber'

点乘。

Args:

  • other:
Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

Source code
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

点乘。

Arguments:

  • other:
Source code
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

def __truediv__(self, other: RealNumber) -> 'Vector3'

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
-    return Vector3(self.x / other, self.y / other, self.z / other)

def __neg__(self)

Source code
python
def __neg__(self):
-    return Vector3(-self.x, -self.y, -self.z)

def __repr__(self)

Source code
python
def __repr__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

def __str__(self)

Source code
python
def __str__(self):
-    return f'Vector3({self.x}, {self.y}, {self.z})'

var zero_vector3 = Vector3(0, 0, 0)

var x_axis = Vector3(1, 0, 0)

var y_axis = Vector3(0, 1, 0)

var z_axis = Vector3(0, 0, 1)

- + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

Source code
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

Source code
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • Type: Vector3

  • Description: 零向量

var x_axis = Vector3(1, 0, 0)

  • Type: Vector3

  • Description: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • Type: Vector3

  • Description: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • Type: Vector3

  • Description: z轴单位向量

+ \ No newline at end of file diff --git a/en/api/particle/index.html b/en/api/particle/index.html index ebfad06..26cf445 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 3fb8407..3d4f738 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 c77b69e..4057700 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:

Return:

  • List[Point3]: 球体上的点集。
Source code
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

Arguments:

  • radius:

  • density:

Return:

  • List[Point3]: 球体上的点集。
Source code
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -35,7 +35,7 @@
     y_array = radius * np.sin(phi_list) * np.sin(theta_list)
     z_array = radius * np.cos(phi_list)
     return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
- + \ No newline at end of file diff --git a/guide/index.html b/guide/index.html index 6c68e0e..484e0c0 100644 --- a/guide/index.html +++ b/guide/index.html @@ -17,8 +17,8 @@ -
Skip to content

开始不了一点

- +
Skip to content

开始不了一点

+ \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index dc9ae90..004e0f2 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":"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_"} +{"api-ex.md":"DOsKaL8H","api_index.md":"BvazTqTB","api_mp_math_angle.md":"HvtyV1VE","api_mp_math_const.md":"BzOZuyZq","api_mp_math_equation.md":"C2RSv9WY","api_mp_math_index.md":"4P0hk6gb","api_mp_math_line.md":"BPnyTp_q","api_mp_math_mp_math_typing.md":"B0OaWJmF","api_mp_math_plane.md":"DLhf2OdI","api_mp_math_point.md":"0dOKpGzi","api_mp_math_segment.md":"9QWXtPbn","api_mp_math_utils.md":"DdkUph5B","api_mp_math_vector.md":"Bodba8jG","api_particle_index.md":"BRCSxC3e","api_presets_index.md":"Dl6Ss91J","api_presets_model_index.md":"YrmtLmca","en_api_index.md":"Bgu-LD1B","en_api_mp_math_angle.md":"fmci6qlC","en_api_mp_math_const.md":"6yNmEodn","en_api_mp_math_equation.md":"BwRlBW4s","en_api_mp_math_index.md":"DrjDUYBY","en_api_mp_math_line.md":"B1oAhkHS","en_api_mp_math_mp_math_typing.md":"Ba9aYPR2","en_api_mp_math_plane.md":"D3xHJy8e","en_api_mp_math_point.md":"P1GRdc2H","en_api_mp_math_segment.md":"DqDvJpQR","en_api_mp_math_utils.md":"B0nejTCy","en_api_mp_math_vector.md":"BpRKRIGw","en_api_particle_index.md":"CmC1QX5o","en_api_presets_index.md":"CZ5hl_7D","en_api_presets_model_index.md":"j5zmPSwU","guide_index.md":"BE2yloik","index.md":"BE1qChTt","ja_api_index.md":"4BnflFIm","ja_api_mp_math_angle.md":"D2dStPZh","ja_api_mp_math_const.md":"CflutYeA","ja_api_mp_math_equation.md":"Cj8tgo_3","ja_api_mp_math_index.md":"CSAMHYsB","ja_api_mp_math_line.md":"Dg8duKLw","ja_api_mp_math_mp_math_typing.md":"Bhy6h0r0","ja_api_mp_math_plane.md":"CTOkqSft","ja_api_mp_math_point.md":"ZsmRVuaC","ja_api_mp_math_segment.md":"D5ZKDDr_","ja_api_mp_math_utils.md":"jeRmCp2Q","ja_api_mp_math_vector.md":"DAXdHSjp","ja_api_particle_index.md":"E2YnH7EN","ja_api_presets_index.md":"ATGcHt9d","ja_api_presets_model_index.md":"CleEI4sj","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_","zht_api_index.md":"Dq4XPUKZ","zht_api_mp_math_angle.md":"CMQhsVJf","zht_api_mp_math_const.md":"CIhADrI2","zht_api_mp_math_equation.md":"BwlIZxDL","zht_api_mp_math_index.md":"D09y2ubg","zht_api_mp_math_line.md":"Czel-DYb","zht_api_mp_math_mp_math_typing.md":"DlxSozR9","zht_api_mp_math_plane.md":"CxUaQCvU","zht_api_mp_math_point.md":"BmRy6Xj6","zht_api_mp_math_segment.md":"Bn34DhAl","zht_api_mp_math_utils.md":"BtiDgiKf","zht_api_mp_math_vector.md":"DmxfMXiN","zht_api_particle_index.md":"kAm9VAEw","zht_api_presets_index.md":"BmouaEaT","zht_api_presets_model_index.md":"DDom2SLG"} diff --git a/index.html b/index.html index 21de108..6e39a3c 100644 --- a/index.html +++ b/index.html @@ -17,8 +17,8 @@ -
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 c0ddb31..e268c1e 100644 --- a/ja/api/index.html +++ b/ja/api/index.html @@ -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 1417142..02aaee1 100644 --- a/ja/api/mp_math/angle.html +++ b/ja/api/mp_math/angle.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Angle

class AnyAngle

def __init__(self, value: float, is_radian: bool = False)

任意角度。

引数:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
+    
Skip to content

class Angle

class AnyAngle(Angle)

method __init__(self, value: float, is_radian: bool = False)

任意角度。

引数:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

ソースコード
python
def __init__(self, value: float, is_radian: bool=False):
     """
         任意角度。
         Args:
@@ -27,98 +27,96 @@
     if is_radian:
         self.radian = value
     else:
-        self.radian = value * PI / 180

@property

def complementary(self) -> 'AnyAngle'

余角:两角的和为90°。

戻り値:

  • 余角
ソースコード
python
@property
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

戻り値:

  • 余角
ソースコード
python
@property
 def complementary(self) -> 'AnyAngle':
     """
         余角:两角的和为90°。
         Returns:
             余角
         """
-    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

def supplementary(self) -> 'AnyAngle'

补角:两角的和为180°。

戻り値:

  • 补角
ソースコード
python
@property
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

戻り値:

  • 补角
ソースコード
python
@property
 def supplementary(self) -> 'AnyAngle':
     """
         补角:两角的和为180°。
         Returns:
             补角
         """
-    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

def degree(self) -> float

角度。

戻り値:

  • 弧度
ソースコード
python
@property
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

角度。

戻り値:

  • 弧度
ソースコード
python
@property
 def degree(self) -> float:
     """
         角度。
         Returns:
             弧度
         """
-    return self.radian * 180 / PI

@property

def minimum_positive(self) -> 'AnyAngle'

最小正角。

戻り値:

  • 最小正角度
ソースコード
python
@property
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

戻り値:

  • 最小正角度
ソースコード
python
@property
 def minimum_positive(self) -> 'AnyAngle':
     """
         最小正角。
         Returns:
             最小正角度
         """
-    return AnyAngle(self.radian % (2 * PI))

@property

def maximum_negative(self) -> 'AnyAngle'

最大负角。

戻り値:

  • 最大负角度
ソースコード
python
@property
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

戻り値:

  • 最大负角度
ソースコード
python
@property
 def maximum_negative(self) -> 'AnyAngle':
     """
         最大负角。
         Returns:
             最大负角度
         """
-    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

def sin(self) -> float

正弦值。

戻り値:

  • 正弦值
ソースコード
python
@property
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

正弦值。

戻り値:

  • 正弦值
ソースコード
python
@property
 def sin(self) -> float:
     """
         正弦值。
         Returns:
             正弦值
         """
-    return math.sin(self.radian)

@property

def cos(self) -> float

余弦值。

戻り値:

  • 余弦值
ソースコード
python
@property
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

戻り値:

  • 余弦值
ソースコード
python
@property
 def cos(self) -> float:
     """
         余弦值。
         Returns:
             余弦值
         """
-    return math.cos(self.radian)

@property

def tan(self) -> float

正切值。

戻り値:

  • 正切值
ソースコード
python
@property
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

戻り値:

  • 正切值
ソースコード
python
@property
 def tan(self) -> float:
     """
         正切值。
         Returns:
             正切值
         """
-    return math.tan(self.radian)

@property

def cot(self) -> float

余切值。

戻り値:

  • 余切值
ソースコード
python
@property
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

戻り値:

  • 余切值
ソースコード
python
@property
 def cot(self) -> float:
     """
         余切值。
         Returns:
             余切值
         """
-    return 1 / math.tan(self.radian)

@property

def sec(self) -> float

正割值。

戻り値:

  • 正割值
ソースコード
python
@property
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

正割值。

戻り値:

  • 正割值
ソースコード
python
@property
 def sec(self) -> float:
     """
         正割值。
         Returns:
             正割值
         """
-    return 1 / math.cos(self.radian)

@property

def csc(self) -> float

余割值。

戻り値:

  • 余割值
ソースコード
python
@property
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

余割值。

戻り値:

  • 余割值
ソースコード
python
@property
 def csc(self) -> float:
     """
         余割值。
         Returns:
             余割值
         """
-    return 1 / math.sin(self.radian)

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
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

ソースコード
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

ソースコード
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

ソースコード
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

ソースコード
python
@overload
 def __truediv__(self, other: float) -> 'AnyAngle':
-    ...

@overload

def __truediv__(self, other: 'AnyAngle') -> float

ソースコード
python
@overload
+    ...

@overload

method self / other: AnyAngle => float

ソースコード
python
@overload
 def __truediv__(self, other: 'AnyAngle') -> float:
-    ...

def __truediv__(self, other)

ソースコード
python
def __truediv__(self, other):
+    ...

method self / other

ソースコード
python
def __truediv__(self, other):
     if isinstance(other, AnyAngle):
         return self.radian / other.radian
     return AnyAngle(self.radian / other, is_radian=True)
- + \ No newline at end of file diff --git a/ja/api/mp_math/const.html b/ja/api/mp_math/const.html index 3b75e21..c6f66df 100644 --- a/ja/api/mp_math/const.html +++ b/ja/api/mp_math/const.html @@ -12,13 +12,13 @@ - + - - + + \ No newline at end of file diff --git a/ja/api/mp_math/equation.html b/ja/api/mp_math/equation.html index 3b2f485..a376aa1 100644 --- a/ja/api/mp_math/equation.html +++ b/ja/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: 偏移量

戻り値:

  • 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

引数:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

戻り値:

  • 偏导函数

例外:

  • ValueError 无效变量类型
ソースコード
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
     """
     求N元函数一阶偏导函数。这玩意不太稳定,慎用。
     Args:
@@ -47,16 +47,16 @@
             return result_func(*args)
         return high_order_partial_derivative_func
     else:
-        raise ValueError('Invalid var type')

def partial_derivative_func() -> Var

ソースコード
python
def partial_derivative_func(*args: Var) -> Var:
+        raise ValueError('Invalid var type')

func 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:
+    return (func(*args_list_plus) - func(*args_list_minus)) / (2 * epsilon)

func high_order_partial_derivative_func() -> Var

ソースコード
python
def high_order_partial_derivative_func(*args: Var) -> Var:
     result_func = func
     for v in var:
         result_func = get_partial_derivative_func(result_func, v, epsilon)
-    return result_func(*args)

class CurveEquation

def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

引数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

ソースコード
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    return result_func(*args)

class CurveEquation

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

引数:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

ソースコード
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
     """
         曲线方程。
         Args:
@@ -66,7 +66,7 @@
         """
     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, ...]:
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

引数:

  • *t:

  • 参数:

ソースコード
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
     """
         计算曲线上的点。
         Args:
@@ -78,9 +78,8 @@
     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)

- + return tuple([Point3(x, y, z) for x, y, z in zip(self.x_func(t), self.y_func(t), self.z_func(t))])
+ \ No newline at end of file diff --git a/ja/api/mp_math/index.html b/ja/api/mp_math/index.html index 06315a8..1e289d5 100644 --- a/ja/api/mp_math/index.html +++ b/ja/api/mp_math/index.html @@ -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 02c8c01..7aa3dcf 100644 --- a/ja/api/mp_math/line.html +++ b/ja/api/mp_math/line.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Line3

def __init__(self, point: 'Point3', direction: 'Vector3')

三维空间中的直线。由一个点和一个方向向量确定。

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
+    
Skip to content

class Line3

method __init__(self, point: Point3, direction: Vector3)

三维空间中的直线。由一个点和一个方向向量确定。

引数:

  • point: 直线上的一点

  • direction: 直线的方向向量

ソースコード
python
def __init__(self, point: 'Point3', direction: 'Vector3'):
     """
         三维空间中的直线。由一个点和一个方向向量确定。
         Args:
@@ -25,7 +25,7 @@
             direction: 直线的方向向量
         """
     self.point = point
-    self.direction = direction

def approx(self, other: 'Line3', epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
+    self.direction = direction

method approx(self, other: Line3, epsilon: float = APPROX) -> bool

判断两条直线是否近似相等。

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Line3', epsilon: float=APPROX) -> bool:
     """
         判断两条直线是否近似相等。
         Args:
@@ -34,7 +34,7 @@
         Returns:
             是否近似相等
         """
-    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

def cal_angle(self, other: 'Line3') -> 'AnyAngle'

计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
+    return self.is_approx_parallel(other, epsilon) and (self.point - other.point).is_approx_parallel(self.direction, epsilon)

method cal_angle(self, other: Line3) -> AnyAngle

计算直线和直线之间的夹角。

引数:

  • other: 另一条直线

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3') -> 'AnyAngle':
     """
         计算直线和直线之间的夹角。
         Args:
@@ -44,7 +44,7 @@
         Raises:
             TypeError: 不支持的类型
         """
-    return self.direction.cal_angle(other.direction)

def cal_distance(self, other: 'Line3 | Point3') -> float

计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
+    return self.direction.cal_angle(other.direction)

method cal_distance(self, other: Line3 | Point3) -> float

计算直线和直线或点之间的距离。

引数:

  • other: 平行直线或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Line3 | Point3') -> float:
     """
         计算直线和直线或点之间的距离。
         Args:
@@ -67,7 +67,7 @@
     elif isinstance(other, Point3):
         return (other - self.point).cross(self.direction).length / self.direction.length
     else:
-        raise TypeError('Unsupported type.')

def cal_intersection(self, other: 'Line3') -> 'Point3'

计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点

例外:

  • ValueError 直线平行

  • ValueError 直线不共面

ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
+        raise TypeError('Unsupported type.')

method cal_intersection(self, other: Line3) -> Point3

计算两条直线的交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点

例外:

  • ValueError 直线平行

  • ValueError 直线不共面

ソースコード
python
def cal_intersection(self, other: 'Line3') -> 'Point3':
     """
         计算两条直线的交点。
         Args:
@@ -82,7 +82,7 @@
         raise ValueError('Lines are parallel and do not intersect.')
     if not self.is_coplanar(other):
         raise ValueError('Lines are not coplanar and do not intersect.')
-    return self.point + self.direction.cross(other.direction) @ other.direction.cross(self.point - other.point) / self.direction.cross(other.direction).length ** 2 * self.direction

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

method cal_perpendicular(self, point: Point3) -> Line3

计算直线经过指定点p的垂线。

引数:

  • point: 指定点

戻り値:

  • 垂线
ソースコード
python
def cal_perpendicular(self, point: 'Point3') -> 'Line3':
     """
         计算直线经过指定点p的垂线。
         Args:
@@ -90,7 +90,7 @@
         Returns:
             垂线
         """
-    return Line3(point, self.direction.cross(point - self.point))

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))

method get_point(self, t: RealNumber) -> Point3

获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。

引数:

  • t: 参数t

戻り値:

ソースコード
python
def get_point(self, t: RealNumber) -> 'Point3':
     """
         获取直线上的点。同一条直线,但起始点和方向向量不同,则同一个t对应的点不同。
         Args:
@@ -98,13 +98,13 @@
         Returns:
 
         """
-    return self.point + t * self.direction

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]:
+    return self.point + t * self.direction

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

戻り値:

  • x(t), y(t), z(t)
ソースコード
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
     """
         获取直线的参数方程。
         Returns:
             x(t), y(t), z(t)
         """
-    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

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)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

引数:

  • other: 另一条直线

  • epsilon: 误差

戻り値:

  • 是否近似平行
ソースコード
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
     """
         判断两条直线是否近似平行。
         Args:
@@ -113,7 +113,7 @@
         Returns:
             是否近似平行
         """
-    return self.direction.is_approx_parallel(other.direction, epsilon)

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)

method is_parallel(self, other: Line3) -> bool

判断两条直线是否平行。

引数:

  • other: 另一条直线

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Line3') -> bool:
     """
         判断两条直线是否平行。
         Args:
@@ -121,7 +121,7 @@
         Returns:
             是否平行
         """
-    return self.direction.is_parallel(other.direction)

def is_collinear(self, other: 'Line3') -> bool

判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値:

  • 是否共线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
+    return self.direction.is_parallel(other.direction)

method is_collinear(self, other: Line3) -> bool

判断两条直线是否共线。

引数:

  • other: 另一条直线

戻り値:

  • 是否共线
ソースコード
python
def is_collinear(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共线。
         Args:
@@ -129,7 +129,7 @@
         Returns:
             是否共线
         """
-    return self.is_parallel(other) and (self.point - other.point).is_parallel(self.direction)

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)

method is_point_on(self, point: Point3) -> bool

判断点是否在直线上。

引数:

  • point: 点

戻り値:

  • 是否在直线上
ソースコード
python
def is_point_on(self, point: 'Point3') -> bool:
     """
         判断点是否在直线上。
         Args:
@@ -137,7 +137,7 @@
         Returns:
             是否在直线上
         """
-    return (point - self.point).is_parallel(self.direction)

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)

method is_coplanar(self, other: Line3) -> bool

判断两条直线是否共面。 充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。

引数:

  • other: 另一条直线

戻り値:

  • 是否共面
ソースコード
python
def is_coplanar(self, other: 'Line3') -> bool:
     """
         判断两条直线是否共面。
         充要条件:两直线方向向量的叉乘与两直线上任意一点的向量的点积为0。
@@ -146,7 +146,7 @@
         Returns:
             是否共面
         """
-    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

def simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

ソースコード
python
def simplify(self):
+    return self.direction.cross(other.direction) @ (self.point - other.point) == 0

method simplify(self)

简化直线方程,等价相等。 自体简化,不返回值。

按照可行性一次对x y z 化 0 处理,并对向量单位化

ソースコード
python
def simplify(self):
     """
         简化直线方程,等价相等。
         自体简化,不返回值。
@@ -159,7 +159,7 @@
     if self.direction.y == 0:
         self.point.y = 0
     if self.direction.z == 0:
-        self.point.z = 0

@classmethod

def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3'

工厂函数 由两点构造直线。

引数:

  • p1: 点1

  • p2: 点2

戻り値:

  • 直线
ソースコード
python
@classmethod
+        self.point.z = 0

@classmethod

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

工厂函数 由两点构造直线。

引数:

  • p1: 点1

  • p2: 点2

戻り値:

  • 直线
ソースコード
python
@classmethod
 def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
     """
         工厂函数 由两点构造直线。
@@ -170,7 +170,7 @@
             直线
         """
     direction = p2 - p1
-    return cls(p1, direction)

def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None'

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

引数:

  • other: 另一条直线

戻り値:

  • 交点
ソースコード
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
     """
         计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。
         Args:
@@ -183,7 +183,7 @@
     elif self.is_parallel(other) or not self.is_coplanar(other):
         return None
     else:
-        return self.cal_intersection(other)

def __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
+        return self.cal_intersection(other)

method __eq__(self, other) -> bool

判断两条直线是否等价。

v1 // v2 ∧ (p1 - p2) // v1

引数:

  • other:
ソースコード
python
def __eq__(self, other) -> bool:
     """
         判断两条直线是否等价。
 
@@ -194,22 +194,8 @@
         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})'
- + return self.direction.is_parallel(other.direction) and (self.point - other.point).is_parallel(self.direction)
+ \ No newline at end of file diff --git a/ja/api/mp_math/mp_math_typing.html b/ja/api/mp_math/mp_math_typing.html index 6e5c1b7..6da90b3 100644 --- a/ja/api/mp_math/mp_math_typing.html +++ b/ja/api/mp_math/mp_math_typing.html @@ -12,13 +12,13 @@ - + -
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 = int | float

  • タイプ: TypeAlias

var Number = RealNumber | complex

  • タイプ: TypeAlias

var Var = SingleVar | ArrayVar

  • タイプ: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • タイプ: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • タイプ: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • タイプ: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • タイプ: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • タイプ: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • タイプ: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • タイプ: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • タイプ: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • タイプ: TypeAlias
+ \ No newline at end of file diff --git a/ja/api/mp_math/plane.html b/ja/api/mp_math/plane.html index 50fbdb7..c777024 100644 --- a/ja/api/mp_math/plane.html +++ b/ja/api/mp_math/plane.html @@ -12,33 +12,31 @@ - + -
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

method __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

引数:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

ソースコード
python
def __init__(self, a: float, b: float, c: float, d: float):
     """
         平面方程:ax + by + cz + d = 0
         Args:
-            a:
-            b:
-            c:
-            d:
+            a: x系数
+            b: y系数
+            c: z系数
+            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:
+    self.d = d

method approx(self, other: Plane3) -> bool

判断两个平面是否近似相等。

引数:

  • other: 另一个平面

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否近似相等。
         Args:
-            other:
-
+            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)
@@ -49,7 +47,7 @@
         k = other.c / self.c
         return approx(other.a, self.a * k) and approx(other.b, self.b * k) and approx(other.d, self.d * k)
     else:
-        return False

def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle'

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
+        return False

method cal_angle(self, other: Line3 | Plane3) -> AnyAngle

计算平面与平面之间的夹角。

引数:

  • other: 另一个平面

戻り値:

  • 夹角弧度

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_angle(self, other: 'Line3 | Plane3') -> 'AnyAngle':
     """
         计算平面与平面之间的夹角。
         Args:
@@ -64,7 +62,7 @@
     elif isinstance(other, Plane3):
         return AnyAngle(math.acos(self.normal @ other.normal / (self.normal.length * other.normal.length)), is_radian=True)
     else:
-        raise TypeError(f'Unsupported type: {type(other)}')

def cal_distance(self, other: 'Plane3 | Point3') -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
+        raise TypeError(f'Unsupported type: {type(other)}')

method cal_distance(self, other: Plane3 | Point3) -> float

计算平面与平面或点之间的距离。

引数:

  • other: 另一个平面或点

戻り値:

  • 距离

例外:

  • TypeError 不支持的类型
ソースコード
python
def cal_distance(self, other: 'Plane3 | Point3') -> float:
     """
         计算平面与平面或点之间的距离。
         Args:
@@ -79,13 +77,13 @@
     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)}')

method 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):
@@ -104,7 +102,7 @@
         A = np.array([[self.a, self.b], [other.a, other.b]])
         B = np.array([-self.d, -other.d])
         x, y = np.linalg.solve(A, B)
-    return Line3(Point3(x, y, z), direction)

def cal_intersection_point3(self, other: 'Line3') -> 'Point3'

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値:

  • 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
+    return Line3(Point3(x, y, z), direction)

method cal_intersection_point3(self, other: Line3) -> Point3

计算平面与直线的交点。

引数:

  • other: 不与平面平行或在平面上的直线

戻り値:

  • 交点

例外:

  • ValueError 平面与直线平行或重合
ソースコード
python
def cal_intersection_point3(self, other: 'Line3') -> 'Point3':
     """
         计算平面与直线的交点。
         Args:
@@ -118,15 +116,15 @@
         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))

method 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:
+    return Plane3.from_point_and_normal(point, self.normal)

method is_parallel(self, other: Plane3) -> bool

判断两个平面是否平行。

引数:

  • other: 另一个平面

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Plane3') -> bool:
     """
         判断两个平面是否平行。
         Args:
@@ -134,14 +132,14 @@
         Returns:
             是否平行
         """
-    return self.normal.is_parallel(other.normal)

@property

def normal(self) -> 'Vector3'

平面的法向量。

戻り値:

  • 法向量
ソースコード
python
@property
+    return self.normal.is_parallel(other.normal)

@property

method normal(self) -> Vector3

平面的法向量。

戻り値:

  • 法向量
ソースコード
python
@property
 def normal(self) -> 'Vector3':
     """
         平面的法向量。
         Returns:
             法向量
         """
-    return Vector3(self.a, self.b, self.c)

@classmethod

def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3'

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

工厂函数 由点和法向量构造平面(点法式构造)。

引数:

  • point: 平面上的一点

  • normal: 法向量

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_normal(cls, point: 'Point3', normal: 'Vector3') -> 'Plane3':
     """
         工厂函数 由点和法向量构造平面(点法式构造)。
@@ -153,7 +151,7 @@
         """
     a, b, c = (normal.x, normal.y, normal.z)
     d = -a * point.x - b * point.y - c * point.z
-    return cls(a, b, c, d)

@classmethod

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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

工厂函数 由三点构造平面。

引数:

  • p1: 点1

  • p2: 点2

  • p3: 点3

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
     """
         工厂函数 由三点构造平面。
@@ -167,7 +165,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

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

工厂函数 由两直线构造平面。

引数:

  • l1: 直线1

  • l2: 直线2

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
     """
         工厂函数 由两直线构造平面。
@@ -181,7 +179,7 @@
     v2 = l2.point - l1.point
     if v2 == zero_vector3:
         v2 = l2.get_point(1) - l1.point
-    return cls.from_point_and_normal(l1.point, v1.cross(v2))

@classmethod

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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

工厂函数 由点和直线构造平面。

引数:

  • point: 面上一点

  • line: 面上直线,不包含点

戻り値:

  • 平面
ソースコード
python
@classmethod
 def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
     """
         工厂函数 由点和直线构造平面。
@@ -191,22 +189,11 @@
         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
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Line3') -> 'Point3 | None':
-    ...

@overload

def __and__(self, other: 'Plane3') -> 'Line3 | None'

ソースコード
python
@overload
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

ソースコード
python
@overload
 def __and__(self, other: 'Plane3') -> 'Line3 | None':
-    ...

def __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
+    ...

method __and__(self, other)

取两平面的交集(人话:交线)

引数:

  • other:

戻り値:

  • 不平行平面的交线,平面平行返回None
ソースコード
python
def __and__(self, other):
     """
         取两平面的交集(人话:交线)
         Args:
@@ -223,10 +210,10 @@
             return None
         return self.cal_intersection_point3(other)
     else:
-        raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

def __eq__(self, other) -> 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])

- + raise TypeError(f"unsupported operand type(s) for &: 'Plane3' and '{type(other)}'")

method __eq__(self, other) -> bool

ソースコード
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

ソースコード
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
+ \ No newline at end of file diff --git a/ja/api/mp_math/point.html b/ja/api/mp_math/point.html index 757297a..6623310 100644 --- a/ja/api/mp_math/point.html +++ b/ja/api/mp_math/point.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Point3

def __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
+    
Skip to content

class Point3

method __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

引数:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         笛卡尔坐标系中的点。
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Point3', epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
     """
         判断两个点是否近似相等。
         Args:
@@ -37,12 +37,11 @@
         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
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Point3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self + other

P + V -> P P + P -> P

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         P + V -> P
         P + P -> P
@@ -50,14 +49,14 @@
             other:
         Returns:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

def __eq__(self, other)

判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

引数:

  • other:
ソースコード
python
def __eq__(self, other):
     """
         判断两个点是否相等。
         Args:
             other:
         Returns:
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __sub__(self, other: 'Point3') -> 'Vector3'

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

引数:

  • other:
ソースコード
python
def __sub__(self, other: 'Point3') -> 'Vector3':
     """
         P - P -> V
 
@@ -69,7 +68,7 @@
         """
     from .vector import Vector3
     return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
- + \ No newline at end of file diff --git a/ja/api/mp_math/segment.html b/ja/api/mp_math/segment.html index efec9d9..bfecb8f 100644 --- a/ja/api/mp_math/segment.html +++ b/ja/api/mp_math/segment.html @@ -12,12 +12,12 @@ - + -
Skip to content

class Segment3

def __init__(self, p1: 'Point3', p2: 'Point3')

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

三维空间中的线段。 :param p1: :param p2:

ソースコード
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
     """
         三维空间中的线段。
         :param p1:
@@ -30,10 +30,8 @@
     '长度'
     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})'
- + self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
+ \ No newline at end of file diff --git a/ja/api/mp_math/utils.html b/ja/api/mp_math/utils.html index ffe9c8f..212c332 100644 --- a/ja/api/mp_math/utils.html +++ b/ja/api/mp_math/utils.html @@ -12,34 +12,33 @@ - + -
Skip to content

def clamp() -> float

区间截断函数。

引数:

  • x:

  • min_:

  • max_:

戻り値:

  • 限制后的值
ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
+    
Skip to content

func clamp() -> float

区间限定函数

引数:

  • x: 待限定的值

  • min_: 最小值

  • max_: 最大值

戻り値:

  • 限制后的值
ソースコード
python
def clamp(x: float, min_: float, max_: float) -> float:
     """
-    区间截断函数。
+    区间限定函数
     Args:
-        x:
-        min_:
-        max_:
+        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:
+    return max(min(x, max_), min_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

引数:

  • x: 数1

  • y: 数2

  • epsilon: 误差

戻り値:

  • 是否近似相等
ソースコード
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
     """
     判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
     Args:
-        x:
-        y:
-        epsilon:
-
+        x: 数1
+        y: 数2
+        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:
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

获取数的符号。

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign(x: float, only_neg: bool=False) -> str:
     """获取数的符号。
     Args:
         x: 数
@@ -52,7 +51,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 ''

func sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

引数:

  • x: 数

  • only_neg: 是否只返回负数的符号

戻り値:

  • 符号 + - ""
ソースコード
python
def sign_format(x: float, only_neg: bool=False) -> str:
     """格式化符号数
     -1 -> -1
     1 -> +1
@@ -68,8 +67,8 @@
     elif x < 0:
         return f'-{abs(x)}'
     else:
-        return ''

class Approx

def __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
-    self.value = value

def __eq__(self, other)

ソースコード
python
def __eq__(self, other):
+        return ''

class Approx

method __init__(self, value: RealNumber)

ソースコード
python
def __init__(self, value: RealNumber):
+    self.value = value

method __eq__(self, other)

ソースコード
python
def __eq__(self, other):
     if isinstance(self.value, (float, int)):
         if isinstance(other, (float, int)):
             return abs(self.value - other) < APPROX
@@ -79,10 +78,10 @@
         if isinstance(other, (Vector3, Point3, Plane3, Line3)):
             return all([approx(self.value.x, other.x), approx(self.value.y, other.y), approx(self.value.z, other.z)])
         else:
-            self.raise_type_error(other)

def raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
-    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

def __ne__(self, other)

ソースコード
python
def __ne__(self, other):
+            self.raise_type_error(other)

method raise_type_error(self, other)

ソースコード
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

ソースコード
python
def __ne__(self, other):
     return not self.__eq__(other)
- + \ No newline at end of file diff --git a/ja/api/mp_math/vector.html b/ja/api/mp_math/vector.html index 5482741..024ea01 100644 --- a/ja/api/mp_math/vector.html +++ b/ja/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

method __init__(self, x: float, y: float, z: float)

3维向量

引数:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

ソースコード
python
def __init__(self, x: float, y: float, z: float):
     """
         3维向量
         Args:
@@ -27,7 +27,7 @@
         """
     self.x = x
     self.y = y
-    self.z = z

def approx(self, other: 'Vector3', epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

引数:

  • other:

  • epsilon:

戻り値:

  • 是否近似相等
ソースコード
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似相等。
         Args:
@@ -37,7 +37,7 @@
         Returns:
             是否近似相等
         """
-    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

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])

method cal_angle(self, other: Vector3) -> AnyAngle

计算两个向量之间的夹角。

引数:

  • other: 另一个向量

戻り値:

  • 夹角
ソースコード
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
     """
         计算两个向量之间的夹角。
         Args:
@@ -45,7 +45,7 @@
         Returns:
             夹角
         """
-    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

def cross(self, other: 'Vector3') -> 'Vector3'

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • other:

戻り値:

  • 行列式的结果
ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

引数:

  • other:

戻り値:

  • 行列式的结果
ソースコード
python
def cross(self, other: 'Vector3') -> 'Vector3':
     """
         向量积 叉乘:v1 cross v2 -> v3
 
@@ -65,7 +65,7 @@
         Returns:
             行列式的结果
         """
-    return Vector3(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x)

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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

引数:

  • other: 另一个向量

  • epsilon: 允许的误差

戻り値:

  • 是否近似平行
ソースコード
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
     """
         判断两个向量是否近似平行。
         Args:
@@ -74,7 +74,7 @@
         Returns:
             是否近似平行
         """
-    return self.cross(other).length < epsilon

def is_parallel(self, other: 'Vector3') -> bool

判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
+    return self.cross(other).length < epsilon

method is_parallel(self, other: Vector3) -> bool

判断两个向量是否平行。

引数:

  • other: 另一个向量

戻り値:

  • 是否平行
ソースコード
python
def is_parallel(self, other: 'Vector3') -> bool:
     """
         判断两个向量是否平行。
         Args:
@@ -82,7 +82,7 @@
         Returns:
             是否平行
         """
-    return self.cross(other).approx(zero_vector3)

def normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
+    return self.cross(other).approx(zero_vector3)

method normalize(self)

将向量归一化。

自体归一化,不返回值。

ソースコード
python
def normalize(self):
     """
         将向量归一化。
 
@@ -91,32 +91,32 @@
     length = self.length
     self.x /= length
     self.y /= length
-    self.z /= length

@property

def np_array(self) -> 'np.ndarray'

ソースコード
python
@property
+    self.z /= length

@property

method np_array(self) -> np.ndarray

ソースコード
python
@property
 def np_array(self) -> 'np.ndarray':
     """
         返回numpy数组
         Returns:
         """
-    return np.array([self.x, self.y, self.z])

@property

def length(self) -> float

向量的模。

戻り値:

ソースコード
python
@property
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

向量的模。

戻り値:

ソースコード
python
@property
 def length(self) -> float:
     """
         向量的模。
         Returns:
 
         """
-    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

def unit(self) -> 'Vector3'

获取该向量的单位向量。

戻り値:

  • 单位向量
ソースコード
python
@property
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

戻り値:

  • 单位向量
ソースコード
python
@property
 def unit(self) -> 'Vector3':
     """
         获取该向量的单位向量。
         Returns:
             单位向量
         """
-    return self / self.length

def __abs__(self)

ソースコード
python
def __abs__(self):
-    return self.length

@overload

def __add__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+    return self / self.length

method __abs__(self)

ソースコード
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

ソースコード
python
@overload
 def __add__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __add__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self + other

V + P -> P

V + V -> V

引数:

  • other:
ソースコード
python
def __add__(self, other):
     """
         V + P -> P
 
@@ -131,7 +131,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

def __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:

戻り値:

  • 是否相等
ソースコード
python
def __eq__(self, other):
+        raise TypeError(f"unsupported operand type(s) for +: 'Vector3' and '{type(other)}'")

method __eq__(self, other)

判断两个向量是否相等。

引数:

  • other:

戻り値:

  • 是否相等
ソースコード
python
def __eq__(self, other):
     """
         判断两个向量是否相等。
         Args:
@@ -139,7 +139,7 @@
         Returns:
             是否相等
         """
-    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

def __radd__(self, other: 'Point3') -> 'Point3'

P + V -> P

别去点那边实现了。 :param other: :return:

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => Point3

P + V -> P

别去点那边实现了。 :param other: :return:

ソースコード
python
def __radd__(self, other: 'Point3') -> 'Point3':
     """
         P + V -> P
 
@@ -147,11 +147,11 @@
         :param other:
         :return:
         """
-    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

def __sub__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

@overload

method self - other: Vector3 => Vector3

ソースコード
python
@overload
 def __sub__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __sub__(self, other: 'Point3') -> 'Point3'

ソースコード
python
@overload
+    ...

@overload

method 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):
+    ...

method self - other

V - P -> P

V - V -> V

引数:

  • other:
ソースコード
python
def __sub__(self, other):
     """
         V - P -> P
 
@@ -165,7 +165,7 @@
     elif isinstance(other, Point3):
         return Point3(self.x - other.x, self.y - other.y, self.z - other.z)
     else:
-        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

def __rsub__(self, other: 'Point3')

P - V -> P

引数:

  • other:
ソースコード
python
def __rsub__(self, other: 'Point3'):
+        raise TypeError(f'unsupported operand type(s) for -: "Vector3" and "{type(other)}"')

method self - other: Point3

P - V -> P

引数:

  • other:
ソースコード
python
def __rsub__(self, other: 'Point3'):
     """
         P - V -> P
         Args:
@@ -176,11 +176,11 @@
     if isinstance(other, Point3):
         return Point3(other.x - self.x, other.y - self.y, other.z - self.z)
     else:
-        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

def __mul__(self, other: 'Vector3') -> 'Vector3'

ソースコード
python
@overload
+        raise TypeError(f"unsupported operand type(s) for -: '{type(other)}' and 'Vector3'")

@overload

method self * other: Vector3 => Vector3

ソースコード
python
@overload
 def __mul__(self, other: 'Vector3') -> 'Vector3':
-    ...

@overload

def __mul__(self, other: RealNumber) -> 'Vector3'

ソースコード
python
@overload
+    ...

@overload

method 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':
+    ...

method self * other: int | float | Vector3 => Vector3

数组运算 非点乘。点乘使用@,叉乘使用cross。

引数:

  • other:
ソースコード
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
     """
         数组运算 非点乘。点乘使用@,叉乘使用cross。
         Args:
@@ -193,20 +193,18 @@
     elif isinstance(other, (float, int)):
         return Vector3(self.x * other, self.y * other, self.z * other)
     else:
-        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

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':
+        raise TypeError(f"unsupported operand type(s) for *: 'Vector3' and '{type(other)}'")

method self * other: RealNumber => Vector3

ソースコード
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

点乘。

引数:

  • other:
ソースコード
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
     """
         点乘。
         Args:
             other:
         Returns:
         """
-    return self.x * other.x + self.y * other.y + self.z * other.z

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)

- + return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

ソースコード
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

ソースコード
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • タイプ: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • タイプ: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • タイプ: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • タイプ: Vector3

  • 説明: z轴单位向量

+ \ No newline at end of file diff --git a/ja/api/particle/index.html b/ja/api/particle/index.html index 6a98578..1ccc710 100644 --- a/ja/api/particle/index.html +++ b/ja/api/particle/index.html @@ -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 2faacb3..39d763d 100644 --- a/ja/api/presets/index.html +++ b/ja/api/presets/index.html @@ -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 745f3c0..9a97d0a 100644 --- a/ja/api/presets/model/index.html +++ b/ja/api/presets/model/index.html @@ -12,12 +12,12 @@ - + -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • List[Point3]: 球体上的点集。
ソースコード
python
@staticmethod
+    
Skip to content

class GeometricModels

@staticmethod

method sphere(radius: float, density: float)

生成球体上的点集。

引数:

  • radius:

  • density:

戻り値:

  • List[Point3]: 球体上的点集。
ソースコード
python
@staticmethod
 def sphere(radius: float, density: float):
     """
         生成球体上的点集。
@@ -35,7 +35,7 @@
     y_array = radius * np.sin(phi_list) * np.sin(theta_list)
     z_array = radius * np.cos(phi_list)
     return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
- + \ No newline at end of file diff --git a/md-ex.html b/md-ex.html index 4eb2e74..65e8351 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 index 3fc95de..2709bfa 100644 --- a/zh-Hant/api/index.html +++ b/zh-Hant/api/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/angle.html b/zh-Hant/api/mp_math/angle.html index bbfc31f..4397cd0 100644 --- a/zh-Hant/api/mp_math/angle.html +++ b/zh-Hant/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/zh-Hant/api/mp_math/const.html b/zh-Hant/api/mp_math/const.html index ae7dca4..a72bbdc 100644 --- a/zh-Hant/api/mp_math/const.html +++ b/zh-Hant/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/zh-Hant/api/mp_math/equation.html b/zh-Hant/api/mp_math/equation.html index a89f551..3f83ff5 100644 --- a/zh-Hant/api/mp_math/equation.html +++ b/zh-Hant/api/mp_math/equation.html @@ -17,7 +17,7 @@ -
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:
+    
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/zh-Hant/api/mp_math/index.html b/zh-Hant/api/mp_math/index.html index 3da4c2b..dc83dd5 100644 --- a/zh-Hant/api/mp_math/index.html +++ b/zh-Hant/api/mp_math/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/zh-Hant/api/mp_math/line.html b/zh-Hant/api/mp_math/line.html index 64ed8ef..fa12d69 100644 --- a/zh-Hant/api/mp_math/line.html +++ b/zh-Hant/api/mp_math/line.html @@ -17,7 +17,7 @@ -
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:
@@ -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/zh-Hant/api/mp_math/mp_math_typing.html b/zh-Hant/api/mp_math/mp_math_typing.html index d53800d..8074cf5 100644 --- a/zh-Hant/api/mp_math/mp_math_typing.html +++ b/zh-Hant/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/zh-Hant/api/mp_math/plane.html b/zh-Hant/api/mp_math/plane.html index ac1d097..3641700 100644 --- a/zh-Hant/api/mp_math/plane.html +++ b/zh-Hant/api/mp_math/plane.html @@ -17,7 +17,7 @@ -
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:
@@ -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/zh-Hant/api/mp_math/point.html b/zh-Hant/api/mp_math/point.html index cc5cf1e..c060a77 100644 --- a/zh-Hant/api/mp_math/point.html +++ b/zh-Hant/api/mp_math/point.html @@ -17,7 +17,7 @@ -
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:
@@ -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/zh-Hant/api/mp_math/segment.html b/zh-Hant/api/mp_math/segment.html index da90aaa..facfb00 100644 --- a/zh-Hant/api/mp_math/segment.html +++ b/zh-Hant/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/zh-Hant/api/mp_math/utils.html b/zh-Hant/api/mp_math/utils.html index c8359cd..3310dd6 100644 --- a/zh-Hant/api/mp_math/utils.html +++ b/zh-Hant/api/mp_math/utils.html @@ -17,7 +17,7 @@ -
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:
@@ -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/zh-Hant/api/mp_math/vector.html b/zh-Hant/api/mp_math/vector.html index d635c71..4a7cf71 100644 --- a/zh-Hant/api/mp_math/vector.html +++ b/zh-Hant/api/mp_math/vector.html @@ -17,7 +17,7 @@ -
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:
@@ -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/zh-Hant/api/particle/index.html b/zh-Hant/api/particle/index.html index 2a194c9..3f66c74 100644 --- a/zh-Hant/api/particle/index.html +++ b/zh-Hant/api/particle/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/zh-Hant/api/presets/index.html b/zh-Hant/api/presets/index.html index 6bccfc6..79ab0a5 100644 --- a/zh-Hant/api/presets/index.html +++ b/zh-Hant/api/presets/index.html @@ -17,8 +17,8 @@ - - + + \ No newline at end of file diff --git a/zh-Hant/api/presets/model/index.html b/zh-Hant/api/presets/model/index.html index 8e48256..7304f99 100644 --- a/zh-Hant/api/presets/model/index.html +++ b/zh-Hant/api/presets/model/index.html @@ -17,7 +17,7 @@ -
Skip to content

class GeometricModels

@staticmethod

def sphere(radius: float, density: float)

生成球体上的点集。

參數:

  • radius:

  • density:

返回:

  • List[Point3]: 球体上的点集。
源碼
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/zht/api/index.html b/zht/api/index.html new file mode 100644 index 0000000..1d23982 --- /dev/null +++ b/zht/api/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zht/api/mp_math/angle.html b/zht/api/mp_math/angle.html new file mode 100644 index 0000000..366a1d2 --- /dev/null +++ b/zht/api/mp_math/angle.html @@ -0,0 +1,122 @@ + + + + + + mbcp.mp_math.angle | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Angle

class AnyAngle(Angle)

method __init__(self, value: float, is_radian: bool = False)

任意角度。

變數説明:

  • value: 角度或弧度值

  • is_radian: 是否为弧度,默认为否

源碼
python
def __init__(self, value: float, is_radian: bool=False):
+    """
+        任意角度。
+        Args:
+            value: 角度或弧度值
+            is_radian: 是否为弧度,默认为否
+        """
+    if is_radian:
+        self.radian = value
+    else:
+        self.radian = value * PI / 180

@property

method complementary(self) -> AnyAngle

余角:两角的和为90°。

返回:

  • 余角
源碼
python
@property
+def complementary(self) -> 'AnyAngle':
+    """
+        余角:两角的和为90°。
+        Returns:
+            余角
+        """
+    return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)

@property

method supplementary(self) -> AnyAngle

补角:两角的和为180°。

返回:

  • 补角
源碼
python
@property
+def supplementary(self) -> 'AnyAngle':
+    """
+        补角:两角的和为180°。
+        Returns:
+            补角
+        """
+    return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)

@property

method degree(self) -> float

角度。

返回:

  • 弧度
源碼
python
@property
+def degree(self) -> float:
+    """
+        角度。
+        Returns:
+            弧度
+        """
+    return self.radian * 180 / PI

@property

method minimum_positive(self) -> AnyAngle

最小正角。

返回:

  • 最小正角度
源碼
python
@property
+def minimum_positive(self) -> 'AnyAngle':
+    """
+        最小正角。
+        Returns:
+            最小正角度
+        """
+    return AnyAngle(self.radian % (2 * PI))

@property

method maximum_negative(self) -> AnyAngle

最大负角。

返回:

  • 最大负角度
源碼
python
@property
+def maximum_negative(self) -> 'AnyAngle':
+    """
+        最大负角。
+        Returns:
+            最大负角度
+        """
+    return AnyAngle(-self.radian % (2 * PI), is_radian=True)

@property

method sin(self) -> float

正弦值。

返回:

  • 正弦值
源碼
python
@property
+def sin(self) -> float:
+    """
+        正弦值。
+        Returns:
+            正弦值
+        """
+    return math.sin(self.radian)

@property

method cos(self) -> float

余弦值。

返回:

  • 余弦值
源碼
python
@property
+def cos(self) -> float:
+    """
+        余弦值。
+        Returns:
+            余弦值
+        """
+    return math.cos(self.radian)

@property

method tan(self) -> float

正切值。

返回:

  • 正切值
源碼
python
@property
+def tan(self) -> float:
+    """
+        正切值。
+        Returns:
+            正切值
+        """
+    return math.tan(self.radian)

@property

method cot(self) -> float

余切值。

返回:

  • 余切值
源碼
python
@property
+def cot(self) -> float:
+    """
+        余切值。
+        Returns:
+            余切值
+        """
+    return 1 / math.tan(self.radian)

@property

method sec(self) -> float

正割值。

返回:

  • 正割值
源碼
python
@property
+def sec(self) -> float:
+    """
+        正割值。
+        Returns:
+            正割值
+        """
+    return 1 / math.cos(self.radian)

@property

method csc(self) -> float

余割值。

返回:

  • 余割值
源碼
python
@property
+def csc(self) -> float:
+    """
+        余割值。
+        Returns:
+            余割值
+        """
+    return 1 / math.sin(self.radian)

method self + other: AnyAngle => AnyAngle

源碼
python
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian + other.radian, is_radian=True)

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+    return approx(self.radian, other.radian)

method self - other: AnyAngle => AnyAngle

源碼
python
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':
+    return AnyAngle(self.radian - other.radian, is_radian=True)

method self * other: float => AnyAngle

源碼
python
def __mul__(self, other: float) -> 'AnyAngle':
+    return AnyAngle(self.radian * other, is_radian=True)

@overload

method self / other: float => AnyAngle

源碼
python
@overload
+def __truediv__(self, other: float) -> 'AnyAngle':
+    ...

@overload

method self / other: AnyAngle => float

源碼
python
@overload
+def __truediv__(self, other: 'AnyAngle') -> float:
+    ...

method self / other

源碼
python
def __truediv__(self, other):
+    if isinstance(other, AnyAngle):
+        return self.radian / other.radian
+    return AnyAngle(self.radian / other, is_radian=True)
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/const.html b/zht/api/mp_math/const.html new file mode 100644 index 0000000..cbf5c8b --- /dev/null +++ b/zht/api/mp_math/const.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math.const | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zht/api/mp_math/equation.html b/zht/api/mp_math/equation.html new file mode 100644 index 0000000..f0f83d4 --- /dev/null +++ b/zht/api/mp_math/equation.html @@ -0,0 +1,85 @@ + + + + + + mbcp.mp_math.equation | MBCP docs + + + + + + + + + + + + + +
Skip to content

func get_partial_derivative_func(func: MultiVarsFunc = EPSILON) -> MultiVarsFunc

求N元函数一阶偏导函数。这玩意不太稳定,慎用。

變數説明:

  • func: 函数

  • var: 变量位置,可为整数(一阶偏导)或整数元组(高阶偏导)

  • epsilon: 偏移量

返回:

  • 偏导函数

抛出:

  • ValueError 无效变量类型
源碼
python
def get_partial_derivative_func(func: MultiVarsFunc, var: int | tuple[int, ...], epsilon: Number=EPSILON) -> MultiVarsFunc:
+    """
+    求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')

func 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)

func 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

method __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc)

曲线方程。

變數説明:

  • x_func: x函数

  • y_func: y函数

  • z_func: z函数

源碼
python
def __init__(self, x_func: OneVarFunc, y_func: OneVarFunc, z_func: OneVarFunc):
+    """
+        曲线方程。
+        Args:
+            x_func: x函数
+            y_func: y函数
+            z_func: z函数
+        """
+    self.x_func = x_func
+    self.y_func = y_func
+    self.z_func = z_func

method __call__(self) -> Point3 | tuple[Point3, ...]

计算曲线上的点。

變數説明:

  • *t:

  • 参数:

源碼
python
def __call__(self, *t: Var) -> Point3 | tuple[Point3, ...]:
+    """
+        计算曲线上的点。
+        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))])
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/index.html b/zht/api/mp_math/index.html new file mode 100644 index 0000000..24707ce --- /dev/null +++ b/zht/api/mp_math/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zht/api/mp_math/line.html b/zht/api/mp_math/line.html new file mode 100644 index 0000000..9672a3b --- /dev/null +++ b/zht/api/mp_math/line.html @@ -0,0 +1,201 @@ + + + + + + mbcp.mp_math.line | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Line3

method __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

method 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)

method 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)

method 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.')

method 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

method 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))

method 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

method get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]

获取直线的参数方程。

返回:

  • x(t), y(t), z(t)
源碼
python
def get_parametric_equations(self) -> tuple[OneSingleVarFunc, OneSingleVarFunc, OneSingleVarFunc]:
+    """
+        获取直线的参数方程。
+        Returns:
+            x(t), y(t), z(t)
+        """
+    return (lambda t: self.point.x + self.direction.x * t, lambda t: self.point.y + self.direction.y * t, lambda t: self.point.z + self.direction.z * t)

method is_approx_parallel(self, other: Line3, epsilon: float = 1e-06) -> bool

判断两条直线是否近似平行。

變數説明:

  • other: 另一条直线

  • epsilon: 误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Line3', epsilon: float=1e-06) -> bool:
+    """
+        判断两条直线是否近似平行。
+        Args:
+            other: 另一条直线
+            epsilon: 误差
+        Returns:
+            是否近似平行
+        """
+    return self.direction.is_approx_parallel(other.direction, epsilon)

method is_parallel(self, other: Line3) -> bool

判断两条直线是否平行。

變數説明:

  • other: 另一条直线

返回:

  • 是否平行
源碼
python
def is_parallel(self, other: 'Line3') -> bool:
+    """
+        判断两条直线是否平行。
+        Args:
+            other: 另一条直线
+        Returns:
+            是否平行
+        """
+    return self.direction.is_parallel(other.direction)

method 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)

method 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)

method 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

method 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

method from_two_points(cls, p1: Point3, p2: Point3) -> Line3

工厂函数 由两点构造直线。

變數説明:

  • p1: 点1

  • p2: 点2

返回:

  • 直线
源碼
python
@classmethod
+def from_two_points(cls, p1: 'Point3', p2: 'Point3') -> 'Line3':
+    """
+        工厂函数 由两点构造直线。
+        Args:
+            p1: 点1
+            p2: 点2
+        Returns:
+            直线
+        """
+    direction = p2 - p1
+    return cls(p1, direction)

method __and__(self, other: Line3) -> Line3 | Point3 | None

计算两条直线点集合的交集。重合线返回自身,平行线返回None,交线返回交点。

變數説明:

  • other: 另一条直线

返回:

  • 交点
源碼
python
def __and__(self, other: 'Line3') -> 'Line3 | Point3 | None':
+    """
+        计算两条直线点集合的交集。重合线返回自身,平行线返回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)

method __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)
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/mp_math_typing.html b/zht/api/mp_math/mp_math_typing.html new file mode 100644 index 0000000..083017f --- /dev/null +++ b/zht/api/mp_math/mp_math_typing.html @@ -0,0 +1,24 @@ + + + + + + mbcp.mp_math.mp_math_typing | MBCP docs + + + + + + + + + + + + + +
Skip to content

var RealNumber = int | float

  • 類型: TypeAlias

var Number = RealNumber | complex

  • 類型: TypeAlias

var Var = SingleVar | ArrayVar

  • 類型: TypeAlias

var OneSingleVarFunc = Callable[[SingleVar], SingleVar]

  • 類型: TypeAlias

var OneArrayFunc = Callable[[ArrayVar], ArrayVar]

  • 類型: TypeAlias

var OneVarFunc = OneSingleVarFunc | OneArrayFunc

  • 類型: TypeAlias

var TwoSingleVarsFunc = Callable[[SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var TwoArraysFunc = Callable[[ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var TwoVarsFunc = TwoSingleVarsFunc | TwoArraysFunc

  • 類型: TypeAlias

var ThreeSingleVarsFunc = Callable[[SingleVar, SingleVar, SingleVar], SingleVar]

  • 類型: TypeAlias

var ThreeArraysFunc = Callable[[ArrayVar, ArrayVar, ArrayVar], ArrayVar]

  • 類型: TypeAlias

var ThreeVarsFunc = ThreeSingleVarsFunc | ThreeArraysFunc

  • 類型: TypeAlias

var MultiSingleVarsFunc = Callable[..., SingleVar]

  • 類型: TypeAlias

var MultiArraysFunc = Callable[..., ArrayVar]

  • 類型: TypeAlias

var MultiVarsFunc = MultiSingleVarsFunc | MultiArraysFunc

  • 類型: TypeAlias
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/plane.html b/zht/api/mp_math/plane.html new file mode 100644 index 0000000..613fc6b --- /dev/null +++ b/zht/api/mp_math/plane.html @@ -0,0 +1,219 @@ + + + + + + mbcp.mp_math.plane | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Plane3

method __init__(self, a: float, b: float, c: float, d: float)

平面方程:ax + by + cz + d = 0

變數説明:

  • a: x系数

  • b: y系数

  • c: z系数

  • d: 常数项

源碼
python
def __init__(self, a: float, b: float, c: float, d: float):
+    """
+        平面方程:ax + by + cz + d = 0
+        Args:
+            a: x系数
+            b: y系数
+            c: z系数
+            d: 常数项
+        """
+    self.a = a
+    self.b = b
+    self.c = c
+    self.d = d

method approx(self, other: Plane3) -> bool

判断两个平面是否近似相等。

變數説明:

  • other: 另一个平面

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Plane3') -> bool:
+    """
+        判断两个平面是否近似相等。
+        Args:
+            other: 另一个平面
+        Returns:
+            是否近似相等
+        """
+    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

method 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)}')

method 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)}')

method 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)

method 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))

method 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)

method 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

method normal(self) -> Vector3

平面的法向量。

返回:

  • 法向量
源碼
python
@property
+def normal(self) -> 'Vector3':
+    """
+        平面的法向量。
+        Returns:
+            法向量
+        """
+    return Vector3(self.a, self.b, self.c)

@classmethod

method from_point_and_normal(cls, point: Point3, normal: Vector3) -> Plane3

工厂函数 由点和法向量构造平面(点法式构造)。

變數説明:

  • point: 平面上的一点

  • normal: 法向量

返回:

  • 平面
源碼
python
@classmethod
+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

method from_three_points(cls, p1: Point3, p2: Point3, p3: Point3) -> Plane3

工厂函数 由三点构造平面。

變數説明:

  • p1: 点1

  • p2: 点2

  • p3: 点3

返回:

  • 平面
源碼
python
@classmethod
+def from_three_points(cls, p1: 'Point3', p2: 'Point3', p3: 'Point3') -> 'Plane3':
+    """
+        工厂函数 由三点构造平面。
+        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

method from_two_lines(cls, l1: Line3, l2: Line3) -> Plane3

工厂函数 由两直线构造平面。

變數説明:

  • l1: 直线1

  • l2: 直线2

返回:

  • 平面
源碼
python
@classmethod
+def from_two_lines(cls, l1: 'Line3', l2: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由两直线构造平面。
+        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

method from_point_and_line(cls, point: Point3, line: Line3) -> Plane3

工厂函数 由点和直线构造平面。

變數説明:

  • point: 面上一点

  • line: 面上直线,不包含点

返回:

  • 平面
源碼
python
@classmethod
+def from_point_and_line(cls, point: 'Point3', line: 'Line3') -> 'Plane3':
+    """
+        工厂函数 由点和直线构造平面。
+        Args:
+            point: 面上一点
+            line: 面上直线,不包含点
+        Returns:
+            平面
+        """
+    return cls.from_point_and_normal(point, line.direction)

@overload

method __and__(self, other: Line3) -> Point3 | None

源碼
python
@overload
+def __and__(self, other: 'Line3') -> 'Point3 | None':
+    ...

@overload

method __and__(self, other: Plane3) -> Line3 | None

源碼
python
@overload
+def __and__(self, other: 'Plane3') -> 'Line3 | None':
+    ...

method __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)}'")

method __eq__(self, other) -> bool

源碼
python
def __eq__(self, other) -> bool:
+    return self.approx(other)

method __rand__(self, other: Line3) -> Point3

源碼
python
def __rand__(self, other: 'Line3') -> 'Point3':
+    return self.cal_intersection_point3(other)
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/point.html b/zht/api/mp_math/point.html new file mode 100644 index 0000000..7e10a1f --- /dev/null +++ b/zht/api/mp_math/point.html @@ -0,0 +1,74 @@ + + + + + + mbcp.mp_math.point | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Point3

method __init__(self, x: float, y: float, z: float)

笛卡尔坐标系中的点。

變數説明:

  • x: x 坐标

  • y: y 坐标

  • z: z 坐标

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        笛卡尔坐标系中的点。
+        Args:
+            x: x 坐标
+            y: y 坐标
+            z: z 坐标
+        """
+    self.x = x
+    self.y = y
+    self.z = z

method approx(self, other: Point3, epsilon: float = APPROX) -> bool

判断两个点是否近似相等。

變數説明:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个点是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Point3':
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

method self + other

P + V -> P P + P -> P

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    """
+        P + V -> P
+        P + P -> P
+        Args:
+            other:
+        Returns:
+        """
+    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

判断两个点是否相等。

變數説明:

  • other:
源碼
python
def __eq__(self, other):
+    """
+        判断两个点是否相等。
+        Args:
+            other:
+        Returns:
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

P - P -> V

P - V -> P 已在 :class:Vector3 中实现

變數説明:

  • other:
源碼
python
def __sub__(self, other: 'Point3') -> 'Vector3':
+    """
+        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/zht/api/mp_math/segment.html b/zht/api/mp_math/segment.html new file mode 100644 index 0000000..af1e2bc --- /dev/null +++ b/zht/api/mp_math/segment.html @@ -0,0 +1,37 @@ + + + + + + mbcp.mp_math.segment | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Segment3

method __init__(self, p1: Point3, p2: Point3)

三维空间中的线段。 :param p1: :param p2:

源碼
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
+    """
+        三维空间中的线段。
+        :param p1:
+        :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)
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/utils.html b/zht/api/mp_math/utils.html new file mode 100644 index 0000000..1af571d --- /dev/null +++ b/zht/api/mp_math/utils.html @@ -0,0 +1,87 @@ + + + + + + mbcp.mp_math.utils | MBCP docs + + + + + + + + + + + + + +
Skip to content

func 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_)

func approx(x: float = 0.0, y: float = APPROX) -> bool

判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。

變數説明:

  • x: 数1

  • y: 数2

  • epsilon: 误差

返回:

  • 是否近似相等
源碼
python
def approx(x: float, y: float=0.0, epsilon: float=APPROX) -> bool:
+    """
+    判断两个数是否近似相等。或包装一个实数,用于判断是否近似于0。
+    Args:
+        x: 数1
+        y: 数2
+        epsilon: 误差
+    Returns:
+        是否近似相等
+    """
+    return abs(x - y) < epsilon

func sign(x: float = False) -> str

获取数的符号。

變數説明:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign(x: float, only_neg: bool=False) -> str:
+    """获取数的符号。
+    Args:
+        x: 数
+        only_neg: 是否只返回负数的符号
+    Returns:
+        符号 + - ""
+    """
+    if x > 0:
+        return '+' if not only_neg else ''
+    elif x < 0:
+        return '-'
+    else:
+        return ''

func sign_format(x: float = False) -> str

格式化符号数 -1 -> -1 1 -> +1 0 -> ""

變數説明:

  • x: 数

  • only_neg: 是否只返回负数的符号

返回:

  • 符号 + - ""
源碼
python
def sign_format(x: float, only_neg: bool=False) -> str:
+    """格式化符号数
+    -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

method __init__(self, value: RealNumber)

源碼
python
def __init__(self, value: RealNumber):
+    self.value = value

method __eq__(self, other)

源碼
python
def __eq__(self, other):
+    if isinstance(self.value, (float, int)):
+        if isinstance(other, (float, int)):
+            return abs(self.value - other) < APPROX
+        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)

method raise_type_error(self, other)

源碼
python
def raise_type_error(self, other):
+    raise TypeError(f'Unsupported type: {type(self.value)} and {type(other)}')

method __ne__(self, other)

源碼
python
def __ne__(self, other):
+    return not self.__eq__(other)
+ + + + \ No newline at end of file diff --git a/zht/api/mp_math/vector.html b/zht/api/mp_math/vector.html new file mode 100644 index 0000000..08f7f2b --- /dev/null +++ b/zht/api/mp_math/vector.html @@ -0,0 +1,210 @@ + + + + + + mbcp.mp_math.vector | MBCP docs + + + + + + + + + + + + + +
Skip to content

class Vector3

method __init__(self, x: float, y: float, z: float)

3维向量

變數説明:

  • x: x轴分量

  • y: y轴分量

  • z: z轴分量

源碼
python
def __init__(self, x: float, y: float, z: float):
+    """
+        3维向量
+        Args:
+            x: x轴分量
+            y: y轴分量
+            z: z轴分量
+        """
+    self.x = x
+    self.y = y
+    self.z = z

method approx(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似相等。

變數説明:

  • other:

  • epsilon:

返回:

  • 是否近似相等
源碼
python
def approx(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似相等。
+        Args:
+            other:
+            epsilon:
+
+        Returns:
+            是否近似相等
+        """
+    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

method cal_angle(self, other: Vector3) -> AnyAngle

计算两个向量之间的夹角。

變數説明:

  • other: 另一个向量

返回:

  • 夹角
源碼
python
def cal_angle(self, other: 'Vector3') -> 'AnyAngle':
+    """
+        计算两个向量之间的夹角。
+        Args:
+            other: 另一个向量
+        Returns:
+            夹角
+        """
+    return AnyAngle(math.acos(self @ other / (self.length * other.length)), is_radian=True)

method cross(self, other: Vector3) -> Vector3

向量积 叉乘:v1 cross v2 -> v3

叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。

變數説明:

  • other:

返回:

  • 行列式的结果
源碼
python
def cross(self, other: 'Vector3') -> 'Vector3':
+    """
+        向量积 叉乘: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)

method is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool

判断两个向量是否近似平行。

變數説明:

  • other: 另一个向量

  • epsilon: 允许的误差

返回:

  • 是否近似平行
源碼
python
def is_approx_parallel(self, other: 'Vector3', epsilon: float=APPROX) -> bool:
+    """
+        判断两个向量是否近似平行。
+        Args:
+            other: 另一个向量
+            epsilon: 允许的误差
+        Returns:
+            是否近似平行
+        """
+    return self.cross(other).length < epsilon

method 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)

method normalize(self)

将向量归一化。

自体归一化,不返回值。

源碼
python
def normalize(self):
+    """
+        将向量归一化。
+
+        自体归一化,不返回值。
+        """
+    length = self.length
+    self.x /= length
+    self.y /= length
+    self.z /= length

@property

method np_array(self) -> np.ndarray

源碼
python
@property
+def np_array(self) -> 'np.ndarray':
+    """
+        返回numpy数组
+        Returns:
+        """
+    return np.array([self.x, self.y, self.z])

@property

method length(self) -> float

向量的模。

返回:

源碼
python
@property
+def length(self) -> float:
+    """
+        向量的模。
+        Returns:
+
+        """
+    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)

@property

method unit(self) -> Vector3

获取该向量的单位向量。

返回:

  • 单位向量
源碼
python
@property
+def unit(self) -> 'Vector3':
+    """
+        获取该向量的单位向量。
+        Returns:
+            单位向量
+        """
+    return self / self.length

method __abs__(self)

源碼
python
def __abs__(self):
+    return self.length

@overload

method self + other: Vector3 => Vector3

源碼
python
@overload
+def __add__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

method self + other: Point3 => Point3

源碼
python
@overload
+def __add__(self, other: 'Point3') -> 'Point3':
+    ...

method self + other

V + P -> P

V + V -> V

變數説明:

  • other:
源碼
python
def __add__(self, other):
+    """
+        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)}'")

method __eq__(self, other)

判断两个向量是否相等。

變數説明:

  • other:

返回:

  • 是否相等
源碼
python
def __eq__(self, other):
+    """
+        判断两个向量是否相等。
+        Args:
+            other:
+        Returns:
+            是否相等
+        """
+    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self + other: Point3 => 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

method self - other: Vector3 => Vector3

源碼
python
@overload
+def __sub__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

method self - other: Point3 => Point3

源碼
python
@overload
+def __sub__(self, other: 'Point3') -> 'Point3':
+    ...

method self - other

V - P -> P

V - V -> V

變數説明:

  • other:
源碼
python
def __sub__(self, other):
+    """
+        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)}"')

method 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

method self * other: Vector3 => Vector3

源碼
python
@overload
+def __mul__(self, other: 'Vector3') -> 'Vector3':
+    ...

@overload

method self * other: RealNumber => Vector3

源碼
python
@overload
+def __mul__(self, other: RealNumber) -> 'Vector3':
+    ...

method self * other: int | float | Vector3 => Vector3

数组运算 非点乘。点乘使用@,叉乘使用cross。

變數説明:

  • other:
源碼
python
def __mul__(self, other: 'int | float | Vector3') -> 'Vector3':
+    """
+        数组运算 非点乘。点乘使用@,叉乘使用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)}'")

method self * other: RealNumber => Vector3

源碼
python
def __rmul__(self, other: 'RealNumber') -> 'Vector3':
+    return self.__mul__(other)

method self @ other: Vector3 => RealNumber

点乘。

變數説明:

  • other:
源碼
python
def __matmul__(self, other: 'Vector3') -> 'RealNumber':
+    """
+        点乘。
+        Args:
+            other:
+        Returns:
+        """
+    return self.x * other.x + self.y * other.y + self.z * other.z

method self / other: RealNumber => Vector3

源碼
python
def __truediv__(self, other: RealNumber) -> 'Vector3':
+    return Vector3(self.x / other, self.y / other, self.z / other)

method - self

源碼
python
def __neg__(self):
+    return Vector3(-self.x, -self.y, -self.z)

var zero_vector3 = Vector3(0, 0, 0)

  • 類型: Vector3

  • 説明: 零向量

var x_axis = Vector3(1, 0, 0)

  • 類型: Vector3

  • 説明: x轴单位向量

var y_axis = Vector3(0, 1, 0)

  • 類型: Vector3

  • 説明: y轴单位向量

var z_axis = Vector3(0, 0, 1)

  • 類型: Vector3

  • 説明: z轴单位向量

+ + + + \ No newline at end of file diff --git a/zht/api/particle/index.html b/zht/api/particle/index.html new file mode 100644 index 0000000..702706e --- /dev/null +++ b/zht/api/particle/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.particle | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zht/api/presets/index.html b/zht/api/presets/index.html new file mode 100644 index 0000000..4896ac4 --- /dev/null +++ b/zht/api/presets/index.html @@ -0,0 +1,24 @@ + + + + + + mbcp.presets | MBCP docs + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zht/api/presets/model/index.html b/zht/api/presets/model/index.html new file mode 100644 index 0000000..d916d8f --- /dev/null +++ b/zht/api/presets/model/index.html @@ -0,0 +1,41 @@ + + + + + + mbcp.presets.model | MBCP docs + + + + + + + + + + + + + +
Skip to content

class GeometricModels

@staticmethod

method 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