# Changeset 2560

Ignore:
Timestamp:
Mar 20, 2006, 7:10:56 PM (17 years ago)
Message:

Started adding polygon functions in Appendix A

File:
1 edited

### Legend:

Unmodified
 r2559 \section{utilities/polygons} Could do now. \begin{itemize} \item \indexedcode{polygon_function} \item \indexedcode{read_polygon} \item \indexedcode{populate_polygon} \item \indexedcode{point_in_polygon} \item \indexedcode{inside_polygon} \item \indexedcode{outside_polygon} \item \indexedcode{point_on_line} \item \indexedcode{separate_points_by_polygon} \end{itemize} \begin{classdesc}{Polygon_function}{regions, default = 0.0, geo_reference = None} Module: \code{utilities.polygon} \end{classdesc} \begin{funcdesc}{read_polygon}{filename} Module: \code{utilities.polygon} Reads the specified file and returns a polygon. Each line of the file must contain exactly two numbers, separated by a comma, which are interpreted as coordinates of one vertex of the polygon. \end{funcdesc} \begin{funcdesc}{populate_polygon}{polygon, number_of_points, seed = None, exclude = None} \indexedcode{populate_polygon} Module: \code{utilities.polygon} Populates the interior of the specified polygon with the specified number of points, selected by means of a uniform distribution function. \end{funcdesc} \begin{funcdesc}{point_in_polygon}{polygon, delta=1e-8} \indexedcode{point_in_polygon} Module: \code{utilities.polygon} Returns a point inside the specified polygon and close to the edge. The distance between the returned point and the nearest point of the polygon is less than $\sqrt{2}$ times the second argument \code{delta}, which is taken as $10^{-8}$ by default. \end{funcdesc} \begin{funcdesc}{inside_polygon}{points, polygon, closed = True, verbose = False} \indexedcode{inside_polygon} Module: \code{utilities.polygon} Used to test whether a single point---or the members of a list of points--- are inside the specified polygon. If the first argument is a single point, returns \code{True} if the point is inside the polygon, or \code{False} otherwise. If the first argument is a list of points, returns a Numeric array comprising the indices of the points in the list that lie inside the polygon. (If none of the points are inside, returns \code{zeros((0,), 'l')}.) Points on the edges of the polygon are regarded as inside if \code{closed} is set to \code{True} or omitted; otherwise they are regarded as outside. \end{funcdesc} \begin{funcdesc}{outside_polygon}{points, polygon, closed = True, verbose = False} \indexedcode{outside_polygon} Module: \code{utilities.polygon} Exactly like \code{inside_polygon}, but with the words inside' and outside' interchanged. \end{funcdesc} \begin{funcdesc}{point_on_line}{x, y, x0, y0, x1, y1} Module: \code{utilities.polygon} Returns \code{True} or \code{False}, depending on whether the point with coordinates \code{x, y} is on the line passing through the points with coordinates \code{x0, y0} and \code{x1, y1} (extended if necessary at either end). \end{funcdesc} \begin{funcdesc}{separate_points_by_polygon}{points, polygon, closed = True, verbose = False}\indexedcode{separate_points_by_polygon} Module: \code{utilities.polygon} \end{funcdesc} \section{coordinate_transforms}