mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-26 11:05:31 +03:00
Fix compilation errors on Linux platform Squeeze compilation warnings on Linux Fix regressions Back RemoveFaceAttribute for further reasons Fix retrieving of polygon by index Fix applying of location Test case for issue CR23106 Fix memory leak regression 'test bugs vis bug79' occurred due to incorrect memory cleaning of inherited objects by MMgtRaw::Free through BRepMesh_IEdgeTool; Replace BRepMesh_PDiscretRoot by pure pointer to BRepMesh_DiscretRoot; Fix IVtkOCC_ShapeMesher.
90 lines
2.9 KiB
C++
90 lines
2.9 KiB
C++
// Created on: 2014-08-13
|
|
// Created by: Oleg AGASHIN
|
|
// Copyright (c) 2011-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <BRepMesh_EdgeParameterProvider.hxx>
|
|
#include <gp_Pnt.hxx>
|
|
#include <TopoDS_Edge.hxx>
|
|
#include <TopoDS_Face.hxx>
|
|
#include <TColStd_HArray1OfReal.hxx>
|
|
#include <BRep_Tool.hxx>
|
|
#include <BRepAdaptor_Curve.hxx>
|
|
#include <Precision.hxx>
|
|
|
|
//=======================================================================
|
|
//function : Constructor
|
|
//purpose :
|
|
//=======================================================================
|
|
BRepMesh_EdgeParameterProvider::BRepMesh_EdgeParameterProvider(
|
|
const TopoDS_Edge& theEdge,
|
|
const TopoDS_Face& theFace,
|
|
const Handle(TColStd_HArray1OfReal)& theParameters)
|
|
: myParameters(theParameters),
|
|
myIsSameParam(BRep_Tool::SameParameter(theEdge)),
|
|
myScale(1.)
|
|
{
|
|
if (myIsSameParam)
|
|
return;
|
|
|
|
// Extract actual parametric values
|
|
Standard_Real aLastParam;
|
|
BRep_Tool::Range(theEdge, theFace, myFirstParam, aLastParam);
|
|
|
|
myFoundParam = myCurParam = myFirstParam;
|
|
|
|
// Extract parameters stored in polygon
|
|
myOldFirstParam =
|
|
myParameters->Value(myParameters->Lower());
|
|
|
|
const Standard_Real aOldLastParam =
|
|
myParameters->Value(myParameters->Upper());
|
|
|
|
// Calculate scale factor between actual and stored parameters
|
|
if ((myOldFirstParam != myFirstParam || aOldLastParam != aLastParam) &&
|
|
myOldFirstParam != aOldLastParam)
|
|
{
|
|
myScale = (aLastParam - myFirstParam) /
|
|
(aOldLastParam - myOldFirstParam);
|
|
}
|
|
|
|
BRepAdaptor_Curve aCOnS(theEdge, theFace);
|
|
myProjector.Initialize(aCOnS, aCOnS.FirstParameter(),
|
|
aCOnS.LastParameter(), Precision::PConfusion());
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : Parameter
|
|
//purpose :
|
|
//=======================================================================
|
|
Standard_Real BRepMesh_EdgeParameterProvider::Parameter(
|
|
const Standard_Integer theIndex,
|
|
const gp_Pnt& thePoint3d)
|
|
{
|
|
if (myIsSameParam)
|
|
return myParameters->Value(theIndex);
|
|
|
|
// Use scaled
|
|
Standard_Real aPrevParam = myCurParam;
|
|
myCurParam = myFirstParam + myScale *
|
|
(myParameters->Value(theIndex) - myOldFirstParam);
|
|
|
|
myFoundParam += (myCurParam - aPrevParam);
|
|
|
|
myProjector.Perform(thePoint3d, myFoundParam);
|
|
if (myProjector.IsDone())
|
|
myFoundParam = myProjector.Point().Parameter();
|
|
|
|
return myFoundParam;
|
|
}
|