Define flat walls in local XY with positive Z normal

This commit is contained in:
2026-10-05 20:11:45 +03:00
parent fa8be77559
commit cfae0d2131
7 changed files with 27 additions and 22 deletions
+4 -4
View File
@@ -17,7 +17,7 @@ type OcclusionConfig struct {
MaxObjects int `yaml:"max_objects,omitempty"`
}
// Size is [width, height] in metres along local X/Z; local Y is the
// Size is [width, height] in metres along local X/Y; local +Z is the
// normal of a zero-thickness rectangle. Rotation is a unit quaternion xyzw.
// Transmission is an amplitude multiplier, not a power ratio or dB value.
type Obstacle struct {
@@ -126,8 +126,8 @@ func (o occluder) intersects(a, b Vec3) bool {
start := Vec3{a.X - o.center.X, a.Y - o.center.Y, a.Z - o.center.Z}
delta := Vec3{b.X - a.X, b.Y - a.Y, b.Z - a.Z}
dot := func(v, axis Vec3) float64 { return v.X*axis.X + v.Y*axis.Y + v.Z*axis.Z }
distance := dot(start, o.axes[1])
denominator := dot(delta, o.axes[1])
distance := dot(start, o.axes[2])
denominator := dot(delta, o.axes[2])
if math.Abs(denominator) < 1e-10 {
return false
}
@@ -136,7 +136,7 @@ func (o occluder) intersects(a, b Vec3) bool {
return false
}
point := Vec3{start.X + t*delta.X, start.Y + t*delta.Y, start.Z + t*delta.Z}
return math.Abs(dot(point, o.axes[0])) <= o.half[0]+1e-8 && math.Abs(dot(point, o.axes[2])) <= o.half[1]+1e-8
return math.Abs(dot(point, o.axes[0])) <= o.half[0]+1e-8 && math.Abs(dot(point, o.axes[1])) <= o.half[1]+1e-8
}
func (s *CompiledScene) Transmission(a, b Vec3) float64 {
return s.transmission(a, b, 0)