comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Already written function to find if a point is within a rectangle?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Already written function to find if a point is within a rectangle? [message #79338] Mon, 20 February 2012 19:22 Go to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Feb 20, 5:56 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
>> So I need a way to find out if a point ( position of a star ) is
>> within a rectangle ( image boundary ). The rectangle edges are not
>> strictly horizontal or vertical.
>
> You talk about coordinates in RA and dec. So are the images really
> rectangular? It seems to me that the real problem is that you need to
> deal with spherical geometry.

Not only that, but an "image boundary" will be projection-dependent
[*]. For small images it probably won't matter much, but there will
always be an edge case that gets you later.

Craig

[*] "projection" = the cartographic projection which was used to turn
a curved sky into a flat image.
Re: Already written function to find if a point is within a rectangle? [message #79341 is a reply to message #79338] Mon, 20 February 2012 15:47 Go to previous messageGo to next message
Jacare Omoplata is currently offline  Jacare Omoplata
Messages: 6
Registered: February 2012
Junior Member
>
> You talk about coordinates in RA and dec. So are the images really
> rectangular? It seems to me that the real problem is that you need to
> deal with spherical geometry.

The angle is very small and the images were taken very close to the
ecliptic. But I'll redo the same thing taking spherical geometry in to
account later, if I have time. Thanks for pointing that out.
Re: Already written function to find if a point is within a rectangle? [message #79342 is a reply to message #79341] Mon, 20 February 2012 15:37 Go to previous messageGo to next message
Jacare Omoplata is currently offline  Jacare Omoplata
Messages: 6
Registered: February 2012
Junior Member
>
> This "point inside polygon" code might be helpful:
>
>   http://www.idlcoyote.com/tips/point_in_polygon.html
>

Thanks!
Re: Already written function to find if a point is within a rectangle? [message #79344 is a reply to message #79342] Mon, 20 February 2012 14:56 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
> So I need a way to find out if a point ( position of a star ) is
> within a rectangle ( image boundary ). The rectangle edges are not
> strictly horizontal or vertical.

You talk about coordinates in RA and dec. So are the images really
rectangular? It seems to me that the real problem is that you need to
deal with spherical geometry.
Re: Already written function to find if a point is within a rectangle? [message #79345 is a reply to message #79344] Mon, 20 February 2012 14:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jacare Omoplata writes:

> So I need a way to find out if a point ( position of a star ) is
> within a rectangle ( image boundary ). The rectangle edges are not
> strictly horizontal or vertical.
>
> I've found several methods of doing this, and can write a function.
> But I can save some time if someone knows if there's already one
> available out there.

This "point inside polygon" code might be helpful:

http://www.idlcoyote.com/tips/point_in_polygon.html

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Already written function to find if a point is within a rectangle? [message #79400 is a reply to message #79338] Wed, 22 February 2012 19:25 Go to previous message
Jacare Omoplata is currently offline  Jacare Omoplata
Messages: 6
Registered: February 2012
Junior Member
>>> So I need a way to find out if a point ( position of a star ) is
>>> within a rectangle ( image boundary ). The rectangle edges are not
>>> strictly horizontal or vertical.
>
>> You talk about coordinates in RA and dec. So are the images really
>> rectangular? It seems to me that the real problem is that you need to
>> deal with spherical geometry.
>
> Not only that, but an "image boundary" will be projection-dependent
> [*].  For small images it probably won't matter much, but there will
> always be an edge case that gets you later.
>

I'm thinking of making polygons with a large number of edges, instead
of rectangles, with every data point at the edge of a FITS file as a
vertex. That would minimize the projection error, right?

Thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: custom IDL programming solutions
Next Topic: Re: Conumdrum -- Or What's a Newsgroup For

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:45:49 PDT 2025

Total time taken to generate the page: 0.00638 seconds