Function
GetLines
(xc, yc, a, nx, ny, hx, hy, u)
Source from the content-addressed store, hash-verified
| 368 | # Equation of line: |
| 369 | # (x-xc)/h dot n = a |
| 370 | def GetLines(xc, yc, a, nx, ny, hx, hy, u): |
| 371 | xc = xc.flatten() |
| 372 | yc = yc.flatten() |
| 373 | nx = nx.flatten() |
| 374 | ny = ny.flatten() |
| 375 | a = a.flatten() |
| 376 | u = u.flatten() |
| 377 | |
| 378 | xa = [] |
| 379 | ya = [] |
| 380 | xb = [] |
| 381 | yb = [] |
| 382 | for i in range(len(xc)): |
| 383 | th = 1e-10 |
| 384 | if u[i] > th and u[i] < 1. - th: |
| 385 | e = GetLineEnds(nx[i] * hx, ny[i] * hy, a[i]) |
| 386 | if len(e) == 2: |
| 387 | xa.append(xc[i] + e[0][0] * hx) |
| 388 | ya.append(yc[i] + e[0][1] * hy) |
| 389 | xb.append(xc[i] + e[1][0] * hx) |
| 390 | yb.append(yc[i] + e[1][1] * hy) |
| 391 | |
| 392 | xa = np.array(xa) |
| 393 | ya = np.array(ya) |
| 394 | xb = np.array(xb) |
| 395 | yb = np.array(yb) |
| 396 | |
| 397 | return xa, ya, xb, yb |
| 398 | |
| 399 | |
| 400 | # Plot particle strings |
Tested by
no test coverage detected