@@ -263,6 +263,11 @@ namespace OpenInfraPlatform {
263263 // --------------------------------------------------------------------------------------------
264264
265265 /* ! \brief Converts \c IfcBSplineSurface to a triangualted surface of \c PolyhedronData to be displayed.
266+
267+ The triangulated surface is stored in \c itemData->open_or_closed_polyhedrons.
268+ The mesh grid lines of the surface are stored in \c itemData->polylines.
269+ They visualize the uv-evaluation grid of the surface.
270+
266271 \param[in] surface \c IfcBSplineSurface entity to be interpreted.
267272 \param[in] pos The relative location of the origin of the representation's coordinate system within the geometric context.
268273 \param[out] itemData A pointer to be filled with the relevant data of the triangulated surface (\c PolyhedronData).
@@ -307,10 +312,8 @@ namespace OpenInfraPlatform {
307312 const size_t numCurvePointsV = curvePoints[0 ].size ();
308313
309314
310- // CONVERTION FROM vector<vector<carve::geom::vector<3>>> TO shared_ptr<carve::input::PolylineSetData>
315+ // SURFACE FROM vector<vector<carve::geom::vector<3>>> TO shared_ptr<carve::input::PolylineSetData>
311316
312- // declaration of result variable for polylines
313- std::shared_ptr<carve::input::PolylineSetData> polylineData = std::make_shared<carve::input::PolylineSetData>();
314317 // declaration of result variable for polyhedrons (surface)
315318 std::shared_ptr<carve::input::PolyhedronData> polyhedronData = std::make_shared<carve::input::PolyhedronData>();
316319
@@ -336,16 +339,11 @@ namespace OpenInfraPlatform {
336339 // storage for the 4 point ids of the surface rectangle
337340 size_t indices[4 ];
338341
339- // construct a poly line in polylineData :
342+ // construction of triangulated polyhedron square :
340343 // D<---C v
341344 // ^ ^
342345 // | |
343346 // A--->B 0-->u
344- //
345- // there is no closing line from D to
346-
347- // start a new poly line
348- polylineData->beginPolyline ();
349347
350348 // loop over the 4 conter points
351349 for (size_t k = 0 ; k < 4 ; ++k)
@@ -365,17 +363,12 @@ namespace OpenInfraPlatform {
365363 else
366364 {
367365 // point doesn't exist;
368- // store face-point k in polylineData; addVertex() returns its id, which is stored in indices[k]
369- indices[k] = polylineData->addVertex (facePoints[k]);
370- // store face-point k in polyhedronData; vertex id is identical to vertices of polyline
371- polyhedronData->addVertex (facePoints[k]);
366+ // store face-point k in polyhedronData; addVertex() returns its id, which is stored in indices[k]
367+ indices[k] = polyhedronData->addVertex (facePoints[k]);
372368
373369 // add the string 'key' of the current face point to the internal list, save its id from indices[k]
374370 vertexMap[key.str ()] = indices[k];
375371 }
376-
377- // add obtaind index to polyline
378- polylineData->addPolylineIndex (indices[k]);
379372 }
380373
381374 // add triangle-faces to polyhedron
@@ -384,15 +377,56 @@ namespace OpenInfraPlatform {
384377 }
385378 }
386379
387- // add polylines and polyhedrons to itemData (= return parameter)
388- itemData->polylines .push_back (polylineData);
380+
381+ // MESH_GRID_LINES FROM vector<vector<carve::geom::vector<3>>> TO shared_ptr<carve::input::PolylineSetData>
382+
383+ // declaration of result variable for meshGridLines (source code like polylines)
384+ std::shared_ptr<carve::input::PolylineSetData> meshGridLineData = std::make_shared<carve::input::PolylineSetData>();
385+
386+ // vertex index of meshGridLineData
387+ size_t index = 0 ;
388+
389+ // meshGridLines in u-direction
390+ for (size_t v = 0 ; v < numCurvePointsV; v++)
391+ {
392+ // start a new polyline
393+ meshGridLineData->beginPolyline ();
394+
395+ for (size_t u = 0 ; u < numCurvePointsU; u++)
396+ {
397+ // all vertices are new in meshGridLineData, thus use addVertex()
398+ meshGridLineData->addVertex (curvePoints[u][v]);
399+ meshGridLineData->addPolylineIndex (index);
400+ index++;
401+ }
402+ }
403+
404+ // meshGridLines in v-direction
405+ for (size_t u = 0 ; u < numCurvePointsU; u++)
406+ {
407+ // start a new polyline
408+ meshGridLineData->beginPolyline ();
409+
410+ for (size_t v = 0 ; v < numCurvePointsV; v++)
411+ {
412+ // all vertices are already in meshGridLineData, thus just calculate their indices
413+ meshGridLineData->addPolylineIndex (v * numCurvePointsU + u);
414+ }
415+ }
416+
417+
418+ // ASSEMBLE RESULT
419+
420+ // add meshGridLines to itemData (= return parameter)
421+ itemData->meshGridLines .push_back (meshGridLineData);
422+
423+ // add polyhedrons to itemData (= return parameter)
389424 itemData->open_or_closed_polyhedrons .push_back (polyhedronData);
425+
390426 return ;
391427 } // end if IfcBSplineSurfaceWithKnots
392428
393- // return std::shared_ptr<carve::input::PolylineSetData> polylineData = std::make_shared<carve::input::PolylineSetData>();
394429 throw oip::UnhandledException (surface);
395-
396430 }
397431
398432 /* ! \brief Converts \c IfcCurveBoundedPlane to ...
@@ -746,8 +780,8 @@ namespace OpenInfraPlatform {
746780 // Loop through all faces
747781 for (const auto & face : faces)
748782 {
749- // get mesh data into polyhedron and polyhedronIndices
750- convertIfcFace (face, pos, polyhedron, polyhedronIndices);
783+ // get mesh data into polyhedron, polyhedronIndices and meshGridLines
784+ convertIfcFace (face, pos, polyhedron, polyhedronIndices, itemData-> meshGridLines );
751785 }
752786
753787 // IfcFaceList can be a closed or open shell, so let the calling function decide where to put it
@@ -759,6 +793,7 @@ namespace OpenInfraPlatform {
759793 \param[in] pos The relative location of the origin of the representation's coordinate system within the geometric context.
760794 \param[in,out] polyhedron \c Carve polyhedron of the converted faces.
761795 \param[in,out] polyhedronIndices Contains coordinates and indices of polyhedron vertices.
796+ \param[in,out] meshGridLines Contains square mesh lines of uv-evaluation grid, i.e. at B-spline surface.
762797
763798
764799 <b>About \c polyhedron and \c polyhedronIndices</b> \n
@@ -780,15 +815,17 @@ namespace OpenInfraPlatform {
780815 void convertIfcFace (const EXPRESSReference<typename IfcEntityTypesT::IfcFace>& face,
781816 const carve::math::Matrix& pos,
782817 std::shared_ptr<carve::input::PolyhedronData>& polyhedron,
783- std::map<std::string, uint32_t >& polyhedronIndices) const noexcept (false )
818+ std::map<std::string, uint32_t >& polyhedronIndices,
819+ std::vector<std::shared_ptr<carve::input::PolylineSetData>>& meshGridLines
820+ ) const noexcept (false )
784821 {
785822 if (face.expired ()) {
786823 throw oip::ReferenceExpiredException (face);
787824 }
788825
789826 if (face.isOfType <typename IfcEntityTypesT::IfcFaceSurface>())
790827 {
791- convertIfcFaceSurface (face.as <typename IfcEntityTypesT::IfcFaceSurface>(), pos, polyhedron, polyhedronIndices);
828+ convertIfcFaceSurface (face.as <typename IfcEntityTypesT::IfcFaceSurface>(), pos, polyhedron, polyhedronIndices, meshGridLines );
792829 }
793830 else
794831 {
@@ -819,6 +856,7 @@ namespace OpenInfraPlatform {
819856 \param[in] pos The relative location of the origin of the representation's coordinate system within the geometric context.
820857 \param[in,out] polyhedron \c Carve polyhedron of the converted faces.
821858 \param[in,out] polyhedronIndices Contains coordinates and indices of polyhedron vertices.
859+ \param[in,out] meshGridLines Contains square mesh lines of uv-evaluation grid, i.e. at B-spline surface.
822860
823861 \see
824862 The parameters \p polyhedron and \p polyhedronIndices are described in more detail in the description of convertIfcFace().
@@ -827,7 +865,8 @@ namespace OpenInfraPlatform {
827865 const EXPRESSReference<typename IfcEntityTypesT::IfcFaceSurface>& faceSurface,
828866 const carve::math::Matrix& pos,
829867 std::shared_ptr<carve::input::PolyhedronData>& polyhedron,
830- std::map<std::string, uint32_t >& polyhedronIndices
868+ std::map<std::string, uint32_t >& polyhedronIndices,
869+ std::vector<std::shared_ptr<carve::input::PolylineSetData>>& meshGridLines
831870 ) const noexcept (false )
832871 {
833872 if (faceSurface.expired ()) {
@@ -836,11 +875,11 @@ namespace OpenInfraPlatform {
836875
837876 if (faceSurface.isOfType <typename IfcEntityTypesT::IfcAdvancedFace>())
838877 {
839- convertIfcAdvancedFace (faceSurface.as <typename IfcEntityTypesT::IfcAdvancedFace>(), pos, polyhedron, polyhedronIndices);
878+ convertIfcAdvancedFace (faceSurface.as <typename IfcEntityTypesT::IfcAdvancedFace>(), pos, polyhedron, polyhedronIndices, meshGridLines );
840879 }
841880 else
842881 {
843- computeIfcFaceSurface (faceSurface, pos, polyhedron, polyhedronIndices);
882+ computeIfcFaceSurface (faceSurface, pos, polyhedron, polyhedronIndices, meshGridLines );
844883 }
845884 }
846885
@@ -849,6 +888,7 @@ namespace OpenInfraPlatform {
849888 \param[in] pos The relative location of the origin of the representation's coordinate system within the geometric context.
850889 \param[in,out] polyhedron \c Carve polyhedron of the converted faces.
851890 \param[in,out] polyhedronIndices Contains coordinates and indices of polyhedron vertices.
891+ \param[in,out] meshGridLines Contains square mesh lines of uv-evaluation grid, i.e. at B-spline surface.
852892
853893 \see
854894 The parameters \p polyhedron and \p polyhedronIndices are described in more detail in the description of convertIfcFace().
@@ -857,7 +897,8 @@ namespace OpenInfraPlatform {
857897 const EXPRESSReference<typename IfcEntityTypesT::IfcAdvancedFace>& advancedFace,
858898 const carve::math::Matrix& pos,
859899 std::shared_ptr<carve::input::PolyhedronData>& polyhedron,
860- std::map<std::string, uint32_t >& polyhedronIndices
900+ std::map<std::string, uint32_t >& polyhedronIndices,
901+ std::vector<std::shared_ptr<carve::input::PolylineSetData>>& meshGridLines
861902 ) const noexcept (false )
862903 {
863904 if (advancedFace.expired ()) {
@@ -883,7 +924,7 @@ namespace OpenInfraPlatform {
883924 throw oip::InconsistentModellingException (advancedFace, " IfcAdvancedFace has a surface type as face surface which is not allowed." );
884925 }
885926
886- computeIfcFaceSurface (advancedFace, pos, polyhedron, polyhedronIndices);
927+ computeIfcFaceSurface (advancedFace, pos, polyhedron, polyhedronIndices, meshGridLines );
887928 }
888929
889930 /* ! \brief Checks whether all points of the \c faceBoundLoops exist coincident in the surface geometry of \c itemDataSurface.
@@ -1491,6 +1532,7 @@ namespace OpenInfraPlatform {
14911532 \param[in] pos The relative location of the origin of the representation's coordinate system within the geometric context.
14921533 \param[in,out] polyhedron \c Carve polyhedron of the converted faces.
14931534 \param[in,out] polyhedronIndices Contains coordinates and indices of polyhedron vertices.
1535+ \param[in,out] meshGridLines Contains square mesh lines of uv-evaluation grid, i.e. at B-spline surface.
14941536
14951537 \see
14961538 The parameters \p polyhedron and \p polyhedronIndices are described in more detail in the description of convertIfcFace().
@@ -1499,7 +1541,8 @@ namespace OpenInfraPlatform {
14991541 const EXPRESSReference<typename IfcEntityTypesT::IfcFaceSurface>& ifcFaceSurface,
15001542 const carve::math::Matrix& pos,
15011543 std::shared_ptr<carve::input::PolyhedronData>& polyhedron,
1502- std::map<std::string, uint32_t >& polyhedronIndices
1544+ std::map<std::string, uint32_t >& polyhedronIndices,
1545+ std::vector<std::shared_ptr<carve::input::PolylineSetData>>& meshGridLines
15031546 ) const noexcept (false )
15041547 {
15051548 if (ifcFaceSurface.expired ()) {
@@ -1539,6 +1582,9 @@ namespace OpenInfraPlatform {
15391582
15401583 // append surface-faces to target polyhedron
15411584 inputDataFaceSurface->mergePolyhedronsIntoOnePolyhedron (polyhedron, polyhedronIndices);
1585+
1586+ // append meshGridLine from temporal inputDataFaceSurface to meshGridLines (copies shared pointers)
1587+ std::copy (inputDataFaceSurface->meshGridLines .begin (), inputDataFaceSurface->meshGridLines .end (), std::back_inserter (meshGridLines));
15421588 }
15431589 }
15441590
0 commit comments