Created
July 11, 2020 17:59
-
-
Save EduardoJM/bf389619b058653fc738b6f02ee018ea to your computer and use it in GitHub Desktop.
Separating Axis Theorem Polygon Offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
polygon.offset = function(dx, dy) { | |
for (let i = 0; i < polygon.vertices.length; i++) { | |
polygon.vertices[i] = { | |
x: polygon.vertices[i].x + dx, | |
y: polygon.vertices[i].y + dy, | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment