inside.c

Go to the documentation of this file.
00001 /*
00002 * $Id: inside.c,v 1.6 2006/02/09 03:08:58 glynn Exp $
00003 *
00004 ****************************************************************************
00005 *
00006 * MODULE:       Vector library 
00007 *               
00008 * AUTHOR(S):    Original author CERL, probably Dave Gerdes.
00009 *               Update to GRASS 5.7 Radim Blazek.
00010 *
00011 * PURPOSE:      Lower level functions for reading/writing/manipulating vectors.
00012 *
00013 * COPYRIGHT:    (C) 2001 by the GRASS Development Team
00014 *
00015 *               This program is free software under the GNU General Public
00016 *               License (>=v2). Read the file COPYING that comes with GRASS
00017 *               for details.
00018 *
00019 *****************************************************************************/
00020 #include <grass/gis.h>
00021 #include <grass/Vect.h>
00022 
00023 double 
00024 dig_x_intersect (
00025                   double beg_x,
00026                   double end_x,
00027                   double beg_y,
00028                   double end_y,
00029                   double Y)
00030 {
00031   double b, a;
00032 
00033   b = (end_x - beg_x) / (end_y - beg_y);
00034   a = beg_x - b * beg_y;
00035   return (a + b * Y);
00036 }
00037 
00038 int 
00039 dig_in_area_bbox (
00040                    P_AREA * Area,
00041                    double x, double y)
00042 {
00043 #ifdef GDEBUG
00044    G_debug (3, "BBOX: (x,y) (%lf, %lf)\n", x, y);
00045    G_debug (3, "NSEW:  %lf, %lf, %lf, %lf\n", Area->N, Area->S, Area->E, Area->W);
00046 #endif
00047   if (x < Area->W)
00048     return (0);
00049   if (x > Area->E)
00050     return (0);
00051   if (y < Area->S)
00052     return (0);
00053   if (y > Area->N)
00054     return (0);
00055 
00056   return (1);
00057 }
00058 

Generated on Sun Apr 6 17:32:44 2008 for GRASS by  doxygen 1.5.5