Home Forums Nazca Trying to get nazca.trace() to work Reply To: Trying to get nazca.trace() to work


Dear Raj Patel,

The path length was not implemented for sine bends. This is fixed and will be in a future release of nazca.

For now you can use this workaround to calculate the arc length of the center line of the sinebend yourself:

from scipy.integrate import quad
from math import sin, pi, sqrt

def length_sinebend(distance, offset):
    def arc_len_sinebend(t, d=distance, s=offset):
        return s / (2 * pi) * sqrt((d / s) ** 2 + (1 - sin(t)) ** 2)
    return quad(arc_len_sinebend, 0, 2 * pi)[0]

# wg=lx.ads.sinebend(distance=1000, offset=1000).put(5000, 10000)
mylength = length_sinebend(1000, 1000)