| ||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
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.
|Method signature:||double area(int tree, int light)|
|(be sure your method is public)|
|-||A return value with either an absolute or relative error of less than 1.0E-9 is considered correct.|
|-||tree will contain exactly 6 elements.|
|-||light will contain exactly 3 elements.|
|-||Each element of tree and of light will be between 1 and 10, inclusive.|
|-||The coordinates of the light will not lie on the boundary of the tree.|
This tree is just a line so its shadow has no area.
This tree is just a rectangle. Its shadow covers an infinite rectangular
area on the ground.
This is a unit cube one unit above the ground. The shadowed area
is a six-sided polygon.|
When the light is inside the tree the shadow extends everywhere.
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.