Skip to content

Error in Common/smooth_pnts function #25

Description

@arbrasington
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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions