mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 08:02:29 +00:00
Fix TypeError in ray_cast_by_proximity_2d degenerate edge
A degenerate edge (zero-length segment) caused an early `return` of a tuple instead of continuing the loop, resulting in a TypeError when snap.py iterated the result and tried to assign `point["group"]` on a float. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -434,11 +434,8 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
seg_len_sq = sx * sx + sy * sy
|
seg_len_sq = sx * sx + sy * sy
|
||||||
|
|
||||||
if seg_len_sq == 0.0:
|
if seg_len_sq == 0.0:
|
||||||
# degenerate segment: return distance to p0
|
# degenerate segment: skip it
|
||||||
dx = px - p0x
|
continue
|
||||||
dy = py - p0y
|
|
||||||
dist = math.hypot(dx, dy)
|
|
||||||
return dist, (p0x, p0y), 0.0
|
|
||||||
|
|
||||||
# project (p - p0) onto seg: t = dot(p-p0, seg) / |seg|^2
|
# project (p - p0) onto seg: t = dot(p-p0, seg) / |seg|^2
|
||||||
apx = px - p0x
|
apx = px - p0x
|
||||||
|
|||||||
Reference in New Issue
Block a user