Skip to content
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

Code breaks on irregular faces #2

Open
smeaden opened this issue Jun 14, 2020 · 1 comment
Open

Code breaks on irregular faces #2

smeaden opened this issue Jun 14, 2020 · 1 comment

Comments

@smeaden
Copy link

smeaden commented Jun 14, 2020

Great code, I have written a conversion of the resultant SVG file to Excel shapes on a worksheet, https://exceldevelopmentplatform.blogspot.com/2020/06/python-wireframe-graphics-on-worksheet.html

However, I would like to get a childhood favorite spaceship of mine to be rendered as well, this is it https://programming-enchiladas.destructuring-bind.org/rm-hull/7098992?shape=cobra&style=translucent&scale=0.03 It is called a Cobra-MK3 and it is from a groundbreaking 1984 game called Elite , https://en.wikipedia.org/wiki/Elite_(video_game)#Gameplay

When I created a similar array of points for the cobra it failed at the numpy’s “fancy indexing” feature. So I wrote some simple code to do the equivalent manually and then convert to a numpy array but this failed also. It seems the code is expecting either all triangles or all squares. The cobra has some faces which have more than 4 sides.

I suppose one way out of this is to break polygons of more than 4 sides into triangles and switch off the drawing of internal edges. I don't know if that is better.

@gever
Copy link

gever commented Oct 11, 2021

Same issue here; at the tail-end of a series of CSG operations, I end up with a list of planar polygons that include 3, 4, 5, and more points. The reliance on numpy's "fancy indexing" requires that all polygons be the same number of points (I've gotten it to accept quads or triangles, but not both). Seems like we could just pass the list of faces and verts into the Mesh - at least for objects with less than 10k faces - pretty easily... Before I jump into it, let me know if you've already thought about it.

Hmm, now I'm thinking that since I can pass in multiple Mesh objects to the scene, maybe I can do the triangles in one mesh, the quads in another, and so on, for every class of polygon I have generated...

(Also, thanks for the awesome code base, it's really solved a problem for me in creating a way to render complex 3d objects in Google Collaboratory with my students)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants