开发者

Conversion formula for Heading of an object to match a value I have in int?

开发者 https://www.devze.com 2023-01-26 19:03 出处:网络
I have a list of items heading that are all in INTEGER (yes the heading is 0 to 120 int) value but when I am reading them they are all in float, so in between there is a conversion being done that I a

I have a list of items heading that are all in INTEGER (yes the heading is 0 to 120 int) value but when I am reading them they are all in float, so in between there is a conversion being done that I am not aware of (code not open so I can't check it myself but I need to update the xml and for that i must know how to convert it).

  • What I wanted to find out here is what sort of conversion do I have to do in order to get out of the float a matching int for it as the examples OBJECT A and B.

First example is OBJECT A which has the floating heading 57 but has the int heading 109. Second example is OBJECT B which has the floating heading 168 but has the int heading 26.

The fl开发者_运维问答oating is 0 to 360 and the int is 0 to 120.

Initially i was think about radians but there are 2 incosistences first is that OBJECT A is 57 having the int 109 so I would not be able to apply a converting formula to it I belive, second is that if I am not mistaken radians is up to 180.

I am really intrigued to understand why it has that integer representing a degree and how it is being converted to such...

PS: By the way I posted this in mathematics first before posting here but they requested it would be more suitable here.

UPDATE WITH MORE SAMPLES:

 F    I
168   26
 57  109
180   30
165   25
 45  105
  0   90
318   99
348   86
240   50
204   38
345   85

F for Float I for INT


Ok. Your coordinates systems are rotated 90 degrees, and 120 matches 360.

Your function is:

f[x_] := 3 Mod[x - 90, 120];

A plot

ListPlot[{kk, Table[{i[[1]], f[i[[1]]]}, {i, kk}]}, PlotMarkers -> {"X", "O"}]

Conversion formula for Heading of an object to match a value I have in int?

All the points are OK, except the last one.

0

精彩评论

暂无评论...
验证码 换一张
取 消