1 // Created on: 2016-04-19
2 // Copyright (c) 2016 OPEN CASCADE SAS
3 // Created by: Oleg AGASHIN
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <BRepMesh_EdgeTessellationExtractor.hxx>
17 #include <BRepMesh_ShapeTool.hxx>
19 #include <BRep_Tool.hxx>
20 #include <IMeshData_Face.hxx>
21 #include <IMeshData_Edge.hxx>
23 //=======================================================================
24 //function : Constructor
26 //=======================================================================
27 BRepMesh_EdgeTessellationExtractor::BRepMesh_EdgeTessellationExtractor (
28 const IMeshData::IEdgeHandle& theEdge,
29 const IMeshData::IFaceHandle& theFace)
31 Handle (Poly_Triangulation) aTriangulation =
32 BRep_Tool::Triangulation (theFace->GetFace(), myLoc);
34 Handle (Poly_PolygonOnTriangulation) aPolygon =
35 BRep_Tool::PolygonOnTriangulation (theEdge->GetEdge(), aTriangulation, myLoc);
37 myNodes = &aTriangulation->Nodes ();
38 myIndices = &aPolygon->Nodes ();
39 myProvider.Init (theEdge, TopAbs_FORWARD, theFace, aPolygon->Parameters ());
42 //=======================================================================
43 //function : Constructor
45 //=======================================================================
46 BRepMesh_EdgeTessellationExtractor::~BRepMesh_EdgeTessellationExtractor ()
50 //=======================================================================
53 //=======================================================================
54 Standard_Integer BRepMesh_EdgeTessellationExtractor::PointsNb () const
56 return myIndices->Size ();
59 //=======================================================================
62 //=======================================================================
63 Standard_Boolean BRepMesh_EdgeTessellationExtractor::Value (
64 const Standard_Integer theIndex,
66 Standard_Real& theParameter) const
68 const gp_Pnt& theRefPnt = (*myNodes) ((*myIndices) (theIndex));
69 thePoint = BRepMesh_ShapeTool::UseLocation (theRefPnt, myLoc);
71 theParameter = myProvider.Parameter (theIndex, thePoint);