From 71e86e0aa171910e5b3d5d131f4dbe1ba46d8409 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Mon, 12 Jan 2026 19:28:01 +0100 Subject: [PATCH] add vertex class --- src/fvr/geom2d.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/fvr/geom2d.py b/src/fvr/geom2d.py index 085cfe1..2c3380b 100644 --- a/src/fvr/geom2d.py +++ b/src/fvr/geom2d.py @@ -1,7 +1,23 @@ import re +import numpy as np from fvr.typing import FloatArray -class polygon: +class Vertex(np.ndarray): + """Point in 2d space using homogeneous coordinates.""" + + def __init__(cls, x=0, y=0): + obj = np.asarray([x, y, 1]).view(cls) + + @property + def x(self): + return self[0] + + @property + def y(self): + return self[1] + + +class Polygon: r"""Properties of a simple polygon. """