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

You are not logged in.

- Topics: Active | Unanswered

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,452

Hi pari_alf,

From post #43:

pari_alf wrote:

I am not satisfy with my direction numbers to each angle.

Anyone help me to check it. thanks

Why are you not satisfied with them?

Anyway, the direction codes can't be checked accurately without knowing the angle ranges of the 16 sectors...see the following, from post #44:

bob bundy wrote:

You haven't said how you converted these to direction codes, so I went back to my post 31 and applied those steps. For values up to direction code 7, we have the same results. Thereafter, my answers are 1 less than yours. And I get 15 not zero for 32.7.... I'd need to see the code to explain that. It may be something to do with the way the numbers are rounded.

Please also give the exact start and end angles for the sectors ; then I can modify the steps to account for the differences.

eg.

sector 0: 0 ≤ angle < 22.5

To enable me to give you the correct direction codes I need to know:

1. the angle ranges of the sectors (as per Bob's post), and

2. which sector applies to an angle that falls exactly on a sector boundary: eg, is it the sector that is clockwise or anticlockwise to that boundary?

Do you agree with the angle ranges I gave in the image of post #46?

ie,

DC0 = 11.25 to -11.25

DC1 = -11.25 to -33.75

DC2 = - 33.75 to -56.25

etc...

In my recent posts (#46 & since) I'd assumed that the compass format is as per your image (see below) in post #39, where E(0°) seems to fall exactly in the middle of the Direction Code 0 sector. However, I'm not so sure now that my assumption is correct, which is why I need the answers to the above questions.

If E falls exactly in the middle of the Direction Code 0 sector then my calculations in those posts are right (I think), but if E falls anywhere else then my calcs are wrong (but easily fixed).

The circular-sector angles in that image are 45° because the compass has 8 equal sectors, whereas your angles for 16 sectors are 22.5°. Therefore I reckoned that, dividing 45° by 2 because E=0° and E is (seemingly) in the middle of the Direction Code 0 sector, the first sector boundary in that image in an anticlockwise direction from E is 22.5°...which for your puzzle would be -11.25° (including the negative notation for the upward angle).

*Last edited by phrontister (2014-05-10 23:20:23)*

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 7,705

hi pari_alf

We have now reached post 53. Your last post was number 45 on April 11th. Since then phrontister has done a lot of work for you which you haven't acknowledged.

On 9th May phrontister asked you several questions about the way you want this to work. You haven't answered him.

The people who give up time to help others on the forum, do not get paid for it. They just do it because they want to be helpful. But it is very hard and discouraging, if the person wanting help doesn't even say whether the help has been understood and appreciated.

Please look back at the last 8 posts and say whether it has made sense. Then answer the questions you have been asked.

Thanks,

Bob

*Last edited by bob bundy (2014-05-22 07:33:16)*

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

Offline

**pari_alf****Member**- Registered: 2013-12-01
- Posts: 85

bob bundy wrote:

hi pari_alf

I still am unable to answer that without knowing how you computed the angles.

Are you using a calculator? In which case, which one?

Or some software? In which case what software?

How have you determined dy and dx? Please post the actual calculation you did.

Bob

Hi Bob, sorry i did not notice about the questions.

I think i mentioned before that i am computing angle using atan2 (dy / dx)

And i computed dy, dx as follows dx = abs (p2.x - p1.x) , dy = abs (p2.y - p1.y);

I did programming in c++.

Offline

**pari_alf****Member**- Registered: 2013-12-01
- Posts: 85

Hi bob,

Yes sorry, i could not give time to it.

Hope you understand.

I will reply to all questions one by one.

Hope it would be ok.

Thanks

bob bundy wrote:

hi pari_alf

We have now reached post 53. Your last post was number 45 on April 11th. Since then phrontister has done a lot of work for you which you haven't acknowledged.

On 9th May phrontister asked you several questions about the way you want this to work. You haven't answered him.

The people who give up time to help others on the forum, do not get paid for it. They just do it because they want to be helpful. But it is very hard and discouraging, if the person wanting help doesn't even say whether the help has been understood and appreciated.

Please look back at the last 8 posts and say whether it has made sense. Then answer the questions you have been asked.

Thanks,

Bob

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,452

Hi Bob,

From post #44:

bob bundy wrote:

I copied your text into an Excel spreadsheet to save having to re-type everything. If you post data again, it would help if you left out all unneeded text and just gave me the numbers.

eg.

x values are

126

172

209etc

then I can copy these straight in rather than having to "MID" out the unwanted characters. Thanks.

Word has a feature that could help with that if the required text is in a vertical block.

Copy the whole text (needed and unneeded) into Word, hold down the Alt key and select the needed text as a vertical block by dragging the cursor down (or up) over it. Like so:

Then copy the selected text into Excel.

Btw, some time back I discovered on another forum a way of entering multiple points into Geogebra's Input bar instead of just one at a time like I did early on with pari_alf's coordinates. However, it's rather cumbersome:

`Execute[{"A_0 = (165, -454)","A_1=(238, -321)","A_2= (287, -307)","A_3= (328, -324)","A_4= (337, -378)","A_5= (303, -431)","A_6= (234, -463)","A_7= (315, -427)","A_8= (435, -441)"}]`

Using a text editor helps with that, but hopefully Geogebra will simplify multiple-point input one day.

Note: I had to change pari_alf's y-axis coordinates to negative to suit Geogebra.

*Last edited by phrontister (2014-05-26 04:27:25)*

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**pari_alf****Member**- Registered: 2013-12-01
- Posts: 85

Hi ,

Hope you are good.

This time i tested 8 direction codes on above given points

My direction code result is shown in the below image.

The points are

105 66

114 92

104 11

99 131

71 144

37 168

And the 8 direction codes are as follows

2

7

6

6

My method of calculating the direction code is same like you directed me for 16 direction codes.

I used the following steps for calculating the direction Codes

1. take angle

2. divide by 40

3. add 0.5 to round up or down correctly

4. take the integer part

5. subtract from 8 to get the correct rotational direction

6. use mod 8 division to get the numbers in range.

The 8 direction code image is shown below

In the image, numbers are assigned to each direction.

=-----------------------------

But my direction codes seems not correct.

bob bundy wrote:

hi pari_alf

So you wish to convert those angles into numbers from 0 to 15 according to the diagram below.

Step 1. Take the calculated angles

result

70 .9...

-97.0....

92.3....

155.0...

144.7....step 2. Divide each by 22.5

result

3.15..

-4.31..

4.10..

6.89..

6.43..step 3. Add 0.5 so that when I use INT I will round up or down correctly

result

3.65..

-3.81..

4.60..

7.39..

6.93..step 4. take the integer part of (note that the negative goes to -4 with my software)

result

3

-4

4

7

6step5. Subtract from 16 to get the correct rotational direction

result

13

20

12

9

10step6. use mod 16 division to get the numbers in range

result

13

4

12

9

10And there you have it. I suggest you check boundary cases such as angle = 90 in case these misbehave.

Bob

*Last edited by pari_alf (2014-06-05 14:44:46)*

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 7,705

hi pari_alf

I'm not following what you have done. The diagram has four points and three lines. But you have six coordinates (which should give five direction codes) but only four codes.

Your compass shows measurements clockwise from the positive x axis, but I cannot tell which point is which on your diagram.

You still haven't said what you want to do about angles that fall exactly on a compass line.

Suggestion:

Let's test this with one pair of points at a time. What happens if you have

(1) A = (2.01. 1.01) and B = (6.01,1.01)

(2) C = (1.43, 1.59) and D = (5,34, 3.44)

(3) E = (-2.01, 2.01) and F = (-6.01, 6.01)

Run the code three times using the data from (1) the first time, then (2) then (3).

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

Offline