22#ifndef COMMON_POLYGON_H
23#define COMMON_POLYGON_H
25#include "common/scummsys.h"
29#include "common/array.h"
30#include "common/rect.h"
37 Polygon(Array<Point> p) : _points(p) {
38 for (uint i = 0; i < p.size(); i++) {
39 _bound.extend(Rect(p[i].x, p[i].y, p[i].x, p[i].y));
42 Polygon(
Point *p,
int n) {
43 for (
int i = 0; i < n; i++) {
48 void addPoint(
const Point &p) {
50 _bound.extend(Rect(p.x, p.y, p.x, p.y));
53 void addPoint(int16 x, int16 y) {
54 addPoint(
Point(x, y));
57 uint getPointCount() {
58 return _points.size();
68 bool contains(int16 x, int16 y)
const;
76 bool contains(
const Point &p)
const {
77 return contains(p.x, p.y);
80 void moveTo(int16 x, int16 y) {
81 int16 dx = x - ((_bound.right + _bound.left) / 2);
82 int16 dy = y - ((_bound.bottom + _bound.top) / 2);
86 void moveTo(
const Point &p) {
90 void translate(int16 dx, int16 dy) {
92 for (it = _points.begin(); it != _points.end(); it++) {
98 Rect getBoundingRect()
const {
103 Array<Point> _points;
Point * iterator
Definition: array.h:54
Definition: algorithm.h:29
Definition: display_client.h:58