1. Home
  2. PTROTATE procedure

PTROTATE procedure

Rotates a point pattern (W. van den Berg).

Options

ANGLE = scalar Angle, in degrees over which the point pattern is to be rotated; no default – must be set
HUB = string token Whether the point pattern is to be rotated around the origin or around the centroid (origin, centroid); default orig

Parameters

OLDY = variates Vertical coordinates of each spatial point pattern
OLDX = variates Horizontal coordinates of each spatial point pattern
NEWY = variates Save the vertical coordinates of the rotated point patterns; if this unset, these replace the original values in OLDY
NEWX = variates Save the horizontal coordinates of the rotated point patterns; if this unset, these replace the original values in OLDX
ROTATION = matrices Save the rotation matrices

Description

PTROTATE rotates a point pattern. The vertical and horizontal coordinates must be supplied as variates using the parameters OLDY and OLDX. The angle over which the point pattern must be rotated must be supplied, in degrees, by the ANGLE option. When a positive angle is supplied the rotation is clockwise. A negative number results in a counter clockwise rotation. By default the rotation is around the origin, but you can set option HUB=centroid to perform the rotation around the centroid of the point pattern.

The vertical coordinates of the rotated pattern can be saved, in a variate, using the NEWY parameter; if this is unset, the rotated pattern replaces the original pattern in OLDY. Similarly, the horizontal coordinates can be saved using the NEWX parameter, or in the original variate supplied by OLDX. The rotation matrix can be saved using the ROTATION parameter.

Options: ANGLE, HUB.

Parameters: OLDY, OLDX, NEWY, NEWX, ROTATION.

Method

A matrix is formed with 2 columns consisting of the coordinates supplied to parameters OLDY and OLDX. This matrix is post-multiplied by a 2×2 matrix, containing COS(ANGLE) on the diagonal, and plus and minus SIN(ANGLE) in the upper-right and lower-left cells.

Action with RESTRICT

Any restrictions on OLDX and OLDY are removed.

See also

Directive: ROTATE.

Commands for: Spatial statistics.

Example

CAPTION   'PTROTATE example'; STYLE=meta
VARIATE   [NVALUES=100] x,y
CALCULATE y,x = URAND (910818; 100)
PTROTATE  [ANGLE=30; HUB=centroid] y; OLDX=x; NEWY=ycentroid; NEWX=xcentroid
PTROTATE  [ANGLE=-180] y; OLDX=x; NEWY=yorigin; NEWX=xorigin
PRINT     y,x,ycentroid,xcentroid,yorigin,xorigin
DGRAPH    y, ycentroid, yorigin; x, xcentroid, xorigin
Updated on March 6, 2019

Was this article helpful?