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.angle","description":"","frontmatter":{"title":"mbcp.mp_math.angle","lastUpdated":false},"headers":[],"relativePath":"en/api/mp_math/angle.md","filePath":"en/api/mp_math/angle.md"}'),e={name:"en/api/mp_math/angle.md"},n=t('
mbcp.mp_math.angle
本模块定义了角度相关的类
Angle
AnyAngle(Angle)
__init__(self, value: float, is_radian: bool = False)
Description: 任意角度。
Arguments:
- value: 角度或弧度值
- is_radian: 是否为弧度,默认为否
def __init__(self, value: float, is_radian: bool=False):\n if is_radian:\n self.radian = value\n else:\n self.radian = value * PI / 180
complementary(self) -> AnyAngle
Description: 余角:两角的和为90°。
Return: 余角
@property\ndef complementary(self) -> 'AnyAngle':\n return AnyAngle(PI / 2 - self.minimum_positive.radian, is_radian=True)
supplementary(self) -> AnyAngle
Description: 补角:两角的和为180°。
Return: 补角
@property\ndef supplementary(self) -> 'AnyAngle':\n return AnyAngle(PI - self.minimum_positive.radian, is_radian=True)
degree(self) -> float
Description: 角度。
Return: 弧度
@property\ndef degree(self) -> float:\n return self.radian * 180 / PI
minimum_positive(self) -> AnyAngle
Description: 最小正角。
Return: 最小正角度
@property\ndef minimum_positive(self) -> 'AnyAngle':\n return AnyAngle(self.radian % (2 * PI))
maximum_negative(self) -> AnyAngle
Description: 最大负角。
Return: 最大负角度
@property\ndef maximum_negative(self) -> 'AnyAngle':\n return AnyAngle(-self.radian % (2 * PI), is_radian=True)
sin(self) -> float
Description: 正弦值。
Return: 正弦值
@property\ndef sin(self) -> float:\n return math.sin(self.radian)
cos(self) -> float
Description: 余弦值。
Return: 余弦值
@property\ndef cos(self) -> float:\n return math.cos(self.radian)
tan(self) -> float
Description: 正切值。
Return: 正切值
@property\ndef tan(self) -> float:\n return math.tan(self.radian)
cot(self) -> float
Description: 余切值。
Return: 余切值
@property\ndef cot(self) -> float:\n return 1 / math.tan(self.radian)
sec(self) -> float
Description: 正割值。
Return: 正割值
@property\ndef sec(self) -> float:\n return 1 / math.cos(self.radian)
csc(self) -> float
Description: 余割值。
Return: 余割值
@property\ndef csc(self) -> float:\n return 1 / math.sin(self.radian)
self + other: AnyAngle => AnyAngle
def __add__(self, other: 'AnyAngle') -> 'AnyAngle':\n return AnyAngle(self.radian + other.radian, is_radian=True)
self == other
def __eq__(self, other):\n return approx(self.radian, other.radian)
self - other: AnyAngle => AnyAngle
def __sub__(self, other: 'AnyAngle') -> 'AnyAngle':\n return AnyAngle(self.radian - other.radian, is_radian=True)
self * other: float => AnyAngle
def __mul__(self, other: float) -> 'AnyAngle':\n return AnyAngle(self.radian * other, is_radian=True)
@overload
self / other: float => AnyAngle
@overload\ndef __truediv__(self, other: float) -> 'AnyAngle':\n ...
@overload
self / other: AnyAngle => float
@overload\ndef __truediv__(self, other: 'AnyAngle') -> float:\n ...
self / other
def __truediv__(self, other):\n if isinstance(other, AnyAngle):\n return self.radian / other.radian\n return AnyAngle(self.radian / other, is_radian=True)