瀏覽代碼

fixup! fixup! fixup! Add unit tests for points

undefined
Wouter Horlings 2 月之前
父節點
當前提交
0f5d5cdf08
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. +3
    -2
      pkg/point/extend_point.go
  2. +1
    -1
      pkg/point/point.go

+ 3
- 2
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.


+ 1
- 1
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{


Loading…
取消
儲存