summaryrefslogtreecommitdiffstats
path: root/main/survey/js/HeatMap/heatmap4Respondents.js
diff options
context:
space:
mode:
Diffstat (limited to 'main/survey/js/HeatMap/heatmap4Respondents.js')
-rw-r--r--main/survey/js/HeatMap/heatmap4Respondents.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/survey/js/HeatMap/heatmap4Respondents.js b/main/survey/js/HeatMap/heatmap4Respondents.js
new file mode 100644
index 0000000..465b771
--- /dev/null
+++ b/main/survey/js/HeatMap/heatmap4Respondents.js
@@ -0,0 +1,13 @@
+
+function insidePoly(poly, pointx, pointy, vre_id) {
+ //console.log("Za poly: "+vre_id+" je x: "+pointx+" y: "+pointy);
+
+ var i, j;
+ var inside = false;
+ for (i = 0, j = poly.length - 1; i < poly.length; j = i++) {
+ //console.log(poly[i].x+" "+poly[i].y);
+ if(((poly[i].y > pointy) != (poly[j].y > pointy)) && (pointx < (poly[j].x-poly[i].x) * (pointy-poly[i].y) / (poly[j].y-poly[i].y) + poly[i].x) ) inside = !inside;
+ }
+ //console.log("inside je: "+inside);
+ return inside;
+} \ No newline at end of file