# Maximum PC

 It is currently Wed May 06, 2015 1:38 am

 All times are UTC - 8 hours

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Calculate angles with JavaPosted: Sat May 30, 2009 5:52 pm
 Northwood

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2263
Hey, I'm doing a simple trajectory calculation in Java and it seems that the Math.sin method is giving me a negative number. Not only that but the number i'm looking for is all wrong.

Top

 Post subject: Re: Calculate angles with JavaPosted: Sat May 30, 2009 6:16 pm
 Little Foot

Joined: Sat Feb 11, 2006 11:04 am
Posts: 174
Dwood15 wrote:
Hey, I'm doing a simple trajectory calculation in Java and it seems that the Math.sin method is giving me a negative number. Not only that but the number i'm looking for is all wrong.

maybe your algorithm is wrong. Post your code here for people can see it.

Top

 Post subject: Posted: Sat May 30, 2009 6:23 pm
 Little Foot

Joined: Mon Jul 28, 2008 1:39 pm
Posts: 123
Also remember that all Java's trig functions work in radians. If you're doing degrees, then it won't work.

Top

 Post subject: Posted: Sat May 30, 2009 6:49 pm
 Northwood

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2263
Quertior wrote:
Also remember that all Java's trig functions work in radians. If you're doing degrees, then it won't work.

it's just Math.sin(angle) so how do I get it into degrees? Math.toDegrees();?

Top

 Post subject: Posted: Sat May 30, 2009 8:00 pm
 Little Foot

Joined: Mon Jul 28, 2008 1:39 pm
Posts: 123
Dwood15 wrote:
it's just Math.sin(angle) so how do I get it into degrees? Math.toDegrees();?

Wait, let me clarify. Math.sin() will NOT work correctly with an angle in degrees. If you are using radians, you should be FINE.

However, if not:
Code:
double angleInDegrees = /*some angle in degrees*/ ;

Hope that helps.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC - 8 hours

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Maximum FAQs    Forum Rules, Posting Guidelines & Announcements    The Good, The Bad & The Banned    FAQs Help/Do It Yourself    PC Building Lab    The Help Desk    PC Modding    Education & Certification Hardware    Nuts & Bolts    Portable Talk    Appraisals, Deals & Bargains (oh my!) OS/Software/Programming    Windows Parlor    Alt.OS.Abode    Games Arena    Programmers' Paradise Networking/Internet    Internet Truckstop    Network Nook In/Out    Magazine and Book Feedback    Forum & Website Feedback    Dog Pound Team Maximum PC Folding at Home    Team Maximum PC - Folding at Home - FIND CURES TO DISEASES    Team MPC - Folding Gauntlets