Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
shapes.cc
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2023 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "dw/core.hh"
22
23using namespace dw::core;
24using namespace lout::misc;
25
26int main()
27{
28 Polygon poly;
29 poly.addPoint(50, 10);
30 poly.addPoint(90, 90);
31 poly.addPoint(10, 90);
32
33 if (!poly.isPointWithin(50, 50)) {
34 printf("poly.isPointWithin(50, 50) failed\n");
35 exit(1);
36 }
37
38 if (poly.isPointWithin(10, 10)) {
39 printf("!poly.isPointWithin(10, 10) failed\n");
40 exit(1);
41 }
42
43 if (poly.isPointWithin(90, 50)) {
44 printf("!poly.isPointWithin(90, 50) failed\n");
45 exit(1);
46 }
47
48 return 0;
49}
dw::core::Shape implemtation for polygons.
Definition types.hh:105
bool isPointWithin(int x, int y)
Definition types.cc:200
void addPoint(int x, int y)
Definition types.cc:156
The core of Dw is defined in this namespace.
Definition core.hh:23
Miscellaneous stuff, which does not fit anywhere else.
Definition misc.cc:31
int main()
Definition shapes.cc:26