(r Ray)
| 54 | } |
| 55 | |
| 56 | func (s *BooleanShape) Intersect(r Ray) Hit { |
| 57 | h1 := s.A.Intersect(r) |
| 58 | h2 := s.B.Intersect(r) |
| 59 | h := h1.Min(h2) |
| 60 | v := r.Position(h.T) |
| 61 | if !h.Ok() || s.Contains(v, 0) { |
| 62 | return h |
| 63 | } |
| 64 | return s.Intersect(Ray{r.Position(h.T + 0.01), r.Direction}) |
| 65 | } |
| 66 | |
| 67 | func (s *BooleanShape) Paths() Paths { |
| 68 | p := s.A.Paths() |