Trigonometry, calculate angel between three coordinates Programming Software Development by gedas … one of the following: sin, cos or tan, but my trigonometry skills are very rusty. i hope someone could help me… Problem requires TRIGONOMETRY Programming Software Development by Asuna Problem requires TRIGONOMETRY: A pipe is to be carried around the right-angled … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral You need to use one of the inverse functions: [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#acos(double)"]acos[/URL], [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#asin(double)"]asin[/URL], or [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#atan(double… Re: Trigonometry, calculate angel between three coordinates Programming Software Development by gedas well i am going to know the line length for all the lines. the shape would look something like this (shape b) [url]http://www.cimt.plymouth.ac.uk/projects/mepres/book7/bk7i5/s5q1.gif[/url] left side of the triangle will keep on changing (slightly) due to the change of the coordinates. how could i calculate the angel of the top side of the … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral Since they're not right triangles, using the dot product of the vectors may be easier. Given the vectors (x1,y1) and (x2,y2): angle in radians = arccos((x1*x2 + y1*y2) / ( sqrt(x1*x1 + y1*y1) * sqrt(x2*x2 + y2*y2) ) More wiki info here: [url]http://en.wikipedia.org/wiki/Dot_product#Geometric_interpretation[/url] Pretty decent vector algebra … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by gedas thank you!!! this formula looks like it would work,but my amateur programming skills are stopping me on implementing "arccos". i have tried Math.arccos(......); but it gives me error, that the symbol can not be found what should i do to get rid of this error?? thanks again for your reply Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral The method is [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#acos(double)"]Math.acos()[/URL] Remember that the angle is in radians. You can use [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#toDegrees(double)"]Math.toDegrees(double)[/URL] to convert to degrees if you need to. Re: Trigonometry, calculate angel between three coordinates Programming Software Development by gedas sorry for the previous post,ignore it please i have worked it out and it is simply Math.acos(); but the calculation gives me wrong values i convert everything back to degrees [CODE] degrees = (radians * 180 / Math.PI) [/CODE] but for some reason the output i receive varies from 0- 15 instead of 0-360 degrees. i am not sure what would be wrong … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral It may depend on how you represented your input vectors. For that upper point on figure b that you refered to, you would need to calculate the vectors from that point of origin such that they were pointing out and down from that position using (x2-x1,y2-y1). Here's a small spreadsheet of the results I got with that formula. I calc'd the angle … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral You could take a look at [URL="http://en.wikipedia.org/wiki/Law_of_cosines"]Law of Cosines[/URL] as well, if the vector method isn't working out for you. It's just another way to skin the same cat. Re: Trigonometry, calculate angel between three coordinates Programming Software Development by gedas Thanks a lot for all the help it really did help me !! i managed to solve my problem from the example in the wiki. i knew all the length of all the sizes so all i had to do is work out the angel. [CODE] hypotenuse = Math.sqrt(Math.pow(xb-xa,2) + Math.pow(yb-ya,2)); adjacent = Math.sqrt(Math.pow(xa-xa,2) + Math.pow(ya+50-ya,2)); … Re: Trigonometry, calculate angel between three coordinates Programming Software Development by saranyabaskaran hai... me to working in the same area...i couldnot understand how to set the angle between three points in java...could u plz help me... thank u... Re: Trigonometry, calculate angel between three coordinates Programming Software Development by Ezzaral @saranyabaskaran: No, do not hijack other posters threads to ask your own questions. Please start a new thread of your own and explain more clearly what you are trying to do when you say "set the angle". Trigonometry Programming Software Development by Hidden_mistakes I am trying to move a player in direction angle by speed. I need to use trigonometric functions in order to calculate this. Can anyone help me discover how to do this? [code]if (playerB.up == true) { (playerB.speed)+=((Delta*ballspeed)/1000); } if (playerB.down == true) { (playerB.speed)-=((Delta*… Re: Trigonometry Programming Software Development by mrnutty >> I am trying to move a player in direction angle by speed I am kind of hesitant of what you mean exactly by that, can you explain? Re: Trigonometry Programming Software Development by Tigran Why don't you do it with vectors? it's alot less work. Just define a vector with a specified length (your speed) and use a rotation matrix to rotate it the amout of degrees. Then add each component of the vector to your position. Just google on the terms vector and rotation matrix and read wikipedia. that should be enough. Trigonometry program Programming Software Development by tlox I am trying to write a C++ program that will prompt the user to enter an angle value and calculate its sine,cosine and tangent without using c math library.The angle value denoted x,should be in radian,otherwise the program will convert it into radian before it computes its sin,cos and tan.So far i have managed to come up with a code(below) for … Re: Trigonometry program Programming Software Development by ithelp move int factorial(int); above main like [code] int factorial(int) { /* your code here */ } [/code] trigonometry c++ Programming Software Development by drjay1627 hey, given one side and an angle how do you calculate the other sides and angles in a right angle triangle in c++. I'm basically looking for an algorithm. Thanks drjay Re: trigonometry c++ Programming Software Development by Sky Diploma Well if you have idea about math, You can write the implementation itself by using the angles and the functions "sin , cos , tan etc. " Provided in the c++ math library. And if you wish to get yourself a algorithm i suggest you try googling it up. Re: trigonometry c++ Programming Software Development by Freaky_Chris You could use <cmath> with sin/cos/tan and implement normal mathematics, just remember that the sin/cos/tan function in cmath are written in Radians :) Re: trigonometry c++ Programming Software Development by Comatose [url]http://www.clarku.edu/~djoyce/trig/right.html[/url] Re: trigonometry c++ Programming Software Development by drjay1627 thanks... how do you print 90 degrees? [code] side2 = (side1) / (tan(angle1*PI/180)); side3 = (side1) / (sin(angle1*PI/180)); angle2 = (atan (side2/side1) * 180 / PI); angle3 = (asin (side3/side1) * 180 / PI); [/code] output: for 90 degree angle i get a weird output: … Re: trigonometry c++ Programming Software Development by StuXYZ You are aware that tan(90) [in degree] is infinity, and obviously, so is tan(pi/2) [in radians] as pi/2 radians == 90degrees. That is easy to see if you consider that tan is the ration of the length of the two shorter sides on a right angled triangle. Ie by the time the angle nearly 90 degrees the other angle in the triangle is very small. Try … Trigonometry in 3d space Programming Software Development by FallenPaladin Hi there, I am having some syntax and logical implementation problems with a really very simple requirment and I am hopeing someone can help point me in the right direction. The problem I am having concrens trignometric functions in 3d space and what I am trying to do is find the angle of tragectory between 2 points in 3d space. I have solved the … Re: Trigonometry in 3d space Programming Software Development by kramerd Look up the documentation for the Math class, which has the trig functions you are looking for, in addition to square root and exponent functions. If this is not enough help, ask a more specific question. Re: Trigonometry in 3d space Programming Software Development by FallenPaladin The problem is implementing the syntax demonstrated in the help file, as I can not visualise how i would implement it. I have already implemented the square root operation. My main concern is that java works in radians and not degrees and from some of what I have seen this impacts on implementation. I do not how more specific you want the … Re: Trigonometry in 3d space Programming Software Development by kramerd Many of the Math operations are in radians, but the Math class also has methods to convert both to radians and to degrees. When I say more specific, I mean what syntax is it that you are having trouble with? You say you already implemented the square root operation. So you are fine calculating this line? Vxz = sqrroot(xd^2 + zd^2) Then is it … Re: Trigonometry in 3d space Programming Software Development by FallenPaladin ok maybe i did not make it clear enough that the example was the paper solution. and it is the tan / cos and sin statements I am having a problem with. As such, knowing the adjacent and the oposit values how do I convert that to to radions to then convert to tangent? Re: Trigonometry in 3d space Programming Software Development by kramerd Say you have an angle in degrees. [CODE] double angle ... // in degrees double radianAngle = Math.toRadians(angle); double radianTangent = Math.tan(radianAngle); double radianDegrees = Math.toDegrees(radianTangent); [/CODE] Is that what you're looking for?