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.
Members
-
PIXI.groupD8.E PIXI.GD8Symmetry staticconstant
-
Rotation Direction 0° East -
PIXI.groupD8.MAIN_DIAGONAL PIXI.GD8Symmetry staticconstant
-
Reflection about the main diagonal.
-
PIXI.groupD8.MIRROR_HORIZONTAL PIXI.GD8Symmetry staticconstant
-
Reflection about X-axis.
-
PIXI.groupD8.MIRROR_VERTICAL PIXI.GD8Symmetry staticconstant
-
Reflection about Y-axis.
-
PIXI.groupD8.N PIXI.GD8Symmetry staticconstant
-
Rotation Direction -90°/270°↻ North -
PIXI.groupD8.NE PIXI.GD8Symmetry staticconstant
-
Rotation Direction -45°/315°↻ Northeast -
PIXI.groupD8.NW PIXI.GD8Symmetry staticconstant
-
Rotation Direction -135°/225°↻ Northwest -
PIXI.groupD8.REVERSE_DIAGONAL PIXI.GD8Symmetry staticconstant
-
Reflection about reverse diagonal.
-
PIXI.groupD8.S PIXI.GD8Symmetry staticconstant
-
Rotation Direction 90°↻ South -
PIXI.groupD8.SE PIXI.GD8Symmetry staticconstant
-
Rotation Direction 45°↻ Southeast -
PIXI.groupD8.SW PIXI.GD8Symmetry staticconstant
-
Rotation Direction 135°↻ Southwest -
PIXI.groupD8.W PIXI.GD8Symmetry staticconstant
-
Rotation Direction 180° West
Methods
-
PIXI.groupD8.add (rotationSecond, rotationFirst)PIXI.GD8Symmetry static
-
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 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 -
PIXI.groupD8.byDirection (dx, dy)PIXI.GD8Symmetry static
-
Approximates the vector
V(dx,dy)
into one of the eight directions provided bygroupD8
.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. -
PIXI.groupD8.inv (rotation)PIXI.GD8Symmetry static
-
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
-
Checks if the rotation angle is vertical, i.e. south or north. It doesn't work for reflections.
Name Type Description rotation
PIXI.GD8Symmetry The number to check.
Returns:
Type Description boolean Whether or not the direction is vertical -
Helps sprite to compensate texture packer rotation.
Name Type Description matrix
PIXI.Matrix sprite world matrix
rotation
PIXI.GD8Symmetry The rotation factor to use.
tx
number sprite anchoring
ty
number sprite anchoring
-
Adds 180 degrees to rotation, which is a commutative operation.
Name Type Description rotation
number The number to rotate.
Returns:
Type Description number Rotated number -
PIXI.groupD8.sub (rotationSecond, rotationFirst)PIXI.GD8Symmetry static
-
Reverse of
add
.Name Type Description rotationSecond
PIXI.GD8Symmetry Second operation
rotationFirst
PIXI.GD8Symmetry First operation
Returns:
Type Description PIXI.GD8Symmetry Result -
PIXI.groupD8.uX (ind)PIXI.GD8Symmetry static
-
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. -
PIXI.groupD8.uY (ind)PIXI.GD8Symmetry static
-
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. -
PIXI.groupD8.vX (ind)PIXI.GD8Symmetry static
-
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. -
PIXI.groupD8.vY (ind)PIXI.GD8Symmetry static
-
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.