Ver código fonte

fixup! fixup! fixup! Add unit tests for points

undefined
Wouter Horlings 2 meses atrás
pai
commit
0f5d5cdf08
2 arquivos alterados com 4 adições e 3 exclusões
  1. +3
    -2
      pkg/point/extend_point.go
  2. +1
    -1
      pkg/point/point.go

+ 3
- 2
pkg/point/extend_point.go Ver arquivo

@@ -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.


+ 1
- 1
pkg/point/point.go Ver arquivo

@@ -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{


Carregando…
Cancelar
Salvar