Author Topic: Quadrants  (Read 5516 times)

0 Members and 1 Guest are viewing this topic.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Quadrants
« 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!


kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #1 on: June 20, 2016, 10:59:58 PM »
Could both vectors point into the same quadrant in your world ??

ie: 1 o'clock and 2 o'clock etc ?
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #2 on: June 20, 2016, 11:07:10 PM »
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.
« Last Edit: June 20, 2016, 11:10:35 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Quadrants
« Reply #3 on: June 21, 2016, 01:29:06 AM »
Could both vectors point into the same quadrant in your world ??

ie: 1 o'clock and 2 o'clock etc ?

crud they can :/

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Quadrants
« Reply #4 on: June 21, 2016, 01:51:14 AM »
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

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #5 on: June 21, 2016, 02:14:53 AM »

I'm more than just a pretty face with a questionable sense of humour :)
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Quadrants
« Reply #6 on: June 25, 2016, 08:57:10 AM »
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.
« Last Edit: June 25, 2016, 09:12:55 AM by roy_043 »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #7 on: June 25, 2016, 09:46:34 AM »
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.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Quadrants
« Reply #8 on: June 25, 2016, 11:06:30 PM »
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 :/ 

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #9 on: June 25, 2016, 11:27:00 PM »
Finally, we come to the issue :

Quote
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.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Quadrants
« Reply #10 on: June 26, 2016, 07:43:37 AM »
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.
Code: [Select]
NW > north sector >= NE

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Quadrants
« Reply #11 on: June 26, 2016, 01:11:10 PM »
Finally, we come to the issue :

Quote
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... :/ 



« Last Edit: June 26, 2016, 01:22:31 PM by Area51Visitor »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Quadrants
« Reply #12 on: June 28, 2016, 04:20:28 AM »
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.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Quadrants
« Reply #13 on: June 28, 2016, 09:00:39 PM »
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.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #14 on: June 29, 2016, 11:19:18 PM »
Try this :
Note: Check the Bit values for veracity ... I rushed this a little

« Last Edit: June 29, 2016, 11:25:35 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Quadrants
« Reply #15 on: June 30, 2016, 04:58:51 AM »
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
« Last Edit: June 30, 2016, 05:22:51 AM by roy_043 »

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Quadrants
« Reply #16 on: June 30, 2016, 09:56:09 AM »
Try this :
Note: Check the Bit values for veracity ... I rushed this a little

Thank you kdub!

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Quadrants
« Reply #17 on: June 30, 2016, 08:03:36 PM »

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.

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.