Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: Already written function to find if a point is within a rectangle?
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.")
> 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.
> > This "point inside polygon" code might be helpful: > > http://www.idlcoyote.com/tips/point_in_polygon.html > Thanks!
> > 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.
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.
>>> 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