CPoint:Class Description


The CPoint class provides a point object consisting of two properties: x, and y. Many class work with CPoint objects to keep x,y values together so as for simply the notation used in your scripts. You also can use the CPoint class to hold 2 arbitrary numbers which can be processed together using the class methods and operators.

Usage

Construction

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

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

Destruction

Object:delete()

Class Properties

These properties specify the point coordinate limits of the CPoint object. You can set them directly or by using several methods.

Methods

Construction

NewPoint

Global function that creates a new CPoint object.

new

Creates a new CPoint object. Same as NewPoint.

delete

Deletes the instance of the CPoint object.

Operators

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

Accessing Properties

In addition to using the properties by name, like P.x, the methods below allow you to set or get all the properties in one operation.

Get

Returns the x and y values of the point.

Set

Sets the x and y values of the point.

Operations

Ceil

Rounds point values up to the next higher integer value.

Floor

Rounds point values down to the next lower integer value.

Offset

Offsets a point's values; same as adding the points.

Round

Rounds the point values to the nearest integer value.

Related Topics

CRect Class

Script Classes

Image Coordinate System

Subpixel Coordinate Definition