import{_ as s,c as i,o as a,a4 as t}from"./chunks/framework.DpC1ZpOZ.js";const m=JSON.parse('{"title":"mbcp.mp_math.segment","description":"","frontmatter":{"title":"mbcp.mp_math.segment","lastUpdated":false},"headers":[],"relativePath":"en/api/mp_math/segment.md","filePath":"en/api/mp_math/segment.md"}'),n={name:"en/api/mp_math/segment.md"},h=t(`<h1 id="module-mbcp-mp-math-segment" tabindex="-1"><strong>Module</strong> <code>mbcp.mp_math.segment</code> <a class="header-anchor" href="#module-mbcp-mp-math-segment" aria-label="Permalink to &quot;**Module** \`mbcp.mp_math.segment\`&quot;">​</a></h1><p>本模块定义了三维空间中的线段类</p><h3 id="class-segment3" tabindex="-1"><em><strong>class</strong></em> <code>Segment3</code> <a class="header-anchor" href="#class-segment3" aria-label="Permalink to &quot;***class*** \`Segment3\`&quot;">​</a></h3><h4 id="method-init-self-p1-point3-p2-point3" tabindex="-1"><em><strong>method</strong></em> <code>__init__(self, p1: Point3, p2: Point3)</code> <a class="header-anchor" href="#method-init-self-p1-point3-p2-point3" aria-label="Permalink to &quot;***method*** \`__init__(self, p1: Point3, p2: Point3)\`&quot;">​</a></h4><p><strong>Description</strong>: 三维空间中的线段。</p><p><strong>Arguments</strong>:</p><blockquote><ul><li>p1 (<a href="./point.html#class-point3"><code>Point3</code></a>): 线段的一个端点</li><li>p2 (<a href="./point.html#class-point3"><code>Point3</code></a>): 线段的另一个端点</li></ul></blockquote><details><summary><b>Source code</b> or <a href="https://github.com/snowykami/mbcp/tree/main/mbcp/mp_math/segment.py#L14" target="_blank">View on GitHub</a></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;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, p1: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;Point3&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, p2: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;Point3&#39;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.p1 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> p1</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.p2 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> p2</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">    &#39;方向向量&#39;</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.direction </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;">.p2 </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;">.p1</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">    &#39;长度&#39;</span></span>
<span class="line"><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:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.direction.length</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">    &#39;中心点&#39;</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.midpoint </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</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;">.p1.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;">.p2.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:#24292E;--shiki-dark:#E1E4E8;">, (</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.p1.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;">.p2.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:#24292E;--shiki-dark:#E1E4E8;">, (</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.p1.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;">.p2.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>`,8),e=[h];function p(l,k,r,d,o,E){return a(),i("div",null,e)}const c=s(n,[["render",p]]);export{m as __pageData,c as default};
