2024-08-29 13:25:00 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-Hant" dir="ltr">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
|
<title>mbcp.mp_math.vector | MBCP docs</title>
|
|
|
|
|
<meta name="description" content="一個用於Minecraft粒子計算和生成的軟體庫">
|
|
|
|
|
<meta name="generator" content="VitePress v1.3.4">
|
2024-08-30 13:46:30 +08:00
|
|
|
|
<link rel="preload stylesheet" href="/assets/style.CTLFORxu.css" as="style">
|
2024-08-29 13:25:00 +08:00
|
|
|
|
|
2024-08-30 13:46:30 +08:00
|
|
|
|
<script type="module" src="/assets/app.DSCSdM_3.js"></script>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
2024-08-30 13:46:30 +08:00
|
|
|
|
<link rel="modulepreload" href="/assets/chunks/theme.CIS5wKR_.js">
|
|
|
|
|
<link rel="modulepreload" href="/assets/chunks/framework.C94oF1kp.js">
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<link rel="modulepreload" href="/assets/zht_api_mp_math_vector.md.DGVOQo3Y.lean.js">
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<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>
|
2024-08-30 17:56:46 +08:00
|
|
|
|
<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="/zht/" 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="/zht/guide/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>指引</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zht/refer.html" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>參考</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zht/api/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>API文檔</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zht/demo/" tabindex="0" data-v-0fb289c1 data-v-ad4a8b64><!--[--><span data-v-ad4a8b64>示範</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>繁體中文</p><!--[--><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/api/mp_math/vector.html" data-v-79776a7a><!--[-->简体中文<!--]--></a></div><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/en/api/mp_math/vector.html" data-v-79776a7a><!--[-->English<!--]--></a></div><div class="VPMenuLink" data-v-cd7b67e8 data-v-79776a7a><a class="VPLink link" href="/ja/api/mp_math/vector.html" 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><!----><!--[--><!--[--><di
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 3维向量</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;"> x: x轴分量</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> y: y轴分量</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> z: z轴分量</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> x</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> y</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> z</span></span></code></pre></div></details><h4 id="def-approx-self-other-vector3-epsilon-float-approx-bool" tabindex="-1"><em><strong>def</strong></em> <code>approx(self, other: Vector3, epsilon: float = APPROX) -> bool</code> <a class="header-anchor" href="#def-approx-self-other-vector3-epsilon-float-approx-bool" aria-label="Permalink to "***def*** `approx(self, other: Vector3, epsilon: float = APPROX) -> bool`""></a></h4><p><strong>説明</strong>: 判断两个向量是否近似相等。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li><li>epsilon:</li></ul></blockquote><p><strong>返回</strong>: 是否近似相等</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> approx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, epsilon: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">float</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">APPROX</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> epsilon:</span></span>
|
|
|
|
|
<span class="line"></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;"> 是否近似相等</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> all</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">([</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">abs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> epsilon, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">abs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> epsilon, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">abs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> epsilon])</span></span></code></pre></div></details><h4 id="def-cal-angle-self-other-vector3-anyangle" tabindex="-1"><em><strong>def</strong></em> <code>cal_angle(self, other: Vector3) -> AnyAngle</code> <a class="header-anchor" href="#def-cal-angle-self-other-vector3-anyangle" aria-label="Permalink to "***def*** `cal_angle(self, other: Vector3) -> AnyAngle`""></a></h4><p><strong>説明</strong>: 计算两个向量之间的夹角。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other: 另一个向量</li></ul></blockquote><p><strong>返回</strong>: 夹角</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> cal_angle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'AnyAngle'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other: 另一个向量</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;"> 夹角</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> AnyAngle(math.acos(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> @</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other </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;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.length </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.length)), </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">is_radian</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">True</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><h4 id="def-cross-self-other-vector3-vector3" tabindex="-1"><em><strong>def</strong></em> <code>cross(self, other: Vector3) -> Vector3</code> <a class="header-anchor" href="#def-cross-self-other-vector3-vector3" aria-label="Permalink to "***def*** `cross(self, other: Vector3) -> Vector3`""></a></h4><p><strong>説明</strong>: 向量积 叉乘:v1 cross v2 -> v3</p><p>叉乘为0,则两向量平行。 其余结果的模为平行四边形的面积。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><p><strong>返回</strong>: 行列式的结果</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> cross</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 向量积 叉乘:v1 cross v2 -> v3</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 叉乘为0,则两向量平行。</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 其余结果的模为平行四边形的面积。</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 返回如下行列式的结果:</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ``i j k``</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ``x1 y1 z1``</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ``x2 y2 z2``</span></span>
|
|
|
|
|
<span class="line"></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;"> other:</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;"> 行列式的结果</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x)</span></span></code></pre></div></details><h4 id="def-is-approx-parallel-self-other-vector3-epsilon-float-approx-bool" tabindex="-1"><em><strong>def</strong></em> <code>is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool</code> <a class="header-anchor" href="#def-is-approx-parallel-self-other-vector3-epsilon-float-approx-bool" aria-label="Permalink to "***def*** `is_approx_parallel(self, other: Vector3, epsilon: float = APPROX) -> bool`""></a></h4><p><strong>説明</strong>: 判断两个向量是否近似平行。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other: 另一个向量</li><li>epsilon: 允许的误差</li></ul></blockquote><p><strong>返回</strong>: 是否近似平行</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> is_approx_parallel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, epsilon: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">float</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">APPROX</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other: 另一个向量</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> epsilon: 允许的误差</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;"> 是否近似平行</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.cross(other).length </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> epsilon</span></span></code></pre></div></details><h4 id="def-is-parallel-self-other-vector3-bool" tabindex="-1"><em><strong>def</strong></em> <code>is_parallel(self, other: Vector3) -> bool</code> <a class="header-anchor" href="#def-is-parallel-self-other-vector3-bool" aria-label="Permalink to "***def*** `is_parallel(self, other: Vector3) -> bool`""></a></h4><p><strong>説明</strong>: 判断两个向量是否平行。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other: 另一个向量</li></ul></blockquote><p><strong>返回</strong>: 是否平行</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> is_parallel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other: 另一个向量</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;"> 是否平行</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.cross(other).approx(zero_vector3)</span></span></code></pre></div></details><h4 id="def-normalize-self" tabindex="-1"><em><strong>def</strong></em> <code>normalize(self)</code> <a class="header-anchor" href="#def-normalize-self" aria-label="Permalink to "***def*** `normalize(self)`""></a></h4><p><strong>説明</strong>: 将向量归一化。</p><p>自体归一化,不返回值。</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> normalize</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 将向量归一化。</span></span>
|
|
|
|
|
<span class="line"></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;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> length </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.length</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> length</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> length</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> length</span></span></code></pre></div></details><p><code>@property</code></p><h4 id="def-np-array-self-np-ndarray" tabindex="-1"><em><strong>def</strong></em> <code>np_array(self) -> np.ndarray</code> <a class="header-anchor" href="#def-np-array-self-np-ndarray" aria-label="Permalink to "***def*** `np_array(self) -> np.ndarray`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">property</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> np_array</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'np.ndarray'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</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;"> 返回numpy数组</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;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> np.array([</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z])</span></span></code></pre></div></details><p><code>@property</code></p><h4 id="def-length-self-float" tabindex="-1"><em><strong>def</strong></em> <code>length(self) -> float</code> <a class="header-anchor" href="#def-length-self-float" aria-label="Permalink to "***def*** `length(self) -> float`""></a></h4><p><strong>説明</strong>: 向量的模。</p><p><strong>返回</strong>: 模</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">property</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> length</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self) -> </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;"> """</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;"> Returns:</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;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> math.sqrt(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">**</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">**</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">**</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><p><code>@property</code></p><h4 id="def-unit-self-vector3" tabindex="-1"><em><strong>def</strong></em> <code>unit(self) -> Vector3</code> <a class="header-anchor" href="#def-unit-self-vector3" aria-label="Permalink to "***def*** `unit(self) -> Vector3`""></a></h4><p><strong>説明</strong>: 获取该向量的单位向量。</p><p><strong>返回</strong>: 单位向量</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">property</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> unit</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</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;"> 获取该向量的单位向量。</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;"> 单位向量</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> /</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.length</span></span></code></pre></div></details><h4 id="def-abs-self" tabindex="-1"><em><strong>def</strong></em> <code>__abs__(self)</code> <a class="header-anchor" href="#def-abs-self" aria-label="Permalink to "***def*** `__abs__(self)`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __abs__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.length</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-vector3-vector3" tabindex="-1"><em><strong>def</strong></em> <code>self + other: Vector3 => Vector3</code> <a class="header-anchor" href="#def-self-other-vector3-vector3" aria-label="Permalink to "***def*** `self + other: Vector3 => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __add__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-point3-point3" tabindex="-1"><em><strong>def</strong></em> <code>self + other: Point3 => Point3</code> <a class="header-anchor" href="#def-self-other-point3-point3" aria-label="Permalink to "***def*** `self + other: Point3 => Point3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __add__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><h4 id="def-self-other" tabindex="-1"><em><strong>def</strong></em> <code>self + other</code> <a class="header-anchor" href="#def-self-other" aria-label="Permalink to "***def*** `self + other`""></a></h4><p><strong>説明</strong>: V + P -> P</p><p>V + V -> V</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __add__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other):</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> V + P -> P</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> V + V -> V</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;"> other:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Returns:</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Vector3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> elif</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Point3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Point3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> raise</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> TypeError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"unsupported operand type(s) for +: 'Vector3' and '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><h4 id="def-eq-self-other" tabindex="-1"><em><strong>def</strong></em> <code>__eq__(self, other)</code> <a class="header-anchor" href="#def-eq-self-other" aria-label="Permalink to "***def*** `__eq__(self, other)`""></a></h4><p><strong>説明</strong>: 判断两个向量是否相等。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><p><strong>返回</strong>: 是否相等</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __eq__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other):</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other:</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;"> 是否相等</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> approx(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x, other.x) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">and</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> approx(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y, other.y) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">and</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> approx(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z, other.z)</span></span></code></pre></div></details><h4 id="def-self-other-point3-point3-1" tabindex="-1"><em><strong>def</strong></em> <code>self + other: Point3 => Point3</code> <a class="header-anchor" href="#def-self-other-point3-point3-1" aria-label="Permalink to "***def*** `self + other: Point3 => Point3`""></a></h4><p><strong>説明</strong>: P + V -> P</p><p>别去点那边实现了。 :param other: :return:</p><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __radd__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> P + V -> P</span></span>
|
|
|
|
|
<span class="line"></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;"> :param other:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> :return:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Point3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-vector3-vector3-1" tabindex="-1"><em><strong>def</strong></em> <code>self - other: Vector3 => Vector3</code> <a class="header-anchor" href="#def-self-other-vector3-vector3-1" aria-label="Permalink to "***def*** `self - other: Vector3 => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __sub__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-point3-point3-2" tabindex="-1"><em><strong>def</strong></em> <code>self - other: Point3 => Point3</code> <a class="header-anchor" href="#def-self-other-point3-point3-2" aria-label="Permalink to "***def*** `self - other: Point3 => Point3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __sub__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><h4 id="def-self-other-1" tabindex="-1"><em><strong>def</strong></em> <code>self - other</code> <a class="header-anchor" href="#def-self-other-1" aria-label="Permalink to "***def*** `self - other`""></a></h4><p><strong>説明</strong>: V - P -> P</p><p>V - V -> V</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __sub__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other):</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> V - P -> P</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> V - V -> V</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;"> other:</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;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Vector3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> elif</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Point3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Point3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> raise</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> TypeError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'unsupported operand type(s) for -: "Vector3" and "</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><h4 id="def-self-other-point3" tabindex="-1"><em><strong>def</strong></em> <code>self - other: Point3</code> <a class="header-anchor" href="#def-self-other-point3" aria-label="Permalink to "***def*** `self - other: Point3`""></a></h4><p><strong>説明</strong>: P - V -> P</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __rsub__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Point3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> P - V -> P</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;"> other:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Returns:</span></span>
|
|
|
|
|
<span class="line"></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Point3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Point3(other.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x, other.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y, other.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> raise</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> TypeError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"unsupported operand type(s) for -: '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' and 'Vector3'"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-vector3-vector3-2" tabindex="-1"><em><strong>def</strong></em> <code>self * other: Vector3 => Vector3</code> <a class="header-anchor" href="#def-self-other-vector3-vector3-2" aria-label="Permalink to "***def*** `self * other: Vector3 => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __mul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><p><code>@overload</code></p><h4 id="def-self-other-realnumber-vector3" tabindex="-1"><em><strong>def</strong></em> <code>self * other: RealNumber => Vector3</code> <a class="header-anchor" href="#def-self-other-realnumber-vector3" aria-label="Permalink to "***def*** `self * other: RealNumber => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@overload</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __mul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: RealNumber) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div></details><h4 id="def-self-other-int-float-vector3-vector3" tabindex="-1"><em><strong>def</strong></em> <code>self * other: int | float | Vector3 => Vector3</code> <a class="header-anchor" href="#def-self-other-int-float-vector3-vector3" aria-label="Permalink to "***def*** `self * other: int | float | Vector3 => Vector3`""></a></h4><p><strong>説明</strong>: 数组运算 非点乘。点乘使用@,叉乘使用cross。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __mul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'int | float | Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 数组运算 非点乘。点乘使用@,叉乘使用cross。</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;"> other:</span></span>
|
|
|
|
|
<span class="line"></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;"> """</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, Vector3):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> elif</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> isinstance</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other, (</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">float</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">int</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)):</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other)</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> raise</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> TypeError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"unsupported operand type(s) for *: 'Vector3' and '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><h4 id="def-self-other-realnumber-vector3-1" tabindex="-1"><em><strong>def</strong></em> <code>self * other: RealNumber => Vector3</code> <a class="header-anchor" href="#def-self-other-realnumber-vector3-1" aria-label="Permalink to "***def*** `self * other: RealNumber => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __rmul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'RealNumber'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">__mul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(other)</span></span></code></pre></div></details><h4 id="def-self-other-vector3-realnumber" tabindex="-1"><em><strong>def</strong></em> <code>self @ other: Vector3 => RealNumber</code> <a class="header-anchor" href="#def-self-other-vector3-realnumber" aria-label="Permalink to "***def*** `self @ other: Vector3 => RealNumber`""></a></h4><p><strong>説明</strong>: 点乘。</p><p><strong>變數説明</strong>:</p><blockquote><ul><li>other:</li></ul></blockquote><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __matmul__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'RealNumber'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
2024-08-29 13:25:00 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> """</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;"> other:</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;"> """</span></span>
|
2024-08-30 15:10:30 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">*</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other.z</span></span></code></pre></div></details><h4 id="def-self-other-realnumber-vector3-2" tabindex="-1"><em><strong>def</strong></em> <code>self / other: RealNumber => Vector3</code> <a class="header-anchor" href="#def-self-other-realnumber-vector3-2" aria-label="Permalink to "***def*** `self / other: RealNumber => Vector3`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __truediv__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, other: RealNumber) -> </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'Vector3'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> other)</span></span></code></pre></div></details><h4 id="def-self" tabindex="-1"><em><strong>def</strong></em> <code>- self</code> <a class="header-anchor" href="#def-self" aria-label="Permalink to "***def*** `- self`""></a></h4><details><summary><b>源碼</b></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __neg__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
2024-08-30 17:56:46 +08:00
|
|
|
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Vector3(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.x, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.y, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.z)</span></span></code></pre></div></details><h3 id="var-zero-vector3-vector3-0-0-0" tabindex="-1">var <code>zero_vector3</code> = <code>Vector3(0, 0, 0)</code> <a class="header-anchor" href="#var-zero-vector3-vector3-0-0-0" aria-label="Permalink to "var `zero_vector3` = `Vector3(0, 0, 0)`""></a></h3><ul><li><p><strong>類型</strong>: <code>Vector3</code></p></li><li><p><strong>説明</strong>: 零向量</p></li></ul><h3 id="var-x-axis-vector3-1-0-0" tabindex="-1">var <code>x_axis</code> = <code>Vector3(1, 0, 0)</code> <a class="header-anchor" href="#var-x-axis-vector3-1-0-0" aria-label="Permalink to "var `x_axis` = `Vector3(1, 0, 0)`""></a></h3><ul><li><p><strong>類型</strong>: <code>Vector3</code></p></li><li><p><strong>説明</strong>: x轴单位向量</p></li></ul><h3 id="var-y-axis-vector3-0-1-0" tabindex="-1">var <code>y_axis</code> = <code>Vector3(0, 1, 0)</code> <a class="header-anchor" href="#var-y-axis-vector3-0-1-0" aria-label="Permalink to "var `y_axis` = `Vector3(0, 1, 0)`""></a></h3><ul><li><p><strong>類型</strong>: <code>Vector3</code></p></li><li><p><strong>説明</strong>: y轴单位向量</p></li></ul><h3 id="var-z-axis-vector3-0-0-1" tabindex="-1">var <code>z_axis</code> = <code>Vector3(0, 0, 1)</code> <a class="header-anchor" href="#var-z-axis-vector3-0-0-1" aria-label="Permalink to "var `z_axis` = `Vector3(0, 0, 1)`""></a></h3><ul><li><p><strong>類型</strong>: <code>Vector3</code></p></li><li><p><strong>説明</strong>: z轴单位向量</p></li></ul></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="/zht/api/mp_math/utils.html" data-v-a4b38bd6><!--[--><span class="desc" data-v-a4b38bd6>Previous page</span><span class="title" data-v-a4b38bd6>mbcp.mp_math.utils</span><!--]--></a></div><div class="pager" data-v-a4b38bd6><a class="VPLink link pager-link next" href="/zht/api/particle/particle.html" data-v-a4b38bd6><!--[--><span class="desc" data-v-a4b38bd6>Next page</span><span class="title" data-v-a4b38bd6>mbcp.particle</span><!--]--></a></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>文檔由 <a href="https://vitepress.dev/">VitePress</a> 構建 | API引用由 <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_api.md\":\"D_B0Hlcp\",\"api_index.md\":\"C_wESrrY\",\"api_mp_math_angle.md\":\"vKQLLqTS\",\"api_mp_math_const.md\":\"BAf8mK4W\",\"api_mp_math_equation.md\":\"DpRfW_6Z\",\"api_mp_math_function.md\":\"Cj4FyaYl\",\"api_mp_math_index.md\":\"BNf7bQqL\",\"api_mp_math_line.md\":\"DPWL9O-M\",\"api_mp_math_mp_math.md\":\"BVQYtS99\",\"api_mp_math_mp_math_typing.md\":\"DlnJmkos\",\"api_mp_math_plane.md\":\"DTAJAb0P\",\"api_mp_math_point.md\":\"vtgIded6\",\"api_mp_math_segment.md\":\"D-8aRB8W\",\"api_mp_math_utils.md\":\"DaaoR634\",\"api_mp_math_vector.md\":\"BTnPeAKR\",\"api_particle_index.md\":\"Cm3Vk-es\",\"api_particle_particle.md\":\"yD6tcNSr\",\"api_presets_index.md\":\"CD62I2gv\",\"api_presets_model_index.md\":\"gO0Notp6\",\"api_presets_model_model.md\":\"s8f68j_n\",\"api_presets_presets.md\":\"4R0VRbQo\",\"demo_index.md\":\"D-H9zRUE\",\"en_api_api.md\":\"BSgrCX1d\",\"en_api_index.md\":\"Dj_5nFTt\",\"en_api_mp_math_angle.md\":\"Bu07wjnV\",\"en_api_mp_math_const.md\":\"gGpXUShq\",\"en_api_mp_math_equation.md\":\"DqlD6s-6\",\"en_api_mp_math_function.md\":\"Bgn-YygZ\",\"en_api_mp_math_index.md\":\"BEjLBMpH\",\"en_api_mp_math_line.md\":\"BGq09mco\",\"en_api_mp_math_mp_math.md\":\"h0PJ9KWU\",\"en_api_mp_math_mp_math_typing.md\":\"Dnl2aJQ4\",\"en_api_mp_math_plane.md\":\"C3KPGKE4\",\"en_api_mp_math_point.md\":\"D7ZdR7VM\",\"en_api_mp_math_segment.md\":\"DMW-YUfw\",\"en_api_mp_math_utils.md\":\"B3i5gz_2\",\"en_api_mp_math_vector.md\":\"CgtIoM4A\",\"en_api_particle_index.md\":\"BfyNQiRg\",\"en_api_particle_particle.md\":\"BNkfEyJn\",\"en_api_presets_index.md\":\"BWb2fpTg\",\"en_api_presets_model_index.md\":\"pbEu-669\",\"en_api_presets_model_model.md\":\"CL5uKZbj\",\"en_api_presets_presets.md\":\"CCUzsYog\",\"en_guide_index.md\":\"DrDHTYCZ\",\"en_index.md\":\"MCm69eyE\",\"en_refer_index.md\":\"alw4L-bp\",\"guide_index.md\":\"Cfmzk2IH\",\"index.md\":\"BjJ9-kbE\",\"ja_api_api.md\":\"CPz58qIw\",\"ja_api_index.md\":\"CnUeuifx\",\"ja_api_mp_math_angle.md\":\"DTK1PNuJ\",\"ja_api_mp_math_const.md\":\"DGXAgDfn\",\"ja_api_mp_math_equation.md\":\"Bt8bfjRZ\",\"ja_api_mp_math_function.md\":\"Bx9H66-W\",\"ja_api_mp_math_index.md\":\"CTZZ-p9Z\",\"ja_api_mp_math_line.md\":\"DYJV4KNE\",\"ja_api_mp_math_mp_math.md\":\"C7tFDhfI\",\"ja_api_mp_math_mp_math_typing.md\":\"BNymgrCT\",\"ja_api_mp_math_plane.md\":\"D-yHaxP-\",\"ja_api_mp_math_point.md\":\"DjHRkHI5\",\"ja_api_mp_math_segment.md\":\"37V8kAc1\",\"ja_api_mp_math_utils.md\":\"BbdhM1tp\",\"ja_api_mp_math_vector.md\":\"BBVnCwJa\",\"ja_api_particle_index.md\":\"Jr41Y3TS\",\"ja_api_particle_particle.md\":\"exTt46pq\",\"ja_api_presets_index.md\":\"CQqdQbIZ\",\"ja_api_presets_model_index.md\":\"C-Ypf-qh\",\"ja_api_presets_model_model.md\":\"Dwbc1qIc\",\"ja_api_presets_presets.md\":\"DwzXdDqR\",\"ja_guide_index.md\":\"BxGnZYwR\",\"ja_index.md\":\"CtozMsIU\",\"ja_refer_index.md\":\"CODW6iMX\",\"refer_function_curry.md\":\"DwKZawp5\",\"refer_function_function.md\":\"D3IgfZX2\",\"refer_index.md\":\"CczYTl3j\",\"zht_api_api.md\":\"DyUSHA0S\",\"zht_api_index.md\":\"CgZH6aHQ\",\"zht_api_mp_math_angle.md\":\"lzcXwnW6\",\"zht_api_mp_math_const.md\":\"xwQvuYck\",\"zht_api_mp_math_equation.md\":\"Bn6MiQ1c\",\"zht_api_mp_math_function.md\":\"C6pPUbwO\",\"zht_api_mp_math_index.md\":\"mmeMMriu\",\"zht_api_mp_math_line.md\":\"DX62bgjZ\",\"zht_api_mp_math_mp_math.md\":\"Cx_EDcbj\",\"zht_api_mp_math_mp_math_typing.md\":\"CNiSnuMw\",\"zht_api_mp_math_plane.md\":\"DJ_9NQFz\",\"zht_api_mp_math_point.md\":\"D1nAiRP0\",\"zht_api_mp_math_segment.md\":\"CMRey-MG\",\"zht_api_mp_math_utils.md\":\"BDpW2Fd4\",\"zht_api_mp_math_vector.md\":\"DGVOQo3Y\",\"zht_api_particle_index.md\":\"8GaGB1ul\",\"zht_api_particle_particle.md\":\"huuRTEb9\",\"zht_api_presets_index.md\":\"DvOViSox\",\"zht_api_presets_model_index.md\":\"BJWX_k6K\",\"zht_api_presets_model_model.md\":\"CNI4ubOh\",\"zht_api_presets_presets.md\":\"CsDHjRbK\",\"zht_guide_index.md\":\"CsuFVFxu\",\"zht_index.md\":\"V9U3SwDR\",\"zht_refer_index.md\":\"Bz6voxEQ\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",
|
2024-08-29 13:25:00 +08:00
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|