1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2
3<!--Converted with LaTeX2HTML 2018.3 (Released July 19, 2018) -->
4<HTML lang="EN">
5<HEAD>
6<TITLE>query_polygon</TITLE>
7<META NAME="description" CONTENT="query_polygon">
8<META NAME="keywords" CONTENT="subroutines">
9<META NAME="resource-type" CONTENT="document">
10<META NAME="distribution" CONTENT="global">
11
12<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
13<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
14<META NAME="Generator" CONTENT="LaTeX2HTML v2018.3">
15   <link rel='apple-touch-icon' sizes='180x180' href='images/favicons/apple-touch-icon.png?v=2017'>
16   <link rel='icon' type='image/png' sizes='32x32' href='images/favicons/favicon-32x32.png?v=2017'>
17   <link rel='icon' type='image/png' sizes='16x16' href='images/favicons/favicon-16x16.png?v=2017'>
18   <link rel='manifest' href='images/favicons/manifest.json?v=2017'>
19   <link rel='mask-icon' href='images/favicons/safari-pinned-tab.svg?v=2017' color='#5bbad5'>
20   <link rel='shortcut icon' href='images/favicons/favicon.ico?v=2017'>
21   <meta name='apple-mobile-web-app-title' content='HEALPix'>
22   <meta name='application-name' content='HEALPix'>
23   <meta name='msapplication-config' content='images/favicons/browserconfig.xml?v=2017'>
24   <meta name='theme-color' content='#ffffff'>
25
26<LINK REL="STYLESHEET" HREF="subroutines.css">
27
28<LINK REL="next" HREF="sub_query_strip.htm">
29<LINK REL="previous" HREF="sub_query_disc.htm">
30<LINK REL="next" HREF="sub_query_strip.htm">
31</HEAD>
32
33<body text="#000000" bgcolor="#FFFFFA">
34
35<DIV CLASS="navigation"><!--Navigation Panel-->
36<A
37 HREF="sub_query_disc.htm">
38<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
39<A
40 HREF="sub_HEALPix_F90_subroutines.htm">
41<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
42<A
43 HREF="sub_query_strip.htm">
44<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
45<A ID="tex2html450"
46  HREF="sub_TABLE_CONTENTS.htm">
47<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
48<BR>
49<B> Previous:</B> <A
50 HREF="sub_query_disc.htm">query_disc</A>
51
52<B>Up:</B> <A
53 HREF="sub_HEALPix_F90_subroutines.htm">HEALPix/F90 subroutines</A>
54
55<B> Next:</B> <A
56 HREF="sub_query_strip.htm">query_strip</A>
57<B> Top:</B> <a href="main.htm">Main Page</a></DIV>
58<!--End of Navigation Panel-->
59
60<H1><A ID="SECTION7900"></A>
61<A ID="sub:query_polygon"></A>
62<BR>
63
64</H1>
65
66<P>
67<b><font size=+6><FONT COLOR="#CC0000">query_polygon</FONT></font></b><hr>
68<H3>Routine to find the index of all pixels enclosed in a polygon. The polygon should be convex,
69or have only one concave vertex. The edges should not intersect each other.
70The output indices can be either in the RING or NESTED scheme</H3>
71Location in HEALPix directory tree: <a href="https://sourceforge.net/p/healpix/code/1005/tree/trunk/src/f90/mod/pix_tools.F90"><b>src/f90/mod/pix_tools.F90</b></a>&nbsp;
72
73<P>
74<hr><h1>FORMAT </h1><blockquote><h3>call <FONT COLOR="#CC0000">query_polygon</FONT>(
75<A HREF="#sub:query_polygon:nside">nside</A>, <A HREF="#sub:query_polygon:vlist">vlist</A>, <A HREF="#sub:query_polygon:nv">nv</A>, <A HREF="#sub:query_polygon:listpix">listpix</A>, <A HREF="#sub:query_polygon:nlist">nlist</A>[, <A HREF="#sub:query_polygon:nest">nest</A>, <A HREF="#sub:query_polygon:inclusive">inclusive</A>]
76)</h3></blockquote>
77
78<P>
79<hr><H1>ARGUMENTS</H1>
80
81<TABLE CELLPADDING=3 BORDER="1">
82<TR><TH ALIGN="LEFT" VALIGN="TOP" WIDTH=125><SPAN  CLASS="textbf">name&nbsp;&amp;&nbsp;dimensionality</SPAN></TH>
83<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=25><SPAN  CLASS="textbf">kind</SPAN></TH>
84<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=50><SPAN  CLASS="textbf">in/out</SPAN></TH>
85<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=250><SPAN  CLASS="textbf">description</SPAN></TH>
86</TR>
87<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>&nbsp;</TD>
88<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>&nbsp;</TD>
89<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>&nbsp;</TD>
90<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>&nbsp;</TD>
91</TR>
92<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>
93nside<A ID="sub:query_polygon:nside"></A></TD>
94<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B</TD>
95<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>IN</TD>
96<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>the <!-- MATH
97 $N_{\mathrm{side}}$
98 -->
99<SPAN CLASS="MATH"><I>N</I><SUB>side</SUB></SPAN> parameter of the map.</TD>
100</TR>
101<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>vlist<A ID="sub:query_polygon:vlist"></A>(1:3,0:*)</TD>
102<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>DP</TD>
103<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>IN</TD>
104<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>cartesian vector pointing at polygon
105                   respective vertices.</TD>
106</TR>
107<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>nv<A ID="sub:query_polygon:nv"></A></TD>
108<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B</TD>
109<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>IN</TD>
110<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>number of vertices, should be equal to 3 or larger.</TD>
111</TR>
112<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>listpix<A ID="sub:query_polygon:listpix"></A>(0:*)</TD>
113<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B/ I8B</TD>
114<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>OUT</TD>
115<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>the index for all pixels enclosed in the triangle. Make sure that the size of the array is big enough to contain all pixels.</TD>
116</TR>
117<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>nlist<A ID="sub:query_polygon:nlist"></A></TD>
118<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B/ I8B</TD>
119<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>OUT</TD>
120<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>The number of pixels listed in <TT>listpix</TT>.</TD>
121</TR>
122<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>nest<A ID="sub:query_polygon:nest"></A>  (OPTIONAL)</TD>
123<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B</TD>
124<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>IN</TD>
125<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>The pixel indices are in the NESTED numbering scheme if nest=1, and in RING scheme otherwise.</TD>
126</TR>
127<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=125>inclusive<A ID="sub:query_polygon:inclusive"></A>  (OPTIONAL)</TD>
128<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>I4B</TD>
129<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>IN</TD>
130<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=250>If set to 1, all the pixels overlapping
131                   (even partially)
132                   with the polygon are listed, otherwise only those whose
133                   center lies within the polygon are listed.</TD>
134</TR>
135</TABLE>
136
137<P>
138<HR><H1>EXAMPLE:</H1>
139<tt>use <A HREF="sub_healpix_modules_module.htm#sub:healpix_modules">healpix_modules</A>
140<BR>
141real(dp), dimension(1:3,0:9) :: vertices
142<BR>
143vertices(:,0) = (/0.,0.,1./)  ! +z
144<BR>
145vertices(:,1) = (/1.,0.,0./)  ! +x
146<BR>
147vertices(:,2) = (/1.,1.,-1./) ! x+y-z
148<BR>
149vertices(:,3) = (/0.,1.,0./)  ! +y
150<BR>
151<BR>
152call query_polygon(256,vertices,4,listpix,nlist,nest=0)
153<BR></tt>
154<blockquote>
155Returns the RING pixel index of all pixels in the polygon with vertices of
156cartesian coordinates (0,0,1), (1,0,0), (1,1,-1) and (0,1,0) in a <!-- MATH
157 $N_{\mathrm{side}}=256$
158 -->
159<SPAN CLASS="MATH"><I>N</I><SUB>side</SUB>=256</SPAN> map.
160</blockquote>
161<hr><H1>MODULES & ROUTINES</H1><H3>This section lists the modules and routines used by <FONT COLOR="#CC0000">query_polygon</FONT>.</h3>
162  <DL COMPACT><DT>
163<B>isort</B>
164<DD>routine to sort integer number
165 <DT>
166<B><A HREF="sub_query_triangle.htm#sub:query_triangle">query_triangle</A></B>
167<DD>render the list of pixels enclosed
168  in a given triangle
169 <DT>
170<B><A HREF="sub_surface_triangle.htm#sub:surface_triangle">surface_triangle</A></B>
171<DD>computes the surface of a spherical triangle defined by 3 vertices
172 <DT>
173<B><A HREF="sub_vect_prod.htm#sub:vect_prod">vect_prod</A></B>
174<DD>routine to compute the vectorial product of two 3D vectors
175  </DL>
176
177<P>
178<hr><H1>RELATED ROUTINES</H1><h3>This section lists the routines related to <b><FONT COLOR="#CC0000">query_polygon</FONT></b></h3>
179
180  <DL COMPACT><DT>
181<B><A HREF="sub_pix2xxx_ang2xxx_vec2xxx_nes.htm#sub:pix_tools">pix2ang</A>, <A HREF="sub_pix2xxx_ang2xxx_vec2xxx_nes.htm#sub:pix_tools">ang2pix</A></B>
182<DD>convert between angle and pixel number.
183  <DT>
184<B><A HREF="sub_pix2xxx_ang2xxx_vec2xxx_nes.htm#sub:pix_tools">pix2vec</A>, <A HREF="sub_pix2xxx_ang2xxx_vec2xxx_nes.htm#sub:pix_tools">vec2pix</A></B>
185<DD>convert between a cartesian vector and pixel number.
186  <DT>
187<B><A HREF="sub_query_disc.htm#sub:query_disc">query_disc</A>, query_polygon,</B>
188<DD><DT>
189<B><A HREF="sub_query_strip.htm#sub:query_strip">query_strip</A>, <A HREF="sub_query_triangle.htm#sub:query_triangle">query_triangle</A></B>
190<DD>render the list of pixels enclosed
191  respectively in a given disc, polygon, latitude strip and triangle
192  <DT>
193<B><A HREF="sub_surface_triangle.htm#sub:surface_triangle">surface_triangle</A></B>
194<DD>computes the surface
195in steradians of a spherical triangle defined by 3 vertices
196
197<P>
198</DL>
199
200<P>
201
202<P>
203
204
205<P>
206
207<P>
208
209<DIV CLASS="navigation"><HR>
210<!--Navigation Panel-->
211<A
212 HREF="sub_query_disc.htm">
213<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
214<A
215 HREF="sub_HEALPix_F90_subroutines.htm">
216<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
217<A
218 HREF="sub_query_strip.htm">
219<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
220<A ID="tex2html450"
221  HREF="sub_TABLE_CONTENTS.htm">
222<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
223<BR>
224<B> Previous:</B> <A
225 HREF="sub_query_disc.htm">query_disc</A>
226
227<B>Up:</B> <A
228 HREF="sub_HEALPix_F90_subroutines.htm">HEALPix/F90 subroutines</A>
229
230<B> Next:</B> <A
231 HREF="sub_query_strip.htm">query_strip</A>
232<B> Top:</B> <a href="main.htm">Main Page</a></DIV>
233<!--End of Navigation Panel-->
234<ADDRESS>
235Version 3.50, 2018-12-10
236</ADDRESS>
237</BODY>
238</HTML>
239