Frequently Asked: What is OdGiGeometrySimplifier and the geometry simplification levels?
November 30, 2017
The OdGiGeometrySimplifier class (in Teigha examples/extensions source code) is frequently used inside a geometry conveyor to transform Gi geometry primitives into simpler forms. For example, polygons can be simplified into a set of triangles; text can be simplified into a set of triangles and polylines, and so on. The simplification method for each kind of geometry primitive after simplification calls virtual methods for a simpler level of geometry.
This topic describes which methods actually can be called by primitive simplification methods and is helpful in understanding which methods of OdGiGeometrySimplifier must be overridden to take geometry with the required level of simplification.
A geometry conveyor can contain high-level geometry primitives (complex primitives that will be simplified into a set of low-level geometry primitives) and low-level geometry primitives (that can be simplified into a set of non-conveyor primitives).
High-level geometry primitives are edges, rows of dots, polypoints, text, raster images, plines and TrueType font polydraws. These primitives are simplified into low-level conveyor geometry primitives.
Low-level geometry primitives are circles, circle arcs, elliptical arcs, nurbs curves, polylines, polygon shells and meshes. These primitives are simplified into non-conveyor geometry primitives.
The next simplification step is the set of generateXXX methods. They are called for complex primitives such as shells and meshes. These methods are called after checking which kind of geometry is required for output (is primitive filled or outlined), and they delegate the sub-primitives simplification for the next level of methods.
The next simplification step is actual for shell/mesh face generation. The shellFaceOut/meshFaceOut methods execute face triangulation and output the resulting triangulation using the triangleOut method.
The triangleOut/polylineOut methods with indexes in the method arguments are called as a result of shell/mesh primitive simplification. They call the polygonOut/polylineOut methods with a vertex list in the arguments list if these methods are not overridden.
The final point of simplification levels are the polygonOut/polylineOut methods. They surely must be overridden if member code hasn’t overridden the previous simplification levels. If polygonOut is called but it is not overridden, it can call the shellProc method, and if client code hasn’t overridden the other simplification levels, the application can enter into an infinite loop. The polylineOut method will generate an assert message (for debug configurations only) if it is called but not overridden in member code.