Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2012-01-06 00:15:21

model
Member
Registered: 2011-08-10
Posts: 142

angle inversion problem when moved to up or down side

hy All,

I calculated angle . but when i move to up side . My angle inverted  and show  direction to down side .

and when i move to down side . my angle direction showed to upside .  So  angle is inverted .

Does any one have idea how to solve this angle inversion problem .
Thanks


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#2 2012-01-06 00:51:45

Bob
Administrator
Registered: 2010-06-20
Posts: 10,163

Re: angle inversion problem when moved to up or down side

hi model,

It sounds like a problem with the way you are calculating the angle.

In most software I would expect angles to be measured from the x axis in a counter clockwise direction (see diagram)

So to calculate that angle you would do

That would give a positive answer in RADIANS.  ( x 180 / pi to get DEGREES )

Hope that helps,  smile

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#3 2012-01-06 20:16:35

model
Member
Registered: 2011-08-10
Posts: 142

Re: angle inversion problem when moved to up or down side

hy Bob,

but i did the same .
I have current and previous position with x and y .
so just calculated deltaX = x2 - x1 and deltay = y2 - y1
  double angle = arctanDegree( deltaY ,deltaX );
and i have converted  it in degree, too .

Is that not same as you  said ,


Maths is Doctor that make our life easy .. smile smile

https://www.facebook.com/groups/Maths.GIS/

Offline

#4 2012-01-06 20:58:13

Bob
Administrator
Registered: 2010-06-20
Posts: 10,163

Re: angle inversion problem when moved to up or down side

Yes it seems like it.

Carry out a 'dry run'.

On a piece of paper you put column headings for all the variables.

Then you work through your code, carefully, line by line, and enter in the columns the values for your test run.

That way you should be able to detect where the inversion occurs.

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

Board footer

Powered by FluxBB