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

class Segment3

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

源码
python
def __init__(self, p1: 'Point3', p2: 'Point3'):
    """
        三维空间中的线段。
        :param p1:
        :param p2:
        """
    self.p1 = p1
    self.p2 = p2
    '方向向量'
    self.direction = self.p2 - self.p1
    '长度'
    self.length = self.direction.length
    '中心点'
    self.midpoint = Point3((self.p1.x + self.p2.x) / 2, (self.p1.y + self.p2.y) / 2, (self.p1.z + self.p2.z) / 2)
源码
python
def __repr__(self):
    return f'Segment3({self.p1}, {self.p2})'
源码
python
def __str__(self):
    return f'Segment3({self.p1} -> {self.p2})'
`,9),l=[t];function e(p,k,r,d,E,g){return a(),i("div",null,l)}const o=s(h,[["render",e]]);export{y as __pageData,o as default};