-- Jayesh
On Wed, Jun 15, 2011 at 11:29 AM, Thomas Paviot <tpav...@gmail.com> wrote: > 2011/6/14 Jayesh Salvi <jayeshsa...@gmail.com> >> >> > >> > I mean 'hazardous' because there might be a confusion between the CGAL >> > and >> > pythonOCC (BRep) data models. >> > >> > Reading your github repos, I see that the Sphere class inherits from >> > Polyhedron. But a sphere is *not* a polyhedron, whereas its tesselation >> > is. >> > Polyhderons have flat faces and straight edges. >> > >> > According to me, 'simple' API means: easy to learn, enabling few lines >> > of >> > well readable code to achieve expectations. It must be semantically >> > explicit >> > and unambiguous (which is not the case if you make the Sphere and >> > Cylinder >> > classes inherit from PolyHedron). >> >> Oh I see what you are saying. This answers some questions I had. >> >> IIUC, you are saying that the name Polyhedron implies only topology, >> which sphere and cylinder are topology+geometry. Is that correct? > > For the difference between geometry ans topology, I suggest the reading of > Roman's blog: > > http://opencascade.blogspot.com/2009/02/topology-and-geometry-in-open-cascade.html > http://opencascade.blogspot.com/2009/02/topology-and-geometry-in-open-cascade_09.html > That's a great resource. I came to know about it from earlier email in another thread. > >> >> I didn't think about that while naming the base class Polyhedron. I >> think I should rename it to "Primitive". Does that sound ok? > > These are 'BRep Primitives', and the OCC module that creates such primitives > is named 'BRepPrimAPI'. Ok. The Polyhedron base class is meant to be just a collection of methods that are applicable to all kinds of solids e.g. affine transformations and export helper functions (e.g. STL) to various formats. Therefore I've renamed it to "Solid" from "Polyhedron", to avoid confusion. Also in a recent commit, I have exported the Solid class from Cadmium module, so that the user code can use it as a base class of custom solids. For example: https://github.com/jayesh3/cadmium/blob/master/examples/example-010.py > >> >> Moreover could you tell me, is there a way for me to get only the >> topology of sphere/cylinder? As you said, they are tesselations, so >> OpenCASCADE does its best to generate as smooth a surface as possible >> to match the real curvature. But this results in lot of polygons. What >> option do I have to limit or control the number of polygons in the >> tesselations? > > With OCC/pythonOCC, you only handle topology/geometry, never tesselations > unless you explicitely call BRepMesh::Mesh. The 'deflection' parameter of > this function enables modifying the quality of the number of triangles > generated. However, the meshing algorithm does not allow to generate very > small meshes. That's very useful information. I will take a look at how Mesh works to extract the polygon data. I found this code written by you in this context: http://pythonocc.googlecode.com/svn-history/r1125/trunk/src/addons/MSH/Mesh.py Is that a good starting point for this purpose? _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users