Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

angle between two lines(urgeeent)

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i want to know that if i know two sides of a triangle can i know the angle between two lines,there is no method in api such as tan inverse , cos inverse etc . please explain with an example its urgent . thanks in advance.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prashant
If you only know 2 sides that is not enough to be able to figure out the angle between them. For triangles, to calculate a missing side or angle, you need to hae three things: 2 angles and a side, 2 sides and an angle, 3 sides, or 3 angles. then you can use sin and cosine to figure out the missing peices.
hope that helps

Dave
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you're thinking of a right triangle? Then you really know one angle (the right angle) and two sides. In that case, yes, it's possible - in Java the inverse trig functions are found in the Math class - asin(), acos(), atan(). Naturally theswe return values in radians, but you can convert the values to degrees if necessary. Hope that helps...
 
prashant komaragiri
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
Perhaps you're thinking of a right triangle? Then you really know one angle (the right angle) and two sides. In that case, yes, it's possible - in Java the inverse trig functions are found in the Math class - asin(), acos(), atan(). Naturally theswe return values in radians, but you can convert the values to degrees if necessary. Hope that helps...


hi jim,
thanks for ur reply but i think atan is not tan inverse.any othe r solution ??
prashant
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I'm quite certain that the atan or arc tan is the "tan inverse", if by that you mean the inverse tangent function, commonly written tan-1. That is, if you input an argument, it returns a value representing an angle in radians between -pi/2 and pi/2 whose tangent is equal to the argument. What makes you think it's not the inverse tangent?
 
prashant komaragiri
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
Well, I'm quite certain that the atan or arc tan is the "tan inverse", if by that you mean the inverse tangent function, commonly written tan-1. That is, if you input an argument, it returns a value representing an angle in radians between -pi/2 and pi/2 whose tangent is equal to the argument. What makes you think it's not the inverse tangent?


ya jim,
i got it thanks very much. actually when i put Math.atan(50/30) and then convert it to degrees it was coming out to be 45 deg that is wrong.thats why i was thinking it is not tan inverse. but when i put 50.0/30.0 in Math.atan it was giving correct value . Thanks again
prashant

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic