Skip to content

Instantly share code, notes, and snippets.

@MikuroXina
Last active January 6, 2022 01:55
Show Gist options
  • Select an option

  • Save MikuroXina/8dad55f2271abd7a8eb4c4be06703fbe to your computer and use it in GitHub Desktop.

Select an option

Save MikuroXina/8dad55f2271abd7a8eb4c4be06703fbe to your computer and use it in GitHub Desktop.
export interface RotOffset {
x: number;
y: number;
}
export interface RotMat {
upToLeft: RotOffset[];
leftToDown: RotOffset[];
downToRight: RotOffset[];
rightToUp: RotOffset[];
}
export const I: RotMat = {
upToLeft: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: 2, y: 0},
{x: -1, y: -2},
{x: 2, y: 1}
],
leftToDown: [
{x: 0, y: 0},
{x: -2, y: 0},
{x: 1, y: 0},
{x: 1, y: -2},
{x: -2, y: 1}
],
downToRight: [
{x: 0, y: 0},
{x: -2, y: 0},
{x: 1, y: 0},
{x: -2, y: -1},
{x: 1, y: 1}
],
rightToUp: [
{x: 0, y: 0},
{x: 2, y: 0},
{x: -1, y: 0},
{x: 2, y: -1},
{x: -1, y: 2}
]
};
export const T: RotMat = {
upToLeft: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: -1},
{x: 0, y: 2},
{x: 1, y: 2}
],
leftToDown: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: 1},
{x: 0, y: -2},
{x: -1, y: -2}
],
downToRight: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: -1},
{x: 0, y: 2},
{x: -1, y: 2}
],
rightToUp: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: 1},
{x: 0, y: -2},
{x: 1, y: -2}
]
};
export const Z: RotMat = {
upToLeft: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: -1},
{x: 0, y: 2},
{x: 1, y: 2}
],
leftToDown: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: 1},
{x: 0, y: -2},
{x: -1, y: -2}
],
downToRight: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: -1},
{x: 0, y: 2},
{x: -1, y: -2}
],
rightToUp: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: 1},
{x: 0, y: -2},
{x: 1, y: 2}
]
};
export const J: RotMat = {
upToLeft: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: -1},
{x: 0, y: 2},
{x: 1, y: 2}
],
leftToDown: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: 1},
{x: 0, y: -2},
{x: -1, y: -2}
],
downToRight: [
{x: 0, y: 0},
{x: -1, y: 0},
{x: -1, y: -1},
{x: 0, y: 2},
{x: -1, y: 2}
],
rightToUp: [
{x: 0, y: 0},
{x: 1, y: 0},
{x: 1, y: 1},
{x: 0, y: -2},
{x: 1, y: -2}
]
};
@MikuroXina
Copy link
Author

MikuroXina commented Dec 26, 2019

左上原点で右下が正の方向です
S / L は、Z / J の x をマイナスしてください
O はありません

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment