PIXI.groupD8

namespace groupD8

Implements the dihedral group D8, which is similar to group D4; D8 is the same but with diagonals, and it is used for texture rotations.

The directions the U- and V- axes after rotation of an angle of a: GD8Constant are the vectors (uX(a), uY(a)) and (vX(a), vY(a)). These aren't necessarily unit vectors.

Origin:
This is the small part of gameofbombs.com portal system. It works.

See:

Public Properties


E groupD8.ts:115
static E: number = 0
Rotation Direction
East
MAIN_DIAGONAL groupD8.ts:194
static MAIN_DIAGONAL: number = 10

Reflection about the main diagonal.

MIRROR_HORIZONTAL groupD8.ts:201
static MIRROR_HORIZONTAL: number = 12

Reflection about X-axis.

MIRROR_VERTICAL groupD8.ts:187
static MIRROR_VERTICAL: number = 8

Reflection about Y-axis.

N groupD8.ts:169
static N: number = 6
Rotation Direction
-90°/270°↻ North
NE groupD8.ts:178
static NE: number = 7
Rotation Direction
-45°/315°↻ Northeast
NW groupD8.ts:160
static NW: number = 5
Rotation Direction
-135°/225°↻ Northwest
REVERSE_DIAGONAL groupD8.ts:208
static REVERSE_DIAGONAL: number = 14

Reflection about reverse diagonal.

S groupD8.ts:133
static S: number = 2
Rotation Direction
90°↻ South
SE groupD8.ts:124
static SE: number = 1
Rotation Direction
45°↻ Southeast
SW groupD8.ts:142
static SW: number = 3
Rotation Direction
135°↻ Southwest
W groupD8.ts:151
static W: number = 4
Rotation Direction
180° West

Public Methods


add groupD8.ts:264
static add(rotationSecond: PIXI.GD8Symmetry, rotationFirst: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}

Composes the two D8 operations.

Taking ^ as reflection:

E=0 S=2 W=4 N=6 E^=8 S^=10 W^=12 N^=14
E=0 E S W N E^ S^ W^ N^
S=2 S W N E S^ W^ N^ E^
W=4 W N E S W^ N^ E^ S^
N=6 N E S W N^ E^ S^ W^
E^=8 E^ N^ W^ S^ E N W S
S^=10 S^ E^ N^ W^ S E N W
W^=12 W^ S^ E^ N^ W S E N
N^=14 N^ W^ S^ E^ N W S E

This is a Cayley table

Parameters:
Name Type Description
rotationSecond PIXI.GD8Symmetry

Second operation, which is the row in the above cayley table.

rotationFirst PIXI.GD8Symmetry

First operation, which is the column in the above cayley table.

Returns:
Type Description
PIXI.GD8Symmetry

Composed operation

byDirection groupD8.ts:321
static byDirection(dx: number, dy: number) → {PIXI.GD8Symmetry}

Approximates the vector V(dx,dy) into one of the eight directions provided by groupD8.

Parameters:
Name Type Description
dx number

X-component of the vector

dy number

Y-component of the vector

Returns:
Type Description
PIXI.GD8Symmetry

Approximation of the vector into one of the eight symmetries.

inv groupD8.ts:247
static inv(rotation: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}
Parameters:
Name Type Description
rotation PIXI.GD8Symmetry

symmetry whose opposite is needed. Only rotations have opposite symmetries while reflections don't.

Returns:
Type Description
PIXI.GD8Symmetry

The opposite symmetry of rotation

isVertical groupD8.ts:312
static isVertical(rotation: PIXI.GD8Symmetry) → {boolean}

Checks if the rotation angle is vertical, i.e. south or north. It doesn't work for reflections.

Parameters:
Name Type Description
rotation PIXI.GD8Symmetry

The number to check.

Returns:
Type Description
boolean

Whether or not the direction is vertical

matrixAppendRotationInv groupD8.ts:367
static matrixAppendRotationInv(matrix: PIXI.Matrix, rotation: PIXI.GD8Symmetry, tx: number, ty: number) → {void}

Helps sprite to compensate texture packer rotation.

Parameters:
Name Type Default Description
matrix PIXI.Matrix

sprite world matrix

rotation PIXI.GD8Symmetry

The rotation factor to use.

tx number 0

sprite anchoring

ty number 0

sprite anchoring

Returns:
Type Description
void
rotate180 groupD8.ts:303
static rotate180(rotation: number) → {number}

Adds 180 degrees to rotation, which is a commutative operation.

Parameters:
Name Type Description
rotation number

The number to rotate.

Returns:
Type Description
number

Rotated number

sub groupD8.ts:292
static sub(rotationSecond: PIXI.GD8Symmetry, rotationFirst: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}

Reverse of add.

Parameters:
Name Type Description
rotationSecond PIXI.GD8Symmetry

Second operation

rotationFirst PIXI.GD8Symmetry

First operation

Returns:
Type Description
PIXI.GD8Symmetry

Result

uX groupD8.ts:215
static uX(ind: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}
Parameters:
Name Type Description
ind PIXI.GD8Symmetry

sprite rotation angle.

Returns:
Type Description
PIXI.GD8Symmetry

The X-component of the U-axis after rotating the axes.

uY groupD8.ts:223
static uY(ind: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}
Parameters:
Name Type Description
ind PIXI.GD8Symmetry

sprite rotation angle.

Returns:
Type Description
PIXI.GD8Symmetry

The Y-component of the U-axis after rotating the axes.

vX groupD8.ts:231
static vX(ind: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}
Parameters:
Name Type Description
ind PIXI.GD8Symmetry

sprite rotation angle.

Returns:
Type Description
PIXI.GD8Symmetry

The X-component of the V-axis after rotating the axes.

vY groupD8.ts:239
static vY(ind: PIXI.GD8Symmetry) → {PIXI.GD8Symmetry}
Parameters:
Name Type Description
ind PIXI.GD8Symmetry

sprite rotation angle.

Returns:
Type Description
PIXI.GD8Symmetry

The Y-component of the V-axis after rotating the axes.


Powered by webdoc!