reorganized the project

This commit is contained in:
grimsace
2026-03-12 12:22:09 -05:00
parent c0382d6657
commit 302a9aaf74
10 changed files with 2657 additions and 2782 deletions
-66
View File
@@ -1277,54 +1277,6 @@ func enforcePerpendicularWallCrossing(points []PathPoint, start, wallStart, wall
return out
}
func estimateWallTangent(mid image.Point, wallMask *PixelMask) (float64, float64, bool) {
if wallMask == nil {
return 0, 0, false
}
const r = 4
var pts [][2]float64
for dy := -r; dy <= r; dy++ {
y := mid.Y + dy
if y < 0 || y >= wallMask.Height {
continue
}
for dx := -r; dx <= r; dx++ {
x := mid.X + dx
if x < 0 || x >= wallMask.Width {
continue
}
if wallMask.GetXY(x, y) {
pts = append(pts, [2]float64{float64(x), float64(y)})
}
}
}
if len(pts) < 3 {
return 0, 0, false
}
var mx, my float64
for _, p := range pts {
mx += p[0]
my += p[1]
}
mx /= float64(len(pts))
my /= float64(len(pts))
var sxx, syy, sxy float64
for _, p := range pts {
dx := p[0] - mx
dy := p[1] - my
sxx += dx * dx
syy += dy * dy
sxy += dx * dy
}
if sxx+syy < 0.001 {
return 0, 0, false
}
theta := 0.5 * math.Atan2(2*sxy, sxx-syy)
return math.Cos(theta), math.Sin(theta), true
}
func crossingAngleToTangentDegrees(rx, ry, tx, ty float64) float64 {
rn := math.Hypot(rx, ry)
tn := math.Hypot(tx, ty)
@@ -1958,21 +1910,3 @@ func ensureGateRoadConnections(gateRoads []*Road, allRoads []*Road, wallLayout *
}
return append(allRoads, connectors...)
}
func clamp(v, lo, hi float64) float64 {
if v < lo {
return lo
}
if v > hi {
return hi
}
return v
}
// abs returns the absolute value of an integer.
func abs(x int) int {
if x < 0 {
return -x
}
return x
}