Case Study: Porting a set of point cloud and triangle mesh processing C++ libraries to 64-bit platform

Evgeniy Ryzhkov
Articles: 109



Abstract

Italian company E.G.S. S.r.l. deals with development of solutions in the field of simulation of triangle mesh-based 3D objects.

Introduction

Italian company E.G.S. S.r.l. deals with development of solutions in the field of simulation of triangle mesh-based 3D objects.

Picture 1313245

For this purpose it uses its own component library Leios Components. When company E.G.S. S.r.l wanted to issue a 64-bit version of its components it turned to OOO "Program Verification Systems" as it is a company specializing in the field of development of code analyzers for 64-bit applications and parallel ones.

Leios Components library

Picture 1312969

Leios Components library is a set of different libraries:

  • Leios Point Cloud and Triangular Mesh API, LMLib.
  • Leios Surface Fitting Library.
  • Leios Sharp Edges Library.

The total volume of source code is 13 Mb (440 000 code lines), the solution consists of several dozens projects. It's obvious that manual porting of such amount to a 64-bit system is rather difficult, especially if you take into account the complexity of mathematical algorithms.

In order to learn the code type which the library contains one should just check main capacities of three mentioned above components.

Leios Point Cloud and Triangular Mesh API

  • Point cloud and triangle mesh import/export (ASCII, STL, PLY, OBJ, VRML formats and native Leios RVE format.
  • Mesh data acquisition.
  • Elementary mesh editing operations.
  • Point cloud and triangle mesh selection operations.
  • Point cloud filtering, noise cleaning, smoothing, offset.
Picture 1313326
  • Point cloud triangulation.
  • Triangle mesh healing, hole filling, smoothing.
Picture 1313396
  • Triangle mesh decimation and refinement.
Picture 1313349
  • Cross sections of a triangle mesh by a plane, mesh subdivision by a plane.
  • Fitting mesh parts to plane, cylinder, or sphere surfaces.
Picture 1313276
  • Merging several point clouds or triangle meshes into a single object.
  • Point cloud and triangle mesh OpenGL visualization.
  • Registration of triangle meshes or point clouds.
Picture 1313005
  • Constrained "2.5d" triangulation procedures.
  • Point Cloud triangulation within given external contour.
  • "out-of-core" implementation to edit big point clouds in 32bit environment.
  • Triangulation between two polylines.
  • Procedure yielding mesh self-intersections.
  • Procedure yielding intersection polylines of two meshes.
  • Polyline smoothing and decimation procedures.
  • Procedure yielding mesh cross section through two points on the mesh.
  • Import-Export routines with double-precision center-of-mass coordinates.
  • Automatic scan merging procedure.

Leios Surface Fitting Library

Extension library for managing the untrimmed NURBS surfaces fitting using

  • Specification of the sets of 4 bound limits on the triangle meshes.
  • Automatic surfaces fitting with automatic distribution of the nurbs patches.
Picture 1313454

Leios Sharp Edges Library

Extension library for

  • Automatic extraction of the fillets curves (bounds curves, central curve on the mesh, theoretical sharp edge curves) on the triangle meshes models
  • Segmentation of the triangles meshes into areas without fillets that can be fitted with untrimmed NURBS surfaces.
Picture 1316598

The necessity of library components migration to a 64-bit platform

E.G.S. S.r.l. company has been concerned with solutions development since 2002 when its first office was opened in Italy. Since the first steps of its work the developments has been directed to high-performance desktop systems.

Minimal PC with which a E.G.S. S.r.l. solution is able to work possesses the following configuration (according to the data acquired in the beginning of 2008):

  • Processor: Intel Core Duo T2300 or higher, AMD X2 3800+ or higher.
  • Memory: 2GB
  • Graphic Card: Nvidia Quadro / 6x series or higher, ATI/AMD "x" series / FireGL or higher.
  • Operating System: Windows XP Professional SP2 or higher, Windows Vista

As the volume of data being processed has been growing, 32-bit version RAM limitations (not exceeding 3 Gb) certainly turned out to be insufficient for serious projects. That's why the necessity to release a 64-bit version seemed to be unquestionable for the E.G.S. S.r.l. administration. However, the chance to produce such a version in a short time remained doubtful. It was next to impossible to verify such amount of code manually.

Participation of OOO "Program Verification Systems" in component library migration

Specialists of OOO "Program Verification Systems" came to rescue. They used Viva64 code analyzer for code migration to a 64-bit platform.

Software product Viva64 provides with error diagnostics. It deals with errors specific for 64-bit Windows applications. Viva64 is a lint-like static C/C++ code analyzer. Fields of Viva64 application are the following: verification of new 64-bit program solutions, assistance with porting of a 32-bit code to a 64-bit system, code optimization taking into account peculiarities of 64-bit architectures.

Using Viva64 specialists of OOO "Program Verification Systems" furnished rapid migration of library components, discovered and corrected problem parts in the library's source code. So, only several persons took part in migration of such a huge and complex library.

Code migration using Viva64 allowed to have saved much time which might have been spent for manual code verification. The main thing is not to make new program errors which tend to appear when a migration to a new platform takes place.

The basic problem points discovered while analyzing code:

  • calculation algorithms peculiarities manifesting when large amounts of data are being processed;
  • processing of large-sized files;
  • processing of highly-triangulated 3-D models (the larger is the number of triangles, the more precise is the model)
  • functioning of licensing subsystem;

All the problems discovered with the help of Viva64 analyzer were corrected, due to this the 64-bit version of high-quality Leios Studio was released in time.

E.G.S. S.r.l. is a private company whose mission is to develop programs and solutions for advanced 3D scanning products processing. The company's offices were opened in Italy and in Moscow in 2002. Website: http://www.egsolutions.com.



Use PVS-Studio to search for bugs in C, C++, and C# code

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;

Evgeniy Ryzhkov
Articles: 109


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;