wood burning stoves 2.0*
The moose likes Java in General and the fly likes Trying to calculate lines over pi/4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Trying to calculate lines over pi/4" Watch "Trying to calculate lines over pi/4" New topic
Author

Trying to calculate lines over pi/4

Tony Craven
Greenhorn

Joined: Aug 14, 2007
Posts: 7
Hi,

I'm trying to draw a visual representation of an array of sensors for a science project demonstration. The 7 sensors are at the front of a little bot.

I'm having trouble finding the right way to do it in java, I'm using Line2D.Double to represent each sensor but when it comes to spreading them out equally over the pi/4 range, I'm stumped.

I guess this is more a maths problem, than a java problem, but I'd really appreciate any help!

Thank you,

Tony


Never trust a computer you can't throw out a window - Steve Wozniak
Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
Can you elaborate a little your problem?


Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Tony Craven
Greenhorn

Joined: Aug 14, 2007
Posts: 7
Actually, I figured out how to do what I wanted in the end.

Briefly, starting at 90 degress.



And each sensor after that would be (45 / 7 * i), where i was the sensor number.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to calculate lines over pi/4
 
Similar Threads
EventHandling on pi-chart
Problem with printf output
AffineTransform Rectangle2D
Can you tell what is wrong with this loop?
How many hours do you sleep every day?