Thread: [cgkit-user] torus mesh
Brought to you by:
mbaas
From: Krystian S. <sam...@gm...> - 2007-04-10 21:36:25
|
Hi, Is it possible to create Torus (or TorusGeom) and read its mesh (vertices, indices)? best regards, krystian |
From: Matthias B. <mat...@gm...> - 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 - |