pythonocc-utils icon indicating copy to clipboard operation
pythonocc-utils copied to clipboard

Error in Common/smooth_pnts function

Open arbrasington opened this issue 4 years ago • 0 comments

def smooth_pnts(pnts):
    smooth = [pnts[0]]
    for i in range(1, len(pnts)-1):
        prev = pnts[i-1]
        this = pnts[i]
        next_pnt = pnts[i+1]
        pt = (prev+this+next_pnt) / 3.0
        smooth.append(pt)
    smooth.append(pnts[-1])
    return smooth

This function is from pythonocc-utils/Common.py. The line: pt = (prev+this+next_pnt) / 3.0

throws this error: TypeError: unsupported operand type(s) for /: 'gp_Pnt' and 'float'.

It seems to be trying to divide a sum of points by a float? Not sure what is suppose to be happening here. Any help is appreciated!

arbrasington avatar Jan 19 '21 17:01 arbrasington