MCPcopy Create free account
hub / github.com/cselab/aphros / GetLineEnds

Function GetLineEnds

src/test/sharp/plot.py:91–108  ·  view source on GitHub ↗
(nx, ny, a)

Source from the content-addressed store, hash-verified

89
90# assume 0 < nx < ny, a < 0
91def GetLineEnds(nx, ny, a):
92 xl = [(a + 0.5 * ny) / nx, (a + 0.5 * nx) / ny]
93 xr = [(a - 0.5 * ny) / nx, (a - 0.5 * nx) / ny]
94
95 e = []
96 if -0.5 <= xl[0] and xl[0] <= 0.5:
97 e.append([xl[0], -0.5])
98 if -0.5 <= xr[0] and xr[0] <= 0.5:
99 e.append([xr[0], 0.5])
100 if len(e) < 2 and -0.5 <= xl[1] and xl[1] <= 0.5:
101 e.append([-0.5, xl[1]])
102 if len(e) < 2 and -0.5 <= xr[1] and xr[1] <= 0.5:
103 e.append([0.5, xr[1]])
104
105 if len(e) == 1: # if only one point found, set second to the same
106 e.append(e[0])
107
108 return e
109
110
111# xc,yc: cell centers

Callers 1

GetLinesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected