mirror of https://gitlab.com/pamhyr/pamhyr2
geometry: Rename point XY to AC.
parent
2ed051bb41
commit
3c58c2d64d
|
|
@ -4,42 +4,42 @@ from math import dist
|
|||
|
||||
from Model.Geometry.Point import Point
|
||||
|
||||
class PointXY(Point):
|
||||
def __init__(self, x:float = 0.0, y:float = 0.0,
|
||||
class PointAC(Point):
|
||||
def __init__(self, a:float = 0.0, c:float = 0.0,
|
||||
name: str = ""):
|
||||
super(PointXY, self).__init__(name = name)
|
||||
|
||||
self._x = float(x)
|
||||
self._y = float(y)
|
||||
self._a = float(a)
|
||||
self._c = float(c)
|
||||
|
||||
def __repr__(self):
|
||||
return f"[{self._x}, {self._y}, {self._name}]"
|
||||
return f"[{self._a}, {self._c}, {self._name}]"
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
def a(self):
|
||||
return self._a
|
||||
|
||||
@x.setter
|
||||
def x(self, value):
|
||||
self._x = float(value)
|
||||
@a.setter
|
||||
def a(self, value):
|
||||
self._a = float(value)
|
||||
|
||||
@property
|
||||
def y(self):
|
||||
return self._y
|
||||
def c(self):
|
||||
return self._c
|
||||
|
||||
@y.setter
|
||||
def y(self, value):
|
||||
self._y = float(value)
|
||||
@c.setter
|
||||
def c(self, value):
|
||||
self._c = float(value)
|
||||
|
||||
@staticmethod
|
||||
def distance(p1, p2):
|
||||
"""Euclidean distance between p1 and p2.
|
||||
|
||||
Args:
|
||||
p1: A XY Point
|
||||
p2: A XY Point
|
||||
p1: A AC Point
|
||||
p2: A AC Point
|
||||
|
||||
Returns:
|
||||
Euclidean distance between the two points
|
||||
"""
|
||||
return dist((p1.x(), p1.y()), (p2.x(), p2.y()))
|
||||
return dist((p1.a(), p1.c()), (p2.a(), p2.c()))
|
||||
|
|
|
|||
|
|
@ -5,16 +5,34 @@ from pandas import isna as pd_is_na
|
|||
|
||||
from Model.Geometry.PointXY import PointXY
|
||||
|
||||
class PointXYZ(PointXY):
|
||||
class PointXYZ(Point):
|
||||
def __init__(self, x:float = 0.0, y:float = 0.0, z:float = 0.0,
|
||||
name:str = ""):
|
||||
super(PointXYZ, self).__init__(x=x, y=y, name=name)
|
||||
|
||||
self._x = float(x)
|
||||
self._y = float(y)
|
||||
self._z = float(z)
|
||||
|
||||
def __repr__(self):
|
||||
return f"({self._x}, {self._y}, {self._z}, {self._name})"
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@x.setter
|
||||
def x(self, value):
|
||||
self._x = float(value)
|
||||
|
||||
@property
|
||||
def y(self):
|
||||
return self._y
|
||||
|
||||
@y.setter
|
||||
def y(self, value):
|
||||
self._y = float(value)
|
||||
|
||||
@property
|
||||
def z(self):
|
||||
return self._z
|
||||
|
|
|
|||
Loading…
Reference in New Issue