Created
October 2, 2016 23:22
-
-
Save cdave1/ca638580ea32bc239beea6a0013d30e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'use strict'; | |
var paper = require('paper'); | |
paper.setup(new paper.Size(2048, 1440)); | |
function ShapeIntersection() { | |
var diamond0 = new paper.Path.RegularPolygon(new paper.Point(0, 0), 4, 100); | |
diamond0.rotate(45.0); | |
var diamond1 = new paper.Path.RegularPolygon(new paper.Point(1, 0), 4, 100); | |
diamond1.rotate(45.0); | |
var intersection = diamond0.intersect(diamond1); | |
if (intersection.closed) { | |
console.log("Closed!"); | |
} else { | |
console.log("Broken!") | |
} | |
var diamond2 = new paper.Path.RegularPolygon(new paper.Point(0, 0), 4, 100); | |
diamond2.rotate(45.0001); | |
var diamond3 = new paper.Path.RegularPolygon(new paper.Point(0, 1), 4, 100); | |
diamond3.rotate(45.0001); | |
intersection = diamond2.intersect(diamond3); | |
if (intersection.closed) { | |
console.log("Closed!"); | |
} else { | |
console.log("Broken!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment