reduce Project calls in Front,Back,BoundingRect
This commit is contained in:
parent
855f39d9d2
commit
c533ee63f7
1 changed files with 6 additions and 6 deletions
12
geom/box.go
12
geom/box.go
|
@ -80,20 +80,20 @@ func (b Box) BoundingRect(π Projector) image.Rectangle {
|
||||||
// Back returns an image.Rectangle representing the back of the box, using
|
// Back returns an image.Rectangle representing the back of the box, using
|
||||||
// the given projection π.
|
// the given projection π.
|
||||||
func (b Box) Back(π Projector) image.Rectangle {
|
func (b Box) Back(π Projector) image.Rectangle {
|
||||||
b.Max.Z = b.Min.Z
|
p := π.Project(Int3{0, 0, b.Min.Z})
|
||||||
return image.Rectangle{
|
return image.Rectangle{
|
||||||
Min: π.Project(b.Min),
|
Min: b.Min.XY().Add(p),
|
||||||
Max: π.Project(b.Max),
|
Max: b.Max.XY().Add(p),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Front returns an image.Rectangle representing the front of the box, using
|
// Front returns an image.Rectangle representing the front of the box, using
|
||||||
// the given projection π.
|
// the given projection π.
|
||||||
func (b Box) Front(π Projector) image.Rectangle {
|
func (b Box) Front(π Projector) image.Rectangle {
|
||||||
b.Min.Z = b.Max.Z
|
p := π.Project(Int3{0, 0, b.Max.Z})
|
||||||
return image.Rectangle{
|
return image.Rectangle{
|
||||||
Min: π.Project(b.Min),
|
Min: b.Min.XY().Add(p),
|
||||||
Max: π.Project(b.Max),
|
Max: b.Max.XY().Add(p),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue