X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=modules%2Fbase%2Fmath%2Fgeometry%2Flines.h;fp=modules%2Fbase%2Fmath%2Fgeometry%2Flines.h;h=5ae239482ff044d4808aaafb49615bf591a529c7;hp=a6cf4215742609f782eacb116fbf9f69b657e302;hb=80386d268a58da2be3eeca83f254c980a047b34f;hpb=bd8acd4f11e6720c96946a7537df5538c0a9a5d4 diff --git a/modules/base/math/geometry/lines.h b/modules/base/math/geometry/lines.h index a6cf421..5ae2394 100755 --- a/modules/base/math/geometry/lines.h +++ b/modules/base/math/geometry/lines.h @@ -1,3 +1,27 @@ +/* + * Copyright Droids Corporation (2009) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: f16.h,v 1.6.4.3 2008-05-10 15:06:26 zer0 Exp $ + * + */ + +#ifndef _LINES_H_ +#define _LINES_H_ + typedef struct _line { double a; double b; @@ -11,10 +35,21 @@ pts2line(const point_t *p1, const point_t *p2, line_t *l); void proj_pt_line(const point_t * p, const line_t * l, point_t * p_out); -uint8_t +/* + * return values: + * 0 dont cross + * 1 cross + * 2 "parallel crossing" + * + * p argument is the crossing point coordinates (dummy for 0 or 2 + * result) + */ +uint8_t intersect_line(const line_t *l1, const line_t *l2, point_t *p); uint8_t intersect_segment(const point_t *s1, const point_t *s2, const point_t *t1, const point_t *t2, point_t *p); + +#endif /* _LINES_H_ */