Skip to content

Instantly share code, notes, and snippets.

@EduardoJM
Created July 11, 2020 17:57
Show Gist options
  • Save EduardoJM/aface044d819d2785d85b82c630b15b9 to your computer and use it in GitHub Desktop.
Save EduardoJM/aface044d819d2785d85b82c630b15b9 to your computer and use it in GitHub Desktop.
Separating Axis Theorem Polygon Structure
function createPolygon(vertices) {
const polygon = {};
polygon.vertices = vertices;
polygon.edges = buildEdges(vertices);
polygon.projectInAxis = function(x, y) {
}
polygon.testWith = function (otherPolygon) {
}
polygon.render = function(context, color) {
}
polygon.offset = function(dx, dy) {
}
return polygon;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment