The BIG graph update
[rrdtool.git] / libraries / libart_lgpl-2.3.7 / art_rect_svp.c
1 /* Libart_LGPL - library of basic graphic primitives
2  * Copyright (C) 1998 Raph Levien
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "art_misc.h"
21 #include "art_svp.h"
22 #include "art_rect.h"
23 #include "art_rect_svp.h"
24
25 /**
26  * art_drect_svp: Find the bounding box of a sorted vector path.
27  * @bbox: Where to store the bounding box.
28  * @svp: The SVP.
29  *
30  * Finds the bounding box of the SVP.
31  **/
32 void
33 art_drect_svp (ArtDRect *bbox, const ArtSVP *svp)
34 {
35   int i;
36
37   bbox->x0 = 0;
38   bbox->y0 = 0;
39   bbox->x1 = 0;
40   bbox->y1 = 0;
41
42   for (i = 0; i < svp->n_segs; i++)
43     {
44       art_drect_union (bbox, bbox, &svp->segs[i].bbox);
45     }
46 }
47
48 /**
49  * art_drect_svp_union: Compute the bounding box of the svp and union it in to the existing bounding box.
50  * @bbox: Initial boundin box and where to store the bounding box.
51  * @svp: The SVP.
52  *
53  * Finds the bounding box of the SVP, computing its union with an
54  * existing bbox.
55  **/
56 void
57 art_drect_svp_union (ArtDRect *bbox, const ArtSVP *svp)
58 {
59   int i;
60
61   for (i = 0; i < svp->n_segs; i++)
62     {
63       art_drect_union (bbox, bbox, &svp->segs[i].bbox);
64     }
65 }