import{_ as s,c as i,o as a,a4 as t}from"./chunks/framework.DpC1ZpOZ.js";const E=JSON.parse('{"title":"mbcp.mp_math.point","description":"","frontmatter":{"title":"mbcp.mp_math.point","lastUpdated":false},"headers":[],"relativePath":"en/api/mp_math/point.md","filePath":"en/api/mp_math/point.md"}'),e={name:"en/api/mp_math/point.md"},h=t('
mbcp.mp_math.point
本模块定义了三维空间中点的类。
Point3
__init__(self, x: float, y: float, z: float)
Description: 笛卡尔坐标系中的点。
Arguments:
- x (
float
): x 坐标- y (
float
): y 坐标- z (
float
): z 坐标
def __init__(self, x: float, y: float, z: float):\n self.x = x\n self.y = y\n self.z = z
approx(self, other: Point3, epsilon: float = APPROX) -> bool
Description: 判断两个点是否近似相等。
Arguments:
Return: bool
: 是否近似相等
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
self + other: Vector3 => Point3
@overload\ndef __add__(self, other: 'Vector3') -> 'Point3':\n ...
@overload
self + other: Point3 => Point3
@overload\ndef __add__(self, other: 'Point3') -> 'Point3':\n ...
self + other
Description: P + V -> P P + P -> P
Arguments:
Return: Point3
: 新的点
def __add__(self, other):\n return Point3(self.x + other.x, self.y + other.y, self.z + other.z)
self == other
Description: 判断两个点是否相等。
Arguments:
- other (
Point3
): 另一个点
Return: bool
: 是否相等
def __eq__(self, other):\n return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
self - other: Point3 => Vector3
Description: P - P -> V
P - V -> P 已在 Vector3
中实现
Arguments:
- other (
Point3
): 另一个点
Return: Vector3
: 新的向量
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)