Canvas Toolkit
← Class index

CPoint

Geometry

Represents a two-dimensional point using Cartesian coordinates.

import { CPoint } from "canvas-toolkit-lib";

Declared members

constructor(x?: number, y?: number);

Creates a point with the specified coordinates. @param x Initial horizontal coordinate. @param y Initial vertical coordinate.

x(): number;

Returns the horizontal coordinate. @returns The x-coordinate.

y(): number;

Returns the vertical coordinate. @returns The y-coordinate.

move(x: number, y: number): void;

Moves the point to the specified coordinates. @param x New horizontal coordinate. @param y New vertical coordinate.

moveBy(x: number, y: number): void;

Translates the point by the specified offsets. @param x Horizontal offset. @param y Vertical offset.