We are going to plant a tree on level ground near a streetlight, and we want
to know how big a shadow it will cast. We will model the tree as a (possibly
degenerate) rectangular
solid, and treat the streetlight as
casting rays from a single point. We will use an x,y,z coordinate system that is aligned with
the rectangular solid and
in which y is the distance above ground level.
int[] tree contains exactly 6 elements, namely the x,y,z coordinates of one
corner of the rectangular solid followed by the coordinates of the diagonally
opposite corner. int[] light contains exactly 3 elements, the x,y,z coordinates
of the streetlight. Given tree and light,
return the area of the shadow, or return -1 to indicate that the shadow has an
infinite area. If the shadow is an infinitely long line, return 0 as its area.
|