GetAngleBetween3Points
#8

Both vectors have their x, y, and z. Let's define the "vector a" by doing "point 1" - "point 2", and define "vector b" by doing "point 3" - "point 2".

For the angle caclulation you have to first calculate (vect_a_x*vect_b_x)+(vect_a_y*vect_b_y)+(vect_a_z* vect_b_z). If this value equals zero, you have obviosly a 90° radius.
If not, you have to divide it by sqrt((vect_a_x*vect_a_x)+(vect_a_y*vect_a_y)+(vect _a_z*vect_a_z)) * sqrt((vect_b_x*vect_b_x)+(vect_b_y*vect_b_y)+(vect _b_z*vect_b_z)). the result should be insterted into acos, and you'll get your result.

Код:
acos(((vect_a_x*vect_b_x)+(vect_a_y*vect_b_y)+(vect_a_z*vect_b_z))/(sqrt((vect_a_x*vect_a_x)+(vect_a_y*vect_a_y)+(vect_a_z*vect_a_z))*sqrt((vect_b_x*vect_b_x)+(vect_b_y*vect_b_y)+(vect_b_z*vect_b_z))))
Reply


Messages In This Thread
GetAngleBetween3Points - by Opah - 16.07.2013, 16:11
Re: GetAngleBetween3Points - by Ballu Miaa - 16.07.2013, 16:18
Re: GetAngleBetween3Points - by Opah - 17.07.2013, 14:59
AW: GetAngleBetween3Points - by BigETI - 17.07.2013, 15:05
Re: GetAngleBetween3Points - by Opah - 17.07.2013, 15:09
Re: GetAngleBetween3Points - by Finn - 17.07.2013, 15:12
Re: GetAngleBetween3Points - by RyDeR` - 17.07.2013, 15:15
AW: GetAngleBetween3Points - by BigETI - 17.07.2013, 15:21
Re: GetAngleBetween3Points - by Opah - 17.07.2013, 15:29
Re: GetAngleBetween3Points - by Opah - 17.07.2013, 15:36

Forum Jump:


Users browsing this thread: 1 Guest(s)