0029817: Documentation - avoid excessive use of "please"
[occt.git] / dox / technical_overview / technical_overview.md
1 Technical Overview {#technical_overview}
2 ========================================
3
4 @tableofcontents
5
6 Open CASCADE Technology (OCCT) is an object-oriented C++ class library designed for rapid production of sophisticated domain-specific CAD/CAM/CAE applications. 
7
8 A typical application developed using OCCT deals with two or three-dimensional (2D or 3D) geometric modeling
9 in general-purpose or specialized Computer Aided Design (CAD) systems, manufacturing
10 or analysis applications, simulation applications, or even illustration tools. 
11
12 @figure{/technical_overview/images/technical_overview_over.png}
13
14 OCCT library is designed to be truly modular and extensible, providing C++ classes for:
15   * Basic data structures (geometric modeling, visualization, interactive selection and application specific services); 
16   * Modeling algorithms; 
17   * Working with mesh (faceted) data; 
18   * Data interoperability with neutral formats (IGES, STEP); 
19
20 The C++ classes and other types are grouped into packages. Packages are organized into toolkits (libraries), to which you can link your application. Finally, toolkits are grouped into seven modules.
21
22 This modular structure is illustrated in the diagram below.
23
24 @figure{/technical_overview/images/technical_overview_schema.png}
25
26 * @ref OCCT_TOVW_SECTION_2 "Foundation Classes" module underlies all other OCCT classes; 
27 * @ref OCCT_TOVW_SECTION_3 "Modeling Data" module supplies data structures to represent 2D and 3D geometric primitives and their compositions into CAD models; 
28 * @ref OCCT_TOVW_SECTION_4 "Modeling Algorithms" module contains a vast range of geometrical and topological algorithms;
29 * @ref OCCT_TOVW_SECTION_4a "Mesh" module implements tessellated  representations of objects;
30 * @ref OCCT_TOVW_SECTION_5 "Visualization" module provides complex mechanisms for graphical data representation;
31 * @ref OCCT_TOVW_SECTION_6 "Data Exchange" module inter-operates with popular data formats and relies on @ref OCCT_TOVW_SECTION_6a "Shape Healing" to improve compatibility between CAD software of different vendors;
32 * @ref OCCT_TOVW_SECTION_7 "Application Framework" module offers ready-to-use solutions for handling application-specific data (user attributes) and commonly used functionality (save/restore, undo/redo, copy/paste, tracking CAD modifications, etc). 
33
34 In addition, @ref OCCT_TOVW_SECTION_8 "Open CASCADE Test Harness", also called Draw, provides an entry point to the library and can be used as a testing tool for its modules.
35
36 @section OCCT_TOVW_SECTION_2 Foundation Classes
37
38 **Foundation Classes** module contains data structures and services used by higher-level Open CASCADE Technology classes:
39
40   * Primitive types, such as Boolean, Character, Integer or Real;
41   * String classes that handle ASCII and Unicode strings;
42   * Collection classes that handle statically or dynamically sized aggregates of data, such as arrays, lists, queues, sets and hash tables (data maps).
43   * Classes providing commonly used numerical algorithms and basic linear algebra calculations (addition, multiplication, transposition of vectors and matrices, solving linear systems etc).
44   * Fundamental types representing physical quantities and supporting date and time information;
45   * Primitive geometry types providing implementation of basic geometric and algebraic entities that define and manipulate elementary data structures. 
46   * Exception classes that describe situations, when the normal execution of program is abandoned;
47
48 This module also provides a variety of general-purpose services, such as:
49   * Safe handling of dynamically created objects, ensuring automatic deletion of unreferenced objects (smart pointers);
50   * Configurable optimized memory manager increasing the performance of applications that intensively use dynamically created objects;
51   * Extended run-time type information (RTTI) mechanism maintaining a full type hierarchy and providing means to iterate over it;
52   * Encapsulation of C++ streams;
53   * Automated management of heap memory by means of specific allocators;
54   * Basic interpreter of expressions facilitating the creation of customized scripting tools, generic definition of expressions, etc.;
55   * Tools for dealing with configuration resource files and customizable message files facilitating  multi-language support in applications;
56   * Progress indication and user break interfaces, giving a possibility even for low-level algorithms to communicate with the user in a universal and convenient way;
57   * and many others...
58
59 See the details in @ref occt_user_guides__foundation_classes "Foundation Classes User's Guide"
60
61 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
62
63 @section OCCT_TOVW_SECTION_3 Modeling Data
64
65 **Modeling Data** supplies data structures to implement boundary representation (BRep) of objects in 3D. In BRep the shape is represented as an aggregation of geometry within topology. The geometry  is understood as a mathematical description of a shape, e.g. as curves and surfaces (simple or canonical, Bezier, NURBS, etc). The topology is a data structure binding geometrical objects together.
66
67 Geometry types and utilities provide geometric data structures and services for:
68  * Description of points, vectors, curves and surfaces:
69          * their positioning in 3D space using axis or coordinate systems, and
70          * their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof.
71  * Creation of parametric curves and surfaces by interpolation and approximation;
72  * Algorithms of direct construction; 
73  * Conversion of curves and surfaces to NURBS form;
74  * Computation of point coordinates on 2D and 3D curves; 
75  * Calculation of extrema between geometric objects. 
76   
77 Topology defines relationships between simple geometric entities.  A shape, which is a basic topological entity, can be divided into components (sub-shapes):
78  * Vertex -- a zero-dimensional shape corresponding to a point;
79  * Edge -- a shape corresponding to a curve and bounded by a vertex at each extremity;
80  * Wire -- a sequence of edges connected by their vertices;
81  * Face -- a part of a plane (in 2D) or a surface (in 3D) bounded by wires;
82  * Shell -- a collection of faces connected by edges of their wire boundaries;
83  * Solid -- a finite closed part of 3D space bounded by shells;
84  * Compound solid -- a collection of solids connected by faces of their shell boundaries.
85
86 Complex shapes can be defined as assemblies of simpler entities.
87
88 See the details in @ref occt_user_guides__modeling_data "Modeling Data User's Guide"
89
90 3D geometric models can be stored in OCCT native BREP format.
91 See @ref occt_user_guides__brep_wp "BREP Format Description White Paper" for details on the format.
92
93 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
94
95 @section OCCT_TOVW_SECTION_4 Modeling Algorithms
96
97 **Modeling Algorithms** module groups a wide range of topological and geometric algorithms used in geometric modeling. Basically, there are two groups of algorithms in Open CASCADE Technology:
98 * High-level modeling routines used in the real design;
99 * Low-level mathematical support functions used as a groundwork for the modeling API;
100
101 * Low-level geometric tools provide the algorithms, which:
102         * Calculate the intersection of two curves, surfaces, or a curve and a surface;
103         * Project points onto 2D and 3D curves, points onto surfaces and 3D curves onto surfaces;
104         * Construct lines and circles from constraints;
105         * Construct free-form curves and surfaces from constraints (interpolation, approximation, skinning, gap filling, etc);
106   
107 * Low-level topological tools provide the algorithms, which:
108         * Tessellate shapes; 
109         * Check correct definition of shapes; 
110         * Determine the local and global properties of shapes (derivatives, mass-inertia properties, etc); 
111         * Perform affine transformations;
112         * Find planes in which edges are located;
113         * Convert shapes to NURBS geometry;
114         * Sew connected topologies (shells and wires) from separate topological elements (faces and edges).
115
116 Top-level API provides the following functionality: 
117
118 * Construction of Primitives:  
119         * Boxes;
120         * Prisms;
121         * Cylinders;
122         * Cones;
123         * Spheres;
124         * Toruses.
125 * Kinematic Modeling: 
126         * Prisms -- linear sweeps;
127         * Revolutions -- rotational sweeps;
128         * Pipes -- general-form sweeps;
129         * Lofting.
130
131 @figure{/technical_overview/images/0001.png "Shapes containing pipes with variable radius produced by sweeping"}
132
133 * Boolean Operations, which allow creating new shapes from the combinations of source shapes. For two shapes *S1* and *S2*:
134   * *Common* contains all points that are in *S1* and *S2*;
135   * *Fuse* contains all points that are in *S1* or *S2*;
136   * *Cut* contains all points in that are in *S1* and not in *S2*
137    
138 See @ref occt_user_guides__boolean_operations "Boolean Operations" User's Guide for detailed documentation.
139
140 * Algorithms for local modifications such as: 
141   * Hollowing; 
142   * Shelling; 
143   * Creation of tapered shapes using draft angles;
144   * Algorithms to make fillets and chamfers on shape edges, including those with variable radius (chord). 
145
146 * Algorithms for creation of mechanical features, i.e. depressions, protrusions, ribs and grooves or slots along planar or revolution surfaces. 
147
148 @figure{/technical_overview/images/0004.png}
149  
150 See the details in @ref occt_user_guides__modeling_algos "Modeling Algorithms User's Guide".
151
152 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
153
154 @section OCCT_TOVW_SECTION_4a Mesh 
155
156 **Mesh** module provides the functionality to work with tessellated  representations of objects in form of triangular facets. This module contains:
157 - data structures to store surface mesh data associated to shapes and basic algorithms to handle them;
158 - data structures and algorithms to a build triangular surface mesh from *BRep* objects (shapes);
159 - tools for displaying meshes with associated pre- and post-processor data (scalars or vectors).
160
161 Open CASCADE Technology includes two mesh converters:
162 - VRML converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language). Two representation modes are possible: shaded, which presents shapes as sets of triangles computed by the mesh algorithm, or wireframe, which presents shapes as sets of curves.
163 - STL converter translates Open CASCADE shapes to STL files. STL (STtereoLithography) format is widely used for rapid prototyping (3D printing).
164
165 Open CASCADE SAS also offers Advanced Mesh Products:
166 - <a href="http://www.opencascade.com/content/mesh-framework">Open CASCADE Mesh Framework (OMF)</a>
167 - <a href="http://www.opencascade.com/content/express-mesh">Express Mesh</a>
168
169 @figure{/technical_overview/images/0003.png}
170
171 @section OCCT_TOVW_SECTION_5 Visualization
172
173 **Visualization** module provides ready-to-use  algorithms to create graphic presentations from various objects: shapes, meshes, etc. 
174
175 In Open CASCADE Technology visualization is based on the separation of CAD data and its graphical presentation. The presentations can be customized to take the specificity of your application into account.
176
177 The module also supports a fast and powerful interactive selection mechanism. 
178
179 The view facilities provided by OCCT range from low-level tools working with basic geometry and topology (such as NURBS visualization with control points and nodes, rendering of isolines to estimate speed and quality of parameterization, or rendering of a parametric profile of edges) to high-level tools for real time quality rendering of models using ray tracing: shades, reflections, transparency, anti-aliasing, etc.
180
181 Here are just a few examples:
182
183 * Camera-driven view projection and orientation. It is possible to choose between perspective, orthographic and stereographic projection. 
184
185 * Real-time ray tracing technique using recursive Whitted's algorithm and Bounded Volume Hierarchy effective optimization structure. 
186
187 @figure{/technical_overview/images/0002.png, "Real time visualization by ray tracing method"}
188
189 * Support of GLSL shaders. The shader management is fully automatic, like with any other OpenGL resource.
190
191 @figure{/technical_overview/images/0013.png, "Fragment shader implementing custom clipping surface"}
192
193 * Support of standard and custom materials, defined by transparency, diffuse, ambient and specular reflection and refraction index. The latter allows implementing transparent materials, such as glass, diamond and water. 
194
195 @figure{/technical_overview/images/0012.png, "Simulation of a glass cover"}
196
197 * Optimization of rendering performance through the algorithms of: 
198         * View frustum culling, which skips the presentation outside camera at the rendering stage and  
199         * Back face culling, which reduces the rendered number of triangles and eliminates artifacts at shape boundaries. 
200         
201 * Definition of clipping planes through the plane equation coefficients. Ability to define visual attributes for cross-section at the level or individual clipping planes. In the image below different parts of the rocket are clipped with different planes and hatched.
202
203 * Possibility to flexibly adjust appearance of dimensions in a 3D view. The 3D text object represents a given text string as a true 3D object in the model space.
204
205 @figure{/technical_overview/images/0008.png, "Display of shape cross-section and dimensions"}
206
207 For more details, see @ref occt_user_guides__visualization "Visualization User's Guide".
208
209 The visualization of OCCT topological shapes by means of VTK library provided by VIS component is described in a separate @ref occt_user_guides__vis "VTK Integration Services" User's Guide.
210
211 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
212
213
214 @section OCCT_TOVW_SECTION_6 Data Exchange
215
216 **Data Exchange** allows developing OCCT-based applications that can interact with other CAD systems by writing and reading CAD models to and from external data. The exchanges run smoothly regardless of the quality of external data or requirements to its internal representation, for example, to the data types, accepted geometric inaccuracies, etc.
217
218 @figure{/technical_overview/images/0014.png,"Shape imported from STEP"}
219
220 **Data Exchange** is organized in a modular way as a set of interfaces that comply with various CAD formats: IGES, STEP, STL, VRML, etc. The interfaces allow software based on OCCT to exchange data with various CAD/PDM software packages, maintaining a good level of interoperability.
221
222 * **Standardized Data Exchange** interfaces allow querying and examining the input file, converting its contents to a CAD model and running validity checks on a fully translated shape. The following formats are currently supported.
223         * @ref occt_user_guides__step "STEP" (AP203 : Mechanical Design, this covers General 3D CAD; AP214: Automotive Design) 
224         * @ref occt_user_guides__iges "IGES" (up to 5.3) 
225         * VRML and STL meshes. 
226 * @ref occt_user_guides__xde "Extended data exchange" (XDE) allows translating  additional attributes attached to geometric data (colors, layers, names, materials etc).
227 * <a href="http://www.opencascade.com/content/advanced-data-exchange-components">Advanced Data Exchange Components</a> are available in addition to standard Data Exchange interfaces to support interoperability and data adaptation (also using @ref OCCT_TOVW_SECTION_6a "Shape Healing") with CAD software using the following proprietary formats:
228         * <a href="http://www.opencascade.com/content/acis-sat-import-export">ACIS SAT</a>
229         * <a href="http://www.opencascade.com/content/parasolid-import">Parasolid</a>
230         * <a href="http://www.opencascade.com/content/dxf-import-export">DXF</a> 
231
232 These components are based on the same architecture as interfaces with STEP and IGES.
233
234 @section OCCT_TOVW_SECTION_6a Shape Healing
235
236 **Shape Healing** library provides algorithms to correct and adapt the geometry and topology of shapes imported to OCCT from other CAD systems. 
237
238 Shape Healing algorithms include, but are not limited to, the following operations:
239 * analyze shape characteristics and, in particular, identify the shapes that do not comply with OCCT geometry and topology  validity rules by analyzing geometrical objects and topology: 
240         - check edge and wire consistency;
241         - check edge order in a wire;
242         - check the orientation of face boundaries;
243         - analyze shape tolerances;
244         - identify closed and open wires in a boundary.
245 * fix incorrect or incomplete shapes:
246         - provide consistency between a 3D curve and its corresponding parametric curve;
247         - repair defective wires;
248         - fit the shapes to a user-defined tolerance value;
249         - fill gaps between patches and edges. 
250 * upgrade and change shape characteristics:
251         - reduce curve and surface degree;
252         - split shapes to obtain C1 continuity;
253         - convert any types of curves or surfaces to Bezier or B-Spline curves or surfaces and back;
254         - split closed surfaces and revolution surfaces.
255
256 Each sub-domain of Shape Healing has its own scope of functionality:
257
258 | Sub-domain | Description | Impact on the shape |
259 | :--- | :---- | :---- |
260 | Analysis | Explores shape properties, computes shape features, detects violation of OCCT requirements. | The shape itself is not modified. |
261 | Fixing  | Fixes the shape to meet the OCCT requirements. | The shape may change its original form: modification, removal or creation of sub-shapes, etc.) |
262 | Upgrade | Improves the shape to fit some particular algorithms. | The shape is replaced with a new one, but geometrically they are the same. |
263 | Customization | Modifies the shape representation to fit specific needs. | The shape is not modified, only the mathematical form of its internal representation is changed. |
264 | Processing | Mechanism of shape modification via a user-editable resource file. | |
265
266 For more details, refer to @ref occt_user_guides__shape_healing "Shape Healing User's guide".
267
268 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
269
270
271 @section OCCT_TOVW_SECTION_7 Application Framework
272
273 **Open CASCADE Application Framework** (OCAF) handles Application Data basing on the Application/Document paradigm. It uses an associativity engine to simplify the development of a CAD application thanks to the following ready-to-use features and services:
274
275 * Data attributes managing the application data, which can be organized according to the development needs; 
276 * Data storage and persistence (open/save); 
277 * Possibility to modify and recompute attributes in documents. With OCAF it is easy to represent the history of modification and parametric dependencies within your model;
278 * Possibility to manage multiple documents;  
279 * Predefined attributes common to CAD/CAM/CAE applications (e.g. to store dimensions);
280 * Undo-Redo and Copy-Paste functions.
281
282 Since OCAF handles the application structure, the only development task is the creation of application-specific data and GUIs. 
283
284 OCAF differs from any other CAD framework in the organization of application data, as there the data structures are based on reference keys rather than on shapes. In a model, such attributes as shape data, color and material are attached to an invariant structure, which is deeper than the shapes. A shape object becomes the value of *Shape* attribute, in the same way as an integer number is the value of *Integer* attribute and a string is the value of *Name* attribute.
285
286 OCAF organizes and embeds these attributes in a document. OCAF documents, in their turn, are managed by an OCAF application.
287
288 For more details, see @ref occt_user_guides__ocaf "OCAF User's Guide". 
289
290 See also: our <a href="http://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
291
292
293 @section OCCT_TOVW_SECTION_8 Draw Test Harness
294
295 **Test Harness** or **Draw** is a convenient testing tool for OCCT libraries. It can be used to test and prototype various algorithms before building an entire application. It includes:
296 - A command interpreter based on the TCL language;
297 - A number of 2D and 3D viewers;
298 - A set of predefined commands.
299
300 The viewers support operations such as zoom, pan, rotation and full-screen views.
301
302 The basic commands provide general-purpose services such as:
303 - Getting help;
304 - Evaluating a script from a file;
305 - Capturing commands in a file;
306 - Managing views;
307 - Displaying objects.
308
309 In addition, **Test Harness** provides commands to create and manipulate curves and surfaces (geometry) and shapes, access visualization services, work with OCAF documents, perform data exchange, etc.
310
311 You can add custom commands to test or demonstrate any new functionalities, which you develop.
312
313 For more details, see @ref occt_user_guides__test_harness "Draw Test Harness Manual".