## Re: [cgkit-user] torus mesh

 Re: [cgkit-user] torus mesh From: Matthias Baas - 2007-04-12 11:22:40 Krystian Samp wrote: > Is it possible to create Torus (or TorusGeom) and read its mesh > (vertices, indices)? Yes, but you have to convert the geom into a mesh. One way to do that is the following: >>> from cgkit.all import * >>> t=Torus() >>> convertToTriMesh(t) >>> for v in t.verts: print v ... (1.1, 0, 0) (1.07071, 0, 0.0707107) (1, 0, 0.1) ... >>> for f in t.faces: print f ... (0, 9, 10) (0, 10, 1) (1, 10, 11) ... If you want to keep the torus you can also use the geom's convert method: >>> t=Torus() >>> tm = TriMeshGeom() >>> t.geom.convert(tm) >>> for v in tm.verts: print v ... (1.1, 0, 0) (1.07071, 0, 0.0707107) (1, 0, 0.1) - Matthias -

### Thread view

 [cgkit-user] torus mesh From: Krystian Samp - 2007-04-10 21:36:25 Attachments: Message as HTML Hi, Is it possible to create Torus (or TorusGeom) and read its mesh (vertices, indices)? best regards, krystian
 Re: [cgkit-user] torus mesh From: Matthias Baas - 2007-04-12 11:22:40 Krystian Samp wrote: > Is it possible to create Torus (or TorusGeom) and read its mesh > (vertices, indices)? Yes, but you have to convert the geom into a mesh. One way to do that is the following: >>> from cgkit.all import * >>> t=Torus() >>> convertToTriMesh(t) >>> for v in t.verts: print v ... (1.1, 0, 0) (1.07071, 0, 0.0707107) (1, 0, 0.1) ... >>> for f in t.faces: print f ... (0, 9, 10) (0, 10, 1) (1, 10, 11) ... If you want to keep the torus you can also use the geom's convert method: >>> t=Torus() >>> tm = TriMeshGeom() >>> t.geom.convert(tm) >>> for v in tm.verts: print v ... (1.1, 0, 0) (1.07071, 0, 0.0707107) (1, 0, 0.1) - Matthias -