automated snapshot

This commit is contained in:
sumi
2025-12-23 10:45:22 -06:00
parent f37bdf0604
commit ecac2dcebe
2 changed files with 52 additions and 23 deletions

View File

@@ -4,12 +4,22 @@ import (
rl "github.com/gen2brain/raylib-go/raylib"
)
type SierpinskiArrow struct{}
type SierpinskiArrow struct{
dirty bool
}
func (s *SierpinskiArrow) Draw(ctx *RenderCtx) {
sierpinskiArrow(ctx, int(ctx.Ports["sierpinskiArrowDepth"]), ctx.Ports["sierpinskiArrowLength"])
}
func (s *SierpinskiArrow) Update(ctx *RenderCtx) {
s.dirty = true
}
func (s *SierpinskiArrow) IsDirty() bool {
return s.dirty
}
func sierpinskiArrow(ctx *RenderCtx, order int, length float64) {
if order == 0 {
curve(ctx, order, length, ctx.Ports["sierpinskiArrowAngle"])
@@ -22,7 +32,8 @@ func sierpinskiArrow(ctx *RenderCtx, order int, length float64) {
func curve(ctx *RenderCtx, order int, length float64, angle float64) {
if order == 0 {
len := int32(length)
rl.DrawLine(0, 0, len, 0, rl.Black)
rl.SetLineWidth(4)
rl.DrawLine(0, 0, len, 0, rl.RayWhite)
rl.Translatef(float32(length), 0, 0)
} else {
curve(ctx, order-1, length/2, -angle)
@@ -33,3 +44,4 @@ func curve(ctx *RenderCtx, order int, length float64, angle float64) {
}
}