Two questions on graphics:
1. I'm trying to create the rooftop for a 'house' which needs to be 61 pixels long. In order to center the roof properly, I need to have both base points at 30.5 pixels from the center.
I am trying to accomplish this by making three points, the peak, and left and right base points, and connecting them with lines.
However, code like this:
Point2D.Float roofPointLeft = new Point2D.Float (9.5 + x, 40 + y);
produces an error.
I've been told you can't have half a pixel, and this makes sense to me. However, without half a pixel I cannot center my roof according to the assignment instructions.
Insight, anyone?
2. The roof of my house consists of three points, two lines for the sides, and the top of the rectangle which serves as the main body of the house as the base.
How can I fill an enclosed area like my roof?
A related question, if I arrange three shape objects (say a circle, a triangle, and a square) so that there is an enclosed space between them -- is there a way to fill this space?
Thanks for any and all help!
1. I'm trying to create the rooftop for a 'house' which needs to be 61 pixels long. In order to center the roof properly, I need to have both base points at 30.5 pixels from the center.
I am trying to accomplish this by making three points, the peak, and left and right base points, and connecting them with lines.
However, code like this:
Point2D.Float roofPointLeft = new Point2D.Float (9.5 + x, 40 + y);
produces an error.
I've been told you can't have half a pixel, and this makes sense to me. However, without half a pixel I cannot center my roof according to the assignment instructions.
Insight, anyone?
2. The roof of my house consists of three points, two lines for the sides, and the top of the rectangle which serves as the main body of the house as the base.
How can I fill an enclosed area like my roof?
A related question, if I arrange three shape objects (say a circle, a triangle, and a square) so that there is an enclosed space between them -- is there a way to fill this space?
Thanks for any and all help!
Comment