From 0f5d5cdf08e5eca8ae9a946b12e89b1dfa307d50 Mon Sep 17 00:00:00 2001 From: Wouter Horlings Date: Thu, 18 Sep 2025 15:21:04 +0200 Subject: [PATCH] fixup! fixup! fixup! Add unit tests for points --- pkg/point/extend_point.go | 5 +++-- pkg/point/point.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/point/extend_point.go b/pkg/point/extend_point.go index 70a5e25..caf476d 100644 --- a/pkg/point/extend_point.go +++ b/pkg/point/extend_point.go @@ -52,8 +52,9 @@ func (b *ExtendPoint) Vector() vector.Vector { // Matrix calculates and returns the [canvas.Matrix] of a point. func (b *ExtendPoint) Matrix() canvas.Matrix { - return b.to.Matrix().Translate(b.extendedVector().Values()). - Rotate((b.from.Vector().AngleBetween(b.to.Vector()) - math.Pi/2) * 180 / math.Pi) + return canvas.Identity.Translate(b.Position().Vector.Values()).Rotate(b.Position().RotationD()) + //return b.to.Matrix().Translate(b.extendedVector().Values()). + // Rotate((b.from.Vector().AngleBetween(b.to.Vector()) - math.Pi/2) * 180 / math.Pi) } // ID returns the point ID. diff --git a/pkg/point/point.go b/pkg/point/point.go index 3cf0dee..0e03e1f 100644 --- a/pkg/point/point.go +++ b/pkg/point/point.go @@ -53,7 +53,7 @@ func Draw(c *canvas.Canvas, point Point, face *canvas.FontFace, debug bool) { c.RenderPath(path, style, m) text := canvas.NewTextLine(face, point.Name(), canvas.Bottom) - c.RenderText(text, m.Translate(2, -4)) + c.RenderText(text, m.Translate(2, -4).Rotate(-point.Position().RotationD())) if debug { yStyle := canvas.Style{