CPolygon:Class Description


The CPolygon class provides a general polygon object consisting of a collection of (x,y) point pairs along with several common properties. Several plotting functions use this class to describe plot markers. You also can use this class for other purposes.

Usage

Construction

Object = NewPolygon() (global function with several overloads)

Object = CPolygon:new() (class method with several overloads)

Destruction

Object:delete()

Class Properties

These properties specify the Polygon properties of the CPolygon object. You can set them directly or by using several methods.

Methods

Construction

NewPolygon

Global function that creates a new CPolygon object.

new

Creates a new CPolygon object. Same as NewPolygon.

delete

Deletes the instance of the CPolygon object.

Copy

Copies an existing CPolygon object into the current one.

Operators

The CPolygon class contains numerous math operators so you can use CPolygon objects in expressions, like P=(P1+P2)/2. These are described on the CPolygon Operators page.

Polygon Operations

The methods below are used for creating and modifying the CPolygon.

Add

Add point data to the polygon.

CopyPts

Copies only the points from an another CPolygon object.

Count

Return the vertex count for the polygon.

DeletePt

Delete a vertex point from the polygon.

Empty

Delete all vertex points from the polygon.

GetPt

Return the properties of a specified point.

GetRect

Return a CRect containing the enclosing rectangle.

InsertPt

Insert a point between other points of the polygon.

SetPt

Set new x,y values for an existing polygon vertex.

Mathematical Operations

Scale

Scale the polygon relative to 1.0.

Rotate

Rotate the polygon.

Shift

Shift the polygon in x and y.

Skew

Skew the polygon by applying different rotation in each axis.

Calculated Properties

Area

Calculate the area of the polygon.

CalcCenter

Return the center of mass of the polygon.

CalcRect

Return a CRect object enclosing all vertex points.

Distance

Returns the distance between two vertices.

PathLen

Calculate the path length along the polygon.

Perimeter

Calculate the perimeter of the polygon.

PtInside

Return true if a point is inside the polygon.

Standard Configurations

These methods configure default polygons.

Circle

Creates a circle with the specified number of vertices.

Ellipse

Creates a rotated ellipse with the specified number of vertices.

Rect

Creates a rectangle or square.

Related Topics

CPoint Class

CRect Class

Script Classes