orbital has asked for the wisdom of the Perl Monks concerning the following question:
My plan is to take the SDTS data (read Coordinate for more info.) from the USGS and calculate each specific waypoint of my GPS data, and find which 4 known coordinates are closest to my current point. Once I have these points I will then be able to get a pretty go estimate of what my specific altitude is.
This Mod is going to tie into another Mod that I am currently working on called Convert::SDTS which dynamically find the known quadrant the data resides in, by looking through the USGS data tables, I am also using Coordinate to figure out which USGS file I exactly need to grab.
My question is there a better way to write the following snippet of code?
@nw=qw(0 30); #North West corner @ne=qw(30 30); #North East corner @se=qw(30 0); #South East corner @sw=qw(0 0); #South West corner @find=qw(10 5); #Point I am trying to find # my current logic to establish if my point # does indeed exist inside my four defined # points. if ((($find[0]<($nw[0]<=$sw[0]?$nw[0]:$sw[0])) or #inside of west? ($find[0]>($ne[0]>=$se[0]?$ne[0]:$se[0])))or #inside of east? (($find[1]<($sw[1]<=$se[1]?$sw[1]:$se[1])) or #inside of south +? ($find[1]>($ne[1]>=$nw[1]?$ne[1]:$nw[1])))) { #inside of north +? die "data is outside of the quadrant\n"; }
This just seems very clumbsy, and I am sure I am missing something easy to clean this up a bit. Please help me out all wise ones.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Better Logic?
by I0 (Priest) on Mar 21, 2001 at 04:57 UTC | |
Re: Better Logic?
by thabenksta (Pilgrim) on Mar 21, 2001 at 01:50 UTC | |
Re: Better Logic?
by orbital (Scribe) on Mar 21, 2001 at 01:43 UTC | |
by merlyn (Sage) on Mar 21, 2001 at 01:50 UTC | |
Re: Better Logic?
by orbital (Scribe) on Mar 21, 2001 at 02:05 UTC | |
by merlyn (Sage) on Mar 21, 2001 at 02:17 UTC | |
by Albannach (Monsignor) on Mar 21, 2001 at 03:43 UTC | |
Re: Better Logic?
by gryng (Hermit) on Mar 21, 2001 at 02:37 UTC | |
Re: Better Logic?
by merlyn (Sage) on Mar 21, 2001 at 01:34 UTC |