Skip to content

utils.py>way unmatch cases causes errors in Path_finder.py>Path.working_points when drawing slanted lines #62

Description

@AdrienGuimbal

The if/else statesments here don't cover the full range of possibilites, so the function often returns a None

def way(vec):
    if vec[1] != 0:
        if abs(vec[0] / vec[1]) < 1e-2:
            if vec[1] > 0:
                return Vector(0, 1)
            elif vec[1] < 0:
                return Vector(0, -1)
    if vec[0] != 0:
        if abs(vec[1] / vec[0]) < 1e-2:
            if vec[0] > 0:
                return Vector(1, 0)
            elif vec[0] < 0:
                return Vector(-1, 0)

Hence in working_points (line 413) in working_p_start = A + vec * min_dist / 2 vec is None and the programs raises an error.

How te reproduce the error : draw a horizontal port, then a (1,1)-slanted one and connect them. If you change the orientation of ports & the order of the ports, the error alway occures at some point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions