Laxkit  0.0.7.1
bezutils.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2007,2010-2012 by Tom Lechner
22 //
23 #ifndef _LAX_BEZUTILS_H
24 #define _LAX_BEZUTILS_H
25 
26 #include <lax/vectors.h>
27 #include <lax/doublebbox.h>
28 
29 namespace Laxkit {
30 
31 int bez_bbox(flatpoint p,flatpoint c,flatpoint d,flatpoint q,Laxkit::DoubleBBox *bbox,double *extrema=0);
32 double bez_segment_length(flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2, int npoints);
33 
37 double bez_distance_to_t(double dist, flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2, int resolution);
38 double bez_t_to_distance(double T, flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2, int resolution);
39 
40 flatpoint *bez_to_points(flatpoint *to_points,flatpoint *from_points,int n,int resolution,int closed);
41 flatpoint *bez_points(flatpoint *to_points,int numsegs,flatpoint *from_points,int resolution);
42 flatpoint *bez_points(flatpoint *to_points,flatpoint *from_points,int resolution,int ignorefirst);
43 flatpoint *bez_points(flatpoint *to_points,flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2,int resolution,int ignorefirst);
44 void bez_subdivide(double t,flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2, flatpoint *points_ret);
45 
46 int bez_intersection(flatpoint p1,flatpoint p2, int isline,
47  flatpoint bp1, flatpoint bc1, flatpoint bc2, flatpoint bp2,
48  int resolution, flatpoint *point_ret, double *t_ret);
49 int bez_intersections(flatpoint p1,flatpoint p2, int isline, flatpoint *points, int n, int resolution,
50  double startt, flatpoint *points_ret,int np, double *t_ret,int nt, double *endt);
51 double bez_closest_point(flatpoint p, flatpoint p1,flatpoint c1,flatpoint c2,flatpoint p2, int maxpoints,
52  double *d_ret,double *dalong_ret, flatpoint *found);
53 double bez_near_point(flatpoint p,flatpoint *points,int n,int maxpoints,double *t_ret,int *i_ret);
54 double bez_near_point_p(flatpoint p,flatpoint **points,int n,int maxpoints,double *t_ret,int *i_ret);
55 
56 int point_is_in_bez(flatpoint p,flatpoint *points,int n,int resolution=20);
57 flatpoint *bez_circle(flatpoint *points, int numpoints, double x,double y,double r);
58 flatpoint *bez_ellipse(flatpoint *points, int numsegments,
59  double x,double y,
60  double xr,double yr,
61  flatvector xaxis,flatvector yaxis,
62  double start_angle,double end_angle);
63 
64 } // namespace Laxkit
65 
66 #endif
67 
68 

Mon Feb 17 2014 11:52:56, Laxkit