« first day (2279 days earlier)      last day (934 days later) » 

11:28 AM
seems I have to deal with the intersections myself :/
 
@flawr this looks like a matlab accident
 
its python, sorry
matlab wouldn't accident this
 
well well I think it may still be acceptable, MATLAB accident is a misnomer, the best description is sceince plotting accindets
those plots are really fun anyway XD :D
 
it's not even science, it is just making decorative arts and crafts!
 
hahaha
 
11:42 AM
@flawr oh yeah, matplotlib can't do that :>
If you show the code I might be able to fix it later
 
12:13 PM
@AndrasDeak this is proprietary code and I have some NDAs
do you know might matplotlib.org/stable/api/_as_gen/… work instead?
as far as I understand Poly3DCollection only colours in the projected (2d) polygon, and cannot take depthi nformation into account
sorry, I meant to send this one: matplotlib.org/stable/tutorials/toolkits/…
 
12:34 PM
@flawr ah
@flawr no, hold on
 
I'm about to write a SO question about this, in case you'd like to reap some sweet internet points:)
 
@flawr click the first figure at riptutorial.com/matplotlib/topic/1880/three-dimensional-plots for a gif
@flawr no, it's well-known that matplotlib has a 2d renderer and complex (non-connected) surfaces get rendered bad, because two connected surfaces are either fully behind or fully in front of one another
of course it depends on what you're trying to ask exactly
 
ah I see, thanks!
 
I've got a few answers on main e.g. stackoverflow.com/questions/35099455/… but there's no general solution to the problem. If you can stitch your surfaces together it's OK, otherwise tough luck.
 
yep the decomposition is a problem here. I guess I need to write my own renderer.
(I wrote a q here)
 
12:44 PM
just use a proper 3d data visualization library
matplotlib is not the right tool here
 
actually since my polygons are simply connected, I could apply ricci flow to the boundary curve and segment the polygon that way.
But that's a tad bit overkill
or maybe mean curvature
ah no, these don't work
 
1:03 PM
@AndrasDeak do you have any recommendation?
 
pyvista is based on vtk which is a huge-ass data visualization library written in C++ with crappy python bindings
 
vtk is cursed
2
ok that looks nice, thanks!
is the output interactive? (rotatable?)
 
yup
The plotter.enable_terrain_style() makes it behave like matplotlib, with z pointing up. The default interaction allows you to rotate the world freely.
for the default I recommend plotter.show_axes() which gives you small x/y/z arrows in the corner
 
thanks, I'll try that then! I have some other business to do right now but maybe I'll continue in the evening:)
 
do let me know if you need any help
when I asked for the code I meant to port it to pyvista for you
there are a shitton of examples and usually good documentation docs.pyvista.org/examples/index.html
 
1:13 PM
@AndrasDeak I'm not sure yet if the logic makes sense, so I don't want to give you code with that level of crappyness:)
 
you'll probably want a PolyData for each polygon, and then create copies of that and rotate/translate with methods (we might be able to create the whole solid with a single call to glyph but that needs some thinking)
@flawr sure thing
 
ah I basically have all the rotations etc already computed, I really just need to plot the polygons given the 3d coordinates of the vertices
 
OK, you can do that with a single PolyData
points should be shape (n*len_polygon, 3)-shaped, and faces should look like this: [len_polygon + 1] + list(range(0, len_polygon)) + [0] + [len_polygon + 1] + list(range(len_polygon, 2*len_polygon)) + [len_polygon] + ..., which you can fairly easily put together with numpy (flattening a 2d array). Then it's poly = pv.PolyData(points, faces); poly.plot()
To clarify, the faces array is a 1d array, where first you have an integer specifying the number of points in the given face, and then the zero-based point indices of the given face. Then the next one etc. Since all your faces have the same size, you can do this using a 2d array.
first column is all len_polygon + 1
 
 
2 hours later…
2:59 PM
> PyVista is “VTK for humans”
 
3:18 PM
so I wrote the code but need to wait for the package to finish installing
 
vtk has wheels unless you have something weird like 32-bit python on windows
(and vtk is the real bottleneck)
 
3:29 PM
My first message here in this chat.
Hi, folks
 
3:55 PM
hi!
@AndrasDeak my poor little computer, this is taking forever :|
oh it was a permission problem and it just got stuck instead of yelling at me
 
Sounds weird
 
windowsTM
 
4:20 PM
\o/
now on to the weird stuff
@AndrasDeak thansk for all the tips, turns out they help if I read them correctly instead of skipping half of them:P
 
Weird :P
 
that looks correct to me
 
right nwo everything goes through the origin, so some offset is missing
 
well, the 5-fold part is not obvious
yeah, then that's why it's off
 
4:33 PM
d'oh
x+y doesn't add y to x, we also need some assignment
 
no way :)
I think x.merge(y, inplace=True) might work
but x += y is probably more readable (althogh it's probably subtly different... I'd have to check)
 
 
1 hour later…
6:01 PM
@flawr this one's for you github.com/pyvista/pyvista/pull/1692
 
> 17 seconds ago
ah yes, the famous platonic teapot
 
ah yuo submited a PR :D
wunderbar!
 
I realised we don't have Platonic solids when you first mentioned dodecahedra last night, and on the same day we talked about octahedra and tetrahedra in the python room
 
I have some weird issue with plotting polygonsin pyvista, some work great, some have some weird assymetries, even though in matplotlib they are perfectly symmetric. writing a minimal example right now to see what's going on
 
OK. Perhaps your points are in the wrong order, either that or the faces array is mixed up
Are you defining the faces using a 2d array as I suggested?
I'd do arange -> reshape to 2d -> append the first column as last column -> prepend a constant first column with polygon sizes
 
6:17 PM
I'm first building lists and then converting them to a nupmy array, but everything should work just as well
but I have problems with already one polygon:
 
suspicious
 
do you also get that weird unsymmetric star shape in pyvista?
 
hold on, I need to look at it closely
 
on a positive note: gay marriage just passed in CH!
(but we don't raise taxes for the wealthy)
 
@flawr awesome!
it'll soon be a crime punishable by stoning here, but I'm real happy for you guys
 
6:22 PM
I was afraid it wouldn't pass but it got a way more positive result than I expected (64% yes)
@AndrasDeak daamn
 
@flawr hmm, not sure what's going on there, I'll have to play with this to find it
surf.plot(show_edges=True) shows that the lines are there, but there's spurious filling
I'd expect that the issue is that you didn't close your faces, but that doesn't seem to help either
faces.append(vert_count + 1)
faces.extend(list(range(vert_count)))
faces.append(faces[1])
another thing I said and you didn't read properly ;)
you don't need list(range()) to extend, by the way, just range()
this might actually be a bug because if I define the face to be a line with surf = pv.PolyData(vertices, lines=faces) then I see the nice line
concave polygons might be fucky somehow
 
ah closing helped!
 
it did?
 
@AndrasDeak I told you! :P
but only for the case of one polygon
 
What do you mean by that exactly?
 
6:32 PM
if I have multiple polygons then they get connected
 
you need to close all of them :P
5 hours ago, by Andras Deak
first column is all len_polygon + 1
+1 because they are each closed
 
yep I do that now
 
I'm surprised it works, though
I mean it should, but it doesn't work for me
oh well
 
what the heck now it doesn't work anymore
maybe just a fluke?
@AndrasDeak but even for convex polygons, you can't draw multiple: pastebin.com/P29sgUUx
"two pentagons"
 
not sure what you mean, let me see
@flawr did you skip point 5 on purpose?
you have index 10 in there for 10 points... we should really raise when this happens
(unfortunately it would be really computationally expensive to check those values for large meshes)
 
6:47 PM
ooh that damn accumulator
yes
 
you can even segfault if you mess up indices like that
vtk doesn't fuck around :P
surf.clean() would get rid of your 10 index
(it can't guess the missing vertex of course)
 
shouldn't it get like an index out of bounds or something like this? or is this one of those instances where they do pointer-arithmetic arrays and don't check for array length?
ok so the things arend connected anymore, but the issue with the non-convex (!= concave) shapes is still an issue, right?
 
You can even pass elephants as faces for now. VTK could check it but doesn't, and pyvista chooses not to check for now, I think, because it's expensive. We talked about adding some compiled code to do these expensive things, but at that point the maintainer said he doesn't want to add that level right now.
@flawr probably. I think you should take a look at github.com/pyvista/pyvista-support/issues for old support issues, and github.com/pyvista/pyvista/issues for regular issues, and github.com/pyvista/pyvista/discussions for new support issues. If this hasn't come up yet, open a bug report on the main repo.
I recommend comparing the lines=... plot and the faces=... plot, because that easily demonstrates that the order of points is correct.
It's likely the conclusion will be "VTK is buggy", but I can't tell for sure
 
ok, that's basically what I tried to verify with matplotlib
 
OK, hey, surf.triangulate() will fix this
just a workaround I think
(with inplace=False if you don't want to reassign it)
 
6:55 PM
ah much better
 
funky
 
is that with lines=faces?
 
no, that's with plot(show_edges=True)
if you pass lines=... you'll get... a line only, not a face
this is the result of the triangulation, with internal edges visualised
since triangles are usually convex (:P) it plots fine
 
might still be worth an issue, I don't know if this is a known bug or not
 
7:11 PM
@AndrasDeak check here
 
7:30 PM
you can define cell scalars to give them colour if you want
(or point scalars, but that seems less straightforward here)
 
@AndrasDeak I tried that but didn't get it to work, maybe because of the triangulation?
 
add the scalars before triangulation
if show_mpl := False:
EW EW EW
 
something something self documenting code something something
you're lucky I removed the sum() to concatenate lists
 
yeah
although if Python allows it that easily then it's fine
 
 
1 hour later…
9:07 PM
@flawr cell scalars work just fine
    surf = pv.PolyData(vertices, faces)
    surf.cell_data['face index'] = np.arange(surf.n_cells)
    surf = surf.triangulate()
    surf.plot(categories=True) #show_edges=True)
 

« first day (2279 days earlier)      last day (934 days later) »