mbcp/en/api/presets/model/index.html

41 lines
36 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>mbcp.presets.model | MBCP docs</title>
<meta name="description" content="A library made for Minecraft particle generation">
<meta name="generator" content="VitePress v1.3.4">
<link rel="preload stylesheet" href="/assets/style.CTLFORxu.css" as="style">
<script type="module" src="/assets/app.DSCSdM_3.js"></script>
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="modulepreload" href="/assets/chunks/theme.CIS5wKR_.js">
<link rel="modulepreload" href="/assets/chunks/framework.C94oF1kp.js">
<link rel="modulepreload" href="/assets/en_api_presets_model_index.md.BOZde1R5.lean.js">
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
</head>
<body>
<div id="app"><div class="Layout" data-v-22f859ac><!--[--><!--]--><!--[--><span tabindex="-1" data-v-3e86afbf></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-3e86afbf> Skip to content </a><!--]--><!----><header class="VPNav" data-v-22f859ac data-v-2a4e514e><div class="VPNavBar has-sidebar top" data-v-2a4e514e data-v-1303e283><div class="wrapper" data-v-1303e283><div class="container" data-v-1303e283><div class="title" data-v-1303e283><div class="VPNavBarTitle has-sidebar" data-v-1303e283 data-v-10b95b50><a class="title" href="/en/" data-v-10b95b50><!--[--><!--]--><!----><span data-v-10b95b50>MBCP docs</span><!--[--><!--]--></a></div></div><div class="content" data-v-1303e283><div class="content-body" data-v-1303e283><!--[--><!--]--><div class="VPNavBarSearch search" data-v-1303e283><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-1303e283 data-v-0fb289c1><span id="main-nav-aria-label" class="visually-hidden" data-v-0fb289c1> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/guide/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>Get Start</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/api/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>API Document</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/demo/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>Demo</span><!--]--></a><!--]--><!--]--></nav><div class="VPFlyout VPNavBarTranslations translations" data-v-1303e283 data-v-cd7b67e8 data-v-ec8c49bc><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="Change language" data-v-ec8c49bc><span class="text" data-v-ec8c49bc><span class="vpi-languages option-icon" data-v-ec8c49bc></span><!----><span class="vpi-chevron-down text-icon" data-v-ec8c49bc></span></span></button><div class="menu" data-v-ec8c49bc><div class="VPMenu" data-v-ec8c49bc data-v-9990563e><!----><!--[--><!--[--><div class="items" data-v-cd7b67e8><p class="title" data-v-cd7b67e8>English</p><!--[--><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/api/presets/model/" data-v-79776a7a><!--[-->简体中文<!--]--></a></div><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/ja/api/presets/model/" data-v-79776a7a><!--[-->日本語<!--]--></a></div><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/zht/api/presets/model/" data-v-79776a7a><!--[-->繁體中文<!--]--></a></div><!--]--></div><!--]--><!--]--></div></div></div><div class="VPNavBarAppearance appearance" data-v-1303e283 data-v-2a6692f8><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-2a6692f8 data-v-3a50aa5c data-v-d82e607b><span class="check" data-v-d82e607b><span class="icon" data-v-d82e607b><!--[--><span class="vpi-sun sun" data-v-3a50aa5c></span><span class="vpi-moon moon" data-v-3a50aa5c></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-1303e283 data-v-f3b91b3a data-v-fa18fe49><!--[--><a class="VPSocialLink no-icon" href="https://github.com/snowykami/mbcp" aria-label="github" target="_blank" rel="noopener" data-v-fa18fe49 data-v-b0526bd7><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-1303e283 data-v-2fc967b6 data-v-ec8c49bc><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-ec8c49bc><span class="vpi-more-horizontal icon" data-v-ec8c49bc></span></button><div class="menu" data-v-ec8c49bc><div class="VPMenu" data-v-ec8c49bc data-v-9990563e><!----><!--[--><!--[--><div class="group translations" data-v-2fc967b6><p class="trans-title" data-v-2fc967b6>English</p><!--[--><div class="VPMenuLink" data-v-2fc967b6 data-v-79776a7a><a class="VPLink link" href="/api/
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> sphere</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(radius: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">float</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, density: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">float</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 生成球体上的点集。</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Args:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> radius:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> density:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Returns:</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> List[Point3]: 球体上的点集。</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;&quot;&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> area </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 4</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> *</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.pi </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> radius </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">**</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> num </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> int</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(area </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> density)</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> phi_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.arccos([clamp(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2.0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> *</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1.0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> num, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _ </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> range</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(num)])</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> theta_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.sqrt(num </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.pi) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> phi_list</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> x_array </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> radius </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.sin(phi_list) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.cos(theta_list)</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> y_array </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> radius </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.sin(phi_list) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.sin(theta_list)</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> z_array </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> radius </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.cos(phi_list)</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> [Point3(x_array[i], y_array[i], z_array[i]) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> i </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> range</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(num)]</span></span></code></pre></div></details></div></div></main><footer class="VPDocFooter" data-v-40342069 data-v-a4b38bd6><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-a4b38bd6><span class="visually-hidden" id="doc-footer-aria-label" data-v-a4b38bd6>Pager</span><div class="pager" data-v-a4b38bd6><a class="VPLink link pager-link prev" href="/en/api/presets/" data-v-a4b38bd6><!--[--><span class="desc" data-v-a4b38bd6>Previous page</span><span class="title" data-v-a4b38bd6>mbcp.presets</span><!--]--></a></div><div class="pager" data-v-a4b38bd6><!----></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-22f859ac data-v-e3ca6860><div class="container" data-v-e3ca6860><p class="message" data-v-e3ca6860>Documentation built with <a href="https://vitepress.dev/">VitePress</a> | API references generated by <a href="https://github.com/LiteyukiStudio/litedoc">litedoc</a></p><p class="copyright" data-v-e3ca6860>Copyright (C) 2020-2024 SnowyKami. All Rights Reserved</p></div></footer><!--[--><!--]--></div></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"api_index.md\":\"C_wESrrY\",\"api_mp_math_angle.md\":\"iDErkOWa\",\"api_mp_math_const.md\":\"BAf8mK4W\",\"api_mp_math_equation.md\":\"Di7kIkyq\",\"api_mp_math_function.md\":\"roDde0nH\",\"api_mp_math_index.md\":\"BNf7bQqL\",\"api_mp_math_line.md\":\"DbfheWE4\",\"api_mp_math_mp_math_typing.md\":\"DlnJmkos\",\"api_mp_math_plane.md\":\"DLuC3Mxh\",\"api_mp_math_point.md\":\"DAQFtNol\",\"api_mp_math_segment.md\":\"CQz_FDoI\",\"api_mp_math_utils.md\":\"C2moaW8N\",\"api_mp_math_vector.md\":\"BiNus8y5\",\"api_particle_index.md\":\"Cm3Vk-es\",\"api_presets_index.md\":\"CD62I2gv\",\"api_presets_model_index.md\":\"CJMO-ffZ\",\"demo_index.md\":\"D-H9zRUE\",\"en_api_index.md\":\"Dj_5nFTt\",\"en_api_mp_math_angle.md\":\"DI0aMl64\",\"en_api_mp_math_const.md\":\"gGpXUShq\",\"en_api_mp_math_equation.md\":\"CFa2gNNX\",\"en_api_mp_math_function.md\":\"D5HNykIX\",\"en_api_mp_math_index.md\":\"BEjLBMpH\",\"en_api_mp_math_line.md\":\"BI7jrk5A\",\"en_api_mp_math_mp_math_typing.md\":\"Dnl2aJQ4\",\"en_api_mp_math_plane.md\":\"C6JEigTz\",\"en_api_mp_math_point.md\":\"DgKVopYL\",\"en_api_mp_math_segment.md\":\"GweOoNT9\",\"en_api_mp_math_utils.md\":\"VHDSe3i2\",\"en_api_mp_math_vector.md\":\"BlzUS0V3\",\"en_api_particle_index.md\":\"BfyNQiRg\",\"en_api_presets_index.md\":\"BWb2fpTg\",\"en_api_presets_model_index.md\":\"BOZde1R5\",\"en_guide_index.md\":\"DrDHTYCZ\",\"en_index.md\":\"MCm69eyE\",\"guide_index.md\":\"Cfmzk2IH\",\"index.md\":\"BjJ9-kbE\",\"ja_api_index.md\":\"CnUeuifx\",\"ja_api_mp_math_angle.md\":\"mNl1_TuR\",\"ja_api_mp_math_const.md\":\"DGXAgDfn\",\"ja_api_mp_math_equation.md\":\"Bx4R1cWT\",\"ja_api_mp_math_function.md\":\"D1A2lXjy\",\"ja_api_mp_math_index.md\":\"CTZZ-p9Z\",\"ja_api_mp_math_line.md\":\"CUb8HcBw\",\"ja_api_mp_math_mp_math_typing.md\":\"BNymgrCT\",\"ja_api_mp_math_plane.md\":\"CzPHp-i-\",\"ja_api_mp_math_point.md\":\"1OBHSorb\",\"ja_api_mp_math_segment.md\":\"Elu4YWS-\",\"ja_api_mp_math_utils.md\":\"DdUJsEiD\",\"ja_api_mp_math_vector.md\":\"BIkkuu3D\",\"ja_api_particle_index.md\":\"Jr41Y3TS\",\"ja_api_presets_index.md\":\"CQqdQbIZ\",\"ja_api_presets_model_index.md\":\"DGIEt4ke\",\"ja_guide_index.md\":\"BxGnZYwR\",\"ja_index.md\":\"CtozMsIU\",\"zht_api_index.md\":\"CgZH6aHQ\",\"zht_api_mp_math_angle.md\":\"BHWp5-Wz\",\"zht_api_mp_math_const.md\":\"xwQvuYck\",\"zht_api_mp_math_equation.md\":\"Da-XfzS0\",\"zht_api_mp_math_function.md\":\"CFVTTeOW\",\"zht_api_mp_math_index.md\":\"mmeMMriu\",\"zht_api_mp_math_line.md\":\"CERQpbvD\",\"zht_api_mp_math_mp_math_typing.md\":\"CNiSnuMw\",\"zht_api_mp_math_plane.md\":\"8lFm9uJ1\",\"zht_api_mp_math_point.md\":\"CH6HpvMW\",\"zht_api_mp_math_segment.md\":\"BZQVMFnu\",\"zht_api_mp_math_utils.md\":\"CAphuB0R\",\"zht_api_mp_math_vector.md\":\"B57rC4-I\",\"zht_api_particle_index.md\":\"8GaGB1ul\",\"zht_api_presets_index.md\":\"DvOViSox\",\"zht_api_presets_model_index.md\":\"D2Dc7np7\",\"zht_guide_index.md\":\"CsuFVFxu\",\"zht_index.md\":\"V9U3SwDR\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"MBCP docs\",\"description\":\"MBCP library docs\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"sidebar\":{\"/api/\":{\"base\":\"/api/\",\"items\":[{\"text\":\"mp_math\",\"items\":[{\"text\":\"mbcp.mp_math.angle\",\"link\":\"mp_math/angle\"},{\"text\":\"mbcp.mp_math.const\",\"link\":\"mp_math/const\"},{\"text\":\"mbcp.mp_math.equation\",\"link\":\"mp_math/equation\"},{\"text\":\"mbcp.mp_math.function\",\"link\":\"mp_math/function\"},{\"text\":\"mbcp.mp_math\",\"link\":\"mp_math/\"},{\"text\":\"mbcp.mp_math.line\",\"link\":\"mp_math/line\"},{\"text\":\"mbcp.mp_math.mp_math_typing\",\"link\":\"mp_math/mp_math_typing\"},{\"text\":\"mbcp.mp_math.plane\",\"link\":\"mp_math/plane\"},{\"text\":\"mbcp.mp_math.point\",\"link\":\"mp_math/point\"},{\"text\":\"mbcp.mp_math.segment\",\"link\":\"mp_math/segment\"},{\"text\":\"mbcp.mp_math.utils\",\"link\":\"mp_math/utils\"},{\"text\":\"mbcp.mp_math.vector\",\"link\":\"mp_math/vector\"}],\"collapsed\":true},{\"text\
</body>
</html>