Skip to content

Commit 886945e

Browse files
committed
Remove unused distance calculations
1 parent 480f568 commit 886945e

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/lines.jl

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function graphline(g, locs_x, locs_y, nodesize::Vector{T}, arrowlength, angleoff
99
j = dst(e)
1010
Δx = locs_x[j] - locs_x[i]
1111
Δy = locs_y[j] - locs_y[i]
12-
d = hypot(Δx, Δy)
1312
θ = atan(Δy,Δx)
1413
startx = locs_x[i] + nodesize[i]*cos(θ)
1514
starty = locs_y[i] + nodesize[i]*sin(θ)
@@ -30,7 +29,6 @@ function graphline(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Real, arrowlen
3029
j = dst(e)
3130
Δx = locs_x[j] - locs_x[i]
3231
Δy = locs_y[j] - locs_y[i]
33-
d = hypot(Δx, Δy)
3432
θ = atan(Δy,Δx)
3533
startx = locs_x[i] + nodesize*cos(θ)
3634
starty = locs_y[i] + nodesize*sin(θ)
@@ -50,7 +48,6 @@ function graphline(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Vector{<:Real}
5048
j = dst(e)
5149
Δx = locs_x[j] - locs_x[i]
5250
Δy = locs_y[j] - locs_y[i]
53-
d = hypot(Δx, Δy)
5451
θ = atan(Δy,Δx)
5552
startx = locs_x[i] + nodesize[i]*cos(θ)
5653
starty = locs_y[i] + nodesize[i]*sin(θ)
@@ -68,7 +65,6 @@ function graphline(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Real) where {T
6865
j = dst(e)
6966
Δx = locs_x[j] - locs_x[i]
7067
Δy = locs_y[j] - locs_y[i]
71-
d = hypot(Δx, Δy)
7268
θ = atan(Δy,Δx)
7369
startx = locs_x[i] + nodesize*cos(θ)
7470
starty = locs_y[i] + nodesize*sin(θ)
@@ -87,20 +83,19 @@ function graphcurve(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Vector{<:Real
8783
j = dst(e)
8884
Δx = locs_x[j] - locs_x[i]
8985
Δy = locs_y[j] - locs_y[i]
90-
# d = hypot(Δx, Δy)
9186
θ = atan(Δy,Δx)
9287
startx = locs_x[i] + nodesize[i]*cos+outangle)
9388
starty = locs_y[i] + nodesize[i]*sin+outangle)
9489
endx = locs_x[j] + nodesize[j]*cos+π-outangle)
9590
endy = locs_y[j] + nodesize[j]*sin+π-outangle)
9691

97-
d2 = hypot(endx-startx, endy-starty)
92+
d = hypot(endx-startx, endy-starty)
9893

9994
if i == j
100-
d2 = 2 * π * nodesize[i]
95+
d = 2 * π * nodesize[i]
10196
end
10297

103-
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d2)
98+
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d)
10499

105100
arr1, arr2 = arrowcoords-outangle, endx, endy, arrowlength, angleoffset)
106101
arrows[e_idx] = [arr1, (endx, endy), arr2]
@@ -116,20 +111,19 @@ function graphcurve(g, locs_x, locs_y, nodesize::Real, arrowlength, angleoffset,
116111
j = dst(e)
117112
Δx = locs_x[j] - locs_x[i]
118113
Δy = locs_y[j] - locs_y[i]
119-
# d = hypot(Δx, Δy)
120114
θ = atan(Δy,Δx)
121115
startx = locs_x[i] + nodesize*cos+outangle)
122116
starty = locs_y[i] + nodesize*sin+outangle)
123117
endx = locs_x[j] + nodesize*cos+π-outangle)
124118
endy = locs_y[j] + nodesize*sin+π-outangle)
125119

126-
d2 = hypot(endx-startx, endy-starty)
120+
d = hypot(endx-startx, endy-starty)
127121

128122
if i == j
129-
d2 = 2 * π * nodesize
123+
d = 2 * π * nodesize
130124
end
131125

132-
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d2)
126+
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d)
133127

134128
arr1, arr2 = arrowcoords-outangle, endx, endy, arrowlength, angleoffset)
135129
arrows[e_idx] = [arr1, (endx, endy), arr2]
@@ -144,20 +138,19 @@ function graphcurve(g, locs_x, locs_y, nodesize::Real, outangle)
144138
j = dst(e)
145139
Δx = locs_x[j] - locs_x[i]
146140
Δy = locs_y[j] - locs_y[i]
147-
# d = hypot(Δx, Δy)
148141
θ = atan(Δy,Δx)
149142
startx = locs_x[i] + nodesize*cos+outangle)
150143
starty = locs_y[i] + nodesize*sin+outangle)
151144
endx = locs_x[j] + nodesize*cos+π-outangle)
152145
endy = locs_y[j] + nodesize*sin+π-outangle)
153146

154-
d2 = hypot(endx-startx, endy-starty)
147+
d = hypot(endx-startx, endy-starty)
155148

156149
if i == j
157-
d2 = 2 * π * nodesize
150+
d = 2 * π * nodesize
158151
end
159152

160-
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d2)
153+
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d)
161154
end
162155
return vcat.(curves...)
163156
end
@@ -169,20 +162,19 @@ function graphcurve(g::AbstractGraph{T}, locs_x, locs_y, nodesize::Vector{<:Real
169162
j = dst(e)
170163
Δx = locs_x[j] - locs_x[i]
171164
Δy = locs_y[j] - locs_y[i]
172-
# d = hypot(Δx, Δy)
173165
θ = atan(Δy,Δx)
174166
startx = locs_x[i] + nodesize[i]*cos+outangle)
175167
starty = locs_y[i] + nodesize[i]*sin+outangle)
176168
endx = locs_x[j] + nodesize[j]*cos+π-outangle)
177169
endy = locs_y[j] + nodesize[j]*sin+π-outangle)
178170

179-
d2 = hypot(endx-startx, endy-starty)
171+
d = hypot(endx-startx, endy-starty)
180172

181173
if i == j
182-
d2 = 2 * π * nodesize[i]
174+
d = 2 * π * nodesize[i]
183175
end
184176

185-
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d2)
177+
curves[e_idx] = curveedge(startx, starty, endx, endy, θ, outangle, d)
186178
end
187179
return vcat.(curves...)
188180
end

0 commit comments

Comments
 (0)