Skip to content

Instantly share code, notes, and snippets.

View adamrecsko's full-sized avatar
🎯
Focusing

Adam Recsko adamrecsko

🎯
Focusing
  • Hungary, Budapest
View GitHub Profile
@annatomka
annatomka / PolygonConvexityTest.js
Last active December 17, 2020 07:19
Determine in Javascript wheather a polygon is convex or not? (using Openlayers polygon and algorithm describe here: http://stackoverflow.com/questions/471962/how-do-determine-if-a-polygon-is-complex-convex-nonconvex)
function calculateAllCrossProduct(points) {
var lastSign = null;
for (var i = 2; i < points.length; i++) {
//calculate crossproduct from 3 consecutive points
var crossproduct = calculateCrossProduct(points[i - 2], points[i - 1], points[i]);
console.log(i + ". crossproduct from ("+ points[i - 2].x +" "+points[i - 1].x +" "+points[i].x +"): " + crossproduct);
var currentSign = Math.sign(crossproduct);
if (lastSign == null) {
//last sign init
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing