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

class Point3

笛卡尔坐标系中的点。

Args:

x: x 坐标

y: y 坐标

z: z 坐标

Source code
python
def __init__(self, x: float, y: float, z: float):
    """
        笛卡尔坐标系中的点。
        Args:
            x: x 坐标
            y: y 坐标
            z: z 坐标
        """
    self.x = x
    self.y = y
    self.z = z

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

Args:

other:

epsilon:

Source code
python
def approx(self, other: 'Point3', epsilon: float=APPROX) -> bool:
    """
        判断两个点是否近似相等。
        Args:
            other:
            epsilon:

        Returns:
            是否近似相等
        """
    return all([abs(self.x - other.x) < epsilon, abs(self.y - other.y) < epsilon, abs(self.z - other.z) < epsilon])
Source code
python
def __str__(self):
    return f'Point3({self.x}, {self.y}, {self.z})'
Source code
python
@overload
def __add__(self, other: 'Vector3') -> 'Point3':
    ...
Source code
python
@overload
def __add__(self, other: 'Point3') -> 'Point3':
    ...

P + V -> P P + P -> P

Args:

other:

Source code
python
def __add__(self, other):
    """
        P + V -> P
        P + P -> P
        Args:
            other:
        Returns:
        """
    return Point3(self.x + other.x, self.y + other.y, self.z + other.z)

判断两个点是否相等。

Args:

other:

Source code
python
def __eq__(self, other):
    """
        判断两个点是否相等。
        Args:
            other:
        Returns:
        """
    return approx(self.x, other.x) and approx(self.y, other.y) and approx(self.z, other.z)
`,34),h=[n];function e(p,k,d,r,o,E){return a(),i("div",null,h)}const y=s(t,[["render",e]]);export{g as __pageData,y as default};