11function 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
158function d3_geom_voronoiCreateBeachSection ( site ) {
@@ -21,26 +14,26 @@ function d3_geom_voronoiCreateBeachSection(site) {
2114
2215function 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
2821function 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 ) ;
0 commit comments