vedo icon indicating copy to clipboard operation
vedo copied to clipboard

Generating a point cloud of cylindrical geometry

Open DeepaMahm opened this issue 2 years ago • 4 comments
trafficstars

Hello @marcomusy,

I've a cylindrical object created using the Cylinder class. I want to define the cylindrical geometry generated from vedo as a PointCloud in Deepxde for simulations.

from vedo import *
from vedo import plotter as vplt

cyl = Cylinder(r=1, height=10, cap=True, alpha=0.8, c='grey').pos([5, 0])
vplt.show(cyl)

Could you please suggest how to obtain pointcould?

Also, could you please let me know if we can generate pointcloud for the internal volume (currently this appears as void space in the visualization i.e. hollow cylinder)?

DeepaMahm avatar Oct 02 '23 11:10 DeepaMahm

Hi, You can use cyl.points() and - if needed - cyl.faces() - to have a numpy array of the coordinates.

marcomusy avatar Oct 02 '23 11:10 marcomusy

Hi,

I tried

    cyl = Cylinder(r=1, height=10, cap=True, alpha=0.8, c='grey').pos([5, 0])
    pts = Points(cyl.points(), c='k')
    plt.show(pts)

To check if I could get the coordinates of all the points on the cylinder boundaries/faces.

image

Unfortunately, I see only a few points on the cap. Could you please have a look? I'm not sure if I am doing it the right way.

Also, cyl.faces() returns the polygon cell connectivity. I am not sure how to get the coordinates.

DeepaMahm avatar Oct 02 '23 12:10 DeepaMahm

The coordinates are given by cyl.points() you don't need faces most likely.. Maybe a better way to get the cylinder in your case is by extruding a circle:

from vedo import Circle, Points, show
disc = Circle(r=1, res=25).linewidth(1)
cyl = disc.extrude(3, res=50)
pts = Points(cyl, c='red5')
show(cyl, pts, axes=1)

Screenshot from 2023-10-02 14-21-32

marcomusy avatar Oct 02 '23 12:10 marcomusy

Thank you so much. Actually, I also need the faces to specify the boundary conditions on the faces.

DeepaMahm avatar Oct 02 '23 13:10 DeepaMahm