# TPoint¶

A file that stores type functions to manipulate TPoints.

The source for this file can be found here.

## TPoint.create¶

```procedure TPoint.create(const pX, pY : Integer);
```

Used to assign values to both the ‘x’ and ‘y’ coordinates of a TPoint.

Note

• by Zyt3x

Example:

```point.create(x,y);
mouse(point.rand(5));
```

## TPoint.rand¶

```function TPoint.rand(xx,yy: integer): TPoint;
```

Used to apply separate randomness to both the ‘x’ and ‘y’ coordinates of a TPoint.

Note

• by NCDS

Example:

```mouse(point.rand(5,5));
```

```function TPoint.rand(ran: integer) : TPoint; overload;
```

Used to apply THE SAME randomness to both the ‘x’ and ‘y’ coordinates of a TPoint.

Note

• by NCDS

Example:

```mouse(point.rand(5));
```

## TPoint.equals¶

```function TPoint.equals(const P : TPoint) : Boolean;
```

Returns True if both TPoint variables are equal.

Note

• by Zyt3x

Example:

```writeLn(P.equals(P2));
```

## TPoint.isInvalid¶

```function TPoint.isInvalid: boolean;
```

Returns true if the TPoint is isInvalid, an invaild TPoint by default is (-1, -1) but can be changed(invaildPoint).

Note

• by Olly

Example:

```if (p.isInvalid) then
exit();
```

## TPoint.rotate¶

```procedure TPoint.rotate(const angle, cx, cy: extended);
```

Rotates the TPoint by angle around cx and cy.

Note

• by Olly

Example:

```p.rotate(54.00, p.x, p.y);
```

## TPoint.swap¶

```procedure TPoint.swap(var p : TPoint);
```

Used to swap two TPoint variables.

Note

• by Zyt3x

Example:

```P.swap(P);
```

## TPoint.offset¶

```function TPoint.offSet(p: TPoint);
```

Offsets the TPoint by p.

Note

• by Olly

Example:

```p.offset(point(50, 50));
```

## TPoint.copy¶

```function TPoint.copy(): TPoint;
```

Result a copy of the TPoint.

Note

• by Olly

Example:

```tp := p.copy();
```

## TPoint.isInBox¶

```function TPoint.isInBox(const box: TBox): boolean;
```

Returns if the TPoint is in the box.

Note

• by Olly

Example:

```if p.isInBox(box) then
writeln('point P is in the box!');
```

## TPoint.randRange¶

```function TPoint.randRange(const aFrom, aTo: integer): TPoint;
```

Used to apply the same randomness to both the ‘x’ and ‘y’ coordinates of a TPoint.

Note

• by Olly

Example:

```writeln(p.randRange(-10, 10));
```

## TPoint.randRange¶

```function TPoint.randRange(const xFrom, xTo, yFrom, yTo: integer): TPoint; overload;
```

Overloaded function, but has extra parameters to apply separate randomness to both ‘x’, ‘y’ cords.

Note

• by Olly

Example:

```p.randRange(-10, 10, -10, 10);
```

## TPoint.gaussRange¶

```function TPoint.gaussRange(const aFrom, aTo: integer): TPoint;
```

Uses gaussain to apply the same randomness to both the ‘x’ and ‘y’ coordinates of a TPoint.

Note

• by Olly

Example:

```p.gaussRange(-10, 10);
```

## TPoint.gaussRange¶

```function TPoint.gaussRange(const xFrom, xTo, yFrom, yTo: integer): TPoint; overload;
```

Overloaded function, but has extra parameters to apply separate gaussian randomness to both ‘x’, ‘y’ cords.

Note

• by Olly

Example:

```p.gaussRange(-10, 10, -5, 5);
```

## TPoint.getAngleTo¶

```function TPoint.getAngleTo(pt2: TPoint): extended;
```

Returns the angle from the TPoint to “pt2”.

Note

• by Janilabo

Example:

```writeln(point(100, 100).getAngleTo(point(150, 150));
```