• Post Reply Bookmark Topic Watch Topic
  • New Topic

drawing a portion of a circle  RSS feed

 
Subhash Sriram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am doing a Java program where users will be able to create pie charts, and I get to design the user interface. I havent got into any of those aspects yet, but am working on a way to just draw a portion of a circle based on what the user enters.
On this first file, I have the class PieChart defining the chart, and what I am wanting to do is take the angle (theta) the user enters in, change it to radians, and then draw that curve in a particular color. I am having trouble with just drawing the curve.
Here is the code I have right now for the class:

I understand there is no for loop in there now, but I am not sure how the best way to do it is.
And, here is my tester program. Instead of taking in user input on this one, just giving a default value.

Any help would be greatly appreciated. Thanks in advance!
The problem is it will not print anything, not even a line between the two points
[ November 10, 2003: Message edited by: Subhash Sriram ]
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got at least 2 problems:
* You're drawing a radius of 1, which is too small to be seen. You need to scale out x and y
* IIRC the default graphics view places the origin in the corner and shows you part of the quadrant where x and y are positive. So you need angles less than 90 degrees, or to shift things around so the origin is not in the corner.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!