Skip to content

Commit 57d7c67

Browse files
committed
More shorter names.
1 parent 0b5625c commit 57d7c67

8 files changed

Lines changed: 447 additions & 449 deletions

File tree

d3.js

Lines changed: 170 additions & 177 deletions
Large diffs are not rendered by default.

d3.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geom/voronoi/beach-section.js

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
function d3_geom_voronoiBeachSection() {
2-
this.edge = null;
3-
this.site = null;
2+
d3_geom_voronoiRedBlackNode.call(this);
3+
this.edge =
4+
this.site =
45
this.circleEvent = null;
5-
6-
// red-black tree properties
7-
this.rbParent = null;
8-
this.rbRed = null;
9-
this.rbLeft = null;
10-
this.rbRight = null;
11-
this.rbPrevious = null;
12-
this.rbNext = null;
136
}
147

158
function d3_geom_voronoiCreateBeachSection(site) {
@@ -21,26 +14,26 @@ function d3_geom_voronoiCreateBeachSection(site) {
2114

2215
function d3_geom_voronoiDetachBeachSection(beachSection) {
2316
d3_geom_voronoiDetachCircleEvent(beachSection);
24-
d3_geom_voronoiBeachLine.rbRemove(beachSection);
17+
d3_geom_voronoiBeachLine.remove(beachSection);
2518
d3_geom_voronoiBeachSectionJunkyard.push(beachSection);
2619
}
2720

2821
function d3_geom_voronoiRemoveBeachSection(beachSection) {
2922
var circle = beachSection.circleEvent,
3023
x = circle[0],
31-
y = circle.ycenter,
24+
y = circle.cy,
3225
vertex = [x, y],
33-
previous = beachSection.rbPrevious,
34-
next = beachSection.rbNext,
26+
previous = beachSection.P,
27+
next = beachSection.N,
3528
disappearingTransitions = [beachSection];
3629

3730
d3_geom_voronoiDetachBeachSection(beachSection);
3831

3932
var lArc = previous;
4033
while (lArc.circleEvent
4134
&& Math.abs(x - lArc.circleEvent[0]) < ε
42-
&& Math.abs(y - lArc.circleEvent.ycenter) < ε) {
43-
previous = lArc.rbPrevious;
35+
&& Math.abs(y - lArc.circleEvent.cy) < ε) {
36+
previous = lArc.P;
4437
disappearingTransitions.unshift(lArc);
4538
d3_geom_voronoiDetachBeachSection(lArc);
4639
lArc = previous;
@@ -52,8 +45,8 @@ function d3_geom_voronoiRemoveBeachSection(beachSection) {
5245
var rArc = next;
5346
while (rArc.circleEvent
5447
&& Math.abs(x - rArc.circleEvent[0]) < ε
55-
&& Math.abs(y - rArc.circleEvent.ycenter) < ε) {
56-
next = rArc.rbNext;
48+
&& Math.abs(y - rArc.circleEvent.cy) < ε) {
49+
next = rArc.N;
5750
disappearingTransitions.push(rArc);
5851
d3_geom_voronoiDetachBeachSection(rArc);
5952
rArc = next;
@@ -85,25 +78,25 @@ function d3_geom_voronoiAddBeachSection(site) {
8578
rArc,
8679
dxl,
8780
dxr,
88-
node = d3_geom_voronoiBeachLine.root;
81+
node = d3_geom_voronoiBeachLine._;
8982

9083
while (node) {
9184
dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;
92-
if (dxl > ε) node = node.rbLeft; else {
85+
if (dxl > ε) node = node.L; else {
9386
dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);
9487
if (dxr > ε) {
95-
if (!node.rbRight) {
88+
if (!node.R) {
9689
lArc = node;
9790
break;
9891
}
99-
node = node.rbRight;
92+
node = node.R;
10093
} else {
10194
if (dxl > -ε) {
102-
lArc = node.rbPrevious;
95+
lArc = node.P;
10396
rArc = node;
10497
} else if (dxr > -ε) {
10598
lArc = node;
106-
rArc = node.rbNext;
99+
rArc = node.N;
107100
} else {
108101
lArc = rArc = node;
109102
}
@@ -113,14 +106,14 @@ function d3_geom_voronoiAddBeachSection(site) {
113106
}
114107

115108
var newArc = d3_geom_voronoiCreateBeachSection(site);
116-
d3_geom_voronoiBeachLine.rbInsert(lArc, newArc);
109+
d3_geom_voronoiBeachLine.insert(lArc, newArc);
117110

118111
if (!lArc && !rArc) return;
119112

120113
if (lArc === rArc) {
121114
d3_geom_voronoiDetachCircleEvent(lArc);
122115
rArc = d3_geom_voronoiCreateBeachSection(lArc.site);
123-
d3_geom_voronoiBeachLine.rbInsert(newArc, rArc);
116+
d3_geom_voronoiBeachLine.insert(newArc, rArc);
124117
newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
125118
d3_geom_voronoiAttachCircleEvent(lArc);
126119
d3_geom_voronoiAttachCircleEvent(rArc);

src/geom/voronoi/break-point.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function d3_geom_voronoiLeftBreakPoint(arc, directrix) {
66

77
if (!pby2) return rfocx;
88

9-
var lArc = arc.rbPrevious;
9+
var lArc = arc.P;
1010
if (!lArc) return -Infinity;
1111

1212
site = lArc.site;
@@ -26,7 +26,7 @@ function d3_geom_voronoiLeftBreakPoint(arc, directrix) {
2626
}
2727

2828
function d3_geom_voronoiRightBreakPoint(arc, directrix) {
29-
var rArc = arc.rbNext;
29+
var rArc = arc.N;
3030
if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);
3131
var site = arc.site;
3232
return site[1] === directrix ? site[0] : Infinity;

src/geom/voronoi/circle-event.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
function d3_geom_voronoiCircleEvent() {
2-
this.arc = null;
3-
this.site = null;
4-
this[0] = null;
5-
this[1] = null;
6-
this.ycenter = null;
2+
d3_geom_voronoiRedBlackNode.call(this);
3+
this[0] =
4+
this[1] =
5+
this.arc =
6+
this.site =
7+
this.cy = null;
78
}
89

910
function d3_geom_voronoiAttachCircleEvent(arc) {
10-
var lArc = arc.rbPrevious,
11-
rArc = arc.rbNext;
11+
var lArc = arc.P,
12+
rArc = arc.N;
1213

1314
if (!lArc || !rArc) return;
1415

@@ -40,32 +41,32 @@ function d3_geom_voronoiAttachCircleEvent(arc) {
4041
circleEvent.site = cSite;
4142
circleEvent[0] = x + bx;
4243
circleEvent[1] = ycenter + Math.sqrt(x * x + y * y); // y bottom
43-
circleEvent.ycenter = ycenter;
44+
circleEvent.cy = ycenter;
4445

4546
arc.circleEvent = circleEvent;
4647

4748
var predecessor = null,
48-
node = d3_geom_voronoiCircleEvents.root;
49+
node = d3_geom_voronoiCircleEvents._;
4950

5051
while (node) {
5152
if (circleEvent[1] < node[1] || (circleEvent[1] === node[1] && circleEvent[0] <= node[0])) {
52-
if (node.rbLeft) node = node.rbLeft;
53-
else { predecessor = node.rbPrevious; break; }
53+
if (node.L) node = node.L;
54+
else { predecessor = node.P; break; }
5455
} else {
55-
if (node.rbRight) node = node.rbRight;
56+
if (node.R) node = node.R;
5657
else { predecessor = node; break; }
5758
}
5859
}
5960

60-
d3_geom_voronoiCircleEvents.rbInsert(predecessor, circleEvent);
61+
d3_geom_voronoiCircleEvents.insert(predecessor, circleEvent);
6162
if (!predecessor) d3_geom_voronoiFirstCircleEvent = circleEvent;
6263
}
6364

6465
function d3_geom_voronoiDetachCircleEvent(arc) {
6566
var circle = arc.circleEvent;
6667
if (circle) {
67-
if (!circle.rbPrevious) d3_geom_voronoiFirstCircleEvent = circle.rbNext;
68-
d3_geom_voronoiCircleEvents.rbRemove(circle);
68+
if (!circle.P) d3_geom_voronoiFirstCircleEvent = circle.N;
69+
d3_geom_voronoiCircleEvents.remove(circle);
6970
d3_geom_voronoiCircleEventJunkyard.push(circle);
7071
arc.circleEvent = null;
7172
}

src/geom/voronoi/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import "circle-event";
1515
import "clip";
1616
import "edge";
1717
import "half-edge";
18-
import "red-black-tree";
18+
import "red-black";
1919
import "vertex";
2020

2121
function d3_geom_voronoi(sites, bbox) {

0 commit comments

Comments
 (0)