applyed codingstyle

This commit is contained in:
boombuler 2013-02-23 16:18:02 +01:00
parent 8d419c3c95
commit c36afe506e

View File

@ -24,9 +24,9 @@ function wrapper() {
var MAX_LINK_COLOR = '#FF0000';
var Triangle = function (a, b, c) {
this.a = a
this.b = b
this.c = c
this.a = a;
this.b = b;
this.c = c;
var A = b.x - a.x,
B = b.y - a.y,
@ -48,9 +48,7 @@ function wrapper() {
this.x = minx + dx
this.y = miny + dy
this.r = dx * dx + dy * dy
}
else {
} else {
this.x = (D*E - B*F) / G
this.y = (A*F - C*E) / G
dx = this.x - a.x
@ -78,21 +76,20 @@ function wrapper() {
}
var dedup = function (edges) {
var j = edges.length,
a, b, i, m, n
var j = edges.length, a, b, i, m, n;
outer: while(j) {
b = edges[--j]
a = edges[--j]
i = j
b = edges[--j];
a = edges[--j];
i = j;
while(i) {
n = edges[--i]
m = edges[--i]
n = edges[--i];
m = edges[--i];
if((a === m && b === n) || (a === n && b === m)) {
edges.splice(j, 2)
edges.splice(i, 2)
j -= 2
continue outer
edges.splice(j, 2);
edges.splice(i, 2);
j -= 2;
continue outer;
}
}
}
@ -112,11 +109,13 @@ function wrapper() {
xmin = vertices[i].x,
xmax = vertices[0].x,
ymin = vertices[i].y,
ymax = ymin
ymax = ymin;
while(i--) {
if(vertices[i].y < ymin) ymin = vertices[i].y
if(vertices[i].y > ymax) ymax = vertices[i].y
if(vertices[i].y < ymin)
ymin = vertices[i].y;
if(vertices[i].y > ymax)
ymax = vertices[i].y;
}
/* Find a supertriangle, which is a triangle that surrounds all the
@ -141,69 +140,66 @@ function wrapper() {
],
closed = [],
edges = [],
j, a, b
j, a, b;
/* Incrementally add each vertex to the mesh. */
i = vertices.length
i = vertices.length;
while(i--) {
/* For each open triangle, check to see if the current point is
* inside it's circumcircle. If it is, remove the triangle and add
* it's edges to an edge list. */
edges.length = 0
j = open.length
edges.length = 0;
j = open.length;
while(j--) {
/* If this point is to the right of this triangle's circumcircle,
* then this triangle should never get checked again. Remove it
* from the open list, add it to the closed list, and skip. */
dx = vertices[i].x - open[j].x
dx = vertices[i].x - open[j].x;
if(dx > 0 && dx * dx > open[j].r) {
closed.push(open[j])
open.splice(j, 1)
continue
closed.push(open[j]);
open.splice(j, 1);
continue;
}
/* If not, skip this triangle. */
dy = vertices[i].y - open[j].y
dy = vertices[i].y - open[j].y;
if(dx * dx + dy * dy > open[j].r)
continue
continue;
/* Remove the triangle and add it's edges to the edge list. */
edges.push(
open[j].a, open[j].b,
open[j].b, open[j].c,
open[j].c, open[j].a
)
open.splice(j, 1)
);
open.splice(j, 1);
}
/* Remove any doubled edges. */
dedup(edges)
dedup(edges);
/* Add a new triangle for each edge. */
j = edges.length
j = edges.length;
while(j) {
b = edges[--j]
a = edges[--j]
open.push(new Triangle(a, b, vertices[i]))
b = edges[--j];
a = edges[--j];
open.push(new Triangle(a, b, vertices[i]));
}
}
/* Copy any remaining open triangles to the closed list, and then
* remove any triangles that share a vertex with the supertriangle. */
Array.prototype.push.apply(closed, open)
Array.prototype.push.apply(closed, open);
i = closed.length
i = closed.length;
while(i--)
if(closed[i].a.__sentinel ||
closed[i].b.__sentinel ||
closed[i].c.__sentinel)
closed.splice(i, 1)
if(closed[i].a.__sentinel || closed[i].b.__sentinel || closed[i].c.__sentinel)
closed.splice(i, 1);
/* Yay, we're done! */
return closed
return closed;
}
var layer = null;
window.plugin.portalfolding.toggle = function() {
@ -221,8 +217,10 @@ function wrapper() {
for (var key in window.portals) {
var loc = window.portals[key].options.details.locationE6;
var nloc = { x: loc.lngE6, y: loc.latE6 };
if (nloc.x < minX) minX = nloc.x;
if (nloc.y < minX) minX = nloc.y;
if (nloc.x < minX)
minX = nloc.x;
if (nloc.y < minX)
minX = nloc.y;
locations.push(nloc);
}