From patrick.dowler at nrc-cnrc.gc.ca Wed Jan 4 10:56:07 2012 From: patrick.dowler at nrc-cnrc.gc.ca (Patrick Dowler) Date: Wed, 4 Jan 2012 10:56:07 -0800 Subject: STC box to polygon Message-ID: <201201041056.07885.patrick.dowler@nrc-cnrc.gc.ca> Has anyone ever written down the complete conversion from an STC box to a polygon? e.g. the computation of the 4 vertices from the centre and sizes. We may have been too lazy when we did it back when trying to get complete STC support into our TAP code. The relevant text from STC: -- Patrick Dowler Tel/T?l: (250) 363-0044 Canadian Astronomy Data Centre National Research Council Canada 5071 West Saanich Road Victoria, BC V9E 2M7 Centre canadien de donnees astronomiques Conseil national de recherches Canada 5071, chemin West Saanich Victoria (C.-B.) V9E 2M7 From patrick.dowler at nrc-cnrc.gc.ca Wed Jan 4 11:03:12 2012 From: patrick.dowler at nrc-cnrc.gc.ca (Patrick Dowler) Date: Wed, 4 Jan 2012 11:03:12 -0800 Subject: STC box to polygon In-Reply-To: <201201041056.07885.patrick.dowler@nrc-cnrc.gc.ca> References: <201201041056.07885.patrick.dowler@nrc-cnrc.gc.ca> Message-ID: <201201041103.12975.patrick.dowler@nrc-cnrc.gc.ca> With links this time :-) On 2012-01-04 10:56:07 you wrote: > Has anyone ever written down the complete conversion from an STC box to a > polygon? e.g. the computation of the 4 vertices from the centre and sizes. > > We may have been too lazy when we did it back when trying to get complete > STC support into our TAP code. > > The relevant text from STC: http://www.ivoa.net/Documents/REC/DM/STC-20071030.html#_Toc181531825 My lazy/approximate code to make a polygon from a box is in here: http://code.google.com/p/opencadc/source/browse/trunk/projects/cadcTAP/src/ca/nrc/cadc/stc/Polygon.java The code does not look at all like the text description. It just tries to make a polygon that is ~square. -- Patrick Dowler Tel/T?l: (250) 363-0044 Canadian Astronomy Data Centre National Research Council Canada 5071 West Saanich Road Victoria, BC V9E 2M7 Centre canadien de donnees astronomiques Conseil national de recherches Canada 5071, chemin West Saanich Victoria (C.-B.) V9E 2M7 -------------- next part -------------- An HTML attachment was scrubbed... URL: From arots at head.cfa.harvard.edu Wed Jan 4 12:18:42 2012 From: arots at head.cfa.harvard.edu (Arnold Rots) Date: Wed, 4 Jan 2012 15:18:42 -0500 (EST) Subject: STC box to polygon In-Reply-To: <201201041103.12975.patrick.dowler@nrc-cnrc.gc.ca> Message-ID: <201201042018.q04KIgJ0000456@xebec.cfa.harvard.edu> Yes, this most certainly is not right. Jonathan undoubtedly has code that does it correctly, but for now I would suggest the following: Define you box as a rectangle in the tangent plane where the tangent point is the center of the box There your corner points will be (+/-hw,+/-hh). Then transform these corners to sky coordinates with the usual tangent plane-to-spherical coordinates transformation, using the box center as tangent point, and you have your vertices. - Arnold Patrick Dowler wrote: [ Charset ISO-8859-1 unsupported, converting... ] > > With links this time :-) > > On 2012-01-04 10:56:07 you wrote: > > Has anyone ever written down the complete conversion from an STC box to a > > polygon? e.g. the computation of the 4 vertices from the centre and sizes. > > > > We may have been too lazy when we did it back when trying to get complete > > STC support into our TAP code. > > > > The relevant text from STC: > > http://www.ivoa.net/Documents/REC/DM/STC-20071030.html#_Toc181531825 > > My lazy/approximate code to make a polygon from a box is in here: > > http://code.google.com/p/opencadc/source/browse/trunk/projects/cadcTAP/src/ca/nrc/cadc/stc/Polygon.java > > The code does not look at all like the text description. It just tries to make > a polygon that is ~square. > > -- > > Patrick Dowler > Tel/T?l: (250) 363-0044 > Canadian Astronomy Data Centre > National Research Council Canada > 5071 West Saanich Road > Victoria, BC V9E 2M7 > > Centre canadien de donnees astronomiques > Conseil national de recherches Canada > 5071, chemin West Saanich > Victoria (C.-B.) V9E 2M7 -------------------------------------------------------------------------- Arnold H. Rots Chandra X-ray Science Center Smithsonian Astrophysical Observatory tel: +1 617 496 7701 60 Garden Street, MS 67 fax: +1 617 495 7356 Cambridge, MA 02138 arots at head.cfa.harvard.edu USA http://hea-www.harvard.edu/~arots/ -------------------------------------------------------------------------- From d.berry at jach.hawaii.edu Wed Jan 4 12:19:30 2012 From: d.berry at jach.hawaii.edu (David Berry) Date: Wed, 4 Jan 2012 20:19:30 +0000 Subject: STC box to polygon In-Reply-To: <201201041103.12975.patrick.dowler@nrc-cnrc.gc.ca> References: <201201041056.07885.patrick.dowler@nrc-cnrc.gc.ca> <201201041103.12975.patrick.dowler@nrc-cnrc.gc.ca> Message-ID: For what it's worth, the code that the AST library (the StcsChan class) uses for this is in function "BoxCorners" in the file stcschan.c: http://starlink.jach.hawaii.edu/git/?p=starlink.git;a=blob;f=libraries/ast/stcschan.c;h=b9ee19394b30af7d560a26b39e14346ca3ebfb5f;hb=HEAD David On 4 January 2012 19:03, Patrick Dowler wrote: > > With links this time :-) > > > On 2012-01-04 10:56:07 you wrote: > >> Has anyone ever written down the complete conversion from an STC box to a > >> polygon? e.g. the computation of the 4 vertices from the centre and sizes. > >> > >> We may have been too lazy when we did it back when trying to get complete > >> STC support into our TAP code. > >> > >> The relevant text from STC: > > > http://www.ivoa.net/Documents/REC/DM/STC-20071030.html#_Toc181531825 > > > My lazy/approximate code to make a polygon from a box is in here: > > > http://code.google.com/p/opencadc/source/browse/trunk/projects/cadcTAP/src/ca/nrc/cadc/stc/Polygon.java > > > The code does not look at all like the text description. It just tries to > make a polygon that is ~square. > > > -- > > > Patrick Dowler > > Tel/T?l: (250) 363-0044 > > Canadian Astronomy Data Centre > > National Research Council Canada > > 5071 West Saanich Road > > Victoria, BC V9E 2M7 > > > Centre canadien de donnees astronomiques > > Conseil national de recherches Canada > > 5071, chemin West Saanich > > Victoria (C.-B.) V9E 2M7