Skip to content

Instantly share code, notes, and snippets.

@weepy
Created July 16, 2013 08:20
Show Gist options
  • Select an option

  • Save weepy/6006819 to your computer and use it in GitHub Desktop.

Select an option

Save weepy/6006819 to your computer and use it in GitHub Desktop.
Example : missing intersection in Raphael.pathIntersection
<body style='background:#000'>
<script src='http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js'></script>
<script>
var path = "M50.975,83.158C79.822,82.37700000000001,81.971,83.114,84.97999999999999,83.15700000000001V85.03200000000001Z"
// no intersections ...
var zigzag = "M69.575,90.190 L69.575,28.290"
// uncomment for intersections ...
//var zigzag = "M69.575,90.190 L69.575,27.290"
var paper = Raphael(0, 0, 10000, 10000);
paper.path(path).attr({stroke: 'red'})
paper.path(zigzag).attr({stroke: 'blue'})
var intersections = Raphael.pathIntersection(path, zigzag)
intersections.forEach(function(co) {
paper.circle(co.x, co.y, 1).attr({stroke: 'none', fill: 'white'})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment