TheSwamp
Code Red => .NET => Topic started by: nobody on June 20, 2016, 10:31:11 PM
-
I need to write code to determine the two quadrants for two lines at different bearings....but can't wrap my head around how many cases will be possible so I can be sure I'm accounting for them all... anyone know this already?
quadrant being north, south, east, west
see attached image, and thanks!
-
Could both vectors point into the same quadrant in your world ??
ie: 1 o'clock and 2 o'clock etc ?
-
Ignoring the order the vectors are considered in :
I believe the short answer is 10
Opposite Quadrant : 2 options
Adjacent Quadrant : 4 options
Same Quadrant : 4 options
added:
and ignoring the Cardinal directions.
-
Could both vectors point into the same quadrant in your world ??
ie: 1 o'clock and 2 o'clock etc ?
crud they can :/
-
Ignoring the order the vectors are considered in :
I believe the short answer is 10
Opposite Quadrant : 2 options
Adjacent Quadrant : 4 options
Same Quadrant : 4 options
added:
and ignoring the Cardinal directions.
oy... good point with the cardinal directions :/ this is going to be harder than anticipated
-
I'm more than just a pretty face with a questionable sense of humour :)
-
If the quadrants are north, east, south and west I would argue that 1 o'clock and 2 o'clock are not in the same quadrant.
-
whatever,
but I'd wager that's not the case.
If you look at his piccy the Cardinal directions appear to be at 12, 3, 6, 9 ... but I've been wrong before :)
and the proposition about 2 vectors in the same quadrant holds.
-
whatever,
but I'd wager that's not the case.
If you look at his piccy the Cardinal directions appear to be at 12, 3, 6, 9 ... but I've been wrong before :)
and the proposition about 2 vectors in the same quadrant holds.
Correct...12,3,6,9.... but thanks all, I'm abandoning the cause... there are far too many conditions to account for.... not worth the effort. Not only can the vectors be opposite, vertical / horizontal, but acute angles and both vectors heading toward the same quadrant....I'll need to try and figure out a different way to address the problem :/
-
Finally, we come to the issue :
I'll need to try and figure out a different way to address the problem
What is the problem ?
The Conditionals are known.
The Vectors are calculatable.
Seems to me the issue is lexical (naming the unique conditions ) rather than mathematical or logical.
-
If you look at his piccy the Cardinal directions appear to be at 12, 3, 6, 9 ... but I've been wrong before :)
and the proposition about 2 vectors in the same quadrant holds.
... The issue is indeed about definitions. IMO the north sector is bisected by the north direction. So assuming 12 o'clock is north, 1 and 2 o'clock are not in the same sector.
NW > north sector >= NE
-
Finally, we come to the issue :
I'll need to try and figure out a different way to address the problem
What is the problem ?
The Conditionals are known.
The Vectors are calculatable.
Seems to me the issue is lexical (naming the unique conditions ) rather than mathematical or logical.
I'm not sure I have all the possible scenario's accounted for graphically...which makes it that much more difficult to do it programmatically... :/
-
If you limit the orientation of the lines to N, NE, E etc., consider N+NE to be equal to NE+N etc., and include the cases where the lines are superimposed, there a [8*8]/2 = 32 combinations.
-
Can't you use the angle of the lines in radians to determine quadrant? or am I missing something? (probably :) )
eg. 0 -> pi/2 is quadrant from 12 o'clock to 3 o'clock, pi/2 -> pi = 9-12 o'clock, pi -> 3pi/2 = 9-6 o'clock and 3pi/2 -> 2pi = 6-3 o'clock.
obviously you will need to rationalise what happens at 3, 6, 9 and 12 o'clock positions.
-
Try this :
Note: Check the Bit values for veracity ... I rushed this a little
-
If you limit the orientation of the lines to N, NE, E etc., consider N+NE to be equal to NE+N etc., and include the cases where the lines are superimposed, there a [8*8]/2 = 32 combinations.
:embarrassed: Oops. I stand corrected. As Kdub demonstrates there are 36 combinations.
https://www.mathsisfun.com/combinatorics/combinations-permutations.html
-
Try this :
Note: Check the Bit values for veracity ... I rushed this a little
Thank you kdub!
-
You're welcome.
Perhaps the assignment of bit values would be more logical if E=1 , N=2 etc progressing counter-clockwise with the increased angular value ; similarly with quadrant nominations.