Data types: point

Data structure with x and y coordinates, each stored as an individual 32-bit signed integer value.

Type syntax

point

Literal syntax

<x‑value,y‑value>

Discussion

Operands of this data type are optimized to represent the position or the displacement of a point in 2D space. They are also used to describe the size of a rectangular area.

The point literal must consist of exact two integer literals x-value and y-value, separated by a , (comma) sign and enclosed between a pair of < ... > (angle brackets). The literal can be used within expressions wherever a point operand is expected. The type name point, in turn, is designated to be used in declarations of data members. For example:

var point originPos = <100,200>; // x=100, y=200 var point size = <150,300>; // x=150, y=300 var point distance = <13,-69>; // x=13, y=-69

Instant constructors

With the instant constructor point() you can initialize point operands dynamically at the runtime.

Instant properties

With the following instant properties you can individually access, evaluate and modify the coordinates of a point operand:

Instant property name

Short description

abs

Represents the absolute value of the given point operand.

area

Represents the area of a rectangle with size specified in the point operand.

length

Represents the length of vector stored in a point operand.

x

Corresponds to the x coordinate of a point operand.

y

Corresponds to the y coordinate of a point operand.

Arithmetic operations

You can combine a point operand with other operands to arithmetic expressions. The following table provides an overview of the possible operations:

Operator

Short description

+

Component-wise addition of two point operands.

-

Component-wise subtraction of two point operands.

Comparison operations

You can compare two point operands in order to test whether these are equal or not. The following table provides an overview of the possible operations:

Operator

Short description

==

Equality test for two point operands.

!=

Inequality test for two point operands.