### Constructor and Destructor

`BPolygon(const ``BPoint`

* pointList,

int32 numPoints);

`BPolygon(const BPolygon* polygon);`

`BPolygon();`

Initializes the `BPolygon`

by copying
`numPoints`

from `pointList`

, or by
copying the list of points from another polygon. If one polygon is
constructed from another, the original and the copy won't share any data;
independent memory is allocated for the copy to hold a duplicate list of
points.

If a `BPolygon`

is constructed without a point list, points must be set
with the `AddPoints()`

function.

`virtual ~BPolygon();`

Frees all the memory allocated to hold the list of points.

`void AddPoints(const ``BPoint`

* pointList,

int32 numPoints);

Appends `numPoints`

from `pointList`

to the list of points that already define the polygon.

`int32 CountPoints() const;`

Returns the number of points that define the polygon.

`BRect`

Frame() const;

Returns the polygon's frame rectangle—the smallest rectangle that
encloses the entire polygon.

`void MapTo(``BRect`

source,

`BRect`

destination);

Modifies the polygon so that it fits the `destination`

rectangle exactly as
it originally fit the `source`

rectangle. Each vertex of the polygon is
modified so that it has the same proportional position relative to the
sides of the destination rectangle as it originally had to the sides of
the source rectangle.

The polygon doesn't have to be contained in either rectangle. However, to
modify a polygon so that it's exactly inscribed in the destination
rectangle, you should pass its frame rectangle as the source:

`BRect`

`frame`

= `myPolygon`

->`Frame`

();
`myPolygon`

->`MapTo`

(`frame`

, `anotherRect`

);

`void PrintToStream() const;`

Prints the `BPolygon`

's point list to the standard output stream (stdout).
The `BPoint`

version of this function is called to report each point as a
string in the form

"`BPoint`

(x, y)"

where x and y stand for the coordinate values of the point in question.

See also:
`BPoint::PrintToStream()`