tbapi.api.models.point
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_class, tb_interface 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Scripts.Api.Models import Point as _Point 7from typing import Any, overload 8from abc import ABC, abstractmethod 9from tbapi.api.interfaces.ipoint import IPoint 10 11@tb_class(_Point) 12class Point(IPoint): 13 """Represents a point in a 2D space with X and Y coordinates.""" 14 15 @overload 16 @staticmethod 17 def new() -> "Point": 18 """Constructor overload with arguments: """ 19 ... 20 @overload 21 @staticmethod 22 def new(point: IPoint) -> "Point": 23 """Constructor overload with arguments: point""" 24 ... 25 @overload 26 @staticmethod 27 def new(x: float, y: float) -> "Point": 28 """Constructor overload with arguments: x, y""" 29 ... 30 @staticmethod 31 def new(*args, **kwargs): 32 """Generic factory method for Point. Use overloads for IDE type hints.""" 33 return Point(*args, **kwargs) 34 35 @property 36 def x(self) -> float: 37 val = self._value.X 38 return val 39 @x.setter 40 def x(self, val: float): 41 tmp = self._value 42 tmp.X = val 43 self._value = tmp 44 @property 45 def y(self) -> float: 46 val = self._value.Y 47 return val 48 @y.setter 49 def y(self, val: float): 50 tmp = self._value 51 tmp.Y = val 52 self._value = tmp 53 @property 54 def magnitude(self) -> float: 55 """The magnitude of the point as a vector""" 56 val = self._value.Magnitude 57 return val 58 @property 59 def angle(self) -> float: 60 """The angle of the point as a vector""" 61 val = self._value.Angle 62 return val 63 64 def normalize(self) -> Point: 65 """Adjusts the point so that the vector it represents has a magnitude of 1""" 66 result = self._value.Normalize() 67 from tbapi.api.models.point import Point 68 return Point(_existing=result) 69
19@tb_class(_Point) 20class Point(IPoint): 21 """Represents a point in a 2D space with X and Y coordinates.""" 22 23 @overload 24 @staticmethod 25 def new() -> "Point": 26 """Constructor overload with arguments: """ 27 ... 28 @overload 29 @staticmethod 30 def new(point: IPoint) -> "Point": 31 """Constructor overload with arguments: point""" 32 ... 33 @overload 34 @staticmethod 35 def new(x: float, y: float) -> "Point": 36 """Constructor overload with arguments: x, y""" 37 ... 38 @staticmethod 39 def new(*args, **kwargs): 40 """Generic factory method for Point. Use overloads for IDE type hints.""" 41 return Point(*args, **kwargs) 42 43 @property 44 def x(self) -> float: 45 val = self._value.X 46 return val 47 @x.setter 48 def x(self, val: float): 49 tmp = self._value 50 tmp.X = val 51 self._value = tmp 52 @property 53 def y(self) -> float: 54 val = self._value.Y 55 return val 56 @y.setter 57 def y(self, val: float): 58 tmp = self._value 59 tmp.Y = val 60 self._value = tmp 61 @property 62 def magnitude(self) -> float: 63 """The magnitude of the point as a vector""" 64 val = self._value.Magnitude 65 return val 66 @property 67 def angle(self) -> float: 68 """The angle of the point as a vector""" 69 val = self._value.Angle 70 return val 71 72 def normalize(self) -> Point: 73 """Adjusts the point so that the vector it represents has a magnitude of 1""" 74 result = self._value.Normalize() 75 from tbapi.api.models.point import Point 76 return Point(_existing=result)
Represents a point in a 2D space with X and Y coordinates.
@staticmethod
def
new(*args, **kwargs):
38 @staticmethod 39 def new(*args, **kwargs): 40 """Generic factory method for Point. Use overloads for IDE type hints.""" 41 return Point(*args, **kwargs)
Generic factory method for Point. Use overloads for IDE type hints.
magnitude: float
61 @property 62 def magnitude(self) -> float: 63 """The magnitude of the point as a vector""" 64 val = self._value.Magnitude 65 return val
The magnitude of the point as a vector
angle: float
66 @property 67 def angle(self) -> float: 68 """The angle of the point as a vector""" 69 val = self._value.Angle 70 return val
The angle of the point as a vector