Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aperiodic monotiles to landing page #543

Merged
merged 36 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8dd7cb1
Replace background image
Splines Oct 16, 2023
130e811
Add slight transparency to boxes on landing page
Splines Oct 16, 2023
ce2e5a4
Recolor github badge (yellow)
Splines Oct 16, 2023
1e036d6
Add interactive aperiodic monotile to landing page
Splines Oct 25, 2023
16c762d
Fix dragging of canvas
Splines Oct 25, 2023
6d8d330
Fix canvas dragging & z-index
Splines Oct 25, 2023
4385834
Add find out more button
Splines Oct 25, 2023
3273a9a
Add copyright notice for aperiodic monotiles
Splines Oct 25, 2023
ac0586e
Move to assets/javascript folder
Splines Oct 25, 2023
8bb6cca
Fix turbolinks setup
Splines Oct 25, 2023
4d83f19
Make buttons less obtrusive
Splines Oct 25, 2023
8dddcc8
Fix P5.js initialization
Splines Oct 25, 2023
552c027
Change to less obtrusive grey color
Splines Oct 25, 2023
7dd0fad
Make colors darker & delete unused comment
Splines Oct 27, 2023
2cf2218
Adjust scaling and add black overlay
Splines Oct 27, 2023
5179050
Disable buttons according to their state
Splines Oct 27, 2023
ec8efca
Add touchMoved function
Splines Oct 27, 2023
368843d
Disable buttons on small devices
Splines Oct 27, 2023
a233e6b
Remove console log
Splines Oct 27, 2023
ee76cd9
Make grey color lighter
Splines Nov 1, 2023
f0dbf34
Merge branch 'mampf-next' into feature/login-background-image
Splines Dec 19, 2023
ad2f8e5
Fix JS layout (according to new ESLint rules)
Splines Dec 19, 2023
8884707
Add cypress rules to ESLint & ignore some patterns
Splines Dec 19, 2023
d1593f1
Allow usage of tempusDominus global variable
Splines Dec 20, 2023
144135e
Ignore JS files with Sprocket syntax
Splines Dec 20, 2023
19342f7
Further improve rules, e.g. allow common globals
Splines Jan 3, 2024
70dbfed
Ignore sprocket syntax in cable.js
Splines Jan 3, 2024
9b9c082
Autofix all `.js` and `.js.erb` files
Splines Jan 3, 2024
cedd0c4
Fix variables in turbolink fix
Splines Jan 3, 2024
f8366ab
Prepend unused variables with "_"
Splines Jan 3, 2024
bc87b65
Get rid of unused widget variable
Splines Jan 3, 2024
a8fc972
Fix specs comment tab alignment
Splines Jan 3, 2024
6e29e27
Merge branch 'lint/eslint-all' into feature/login-background-image
Splines Jan 3, 2024
e60dc7a
Disable some ESLint rules for monotile code
Splines Jan 3, 2024
f0c705b
Merge branch 'mampf-next' into feature/login-background-image
Splines Jan 4, 2024
9723468
Merge branch 'mampf-next' into feature/login-background-image
Splines Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link commontator/manifest.js
//= link thredded_katex.css
//= link thredded_katex.css
//= link monotile/geometry.js
//= link monotile/hat.js
Binary file removed app/assets/images/landing-background.jpg
Binary file not shown.
94 changes: 94 additions & 0 deletions app/assets/javascripts/monotile/geometry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// BSD-3-Clause licensed by Craig S. Kaplan
// adapted from: https://github.com/isohedral/hatviz

// This file is mostly code that will get replaced anyways since
// the monotiles will probably not stay on the front screen forever.
// Having to properly use modules here and import/export the respective variables
// would be overkill. This is mostly external code from the monotile project.
// It works as intended and is pretty much unrelated to the rest of our code base.
// For these reasons, we disable some ESLint rules for this file.
/* eslint-disable no-undef, no-unused-vars */

const r3 = 1.7320508075688772;
const hr3 = 0.8660254037844386;
const ident = [1, 0, 0, 0, 1, 0];

function pt(x, y) {
return { x: x, y: y };
}

function hexPt(x, y) {
return pt(x + 0.5 * y, hr3 * y);
}

// Affine matrix inverse
function inv(T) {
const det = T[0] * T[4] - T[1] * T[3];
return [T[4] / det, -T[1] / det, (T[1] * T[5] - T[2] * T[4]) / det,
-T[3] / det, T[0] / det, (T[2] * T[3] - T[0] * T[5]) / det];
}

// Affine matrix multiply
function mul(A, B) {
return [A[0] * B[0] + A[1] * B[3],
A[0] * B[1] + A[1] * B[4],
A[0] * B[2] + A[1] * B[5] + A[2],

A[3] * B[0] + A[4] * B[3],
A[3] * B[1] + A[4] * B[4],
A[3] * B[2] + A[4] * B[5] + A[5]];
}

function padd(p, q) {
return { x: p.x + q.x, y: p.y + q.y };
}

function psub(p, q) {
return { x: p.x - q.x, y: p.y - q.y };
}

// Rotation matrix
function trot(ang) {
const c = cos(ang);
const s = sin(ang);
return [c, -s, 0, s, c, 0];
}

// Translation matrix
function ttrans(tx, ty) {
return [1, 0, tx, 0, 1, ty];
}

function rotAbout(p, ang) {
return mul(ttrans(p.x, p.y),
mul(trot(ang), ttrans(-p.x, -p.y)));
}

// Matrix * point
function transPt(M, P) {
return pt(M[0] * P.x + M[1] * P.y + M[2], M[3] * P.x + M[4] * P.y + M[5]);
}

// Match unit interval to line segment p->q
function matchSeg(p, q) {
return [q.x - p.x, p.y - q.y, p.x, q.y - p.y, q.x - p.x, p.y];
}

// Match line segment p1->q1 to line segment p2->q2
function matchTwo(p1, q1, p2, q2) {
return mul(matchSeg(p2, q2), inv(matchSeg(p1, q1)));
}

// Intersect two lines defined by segments p1->q1 and p2->q2
function intersect(p1, q1, p2, q2) {
const d = (q2.y - p2.y) * (q1.x - p1.x) - (q2.x - p2.x) * (q1.y - p1.y);
const uA = ((q2.x - p2.x) * (p1.y - p2.y) - (q2.y - p2.y) * (p1.x - p2.x)) / d;
return pt(p1.x + uA * (q1.x - p1.x), p1.y + uA * (q1.y - p1.y));
}

const hat_outline = [
hexPt(0, 0), hexPt(-1, -1), hexPt(0, -2), hexPt(2, -2),
hexPt(2, -1), hexPt(4, -2), hexPt(5, -1), hexPt(4, 0),
hexPt(3, 0), hexPt(2, 2), hexPt(0, 3), hexPt(0, 2),
hexPt(-1, 2),
];
Loading