discord/gridrender.py
def filterGridCircle(points, n, radius):
    """Returns points inside circle. Points outside are set to NaN."""
    # Code ported from
    # https://github.com/Smoothieware/Smoothieware/blob/c398f3aa9d2bd6ac2c9328ef0bc08429788d6203/src/modules/tools/zprobe/DeltaGridStrategy.cpp

    res = points.copy()
    d = ((radius * 2) / (n - 1))
    for c in range(n):
        y = -radius + d * c
        for  r in range(n):
            x = -radius + d * r

            distance_from_center = (x * x + y * y)**0.5 # sqrt
            if not distance_from_center <= radius:
                res[c*n+r] = float("NaN")
    
    return res
Returns points inside circle. Points outside are set to NaN.
Returns points inside circle. Points outside are set to NaN.
Returns points inside circle . Points outside are set to NaN .
def filterGridCircle(points, n, radius):
    res = points.copy()
    d = ((radius * 2) / (n - 1))
    for c in range(n):
        y = -radius + d * c
        for  r in range(n):
            x = -radius + d * r
            distance_from_center = (x * x + y * y)**0.5 
            if not distance_from_center <= radius:
                res[c*n+r] = float("NaN")
    return res
def filterGridCircle ( points , n , radius ) : res = points . copy ( ) d = ( ( radius * 2 ) / ( n - 1 ) ) for c in range ( n ) : y = - radius + d * c for r in range ( n ) : x = - radius + d * r distance_from_center = ( x * x + y * y ) ** 0.5 if not distance_from_center <= radius : res [ c * n + r ] = float ( "NaN" ) return res
Returns points inside circle.
Returns points inside circle .
"""Returns points inside circle. Points outside are set to NaN.""" # Code ported from # https://github.com/Smoothieware/Smoothieware/blob/c398f3aa9d2bd6ac2c9328ef0bc08429788d6203/src/modules/tools/zprobe/DeltaGridStrategy.cpp # sqrt
points
n
radius