import{_ as s,c as i,o as a,a4 as t}from"./chunks/framework.DpC1ZpOZ.js";const c=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point","lastUpdated":false},"headers":[],"relativePath":"api/mp_math/point.md","filePath":"zh/api/mp_math/point.md"}'),e={name:"api/mp_math/point.md"},h=t('

模块 mbcp.mp_math.point

本模块定义了三维空间中点的类。

class Point3

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

说明: 笛卡尔坐标系中的点。

参数:

源代码在GitHub上查看
python
def __init__(self, x: float, y: float, z: float):\n    self.x = x\n    self.y = y\n    self.z = z

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

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

参数:

返回: bool: 是否近似相等

源代码在GitHub上查看
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:\n    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])

@overload

method self + other: Vector3 => Point3

源代码在GitHub上查看
python
@overload\ndef __add__(self, other: 'Vector3') -> 'Point3':\n    ...

@overload

method self + other: Point3 => Point3

源代码在GitHub上查看
python
@overload\ndef __add__(self, other: 'Point3') -> 'Point3':\n    ...

method self + other

说明: P + V -> P P + P -> P

参数:

返回: Point3: 新的点

源代码在GitHub上查看
python
def __add__(self, other):\n    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

method __eq__(self, other)

说明: 判断两个点是否相等。

参数:

返回: bool: 是否相等

源代码在GitHub上查看
python
def __eq__(self, other):\n    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)

method self - other: Point3 => Vector3

说明: P - P -> V

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

参数:

返回: Vector3: 新的向量

源代码在GitHub上查看
python
def __sub__(self, other: 'Point3') -> 'Vector3':\n    from .vector import Vector3\n    return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
',39),n=[h];function l(p,o,k,r,d,g){return a(),i("div",null,n)}const y=s(e,[["render",l]]);export{c as __pageData,y as default};