Questions regarding plotting window and drawing custom surface with colour
See original GitHub issueDear Marco,
I just came upon the vtkplotter lib and it seems quite interesting thus I started playing a bit with it. I have two questions though which I couldn’t clearly answer by going through the examples and the issues section.
- Is it possible to have interactive action menu on the plotting window so that you can activate/deactivate/adjust axes, grid, take a screenshot, save plot, etc. From what I’ve seen in the examples https://github.com/marcomusy/vtkplotter/blob/master/vtkplotter/examples/pyplot/customAxes.py for the axes you can do that only by code. Is that the only way?
- I was testing on an example of mine where I have 4 numpy arrays for the corresponding coordinates of faces/polygons and their corresponding color, something like that:
x = np.array([[-0.93333333, -0.93333333, -0.93333333, -0.93333333],
[-0.93333333, -0.93333333, -0.93333333, -0.93333333],
[-1., -1., -1., -1. ],
[-1., -1., -1., -1. ]])
y = np.array([[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.]])
z = np.array([[-1., -0.93333333, -0.86666667, -0.8 ],
[-0.93333333, -0.86666667, -0.8, -0.73333333],
[-0.93333333, -0.86666667, -0.8, -0.73333333],
[-1., -0.93333333, -0.86666667, -0.8 ]])
colormat = np.array([[0.11484721, 0.11484721, 0.11484721],
[0.11648363, 0.11648363, 0.11648363],
[0.12010454, 0.12010454, 0.12010454],
[0.12384401, 0.12384401, 0.12384401]])
Now each column in the x, y, z matrices corresponds to the four 3d coordinates of the quadrangle in an clockwise/anti-clockwise order and each row in the colormat matrix to the face color (it is grayscale as you can see). For example for the first quadrangle you have, something like:
My question now is how to draw these quadrangles all together with the corresponding color using vtkplotter. To be honest looking on the examples I couldn’t find something relevant but I might have overlooked.
Also you might get the points in an [x, y, z] form array with numpy as follows in case that this helps somehow:
>>> verts = np.hstack([x.reshape(-1,1,order='F'), y.reshape(-1,1,order='F'), z.reshape(-1,1,order='F')])
>>> verts
array([[-0.93333333, 1. , -1. ],
[-0.93333333, 1. , -0.93333333],
[-1. , 1. , -0.93333333],
[-1. , 1. , -1. ],
[-0.93333333, 1. , -0.93333333],
[-0.93333333, 1. , -0.86666667],
[-1. , 1. , -0.86666667],
[-1. , 1. , -0.93333333],
[-0.93333333, 1. , -0.86666667],
[-0.93333333, 1. , -0.8 ],
[-1. , 1. , -0.8 ],
[-1. , 1. , -0.86666667],
[-0.93333333, 1. , -0.8 ],
[-0.93333333, 1. , -0.73333333],
[-1. , 1. , -0.73333333],
[-1. , 1. , -0.8 ]])
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (9 by maintainers)
Top GitHub Comments
yes that was the problem, I was rendering the lines as:
taken from the corresponding example. Rendering them instead as:
lines = vp.Lines(origins,drays, c='b')
gives me the same smooth result 😉
I see, well it should be able to add/send a mesh to the child process because you might need to send a custom mesh rather an existing mesh from within the vtkplotter api.
Regarding pathos, you might try to open a new issue in their github account and ask if you cannot figure it out. I am looking at it as well, it seems to be a bit different from the vanilla multiprocessing.