| @@ -20,7 +20,7 @@ func (p *Polygon) Through() []point.Point { | |||||
| // NewPolygon returns a new [Polygon]. | // NewPolygon returns a new [Polygon]. | ||||
| func NewPolygon(points []point.Point, style Style, id util.ID) *Polygon { | func NewPolygon(points []point.Point, style Style, id util.ID) *Polygon { | ||||
| return &Polygon{points: points, style: style} | |||||
| return &Polygon{points: points, style: style, id: id} | |||||
| } | } | ||||
| // WithStyle updates the style of the Polygon. | // WithStyle updates the style of the Polygon. | ||||
| @@ -19,7 +19,7 @@ type AbsolutePoint struct { | |||||
| // Matrix calculates and returns the [canvas.Matrix] of a point. | // Matrix calculates and returns the [canvas.Matrix] of a point. | ||||
| func (a *AbsolutePoint) Matrix() canvas.Matrix { | func (a *AbsolutePoint) Matrix() canvas.Matrix { | ||||
| return canvas.Identity.Translate(a.position.Vector.Values()).Rotate(a.position.Rotation) | |||||
| return canvas.Identity.Translate(a.position.Vector.Values()).Rotate(a.position.RotationD()) | |||||
| } | } | ||||
| // ID returns the point ID. | // ID returns the point ID. | ||||
| @@ -69,7 +69,7 @@ func (a *AbsolutePoint) SetDraw() { | |||||
| // UnsetDraw indicates that the point should not be drawn. | // UnsetDraw indicates that the point should not be drawn. | ||||
| func (a *AbsolutePoint) UnsetDraw() { | func (a *AbsolutePoint) UnsetDraw() { | ||||
| a.draw = true | |||||
| a.draw = false | |||||
| } | } | ||||
| // Hide returns if the point must remain hidden. | // Hide returns if the point must remain hidden. | ||||
| @@ -22,6 +22,10 @@ func (p Position) Add(q Position) Position { | |||||
| } | } | ||||
| } | } | ||||
| func (p Position) RotationD() float64 { | |||||
| return p.Rotation*180/math.Pi | |||||
| } | |||||
| // Distance returns the distance between two positions. | // Distance returns the distance between two positions. | ||||
| func (p Position) Distance(q Position) float64 { | func (p Position) Distance(q Position) float64 { | ||||
| return p.Vector.Distance(q.Vector) | return p.Vector.Distance(q.Vector) | ||||