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
|
from Model.Geometry.Point import Point
|
||||||
|
|
||||||
class PointXY(Point):
|
class PointAC(Point):
|
||||||
def __init__(self, x:float = 0.0, y:float = 0.0,
|
def __init__(self, a:float = 0.0, c:float = 0.0,
|
||||||
name: str = ""):
|
name: str = ""):
|
||||||
super(PointXY, self).__init__(name = name)
|
super(PointXY, self).__init__(name = name)
|
||||||
|
|
||||||
self._x = float(x)
|
self._a = float(a)
|
||||||
self._y = float(y)
|
self._c = float(c)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"[{self._x}, {self._y}, {self._name}]"
|
return f"[{self._a}, {self._c}, {self._name}]"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def x(self):
|
def a(self):
|
||||||
return self._x
|
return self._a
|
||||||
|
|
||||||
@x.setter
|
@a.setter
|
||||||
def x(self, value):
|
def a(self, value):
|
||||||
self._x = float(value)
|
self._a = float(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def y(self):
|
def c(self):
|
||||||
return self._y
|
return self._c
|
||||||
|
|
||||||
@y.setter
|
@c.setter
|
||||||
def y(self, value):
|
def c(self, value):
|
||||||
self._y = float(value)
|
self._c = float(value)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def distance(p1, p2):
|
def distance(p1, p2):
|
||||||
"""Euclidean distance between p1 and p2.
|
"""Euclidean distance between p1 and p2.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
p1: A XY Point
|
p1: A AC Point
|
||||||
p2: A XY Point
|
p2: A AC Point
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Euclidean distance between the two points
|
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
|
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,
|
def __init__(self, x:float = 0.0, y:float = 0.0, z:float = 0.0,
|
||||||
name:str = ""):
|
name:str = ""):
|
||||||
super(PointXYZ, self).__init__(x=x, y=y, name=name)
|
super(PointXYZ, self).__init__(x=x, y=y, name=name)
|
||||||
|
|
||||||
|
self._x = float(x)
|
||||||
|
self._y = float(y)
|
||||||
self._z = float(z)
|
self._z = float(z)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"({self._x}, {self._y}, {self._z}, {self._name})"
|
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
|
@property
|
||||||
def z(self):
|
def z(self):
|
||||||
return self._z
|
return self._z
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue