# Article : Projection Problem, Algorithm and Solution

Projection Problem, Algorithm and Solution
By Shen Zhong
26/08/2002

Subject: This document discusses algorithm and solutions for resolving the problems in calculating projection of any closed geometric shape onto a given plane by using Open CASCADE. I provide two solutions for this purpose named HLR and Poly respectively. Additionally, it doesn’t give detail coding and algorithm complexity analysis. I hope that this new version have some better performance than old one by:
• Reducing calculation burden;
• Taking advantage of “Handle” classes and save memory usage;
• Fully controlling the tolerance.

Keywords: Open CASCADE, projection, exploration of outline, HLR (hidden line remove), 3D curve, 3D point, algorithm complexity, coordinate system transformation, Handle and Handle classes and so on.

Background: Open CASCADE provides some classes for projecting geometric objects onto curve or surface. These classes include:
• Geom2dAPI_ProjectPointOnCurve – dealing with calculating projection of a 2D point onto a 2D curve;
• GeomAPI_ProjectPointOnCurve – handling projecting a 3D point onto 3D curve;
• GeomAPI_ProjectPointOnSurf – like before one, this class deal with projecting a 3D point onto 3D surface;
• BRepOffsetAPI_NormalProjection – framing to define projection of an edge or wire onto a face.

Obviously however, it doesn’t provide any direct algorithm or solution for projection of 3D shape on a given plane. The 3D shape is normally represented as TopoDS_Shape. In some geometric checking functions for IBP and IBS, the projection of shape is essential and crucial such as calculating area of staircase or projecting area of shield slab. From last week training, we grab some important concepts about Open CASCADE classes and data structure, which is useful in creating general projection of shape. According to trainer advice, I researched and redesigned the algorithm of projection on the base of early projection solution. The new algorithm need modify about 80% code of old solution with more circumspection.

Description:

Current design for projection has two solutions named HLR solution and Poly solution. The former is implemented by using HLRBRep_Algo or HLRBRep_HLRToShape class of Open CASCADE and can deal with any shape including plane-consist shape and curve-surface shape. On contrast, the latter one only handle the plane-consist shape using BRepOffsetAPI_NormalProjection and functions made by myself with better performance compared with the former.
......