-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError out of range when converting to STL #176
Comments
So it looks like it's trying to get the normal using Newell's method for a Happy to create a quick PR for it if I understand what would need to be changed here; should Relevant function def get_normal_newell(poly):
# find normal with Newell's method
# print (poly)
n = np.array([0.0, 0.0, 0.0], dtype=np.float64)
# if len(poly) == 0:
# print ("NOPOINTS")
for i,p in enumerate(poly):
ne = i + 1
if (ne == len(poly)):
ne = 0
n[0] += ( (poly[i][1] - poly[ne][1]) * (poly[i][2] + poly[ne][2]) )
n[1] += ( (poly[i][2] - poly[ne][2]) * (poly[i][0] + poly[ne][0]) )
n[2] += ( (poly[i][0] - poly[ne][0]) * (poly[i][1] + poly[ne][1]) )
if (n==np.array([0.0, 0.0, 0.0])).all():
# print("one wrong")
return (n, False)
n = n / math.sqrt(n[0]*n[0] + n[1]*n[1] + n[2]*n[2])
return (n, True) |
PR welcome. Yes just drop the invalid/collapsed face, nothing more you can do here I'm afraid. |
stil got the same error steps
result
expected result known work
best regards |
Describe the bug
When trying to convert a CityJSON to STL I get a
list index out of range
. I'm running the command on a CityJSON I created by downloading BAG3D tiles and merging them. I then also upgraded the merged file to CityJSON 2.0 usingcjio delft.city.json upgrade save delft-upgraded.city.json
.cjio validate
on the file indicates that everything is valid.Stacktrace
cjio version
I installed from the git repo, but used tag v0.9.0.
➜ cjio --version cjio v0.9.0; supports CityJSON v2.0
To Reproduce
It's awkward, because if I convert a single CityJSON to STL it works fine, but converting the merged file results in the IndexError, so I'm not sure which file is introducing it at this point. The merged file is kind of large to attach; I guess it might help if I try to convert each file separately and see which one crashes it?
Expected behavior
No IndexError upon conversion to STL 😅
Desktop (please complete the following information):
Ubuntu 22.04
Python 3.10.12
cjio
installed to a fresh venv (with latest main ofcjvalpy
from git)pip freeze
The text was updated successfully, but these errors were encountered: