Add tests

This commit is contained in:
2024-06-11 19:36:04 +02:00
parent dfc277ddf2
commit 57f7e9140e
2 changed files with 4 additions and 1 deletions

View File

@@ -268,5 +268,5 @@ block_list = ["blue_concrete", "red_concrete", "green_concrete",
print(Polyline((Point2D(0, 0), Point2D(0, 10), Point2D(50, 10), Point2D(20, 20))))
s = Segment3D(Point3D(0, 0, 0), Point3D(10, 10, 10)).perpendicular(10)
s = Segment2D(Point2D(0, 0), Point2D(10, 10)).perpendicular(10)
print(s)

View File

@@ -200,6 +200,9 @@ class Segment2D:
Returns:
List[Point2D]: Two points. First one positioned on the counterclockwise side of the segment, oriented from start to end (meaning left).
>>> Segment2D(Point2D(0, 0), Point2D(10, 10)).perpendicular(10)
(Point2D(x: -4, y: 4), Point2D(x: 4, y: -4))
"""
delta = self.start.distance(self.end)
dx = (self.start.x - self.end.x) / delta