mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-07 05:08:13 +08:00
Modeling Data - Enforce construction-time initialization for Prop and GridEval classes (#1118)
Replace two-step initialization (default constructor + Initialize) with direct construction for 8 non-copyable/non-movable property and grid evaluator classes. Objects are now always in a valid state after construction. Refactored classes: - GeomProp_Curve, GeomProp_Surface (TKG3d) - Geom2dProp_Curve (TKG2d) - BRepProp_Curve, BRepProp_Surface (TKBRep) - GeomGridEval_Curve, GeomGridEval_Surface (TKG3d) - Geom2dGridEval_Curve (TKG2d) Changes per class: - Remove default constructor and IsInitialized() method. - Add constructors matching each former Initialize overload. - Rename Initialize to protected initialization method for internal and derived class use. All callers updated across production code (Extrema, BndLib, IntCurveSurface, IntPatch, HLRBRep, GeomGridEval derived classes) and test files to use constructor-based initialization.
This commit is contained in:
+2
-4
@@ -87,8 +87,7 @@ void IntCurveSurface_ThePolyhedronOfHInter::Init(const occ::handle<Adaptor3d_Sur
|
||||
const double V1)
|
||||
{
|
||||
// Initialize grid evaluator with surface
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(*Surface);
|
||||
GeomGridEval_Surface anEval(*Surface);
|
||||
|
||||
PolyUtils::InitUniform(anEval,
|
||||
U0,
|
||||
@@ -118,8 +117,7 @@ void IntCurveSurface_ThePolyhedronOfHInter::Init(const occ::handle<Adaptor3d_Sur
|
||||
const NCollection_Array1<double>& Vpars)
|
||||
{
|
||||
// Initialize grid evaluator with surface
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(*Surface);
|
||||
GeomGridEval_Surface anEval(*Surface);
|
||||
|
||||
PolyUtils::InitWithParams(anEval,
|
||||
Upars,
|
||||
|
||||
@@ -108,8 +108,7 @@ IntPatch_Polyhedron::IntPatch_Polyhedron(const occ::handle<Adaptor3d_Surface>& S
|
||||
}
|
||||
|
||||
// Use grid evaluator for batch point evaluation
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(*Surface);
|
||||
GeomGridEval_Surface anEval(*Surface);
|
||||
NCollection_Array2<gp_Pnt> aGridPnts = anEval.EvaluateGrid(aUParams, aVParams);
|
||||
|
||||
// Copy to internal arrays and build bounding box
|
||||
@@ -179,8 +178,7 @@ IntPatch_Polyhedron::IntPatch_Polyhedron(const occ::handle<Adaptor3d_Surface>& S
|
||||
}
|
||||
|
||||
// Use grid evaluator for batch point evaluation
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(*Surface);
|
||||
GeomGridEval_Surface anEval(*Surface);
|
||||
NCollection_Array2<gp_Pnt> aGridPnts = anEval.EvaluateGrid(aUParams, aVParams);
|
||||
|
||||
// Copy to internal arrays and build bounding box
|
||||
|
||||
@@ -86,8 +86,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(HLRBRep_Surface* Surface,
|
||||
const double V1)
|
||||
{
|
||||
// Initialize grid evaluator with the underlying BRepAdaptor_Surface
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(Surface->Surface());
|
||||
GeomGridEval_Surface anEval(Surface->Surface());
|
||||
|
||||
PolyUtils::InitUniform(anEval,
|
||||
U0,
|
||||
@@ -117,8 +116,7 @@ void HLRBRep_ThePolyhedronOfInterCSurf::Init(HLRBRep_Surface* S
|
||||
const NCollection_Array1<double>& Vpars)
|
||||
{
|
||||
// Initialize grid evaluator with the underlying BRepAdaptor_Surface
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(Surface->Surface());
|
||||
GeomGridEval_Surface anEval(Surface->Surface());
|
||||
|
||||
PolyUtils::InitWithParams(anEval,
|
||||
Upars,
|
||||
|
||||
@@ -22,7 +22,28 @@
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Curve::Initialize(const TopoDS_Edge& theEdge)
|
||||
BRepProp_Curve::BRepProp_Curve(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
initialization(theEdge);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
BRepProp_Curve::BRepProp_Curve(const BRepAdaptor_Curve& theCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
BRepProp_Curve::BRepProp_Curve(const occ::handle<BRepAdaptor_Curve>& theCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Curve::initialization(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (theEdge.IsNull())
|
||||
{
|
||||
@@ -36,7 +57,7 @@ void BRepProp_Curve::Initialize(const TopoDS_Edge& theEdge)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Curve::Initialize(const BRepAdaptor_Curve& theCurve)
|
||||
void BRepProp_Curve::initialization(const BRepAdaptor_Curve& theCurve)
|
||||
{
|
||||
myOwned.Nullify();
|
||||
myPtr = &theCurve;
|
||||
@@ -44,7 +65,7 @@ void BRepProp_Curve::Initialize(const BRepAdaptor_Curve& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Curve::Initialize(const occ::handle<BRepAdaptor_Curve>& theCurve)
|
||||
void BRepProp_Curve::initialization(const occ::handle<BRepAdaptor_Curve>& theCurve)
|
||||
{
|
||||
myOwned = theCurve;
|
||||
myPtr = myOwned.get();
|
||||
@@ -54,10 +75,6 @@ void BRepProp_Curve::Initialize(const occ::handle<BRepAdaptor_Curve>& theCurve)
|
||||
|
||||
GeomProp::TangentResult BRepProp_Curve::Tangent(const double theParam, const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
{
|
||||
return {{}, false};
|
||||
}
|
||||
gp_Pnt aPnt;
|
||||
gp_Vec aD1, aD2, aD3;
|
||||
myPtr->D3(theParam, aPnt, aD1, aD2, aD3);
|
||||
@@ -69,10 +86,6 @@ GeomProp::TangentResult BRepProp_Curve::Tangent(const double theParam, const dou
|
||||
GeomProp::CurvatureResult BRepProp_Curve::Curvature(const double theParam,
|
||||
const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
gp_Pnt aPnt;
|
||||
gp_Vec aD1, aD2;
|
||||
myPtr->D2(theParam, aPnt, aD1, aD2);
|
||||
@@ -83,10 +96,6 @@ GeomProp::CurvatureResult BRepProp_Curve::Curvature(const double theParam,
|
||||
|
||||
GeomProp::NormalResult BRepProp_Curve::Normal(const double theParam, const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
{
|
||||
return {{}, false};
|
||||
}
|
||||
gp_Pnt aPnt;
|
||||
gp_Vec aD1, aD2;
|
||||
myPtr->D2(theParam, aPnt, aD1, aD2);
|
||||
@@ -98,10 +107,6 @@ GeomProp::NormalResult BRepProp_Curve::Normal(const double theParam, const doubl
|
||||
GeomProp::CentreResult BRepProp_Curve::CentreOfCurvature(const double theParam,
|
||||
const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
{
|
||||
return {{}, false};
|
||||
}
|
||||
gp_Pnt aPnt;
|
||||
gp_Vec aD1, aD2;
|
||||
myPtr->D2(theParam, aPnt, aD1, aD2);
|
||||
@@ -139,9 +144,8 @@ GeomAbs_Shape BRepProp_Curve::Continuity(const BRepAdaptor_Curve& theCurve1,
|
||||
aN2 = 1;
|
||||
|
||||
// Evaluate properties at junction points.
|
||||
BRepProp_Curve aProp1, aProp2;
|
||||
aProp1.Initialize(theCurve1);
|
||||
aProp2.Initialize(theCurve2);
|
||||
BRepProp_Curve aProp1(theCurve1);
|
||||
BRepProp_Curve aProp2(theCurve2);
|
||||
|
||||
// Check point coincidence.
|
||||
gp_Pnt aPnt1, aPnt2;
|
||||
|
||||
@@ -35,8 +35,7 @@ class TopoDS_Edge;
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! BRepProp_Curve aProp;
|
||||
//! aProp.Initialize(myEdge);
|
||||
//! BRepProp_Curve aProp(myEdge);
|
||||
//! GeomProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
//! if (aCurv.IsDefined)
|
||||
//! {
|
||||
@@ -48,8 +47,21 @@ class BRepProp_Curve
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
BRepProp_Curve() = default;
|
||||
//! Construct from a TopoDS_Edge.
|
||||
//! Creates an internal BRepAdaptor_Curve (owning).
|
||||
//! @param[in] theEdge the edge to evaluate
|
||||
Standard_EXPORT BRepProp_Curve(const TopoDS_Edge& theEdge);
|
||||
|
||||
//! Construct from an existing BRepAdaptor_Curve.
|
||||
//! The adaptor is referenced without copying (non-owning);
|
||||
//! the caller must ensure the adaptor outlives this object.
|
||||
//! @param[in] theCurve the adaptor to reference
|
||||
Standard_EXPORT BRepProp_Curve(const BRepAdaptor_Curve& theCurve);
|
||||
|
||||
//! Construct from a handle to BRepAdaptor_Curve.
|
||||
//! Shares ownership of the adaptor (no copy).
|
||||
//! @param[in] theCurve handle to the adaptor
|
||||
Standard_EXPORT BRepProp_Curve(const occ::handle<BRepAdaptor_Curve>& theCurve);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
BRepProp_Curve(const BRepProp_Curve&) = delete;
|
||||
@@ -57,25 +69,6 @@ public:
|
||||
BRepProp_Curve(BRepProp_Curve&&) = delete;
|
||||
BRepProp_Curve& operator=(BRepProp_Curve&&) = delete;
|
||||
|
||||
//! Initialize from a TopoDS_Edge.
|
||||
//! Creates an internal BRepAdaptor_Curve (owning).
|
||||
//! @param[in] theEdge the edge to evaluate
|
||||
Standard_EXPORT void Initialize(const TopoDS_Edge& theEdge);
|
||||
|
||||
//! Initialize from an existing BRepAdaptor_Curve.
|
||||
//! The adaptor is referenced without copying (non-owning);
|
||||
//! the caller must ensure the adaptor outlives this object.
|
||||
//! @param[in] theCurve the adaptor to reference
|
||||
Standard_EXPORT void Initialize(const BRepAdaptor_Curve& theCurve);
|
||||
|
||||
//! Initialize from a handle to BRepAdaptor_Curve.
|
||||
//! Shares ownership of the adaptor (no copy).
|
||||
//! @param[in] theCurve handle to the adaptor
|
||||
Standard_EXPORT void Initialize(const occ::handle<BRepAdaptor_Curve>& theCurve);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
bool IsInitialized() const { return myPtr != nullptr; }
|
||||
|
||||
//! Returns the underlying adaptor.
|
||||
const BRepAdaptor_Curve& Adaptor() const { return *myPtr; }
|
||||
|
||||
@@ -125,6 +118,19 @@ public:
|
||||
double theU1,
|
||||
double theU2);
|
||||
|
||||
protected:
|
||||
//! Initialize from a TopoDS_Edge.
|
||||
//! @param[in] theEdge the edge to evaluate
|
||||
Standard_EXPORT void initialization(const TopoDS_Edge& theEdge);
|
||||
|
||||
//! Initialize from an existing BRepAdaptor_Curve (non-owning).
|
||||
//! @param[in] theCurve the adaptor to reference
|
||||
Standard_EXPORT void initialization(const BRepAdaptor_Curve& theCurve);
|
||||
|
||||
//! Initialize from a handle to BRepAdaptor_Curve.
|
||||
//! @param[in] theCurve handle to the adaptor
|
||||
Standard_EXPORT void initialization(const occ::handle<BRepAdaptor_Curve>& theCurve);
|
||||
|
||||
private:
|
||||
occ::handle<BRepAdaptor_Curve> myOwned; //!< Owns the adaptor when created from TopoDS_Edge.
|
||||
const BRepAdaptor_Curve* myPtr = nullptr; //!< Non-owning pointer to the active adaptor.
|
||||
|
||||
@@ -17,7 +17,28 @@
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Surface::Initialize(const TopoDS_Face& theFace)
|
||||
BRepProp_Surface::BRepProp_Surface(const TopoDS_Face& theFace)
|
||||
{
|
||||
initialization(theFace);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
BRepProp_Surface::BRepProp_Surface(const BRepAdaptor_Surface& theSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
BRepProp_Surface::BRepProp_Surface(const occ::handle<BRepAdaptor_Surface>& theSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Surface::initialization(const TopoDS_Face& theFace)
|
||||
{
|
||||
if (theFace.IsNull())
|
||||
{
|
||||
@@ -31,7 +52,7 @@ void BRepProp_Surface::Initialize(const TopoDS_Face& theFace)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Surface::Initialize(const BRepAdaptor_Surface& theSurface)
|
||||
void BRepProp_Surface::initialization(const BRepAdaptor_Surface& theSurface)
|
||||
{
|
||||
myOwned.Nullify();
|
||||
myPtr = &theSurface;
|
||||
@@ -39,7 +60,7 @@ void BRepProp_Surface::Initialize(const BRepAdaptor_Surface& theSurface)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void BRepProp_Surface::Initialize(const occ::handle<BRepAdaptor_Surface>& theSurface)
|
||||
void BRepProp_Surface::initialization(const occ::handle<BRepAdaptor_Surface>& theSurface)
|
||||
{
|
||||
myOwned = theSurface;
|
||||
myPtr = myOwned.get();
|
||||
@@ -51,7 +72,7 @@ GeomProp::SurfaceNormalResult BRepProp_Surface::Normal(const double theU,
|
||||
const double theV,
|
||||
const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
if (myPtr == nullptr)
|
||||
{
|
||||
return {{}, false};
|
||||
}
|
||||
@@ -67,7 +88,7 @@ GeomProp::SurfaceCurvatureResult BRepProp_Surface::Curvatures(const double theU,
|
||||
const double theV,
|
||||
const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
if (myPtr == nullptr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
@@ -83,7 +104,7 @@ GeomProp::MeanGaussianResult BRepProp_Surface::MeanGaussian(const double theU,
|
||||
const double theV,
|
||||
const double theTol) const
|
||||
{
|
||||
if (!IsInitialized())
|
||||
if (myPtr == nullptr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ class TopoDS_Face;
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! BRepProp_Surface aProp;
|
||||
//! aProp.Initialize(myFace);
|
||||
//! BRepProp_Surface aProp(myFace);
|
||||
//! GeomProp::SurfaceNormalResult aNorm = aProp.Normal(0.5, 0.5, Precision::Confusion());
|
||||
//! if (aNorm.IsDefined)
|
||||
//! {
|
||||
@@ -47,8 +46,21 @@ class BRepProp_Surface
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
BRepProp_Surface() = default;
|
||||
//! Construct from a TopoDS_Face.
|
||||
//! Creates an internal BRepAdaptor_Surface (owning).
|
||||
//! @param[in] theFace the face to evaluate
|
||||
Standard_EXPORT BRepProp_Surface(const TopoDS_Face& theFace);
|
||||
|
||||
//! Construct from an existing BRepAdaptor_Surface.
|
||||
//! The adaptor is referenced without copying (non-owning);
|
||||
//! the caller must ensure the adaptor outlives this object.
|
||||
//! @param[in] theSurface the adaptor to reference
|
||||
Standard_EXPORT BRepProp_Surface(const BRepAdaptor_Surface& theSurface);
|
||||
|
||||
//! Construct from a handle to BRepAdaptor_Surface.
|
||||
//! Shares ownership of the adaptor (no copy).
|
||||
//! @param[in] theSurface handle to the adaptor
|
||||
Standard_EXPORT BRepProp_Surface(const occ::handle<BRepAdaptor_Surface>& theSurface);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
BRepProp_Surface(const BRepProp_Surface&) = delete;
|
||||
@@ -56,25 +68,6 @@ public:
|
||||
BRepProp_Surface(BRepProp_Surface&&) = delete;
|
||||
BRepProp_Surface& operator=(BRepProp_Surface&&) = delete;
|
||||
|
||||
//! Initialize from a TopoDS_Face.
|
||||
//! Creates an internal BRepAdaptor_Surface (owning).
|
||||
//! @param[in] theFace the face to evaluate
|
||||
Standard_EXPORT void Initialize(const TopoDS_Face& theFace);
|
||||
|
||||
//! Initialize from an existing BRepAdaptor_Surface.
|
||||
//! The adaptor is referenced without copying (non-owning);
|
||||
//! the caller must ensure the adaptor outlives this object.
|
||||
//! @param[in] theSurface the adaptor to reference
|
||||
Standard_EXPORT void Initialize(const BRepAdaptor_Surface& theSurface);
|
||||
|
||||
//! Initialize from a handle to BRepAdaptor_Surface.
|
||||
//! Shares ownership of the adaptor (no copy).
|
||||
//! @param[in] theSurface handle to the adaptor
|
||||
Standard_EXPORT void Initialize(const occ::handle<BRepAdaptor_Surface>& theSurface);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
bool IsInitialized() const { return myPtr != nullptr; }
|
||||
|
||||
//! Returns the underlying adaptor.
|
||||
const BRepAdaptor_Surface& Adaptor() const { return *myPtr; }
|
||||
|
||||
@@ -105,6 +98,19 @@ public:
|
||||
double theV,
|
||||
double theTol) const;
|
||||
|
||||
protected:
|
||||
//! Initialize from a TopoDS_Face.
|
||||
//! @param[in] theFace the face to evaluate
|
||||
Standard_EXPORT void initialization(const TopoDS_Face& theFace);
|
||||
|
||||
//! Initialize from an existing BRepAdaptor_Surface (non-owning).
|
||||
//! @param[in] theSurface the adaptor to reference
|
||||
Standard_EXPORT void initialization(const BRepAdaptor_Surface& theSurface);
|
||||
|
||||
//! Initialize from a handle to BRepAdaptor_Surface.
|
||||
//! @param[in] theSurface handle to the adaptor
|
||||
Standard_EXPORT void initialization(const occ::handle<BRepAdaptor_Surface>& theSurface);
|
||||
|
||||
private:
|
||||
occ::handle<BRepAdaptor_Surface> myOwned; //!< Owns the adaptor when created from TopoDS_Face.
|
||||
const BRepAdaptor_Surface* myPtr = nullptr; //!< Non-owning pointer to the active adaptor.
|
||||
|
||||
@@ -52,31 +52,13 @@ constexpr double THE_POINT_TOL = Precision::Confusion();
|
||||
// BRepProp_Curve tests
|
||||
// ============================================================
|
||||
|
||||
TEST(BRepProp_CurveTest, UninitializedState)
|
||||
{
|
||||
BRepProp_Curve aProp;
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
|
||||
const GeomProp::TangentResult aTan = aProp.Tangent(0.0, THE_LIN_TOL);
|
||||
const GeomProp::CurvatureResult aCurv = aProp.Curvature(0.0, THE_LIN_TOL);
|
||||
const GeomProp::NormalResult aNorm = aProp.Normal(0.0, THE_LIN_TOL);
|
||||
const GeomProp::CentreResult aCent = aProp.CentreOfCurvature(0.0, THE_LIN_TOL);
|
||||
|
||||
EXPECT_FALSE(aTan.IsDefined);
|
||||
EXPECT_FALSE(aCurv.IsDefined);
|
||||
EXPECT_FALSE(aNorm.IsDefined);
|
||||
EXPECT_FALSE(aCent.IsDefined);
|
||||
}
|
||||
|
||||
TEST(BRepProp_CurveTest, InitializeFromEdge_Line)
|
||||
{
|
||||
BRepBuilderAPI_MakeEdge aMakeEdge(gp_Lin(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)), 0.0, 10.0);
|
||||
ASSERT_TRUE(aMakeEdge.IsDone());
|
||||
const TopoDS_Edge& anEdge = aMakeEdge.Edge();
|
||||
|
||||
BRepProp_Curve aProp;
|
||||
aProp.Initialize(anEdge);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Curve aProp(anEdge);
|
||||
|
||||
// Tangent on a line should be defined.
|
||||
const GeomProp::TangentResult aTan = aProp.Tangent(5.0, THE_LIN_TOL);
|
||||
@@ -97,9 +79,7 @@ TEST(BRepProp_CurveTest, InitializeFromEdge_Circle)
|
||||
ASSERT_TRUE(aMakeEdge.IsDone());
|
||||
const TopoDS_Edge& anEdge = aMakeEdge.Edge();
|
||||
|
||||
BRepProp_Curve aProp;
|
||||
aProp.Initialize(anEdge);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Curve aProp(anEdge);
|
||||
|
||||
// Check curvature = 1/R at midpoint.
|
||||
const GeomProp::CurvatureResult aCurv = aProp.Curvature(M_PI, THE_LIN_TOL);
|
||||
@@ -125,9 +105,7 @@ TEST(BRepProp_CurveTest, InitializeFromAdaptor)
|
||||
|
||||
BRepAdaptor_Curve anAdaptor(aMakeEdge.Edge());
|
||||
|
||||
BRepProp_Curve aProp;
|
||||
aProp.Initialize(anAdaptor);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Curve aProp(anAdaptor);
|
||||
|
||||
const GeomProp::CurvatureResult aCurv = aProp.Curvature(M_PI / 2.0, THE_LIN_TOL);
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
@@ -145,9 +123,7 @@ TEST(BRepProp_CurveTest, BoxEdge_Tangent)
|
||||
ASSERT_TRUE(anExp.More());
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
|
||||
|
||||
BRepProp_Curve aProp;
|
||||
aProp.Initialize(anEdge);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Curve aProp(anEdge);
|
||||
|
||||
double aFirst = 0.0, aLast = 0.0;
|
||||
BRep_Tool::Range(anEdge, aFirst, aLast);
|
||||
@@ -174,9 +150,7 @@ TEST(BRepProp_CurveTest, CylinderEdge_Curvature)
|
||||
for (TopExp_Explorer anExp(aCyl, TopAbs_EDGE); anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
|
||||
BRepProp_Curve aProp;
|
||||
aProp.Initialize(anEdge);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Curve aProp(anEdge);
|
||||
|
||||
double aFirst = 0.0, aLast = 0.0;
|
||||
BRep_Tool::Range(anEdge, aFirst, aLast);
|
||||
@@ -198,21 +172,6 @@ TEST(BRepProp_CurveTest, CylinderEdge_Curvature)
|
||||
// BRepProp_Surface tests
|
||||
// ============================================================
|
||||
|
||||
TEST(BRepProp_SurfaceTest, UninitializedState)
|
||||
{
|
||||
BRepProp_Surface aProp;
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
|
||||
const GeomProp::SurfaceNormalResult aNorm = aProp.Normal(0.0, 0.0, THE_LIN_TOL);
|
||||
EXPECT_FALSE(aNorm.IsDefined);
|
||||
|
||||
const GeomProp::SurfaceCurvatureResult aCurv = aProp.Curvatures(0.0, 0.0, THE_LIN_TOL);
|
||||
EXPECT_FALSE(aCurv.IsDefined);
|
||||
|
||||
const GeomProp::MeanGaussianResult aMG = aProp.MeanGaussian(0.0, 0.0, THE_LIN_TOL);
|
||||
EXPECT_FALSE(aMG.IsDefined);
|
||||
}
|
||||
|
||||
TEST(BRepProp_SurfaceTest, BoxFace_PlanarNormal)
|
||||
{
|
||||
BRepPrimAPI_MakeBox aBoxMaker(10.0, 20.0, 30.0);
|
||||
@@ -223,9 +182,7 @@ TEST(BRepProp_SurfaceTest, BoxFace_PlanarNormal)
|
||||
ASSERT_TRUE(anExp.More());
|
||||
const TopoDS_Face& aFace = TopoDS::Face(anExp.Current());
|
||||
|
||||
BRepProp_Surface aProp;
|
||||
aProp.Initialize(aFace);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Surface aProp(aFace);
|
||||
|
||||
const GeomProp::SurfaceNormalResult aNorm = aProp.Normal(0.5, 0.5, THE_LIN_TOL);
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
@@ -253,9 +210,7 @@ TEST(BRepProp_SurfaceTest, InitializeFromAdaptor)
|
||||
const TopoDS_Face& aFace = TopoDS::Face(anExp.Current());
|
||||
|
||||
BRepAdaptor_Surface anAdaptor(aFace);
|
||||
BRepProp_Surface aProp;
|
||||
aProp.Initialize(anAdaptor);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Surface aProp(anAdaptor);
|
||||
|
||||
const GeomProp::SurfaceNormalResult aNorm = aProp.Normal(0.5, 0.5, THE_LIN_TOL);
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
@@ -273,9 +228,7 @@ TEST(BRepProp_SurfaceTest, SphereFace_Curvatures)
|
||||
ASSERT_TRUE(anExp.More());
|
||||
const TopoDS_Face& aFace = TopoDS::Face(anExp.Current());
|
||||
|
||||
BRepProp_Surface aProp;
|
||||
aProp.Initialize(aFace);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Surface aProp(aFace);
|
||||
|
||||
// Evaluate at equator-like parameter (away from poles).
|
||||
const double aU = M_PI;
|
||||
@@ -313,9 +266,7 @@ TEST(BRepProp_SurfaceTest, CylinderFace_Curvatures)
|
||||
continue;
|
||||
}
|
||||
|
||||
BRepProp_Surface aProp;
|
||||
aProp.Initialize(aFace);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
BRepProp_Surface aProp(aFace);
|
||||
|
||||
const double aU = M_PI / 4.0;
|
||||
const double aV = aHeight / 2.0;
|
||||
|
||||
@@ -58,8 +58,7 @@ void compareCurveTangent(const TopoDS_Edge& theEdge, const double theParam)
|
||||
BRepAdaptor_Curve anAdaptor(theEdge);
|
||||
|
||||
// New API
|
||||
BRepProp_Curve aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Curve aNewProp(anAdaptor);
|
||||
const GeomProp::TangentResult aNew = aNewProp.Tangent(theParam, THE_LIN_TOL);
|
||||
|
||||
// Old API
|
||||
@@ -79,8 +78,7 @@ void compareCurveCurvature(const TopoDS_Edge& theEdge, const double theParam)
|
||||
{
|
||||
BRepAdaptor_Curve anAdaptor(theEdge);
|
||||
|
||||
BRepProp_Curve aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Curve aNewProp(anAdaptor);
|
||||
const GeomProp::CurvatureResult aNew = aNewProp.Curvature(theParam, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_CLProps anOld(anAdaptor, theParam, 2, THE_LIN_TOL);
|
||||
@@ -96,8 +94,7 @@ void compareCurveNormal(const TopoDS_Edge& theEdge, const double theParam)
|
||||
{
|
||||
BRepAdaptor_Curve anAdaptor(theEdge);
|
||||
|
||||
BRepProp_Curve aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Curve aNewProp(anAdaptor);
|
||||
const GeomProp::NormalResult aNew = aNewProp.Normal(theParam, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_CLProps anOld(anAdaptor, theParam, 2, THE_LIN_TOL);
|
||||
@@ -116,8 +113,7 @@ void compareCurveCentre(const TopoDS_Edge& theEdge, const double theParam)
|
||||
{
|
||||
BRepAdaptor_Curve anAdaptor(theEdge);
|
||||
|
||||
BRepProp_Curve aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Curve aNewProp(anAdaptor);
|
||||
const GeomProp::CentreResult aNew = aNewProp.CentreOfCurvature(theParam, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_CLProps anOld(anAdaptor, theParam, 2, THE_LIN_TOL);
|
||||
@@ -139,8 +135,7 @@ void compareSurfaceNormal(const TopoDS_Face& theFace, const double theU, const d
|
||||
{
|
||||
BRepAdaptor_Surface anAdaptor(theFace);
|
||||
|
||||
BRepProp_Surface aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Surface aNewProp(anAdaptor);
|
||||
const GeomProp::SurfaceNormalResult aNew = aNewProp.Normal(theU, theV, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_SLProps anOld(anAdaptor, theU, theV, 2, THE_LIN_TOL);
|
||||
@@ -159,8 +154,7 @@ void compareSurfaceCurvatures(const TopoDS_Face& theFace, const double theU, con
|
||||
{
|
||||
BRepAdaptor_Surface anAdaptor(theFace);
|
||||
|
||||
BRepProp_Surface aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Surface aNewProp(anAdaptor);
|
||||
const GeomProp::SurfaceCurvatureResult aNew = aNewProp.Curvatures(theU, theV, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_SLProps anOld(anAdaptor, theU, theV, 2, THE_LIN_TOL);
|
||||
@@ -178,8 +172,7 @@ void compareSurfaceMeanGaussian(const TopoDS_Face& theFace, const double theU, c
|
||||
{
|
||||
BRepAdaptor_Surface anAdaptor(theFace);
|
||||
|
||||
BRepProp_Surface aNewProp;
|
||||
aNewProp.Initialize(anAdaptor);
|
||||
BRepProp_Surface aNewProp(anAdaptor);
|
||||
const GeomProp::MeanGaussianResult aNew = aNewProp.MeanGaussian(theU, theV, THE_LIN_TOL);
|
||||
|
||||
BRepLProp_SLProps anOld(anAdaptor, theU, theV, 2, THE_LIN_TOL);
|
||||
|
||||
@@ -404,9 +404,7 @@ TEST(Geom2dGridEval_CurveTest, LineDispatch)
|
||||
occ::handle<Geom2d_Line> aGeomLine = new Geom2d_Line(gp_Pnt2d(0, 0), gp_Dir2d(1, 0));
|
||||
Geom2dAdaptor_Curve anAdaptor(aGeomLine);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Line);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 10.0, 11);
|
||||
@@ -427,9 +425,7 @@ TEST(Geom2dGridEval_CurveTest, CircleDispatch)
|
||||
new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 2.0);
|
||||
Geom2dAdaptor_Curve anAdaptor(aGeomCircle);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Circle);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 17);
|
||||
@@ -449,9 +445,7 @@ TEST(Geom2dGridEval_CurveTest, EllipseDispatch)
|
||||
new Geom2d_Ellipse(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 3.0, 2.0);
|
||||
Geom2dAdaptor_Curve anAdaptor(anEllipse);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Ellipse);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 13);
|
||||
@@ -471,9 +465,7 @@ TEST(Geom2dGridEval_CurveTest, HyperbolaDispatch)
|
||||
new Geom2d_Hyperbola(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 3.0, 2.0);
|
||||
Geom2dAdaptor_Curve anAdaptor(aHypr);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Hyperbola);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(-2.0, 2.0, 11);
|
||||
@@ -493,9 +485,7 @@ TEST(Geom2dGridEval_CurveTest, ParabolaDispatch)
|
||||
new Geom2d_Parabola(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 1.0);
|
||||
Geom2dAdaptor_Curve anAdaptor(aParab);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Parabola);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(-2.0, 2.0, 11);
|
||||
@@ -514,9 +504,7 @@ TEST(Geom2dGridEval_CurveTest, BSplineDispatch)
|
||||
occ::handle<Geom2d_BSplineCurve> aCurve = CreateSimpleBSpline2d();
|
||||
Geom2dAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BSplineCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 21);
|
||||
@@ -540,9 +528,7 @@ TEST(Geom2dGridEval_CurveTest, BezierCurveDispatch)
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
Geom2dAdaptor_Curve anAdaptor(aBezier);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BezierCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
@@ -561,9 +547,7 @@ TEST(Geom2dGridEval_CurveTest, OffsetCurveDispatch)
|
||||
occ::handle<Geom2d_Line> aLine = new Geom2d_Line(gp_Pnt2d(0, 0), gp_Dir2d(1, 0));
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aLine, 1.0);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anOffset);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anOffset);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_OffsetCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 5.0, 6);
|
||||
@@ -581,9 +565,7 @@ TEST(Geom2dGridEval_CurveTest, DirectHandleInit)
|
||||
{
|
||||
occ::handle<Geom2d_Line> aGeomLine = new Geom2d_Line(gp_Pnt2d(0, 0), gp_Dir2d(1, 0));
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(aGeomLine);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(aGeomLine);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Line);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 10.0, 11);
|
||||
@@ -593,24 +575,12 @@ TEST(Geom2dGridEval_CurveTest, DirectHandleInit)
|
||||
EXPECT_NEAR(aGrid.Value(1).X(), 0.0, THE_TOLERANCE);
|
||||
}
|
||||
|
||||
TEST(Geom2dGridEval_CurveTest, UninitializedState)
|
||||
{
|
||||
Geom2dGridEval_Curve anEval;
|
||||
EXPECT_FALSE(anEval.IsInitialized());
|
||||
|
||||
NCollection_Array1<double> aEmptyParams;
|
||||
NCollection_Array1<gp_Pnt2d> aGrid = anEval.EvaluateGrid(aEmptyParams);
|
||||
EXPECT_TRUE(aGrid.IsEmpty());
|
||||
}
|
||||
|
||||
TEST(Geom2dGridEval_CurveTest, EmptyParams)
|
||||
{
|
||||
occ::handle<Geom2d_Line> aGeomLine = new Geom2d_Line(gp_Pnt2d(0, 0), gp_Dir2d(1, 0));
|
||||
Geom2dAdaptor_Curve anAdaptor(aGeomLine);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aEmptyParams;
|
||||
NCollection_Array1<gp_Pnt2d> aGrid = anEval.EvaluateGrid(aEmptyParams);
|
||||
@@ -623,8 +593,7 @@ TEST(Geom2dGridEval_CurveTest, UnifiedDerivativeD1)
|
||||
new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 2.0);
|
||||
Geom2dAdaptor_Curve anAdaptor(aGeomCircle);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
|
||||
@@ -645,8 +614,7 @@ TEST(Geom2dGridEval_CurveTest, UnifiedDerivativeD2)
|
||||
occ::handle<Geom2d_BSplineCurve> aCurve = CreateSimpleBSpline2d();
|
||||
Geom2dAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
|
||||
@@ -668,8 +636,7 @@ TEST(Geom2dGridEval_CurveTest, UnifiedDerivativeD3)
|
||||
occ::handle<Geom2d_BSplineCurve> aCurve = CreateSimpleBSpline2d();
|
||||
Geom2dAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
Geom2dGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
|
||||
@@ -693,8 +660,7 @@ TEST(Geom2dGridEval_CurveTest, OffsetCurveDerivativeD3)
|
||||
new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(0, 0), gp_Dir2d(1, 0)), 2.0);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aCircle, 0.5);
|
||||
|
||||
Geom2dGridEval_Curve anEval;
|
||||
anEval.Initialize(anOffset);
|
||||
Geom2dGridEval_Curve anEval(anOffset);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_OffsetCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <optional>
|
||||
|
||||
// ============================================================================
|
||||
// Free functions tests (Geom2dProp namespace)
|
||||
@@ -247,22 +248,21 @@ protected:
|
||||
{
|
||||
gp_Lin2d aLin(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0));
|
||||
myLine = new Geom2d_Line(aLin);
|
||||
myProp.Initialize(myLine);
|
||||
myProp.emplace(myLine);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_Line> myLine;
|
||||
Geom2dProp_Curve myProp;
|
||||
occ::handle<Geom2d_Line> myLine;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_Line);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_Line);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, Tangent)
|
||||
{
|
||||
const Geom2dProp::TangentResult aRes = myProp.Tangent(5.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aRes = myProp->Tangent(5.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Direction.X(), 1.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Direction.Y(), 0.0, Precision::Confusion());
|
||||
@@ -273,7 +273,7 @@ TEST_F(Geom2dProp_CurveLineTest, TangentIsConstant)
|
||||
// Tangent should be the same at any parameter
|
||||
for (double u = -100.0; u <= 100.0; u += 50.0)
|
||||
{
|
||||
const Geom2dProp::TangentResult aRes = myProp.Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aRes = myProp->Tangent(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Direction.X(), 1.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Direction.Y(), 0.0, Precision::Confusion());
|
||||
@@ -282,7 +282,7 @@ TEST_F(Geom2dProp_CurveLineTest, TangentIsConstant)
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, CurvatureIsZero)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aRes = myProp.Curvature(5.0, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes = myProp->Curvature(5.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_FALSE(aRes.IsInfinite);
|
||||
EXPECT_NEAR(aRes.Value, 0.0, Precision::Confusion());
|
||||
@@ -290,26 +290,26 @@ TEST_F(Geom2dProp_CurveLineTest, CurvatureIsZero)
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, NormalUndefined)
|
||||
{
|
||||
const Geom2dProp::NormalResult aRes = myProp.Normal(5.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aRes = myProp->Normal(5.0, Precision::Confusion());
|
||||
EXPECT_FALSE(aRes.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, CentreUndefined)
|
||||
{
|
||||
const Geom2dProp::CentreResult aRes = myProp.CentreOfCurvature(5.0, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aRes = myProp->CentreOfCurvature(5.0, Precision::Confusion());
|
||||
EXPECT_FALSE(aRes.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, NoExtrema)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindCurvatureExtrema();
|
||||
EXPECT_TRUE(aRes.IsDone);
|
||||
EXPECT_TRUE(aRes.Points.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveLineTest, NoInflections)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindInflections();
|
||||
EXPECT_TRUE(aRes.IsDone);
|
||||
EXPECT_TRUE(aRes.Points.IsEmpty());
|
||||
}
|
||||
@@ -320,8 +320,7 @@ TEST(Geom2dProp_LineTest, DiagonalLine_TangentDirection)
|
||||
gp_Lin2d aLin(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 1.0));
|
||||
occ::handle<Geom2d_Line> aLine = new Geom2d_Line(aLin);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aLine);
|
||||
Geom2dProp_Curve aProp(aLine);
|
||||
|
||||
const Geom2dProp::TangentResult aTan = aProp.Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
@@ -341,22 +340,21 @@ protected:
|
||||
{
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 5.0);
|
||||
myCircle = new Geom2d_Circle(aCirc);
|
||||
myProp.Initialize(myCircle);
|
||||
myProp.emplace(myCircle);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_Circle> myCircle;
|
||||
Geom2dProp_Curve myProp;
|
||||
occ::handle<Geom2d_Circle> myCircle;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_Circle);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_Circle);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, Tangent)
|
||||
{
|
||||
const Geom2dProp::TangentResult aRes = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aRes = myProp->Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Direction.X(), 0.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Direction.Y(), 1.0, Precision::Confusion());
|
||||
@@ -364,7 +362,7 @@ TEST_F(Geom2dProp_CurveCircleTest, Tangent)
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, TangentAtPiHalf)
|
||||
{
|
||||
const Geom2dProp::TangentResult aRes = myProp.Tangent(M_PI / 2.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aRes = myProp->Tangent(M_PI / 2.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Direction.X(), -1.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Direction.Y(), 0.0, Precision::Confusion());
|
||||
@@ -375,7 +373,7 @@ TEST_F(Geom2dProp_CurveCircleTest, TangentPerpendicularToRadius)
|
||||
// At any parameter, tangent should be perpendicular to the radius vector
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 7.0)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
// Radius direction at param u on circle centered at origin
|
||||
const double aRadX = std::cos(u);
|
||||
@@ -389,7 +387,7 @@ TEST_F(Geom2dProp_CurveCircleTest, ConstantCurvature)
|
||||
{
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aRes = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes = myProp->Curvature(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Value, 1.0 / 5.0, Precision::Confusion());
|
||||
}
|
||||
@@ -397,9 +395,9 @@ TEST_F(Geom2dProp_CurveCircleTest, ConstantCurvature)
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, Normal)
|
||||
{
|
||||
const Geom2dProp::NormalResult aRes = myProp.Normal(0.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aRes = myProp->Normal(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
EXPECT_NEAR(
|
||||
std::abs(aTan.Direction.X() * aRes.Direction.X() + aTan.Direction.Y() * aRes.Direction.Y()),
|
||||
0.0,
|
||||
@@ -409,7 +407,7 @@ TEST_F(Geom2dProp_CurveCircleTest, Normal)
|
||||
TEST_F(Geom2dProp_CurveCircleTest, NormalPointsTowardCenter)
|
||||
{
|
||||
// At param=0, point=(5,0), normal should point toward center (0,0) => direction (-1,0)
|
||||
const Geom2dProp::NormalResult aRes = myProp.Normal(0.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aRes = myProp->Normal(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Direction.X(), -1.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Direction.Y(), 0.0, Precision::Confusion());
|
||||
@@ -417,7 +415,7 @@ TEST_F(Geom2dProp_CurveCircleTest, NormalPointsTowardCenter)
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, CentreOfCurvature)
|
||||
{
|
||||
const Geom2dProp::CentreResult aRes = myProp.CentreOfCurvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aRes = myProp->CentreOfCurvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Centre.X(), 0.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Centre.Y(), 0.0, Precision::Confusion());
|
||||
@@ -427,7 +425,7 @@ TEST_F(Geom2dProp_CurveCircleTest, CentreOfCurvature_ConstantAtAllParams)
|
||||
{
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 5.0)
|
||||
{
|
||||
const Geom2dProp::CentreResult aRes = myProp.CentreOfCurvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aRes = myProp->CentreOfCurvature(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Centre.X(), 0.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aRes.Centre.Y(), 0.0, Precision::Confusion());
|
||||
@@ -436,14 +434,14 @@ TEST_F(Geom2dProp_CurveCircleTest, CentreOfCurvature_ConstantAtAllParams)
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, NoExtrema)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindCurvatureExtrema();
|
||||
EXPECT_TRUE(aRes.IsDone);
|
||||
EXPECT_TRUE(aRes.Points.IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveCircleTest, NoInflections)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindInflections();
|
||||
EXPECT_TRUE(aRes.IsDone);
|
||||
EXPECT_TRUE(aRes.Points.IsEmpty());
|
||||
}
|
||||
@@ -454,8 +452,7 @@ TEST(Geom2dProp_CircleTest, SmallRadius_HighCurvature)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 0.1);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
|
||||
const Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
@@ -468,8 +465,7 @@ TEST(Geom2dProp_CircleTest, OffCenter_CentreOfCurvature)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(3.0, 7.0), gp_Dir2d(1.0, 0.0)), 4.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
|
||||
const Geom2dProp::CentreResult aCentre = aProp.CentreOfCurvature(1.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCentre.IsDefined);
|
||||
@@ -488,23 +484,22 @@ protected:
|
||||
{
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 10.0, 5.0);
|
||||
myEllipse = new Geom2d_Ellipse(anElips);
|
||||
myProp.Initialize(myEllipse);
|
||||
myProp.emplace(myEllipse);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_Ellipse> myEllipse;
|
||||
Geom2dProp_Curve myProp;
|
||||
occ::handle<Geom2d_Ellipse> myEllipse;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_Ellipse);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_Ellipse);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, TangentAtMajorVertex)
|
||||
{
|
||||
// At U=0, point is on major axis endpoint, tangent should be vertical
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
EXPECT_NEAR(aTan.Direction.X(), 0.0, Precision::Confusion());
|
||||
EXPECT_NEAR(std::abs(aTan.Direction.Y()), 1.0, Precision::Confusion());
|
||||
@@ -513,7 +508,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, TangentAtMajorVertex)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, TangentAtMinorVertex)
|
||||
{
|
||||
// At U=PI/2, point is on minor axis endpoint, tangent should be horizontal
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(M_PI / 2.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(M_PI / 2.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
EXPECT_NEAR(std::abs(aTan.Direction.X()), 1.0, Precision::Confusion());
|
||||
EXPECT_NEAR(aTan.Direction.Y(), 0.0, Precision::Confusion());
|
||||
@@ -523,8 +518,8 @@ TEST_F(Geom2dProp_CurveEllipseTest, TangentPerpToNormal)
|
||||
{
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 6.0)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp.Normal(u, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp->Normal(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
const double aDot =
|
||||
@@ -536,7 +531,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, TangentPerpToNormal)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CurvatureAtMajorVertex)
|
||||
{
|
||||
// At U=0 (major vertex): curvature = a/b^2 = 10/25 = 0.4
|
||||
const Geom2dProp::CurvatureResult aRes = myProp.Curvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes = myProp->Curvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Value, 10.0 / 25.0, 1.0e-6);
|
||||
}
|
||||
@@ -544,7 +539,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, CurvatureAtMajorVertex)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CurvatureAtMinorVertex)
|
||||
{
|
||||
// At U=PI/2 (minor vertex): curvature = b/a^2 = 5/100 = 0.05
|
||||
const Geom2dProp::CurvatureResult aRes = myProp.Curvature(M_PI / 2.0, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes = myProp->Curvature(M_PI / 2.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Value, 5.0 / 100.0, 1.0e-6);
|
||||
}
|
||||
@@ -552,7 +547,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, CurvatureAtMinorVertex)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CurvatureAtPi)
|
||||
{
|
||||
// At U=PI (opposite major vertex), curvature same as U=0
|
||||
const Geom2dProp::CurvatureResult aRes = myProp.Curvature(M_PI, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes = myProp->Curvature(M_PI, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
EXPECT_NEAR(aRes.Value, 10.0 / 25.0, 1.0e-6);
|
||||
}
|
||||
@@ -562,8 +557,8 @@ TEST_F(Geom2dProp_CurveEllipseTest, CurvatureSymmetry)
|
||||
// Curvature at U and -U should be equal (ellipse is symmetric)
|
||||
for (double u = 0.1; u < M_PI; u += 0.3)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aRes1 = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes2 = myProp.Curvature(-u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes1 = myProp->Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aRes2 = myProp->Curvature(-u, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes1.IsDefined);
|
||||
ASSERT_TRUE(aRes2.IsDefined);
|
||||
EXPECT_NEAR(aRes1.Value, aRes2.Value, 1.0e-10);
|
||||
@@ -573,10 +568,10 @@ TEST_F(Geom2dProp_CurveEllipseTest, CurvatureSymmetry)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CurvatureMaxAtMajorVertex)
|
||||
{
|
||||
// |curvature| should be maximum at major vertex (U=0, PI)
|
||||
const double aCurvMax = myProp.Curvature(0.0, Precision::Confusion()).Value;
|
||||
const double aCurvMax = myProp->Curvature(0.0, Precision::Confusion()).Value;
|
||||
for (double u = 0.1; u < 2.0 * M_PI; u += 0.2)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_LE(std::abs(aCurv.Value), std::abs(aCurvMax) + 1.0e-10);
|
||||
}
|
||||
@@ -584,7 +579,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, CurvatureMaxAtMajorVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, NormalAtMajorVertex)
|
||||
{
|
||||
const Geom2dProp::NormalResult aRes = myProp.Normal(0.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aRes = myProp->Normal(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
// At (10,0) on x-axis aligned ellipse, normal should point toward center: (-1,0)
|
||||
EXPECT_NEAR(aRes.Direction.X(), -1.0, Precision::Confusion());
|
||||
@@ -593,7 +588,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, NormalAtMajorVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CentreOfCurvatureAtMajorVertex)
|
||||
{
|
||||
const Geom2dProp::CentreResult aRes = myProp.CentreOfCurvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aRes = myProp->CentreOfCurvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
// Radius of curvature at major vertex = b^2/a = 25/10 = 2.5
|
||||
// Centre should be at (10 - 2.5, 0) = (7.5, 0)
|
||||
@@ -604,7 +599,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, CentreOfCurvatureAtMajorVertex)
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, CentreOfCurvatureAtMinorVertex)
|
||||
{
|
||||
const Geom2dProp::CentreResult aRes =
|
||||
myProp.CentreOfCurvature(M_PI / 2.0, Precision::Confusion());
|
||||
myProp->CentreOfCurvature(M_PI / 2.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
// Radius of curvature at minor vertex = a^2/b = 100/5 = 20
|
||||
// Centre should be at (0, 5 - 20) = (0, -15)
|
||||
@@ -614,7 +609,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, CentreOfCurvatureAtMinorVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, FindCurvatureExtrema)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aRes.IsDone);
|
||||
EXPECT_EQ(aRes.Points.Length(), 4);
|
||||
|
||||
@@ -636,7 +631,7 @@ TEST_F(Geom2dProp_CurveEllipseTest, FindCurvatureExtrema)
|
||||
|
||||
TEST_F(Geom2dProp_CurveEllipseTest, NoInflections)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aRes = myProp->FindInflections();
|
||||
EXPECT_TRUE(aRes.IsDone);
|
||||
EXPECT_TRUE(aRes.Points.IsEmpty());
|
||||
}
|
||||
@@ -647,8 +642,7 @@ TEST(Geom2dProp_EllipseTest, EqualSemiAxes_BehavesLikeCircle)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 5.0, 5.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
|
||||
// Curvature should be constant = 1/R = 1/5
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0)
|
||||
@@ -670,22 +664,21 @@ protected:
|
||||
{
|
||||
gp_Hypr2d aHypr(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 5.0, 3.0);
|
||||
myHyperbola = new Geom2d_Hyperbola(aHypr);
|
||||
myProp.Initialize(myHyperbola);
|
||||
myProp.emplace(myHyperbola);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_Hyperbola> myHyperbola;
|
||||
Geom2dProp_Curve myProp;
|
||||
occ::handle<Geom2d_Hyperbola> myHyperbola;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_Hyperbola);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_Hyperbola);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, TangentAtVertex)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
// At vertex of hyperbola (t=0), tangent is vertical
|
||||
EXPECT_NEAR(aTan.Direction.X(), 0.0, Precision::Confusion());
|
||||
@@ -697,7 +690,7 @@ TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureAtVertex)
|
||||
// At vertex (t=0): curvature = b^2/a^2 * 1/a * a = b^2/(a * a) ... actually K = b^2/a
|
||||
// For hyperbola x=a*cosh(t), y=b*sinh(t):
|
||||
// K(0) = b^2/(a^2 * (b^2/a^2)^(3/2)) ... Just verify it's defined and positive.
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_GT(aCurv.Value, 0.0);
|
||||
}
|
||||
@@ -705,10 +698,10 @@ TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureAtVertex)
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureDecreasesFromVertex)
|
||||
{
|
||||
// Curvature should be maximum at vertex and decrease away from it
|
||||
const double aCurvAtVertex = std::abs(myProp.Curvature(0.0, Precision::Confusion()).Value);
|
||||
const double aCurvAtVertex = std::abs(myProp->Curvature(0.0, Precision::Confusion()).Value);
|
||||
for (double u = 0.5; u < 3.0; u += 0.5)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_LT(std::abs(aCurv.Value), aCurvAtVertex + 1.0e-10);
|
||||
}
|
||||
@@ -716,10 +709,10 @@ TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureDecreasesFromVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, NormalAtVertex)
|
||||
{
|
||||
const Geom2dProp::NormalResult aNorm = myProp.Normal(0.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp->Normal(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
// Normal should be perpendicular to tangent
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
const double aDot =
|
||||
aTan.Direction.X() * aNorm.Direction.X() + aTan.Direction.Y() * aNorm.Direction.Y();
|
||||
EXPECT_NEAR(aDot, 0.0, 1.0e-10);
|
||||
@@ -727,13 +720,13 @@ TEST_F(Geom2dProp_CurveHyperbolaTest, NormalAtVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, CentreOfCurvatureAtVertex)
|
||||
{
|
||||
const Geom2dProp::CentreResult aCentre = myProp.CentreOfCurvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aCentre = myProp->CentreOfCurvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCentre.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureExtremaAtVertex)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp->FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aExtrema.IsDone);
|
||||
EXPECT_EQ(aExtrema.Points.Length(), 1);
|
||||
if (!aExtrema.Points.IsEmpty())
|
||||
@@ -745,7 +738,7 @@ TEST_F(Geom2dProp_CurveHyperbolaTest, CurvatureExtremaAtVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveHyperbolaTest, NoInflections)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp->FindInflections();
|
||||
EXPECT_TRUE(aInfl.IsDone);
|
||||
EXPECT_TRUE(aInfl.Points.IsEmpty());
|
||||
}
|
||||
@@ -762,22 +755,21 @@ protected:
|
||||
// Focal parameter p=2 => parabola y^2 = 4px = 8x
|
||||
gp_Parab2d aParab(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 2.0);
|
||||
myParabola = new Geom2d_Parabola(aParab);
|
||||
myProp.Initialize(myParabola);
|
||||
myProp.emplace(myParabola);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_Parabola> myParabola;
|
||||
Geom2dProp_Curve myProp;
|
||||
occ::handle<Geom2d_Parabola> myParabola;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_Parabola);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_Parabola);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, TangentAtVertex)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
// At vertex, tangent is vertical
|
||||
EXPECT_NEAR(aTan.Direction.X(), 0.0, Precision::Confusion());
|
||||
@@ -787,17 +779,17 @@ TEST_F(Geom2dProp_CurveParabolaTest, TangentAtVertex)
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, CurvatureAtVertex)
|
||||
{
|
||||
// At vertex: curvature = 1/(2*focal_parameter) = 1/4 = 0.25
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_GT(aCurv.Value, 0.0);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, CurvatureDecreasesFromVertex)
|
||||
{
|
||||
const double aCurvAtVertex = std::abs(myProp.Curvature(0.0, Precision::Confusion()).Value);
|
||||
const double aCurvAtVertex = std::abs(myProp->Curvature(0.0, Precision::Confusion()).Value);
|
||||
for (double u = 1.0; u <= 5.0; u += 1.0)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_LT(std::abs(aCurv.Value), aCurvAtVertex);
|
||||
}
|
||||
@@ -808,17 +800,17 @@ TEST_F(Geom2dProp_CurveParabolaTest, CurvatureSymmetric)
|
||||
// Curvature at U and -U should be equal
|
||||
for (double u = 0.5; u <= 5.0; u += 0.5)
|
||||
{
|
||||
const double aCurv1 = myProp.Curvature(u, Precision::Confusion()).Value;
|
||||
const double aCurv2 = myProp.Curvature(-u, Precision::Confusion()).Value;
|
||||
const double aCurv1 = myProp->Curvature(u, Precision::Confusion()).Value;
|
||||
const double aCurv2 = myProp->Curvature(-u, Precision::Confusion()).Value;
|
||||
EXPECT_NEAR(aCurv1, aCurv2, 1.0e-10);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, NormalAtVertex)
|
||||
{
|
||||
const Geom2dProp::NormalResult aNorm = myProp.Normal(0.0, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp->Normal(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
const double aDot =
|
||||
aTan.Direction.X() * aNorm.Direction.X() + aTan.Direction.Y() * aNorm.Direction.Y();
|
||||
EXPECT_NEAR(aDot, 0.0, 1.0e-10);
|
||||
@@ -826,13 +818,13 @@ TEST_F(Geom2dProp_CurveParabolaTest, NormalAtVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, CentreOfCurvatureAtVertex)
|
||||
{
|
||||
const Geom2dProp::CentreResult aCentre = myProp.CentreOfCurvature(0.0, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aCentre = myProp->CentreOfCurvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCentre.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, CurvatureExtremaAtVertex)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp->FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aExtrema.IsDone);
|
||||
EXPECT_EQ(aExtrema.Points.Length(), 1);
|
||||
if (!aExtrema.Points.IsEmpty())
|
||||
@@ -844,7 +836,7 @@ TEST_F(Geom2dProp_CurveParabolaTest, CurvatureExtremaAtVertex)
|
||||
|
||||
TEST_F(Geom2dProp_CurveParabolaTest, NoInflections)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp->FindInflections();
|
||||
EXPECT_TRUE(aInfl.IsDone);
|
||||
EXPECT_TRUE(aInfl.Points.IsEmpty());
|
||||
}
|
||||
@@ -865,22 +857,21 @@ protected:
|
||||
aPoles(3) = gp_Pnt2d(3.0, -2.0);
|
||||
aPoles(4) = gp_Pnt2d(4.0, 0.0);
|
||||
myBezier = new Geom2d_BezierCurve(aPoles);
|
||||
myProp.Initialize(myBezier);
|
||||
myProp.emplace(myBezier);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_BezierCurve> myBezier;
|
||||
Geom2dProp_Curve myProp;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveBezierTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_BezierCurve);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_BezierCurve);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveBezierTest, TangentAtStart)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(0.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
// Tangent at start should point toward second control point: (1,2)
|
||||
// Direction should be proportional to (1,2), normalized
|
||||
@@ -891,7 +882,7 @@ TEST_F(Geom2dProp_CurveBezierTest, TangentAtStart)
|
||||
|
||||
TEST_F(Geom2dProp_CurveBezierTest, TangentAtEnd)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(1.0, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(1.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
// Tangent at end should point from third control point to fourth: (4,0)-(3,-2) = (1,2)
|
||||
const double aLen = std::sqrt(1.0 + 4.0);
|
||||
@@ -903,7 +894,7 @@ TEST_F(Geom2dProp_CurveBezierTest, CurvatureAtMultiplePoints)
|
||||
{
|
||||
for (double u = 0.0; u <= 1.0; u += 0.1)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
EXPECT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_FALSE(aCurv.IsInfinite);
|
||||
}
|
||||
@@ -913,8 +904,8 @@ TEST_F(Geom2dProp_CurveBezierTest, NormalPerpendicularToTangent)
|
||||
{
|
||||
for (double u = 0.1; u < 1.0; u += 0.2)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp.Normal(u, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp->Normal(u, Precision::Confusion());
|
||||
if (aTan.IsDefined && aNorm.IsDefined)
|
||||
{
|
||||
const double aDot =
|
||||
@@ -927,8 +918,8 @@ TEST_F(Geom2dProp_CurveBezierTest, NormalPerpendicularToTangent)
|
||||
TEST_F(Geom2dProp_CurveBezierTest, CentreOfCurvature_DistanceIsRadiusOfCurvature)
|
||||
{
|
||||
const double u = 0.3;
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aCentre = myProp.CentreOfCurvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aCentre = myProp->CentreOfCurvature(u, Precision::Confusion());
|
||||
if (aCurv.IsDefined && aCentre.IsDefined && !aCurv.IsInfinite && std::abs(aCurv.Value) > 1.0e-10)
|
||||
{
|
||||
gp_Pnt2d aPnt;
|
||||
@@ -942,7 +933,7 @@ TEST_F(Geom2dProp_CurveBezierTest, CentreOfCurvature_DistanceIsRadiusOfCurvature
|
||||
TEST_F(Geom2dProp_CurveBezierTest, InflectionPoints)
|
||||
{
|
||||
// S-shaped curve should have inflection point(s) near the middle
|
||||
const Geom2dProp::CurveAnalysis aInflections = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aInflections = myProp->FindInflections();
|
||||
EXPECT_TRUE(aInflections.IsDone);
|
||||
EXPECT_GE(aInflections.Points.Length(), 1);
|
||||
if (!aInflections.Points.IsEmpty())
|
||||
@@ -959,7 +950,7 @@ TEST_F(Geom2dProp_CurveBezierTest, InflectionPoints)
|
||||
|
||||
TEST_F(Geom2dProp_CurveBezierTest, CurvatureExtrema)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp->FindCurvatureExtrema();
|
||||
EXPECT_TRUE(aExtrema.IsDone);
|
||||
// S-shaped cubic should have curvature extrema
|
||||
for (int i = 0; i < aExtrema.Points.Length(); ++i)
|
||||
@@ -980,8 +971,7 @@ TEST(Geom2dProp_BezierTest, StraightLine_ZeroCurvature)
|
||||
aPoles(3) = gp_Pnt2d(4.0, 0.0);
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
|
||||
const Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
ASSERT_TRUE(aCurv.IsDefined);
|
||||
@@ -997,8 +987,7 @@ TEST(Geom2dProp_BezierTest, QuadraticBezier_Properties)
|
||||
aPoles(3) = gp_Pnt2d(2.0, 0.0);
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
|
||||
// Symmetric parabolic arc: curvature should be max at midpoint
|
||||
const double aCurvMid = std::abs(aProp.Curvature(0.5, Precision::Confusion()).Value);
|
||||
@@ -1036,24 +1025,23 @@ protected:
|
||||
aMults(3) = 3;
|
||||
|
||||
myBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 2);
|
||||
myProp.Initialize(myBSpline);
|
||||
myProp.emplace(myBSpline);
|
||||
}
|
||||
|
||||
occ::handle<Geom2d_BSplineCurve> myBSpline;
|
||||
Geom2dProp_Curve myProp;
|
||||
std::optional<Geom2dProp_Curve> myProp;
|
||||
};
|
||||
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, IsInitialized)
|
||||
{
|
||||
EXPECT_TRUE(myProp.IsInitialized());
|
||||
EXPECT_EQ(myProp.GetType(), GeomAbs_BSplineCurve);
|
||||
EXPECT_EQ(myProp->GetType(), GeomAbs_BSplineCurve);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, TangentDefined)
|
||||
{
|
||||
for (double u = 0.0; u <= 1.0; u += 0.2)
|
||||
{
|
||||
const Geom2dProp::TangentResult aTan = myProp.Tangent(u, Precision::Confusion());
|
||||
const Geom2dProp::TangentResult aTan = myProp->Tangent(u, Precision::Confusion());
|
||||
EXPECT_TRUE(aTan.IsDefined);
|
||||
}
|
||||
}
|
||||
@@ -1062,7 +1050,7 @@ TEST_F(Geom2dProp_CurveBSplineTest, CurvatureDefined)
|
||||
{
|
||||
for (double u = 0.0; u <= 1.0; u += 0.2)
|
||||
{
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp.Curvature(u, Precision::Confusion());
|
||||
const Geom2dProp::CurvatureResult aCurv = myProp->Curvature(u, Precision::Confusion());
|
||||
EXPECT_TRUE(aCurv.IsDefined);
|
||||
EXPECT_FALSE(aCurv.IsInfinite);
|
||||
}
|
||||
@@ -1071,19 +1059,19 @@ TEST_F(Geom2dProp_CurveBSplineTest, CurvatureDefined)
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, NormalDefined)
|
||||
{
|
||||
// B-spline has non-zero curvature, so normal should be defined in the middle
|
||||
const Geom2dProp::NormalResult aNorm = myProp.Normal(0.3, Precision::Confusion());
|
||||
const Geom2dProp::NormalResult aNorm = myProp->Normal(0.3, Precision::Confusion());
|
||||
EXPECT_TRUE(aNorm.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, CentreOfCurvatureDefined)
|
||||
{
|
||||
const Geom2dProp::CentreResult aCentre = myProp.CentreOfCurvature(0.3, Precision::Confusion());
|
||||
const Geom2dProp::CentreResult aCentre = myProp->CentreOfCurvature(0.3, Precision::Confusion());
|
||||
EXPECT_TRUE(aCentre.IsDefined);
|
||||
}
|
||||
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, CurvatureExtrema)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aExtrema = myProp->FindCurvatureExtrema();
|
||||
EXPECT_TRUE(aExtrema.IsDone);
|
||||
// Verify all extrema parameters are within [0, 1]
|
||||
for (int i = 0; i < aExtrema.Points.Length(); ++i)
|
||||
@@ -1095,7 +1083,7 @@ TEST_F(Geom2dProp_CurveBSplineTest, CurvatureExtrema)
|
||||
|
||||
TEST_F(Geom2dProp_CurveBSplineTest, InflectionPoints)
|
||||
{
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp.FindInflections();
|
||||
const Geom2dProp::CurveAnalysis aInfl = myProp->FindInflections();
|
||||
EXPECT_TRUE(aInfl.IsDone);
|
||||
for (int i = 0; i < aInfl.Points.Length(); ++i)
|
||||
{
|
||||
@@ -1129,9 +1117,7 @@ TEST(Geom2dProp_BSplineTest, LowContinuity_C1)
|
||||
|
||||
occ::handle<Geom2d_BSplineCurve> aBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 2);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
|
||||
// Should work with C3 interval subdivision
|
||||
const Geom2dProp::CurveAnalysis aExtrema = aProp.FindCurvatureExtrema();
|
||||
@@ -1151,9 +1137,7 @@ TEST(Geom2dProp_OffsetCurveTest, IsInitialized)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aCircle, 2.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_OffsetCurve);
|
||||
}
|
||||
|
||||
@@ -1164,8 +1148,7 @@ TEST(Geom2dProp_OffsetCurveTest, OffsetCircle_ConstantCurvature)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aCircle, 2.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0)
|
||||
{
|
||||
@@ -1181,8 +1164,7 @@ TEST(Geom2dProp_OffsetCurveTest, TangentAndNormalDefined)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aCircle, 2.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
|
||||
const Geom2dProp::TangentResult aTan = aProp.Tangent(0.5, Precision::Confusion());
|
||||
EXPECT_TRUE(aTan.IsDefined);
|
||||
@@ -1205,9 +1187,7 @@ TEST(Geom2dProp_OffsetCurveTest, OffsetEllipse_ExtremaAndInflections)
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(anEllipse, 1.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
|
||||
const Geom2dProp::CurveAnalysis aExtrema = aProp.FindCurvatureExtrema();
|
||||
EXPECT_TRUE(aExtrema.IsDone);
|
||||
@@ -1226,9 +1206,7 @@ TEST(Geom2dProp_TrimmedCurveTest, UnwrapsToCircle)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed = new Geom2d_TrimmedCurve(aCircle, 0.0, M_PI);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Circle);
|
||||
|
||||
const Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
@@ -1242,9 +1220,7 @@ TEST(Geom2dProp_TrimmedCurveTest, UnwrapsToEllipse)
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed = new Geom2d_TrimmedCurve(anEllipse, 0.0, M_PI);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Ellipse);
|
||||
}
|
||||
|
||||
@@ -1255,9 +1231,7 @@ TEST(Geom2dProp_TrimmedCurveTest, NestedTrimmedCurve)
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed1 = new Geom2d_TrimmedCurve(aCircle, 0.0, M_PI);
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed2 = new Geom2d_TrimmedCurve(aTrimmed1, 0.1, 1.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed2);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(aTrimmed2);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Circle);
|
||||
|
||||
const Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
@@ -1271,10 +1245,8 @@ TEST(Geom2dProp_TrimmedCurveTest, NestedTrimmedCurve)
|
||||
|
||||
TEST(Geom2dProp_CurveTest, NullHandle_NotInitialized)
|
||||
{
|
||||
Geom2dProp_Curve aProp;
|
||||
occ::handle<Geom2d_Curve> aNullCurve;
|
||||
aProp.Initialize(aNullCurve);
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(aNullCurve);
|
||||
|
||||
const Geom2dProp::TangentResult aTan = aProp.Tangent(0.0, 1.0e-7);
|
||||
EXPECT_FALSE(aTan.IsDefined);
|
||||
@@ -1295,28 +1267,20 @@ TEST(Geom2dProp_CurveTest, NullHandle_NotInitialized)
|
||||
EXPECT_FALSE(aInfl.IsDone);
|
||||
}
|
||||
|
||||
TEST(Geom2dProp_CurveTest, DefaultConstructor_NotInitialized)
|
||||
TEST(Geom2dProp_CurveTest, DifferentTypes)
|
||||
{
|
||||
Geom2dProp_Curve aProp;
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
}
|
||||
|
||||
TEST(Geom2dProp_CurveTest, ReInitialize_ChangesType)
|
||||
{
|
||||
Geom2dProp_Curve aProp;
|
||||
|
||||
// First: circle
|
||||
// Circle
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 5.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
aProp.Initialize(aCircle);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Circle);
|
||||
Geom2dProp_Curve aPropCircle(aCircle);
|
||||
EXPECT_EQ(aPropCircle.GetType(), GeomAbs_Circle);
|
||||
|
||||
// Re-initialize with line
|
||||
// Line
|
||||
gp_Lin2d aLin(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0));
|
||||
occ::handle<Geom2d_Line> aLine = new Geom2d_Line(aLin);
|
||||
aProp.Initialize(aLine);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Line);
|
||||
EXPECT_NEAR(aProp.Curvature(0.0, Precision::Confusion()).Value, 0.0, Precision::Confusion());
|
||||
Geom2dProp_Curve aPropLine(aLine);
|
||||
EXPECT_EQ(aPropLine.GetType(), GeomAbs_Line);
|
||||
EXPECT_NEAR(aPropLine.Curvature(0.0, Precision::Confusion()).Value, 0.0, Precision::Confusion());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -1329,9 +1293,7 @@ TEST(Geom2dProp_AdaptorTest, InitFromGeom2dAdaptor)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
Geom2dAdaptor_Curve anAdaptor(aCircle);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(anAdaptor);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Circle);
|
||||
|
||||
const Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.0, Precision::Confusion());
|
||||
@@ -1345,9 +1307,7 @@ TEST(Geom2dProp_AdaptorTest, InitFromGeom2dAdaptor_Ellipse)
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
Geom2dAdaptor_Curve anAdaptor(anEllipse);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(anAdaptor);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Ellipse);
|
||||
|
||||
// Curvature at major vertex: a/b^2 = 8/9
|
||||
@@ -1377,9 +1337,7 @@ TEST(Geom2dProp_AdaptorTest, InitFromGeom2dAdaptor_BSpline)
|
||||
occ::handle<Geom2d_BSplineCurve> aBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 2);
|
||||
Geom2dAdaptor_Curve anAdaptor(aBSpline);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(aProp.IsInitialized());
|
||||
Geom2dProp_Curve aProp(anAdaptor);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_BSplineCurve);
|
||||
}
|
||||
|
||||
@@ -1392,8 +1350,7 @@ TEST(Geom2dProp_CrossValidationTest, Circle_MatchesLProp)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(1.0, 2.0), gp_Dir2d(1.0, 0.0)), 7.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 6.0)
|
||||
{
|
||||
@@ -1413,8 +1370,7 @@ TEST(Geom2dProp_CrossValidationTest, Ellipse_MatchesLProp)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 10.0, 5.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
|
||||
// At major vertex (U=0): curvature = a/b^2 = 10/25 = 0.4
|
||||
const Geom2dProp::CurvatureResult aCurv0 = aProp.Curvature(0.0, Precision::Confusion());
|
||||
@@ -1433,8 +1389,7 @@ TEST(Geom2dProp_CrossValidationTest, FreeFunctionVsDispatcher)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 3.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
|
||||
const double u = 1.0;
|
||||
gp_Pnt2d aPnt;
|
||||
@@ -1458,8 +1413,7 @@ TEST(Geom2dProp_CrossValidationTest, CentreDistanceConsistency)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 8.0, 4.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 8.0)
|
||||
{
|
||||
@@ -1484,12 +1438,10 @@ TEST(Geom2dProp_CrossValidationTest, AdaptorVsGeometryInit)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(1.0, 2.0), gp_Dir2d(1.0, 0.0)), 6.0, 3.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aPropGeom;
|
||||
aPropGeom.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aPropGeom(anEllipse);
|
||||
|
||||
Geom2dAdaptor_Curve anAdaptor(anEllipse);
|
||||
Geom2dProp_Curve aPropAdap;
|
||||
aPropAdap.Initialize(anAdaptor);
|
||||
Geom2dProp_Curve aPropAdap(anAdaptor);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 5.0)
|
||||
{
|
||||
|
||||
@@ -160,8 +160,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Line_Tangent)
|
||||
gp_Lin2d aLin(gp_Pnt2d(1.0, 2.0), gp_Dir2d(3.0, 4.0));
|
||||
occ::handle<Geom2d_Line> aLine = new Geom2d_Line(aLin);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aLine);
|
||||
Geom2dProp_Curve aProp(aLine);
|
||||
Geom2dLProp_CLProps2d aOld(aLine, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -10.0; u <= 10.0; u += 2.5)
|
||||
@@ -175,8 +174,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Line_Curvature)
|
||||
gp_Lin2d aLin(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 1.0));
|
||||
occ::handle<Geom2d_Line> aLine = new Geom2d_Line(aLin);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aLine);
|
||||
Geom2dProp_Curve aProp(aLine);
|
||||
Geom2dLProp_CLProps2d aOld(aLine, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -5.0; u <= 5.0; u += 1.0)
|
||||
@@ -194,8 +192,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Circle_AllProperties)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(3.0, 4.0), gp_Dir2d(1.0, 0.0)), 7.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
Geom2dLProp_CLProps2d aOld(aCircle, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 6.0)
|
||||
@@ -209,8 +206,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Circle_SmallRadius)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 0.01);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
Geom2dLProp_CLProps2d aOld(aCircle, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0)
|
||||
@@ -224,8 +220,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Circle_LargeRadius)
|
||||
gp_Circ2d aCirc(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 1000.0);
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
Geom2dLProp_CLProps2d aOld(aCircle, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 4.0)
|
||||
@@ -243,8 +238,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Ellipse_AllProperties)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 10.0, 5.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
Geom2dLProp_CLProps2d aOld(anEllipse, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 12.0)
|
||||
@@ -258,8 +252,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Ellipse_HighEccentricity)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 100.0, 1.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
Geom2dLProp_CLProps2d aOld(anEllipse, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 8.0)
|
||||
@@ -273,8 +266,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Ellipse_OffCenter)
|
||||
gp_Elips2d anElips(gp_Ax2d(gp_Pnt2d(100.0, -50.0), gp_Dir2d(1.0, 0.0)), 8.0, 3.0);
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
Geom2dLProp_CLProps2d aOld(anEllipse, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 8.0)
|
||||
@@ -292,8 +284,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Hyperbola_AllProperties)
|
||||
gp_Hypr2d anHypr(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 6.0, 3.0);
|
||||
occ::handle<Geom2d_Hyperbola> aHyperbola = new Geom2d_Hyperbola(anHypr);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aHyperbola);
|
||||
Geom2dProp_Curve aProp(aHyperbola);
|
||||
Geom2dLProp_CLProps2d aOld(aHyperbola, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -2.0; u <= 2.0; u += 0.5)
|
||||
@@ -307,8 +298,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Hyperbola_NearVertex)
|
||||
gp_Hypr2d anHypr(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 4.0, 2.0);
|
||||
occ::handle<Geom2d_Hyperbola> aHyperbola = new Geom2d_Hyperbola(anHypr);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aHyperbola);
|
||||
Geom2dProp_Curve aProp(aHyperbola);
|
||||
Geom2dLProp_CLProps2d aOld(aHyperbola, 2, THE_PARAM_TOL);
|
||||
|
||||
// Fine-grained near vertex
|
||||
@@ -327,8 +317,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Parabola_AllProperties)
|
||||
gp_Parab2d aParab(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 2.0);
|
||||
occ::handle<Geom2d_Parabola> aParabola = new Geom2d_Parabola(aParab);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
Geom2dLProp_CLProps2d aOld(aParabola, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -5.0; u <= 5.0; u += 1.0)
|
||||
@@ -342,8 +331,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Parabola_SmallFocal)
|
||||
gp_Parab2d aParab(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 0.1);
|
||||
occ::handle<Geom2d_Parabola> aParabola = new Geom2d_Parabola(aParab);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
Geom2dLProp_CLProps2d aOld(aParabola, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -3.0; u <= 3.0; u += 0.5)
|
||||
@@ -357,8 +345,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Parabola_LargeFocal)
|
||||
gp_Parab2d aParab(gp_Ax2d(gp_Pnt2d(0.0, 0.0), gp_Dir2d(1.0, 0.0)), 50.0);
|
||||
occ::handle<Geom2d_Parabola> aParabola = new Geom2d_Parabola(aParab);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
Geom2dLProp_CLProps2d aOld(aParabola, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = -10.0; u <= 10.0; u += 2.0)
|
||||
@@ -380,8 +367,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Bezier_CubicSShape)
|
||||
aPoles(4) = gp_Pnt2d(4.0, 0.0);
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
Geom2dLProp_CLProps2d aOld(aBezier, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.1)
|
||||
@@ -398,8 +384,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Bezier_Quadratic)
|
||||
aPoles(3) = gp_Pnt2d(4.0, 0.0);
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
Geom2dLProp_CLProps2d aOld(aBezier, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.1)
|
||||
@@ -419,8 +404,7 @@ TEST(Geom2dProp_VsCLProps2dTest, Bezier_HighDegree)
|
||||
aPoles(6) = gp_Pnt2d(5.0, 1.0);
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
Geom2dLProp_CLProps2d aOld(aBezier, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.05)
|
||||
@@ -453,8 +437,7 @@ TEST(Geom2dProp_VsCLProps2dTest, BSpline_Quadratic)
|
||||
|
||||
occ::handle<Geom2d_BSplineCurve> aBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 2);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
Geom2dLProp_CLProps2d aOld(aBSpline, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.1)
|
||||
@@ -487,8 +470,7 @@ TEST(Geom2dProp_VsCLProps2dTest, BSpline_Cubic)
|
||||
|
||||
occ::handle<Geom2d_BSplineCurve> aBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 3);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
Geom2dLProp_CLProps2d aOld(aBSpline, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.05)
|
||||
@@ -516,8 +498,7 @@ TEST(Geom2dProp_VsCLProps2dTest, BSpline_Degree4)
|
||||
|
||||
occ::handle<Geom2d_BSplineCurve> aBSpline = new Geom2d_BSplineCurve(aPoles, aKnots, aMults, 4);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
Geom2dLProp_CLProps2d aOld(aBSpline, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u <= 1.0; u += 0.05)
|
||||
@@ -536,8 +517,7 @@ TEST(Geom2dProp_VsCLProps2dTest, OffsetCircle_AllProperties)
|
||||
occ::handle<Geom2d_Circle> aCircle = new Geom2d_Circle(aCirc);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(aCircle, 2.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
Geom2dLProp_CLProps2d aOld(anOffset, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 6.0)
|
||||
@@ -552,8 +532,7 @@ TEST(Geom2dProp_VsCLProps2dTest, OffsetEllipse_AllProperties)
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
occ::handle<Geom2d_OffsetCurve> anOffset = new Geom2d_OffsetCurve(anEllipse, 1.0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
Geom2dLProp_CLProps2d aOld(anOffset, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.0; u < 2.0 * M_PI; u += M_PI / 8.0)
|
||||
@@ -572,8 +551,7 @@ TEST(Geom2dProp_VsCLProps2dTest, TrimmedEllipse_AllProperties)
|
||||
occ::handle<Geom2d_Ellipse> anEllipse = new Geom2d_Ellipse(anElips);
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed = new Geom2d_TrimmedCurve(anEllipse, 0.5, 2.5);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
Geom2dLProp_CLProps2d aOld(aTrimmed, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.5; u <= 2.5; u += 0.2)
|
||||
@@ -592,8 +570,7 @@ TEST(Geom2dProp_VsCLProps2dTest, TrimmedBezier_AllProperties)
|
||||
occ::handle<Geom2d_BezierCurve> aBezier = new Geom2d_BezierCurve(aPoles);
|
||||
occ::handle<Geom2d_TrimmedCurve> aTrimmed = new Geom2d_TrimmedCurve(aBezier, 0.2, 0.8);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
Geom2dLProp_CLProps2d aOld(aTrimmed, 2, THE_PARAM_TOL);
|
||||
|
||||
for (double u = 0.2; u <= 0.8; u += 0.1)
|
||||
|
||||
@@ -89,8 +89,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Circle_NoExtrema)
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
EXPECT_EQ(anOld.NbPoints(), 0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
EXPECT_EQ(aNew.Points.Length(), 0);
|
||||
@@ -106,8 +105,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Circle_NoInflections)
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
EXPECT_EQ(anOld.NbPoints(), 0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
Geom2dProp_Curve aProp(aCircle);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
EXPECT_EQ(aNew.Points.Length(), 0);
|
||||
@@ -126,8 +124,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Ellipse_Extrema)
|
||||
anOld.PerformCurExt(anEllipse);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -144,8 +141,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Ellipse_NoInflections)
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
EXPECT_EQ(anOld.NbPoints(), 0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
EXPECT_EQ(aNew.Points.Length(), 0);
|
||||
@@ -160,8 +156,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Ellipse_HighEccentricity_Extrema)
|
||||
anOld.PerformCurExt(anEllipse);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -177,8 +172,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Ellipse_FullPerform)
|
||||
anOld.Perform(anEllipse);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
Geom2dProp_Curve aProp(anEllipse);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -201,8 +195,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Hyperbola_Extrema)
|
||||
anOld.PerformCurExt(aHyperbola);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aHyperbola);
|
||||
Geom2dProp_Curve aProp(aHyperbola);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -219,8 +212,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Hyperbola_NoInflections)
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
EXPECT_EQ(anOld.NbPoints(), 0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aHyperbola);
|
||||
Geom2dProp_Curve aProp(aHyperbola);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
EXPECT_EQ(aNew.Points.Length(), 0);
|
||||
@@ -239,8 +231,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Parabola_Extrema)
|
||||
anOld.PerformCurExt(aParabola);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -257,8 +248,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Parabola_NoInflections)
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
EXPECT_EQ(anOld.NbPoints(), 0);
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
EXPECT_EQ(aNew.Points.Length(), 0);
|
||||
@@ -273,8 +263,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Parabola_FullPerform)
|
||||
anOld.Perform(aParabola);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
Geom2dProp_Curve aProp(aParabola);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -301,8 +290,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Bezier_CubicS_Inflections)
|
||||
anOld.PerformInf(aBezier);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -322,8 +310,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Bezier_CubicS_Extrema)
|
||||
anOld.PerformCurExt(aBezier);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -343,8 +330,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Bezier_CubicS_FullPerform)
|
||||
anOld.Perform(aBezier);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -366,8 +352,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Bezier_Quadratic_NoInflections)
|
||||
anOld.PerformInf(aBezier);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -389,8 +374,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, Bezier_HighDegree_FullPerform)
|
||||
anOld.Perform(aBezier);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
Geom2dProp_Curve aProp(aBezier);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -427,8 +411,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, BSpline_Degree4_FullPerform)
|
||||
anOld.Perform(aBSpline);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -466,8 +449,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, BSpline_Cubic_Extrema)
|
||||
anOld.PerformCurExt(aBSpline);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -502,8 +484,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, BSpline_Cubic_Inflections)
|
||||
anOld.PerformInf(aBSpline);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -537,8 +518,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, BSpline_LowContinuity_FullPerform)
|
||||
anOld.Perform(aBSpline);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aBSpline);
|
||||
Geom2dProp_Curve aProp(aBSpline);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -593,8 +573,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, TrimmedEllipse_Extrema)
|
||||
anOld.PerformCurExt(aTrimmed);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -615,8 +594,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, TrimmedBezier_FullPerform)
|
||||
anOld.Perform(aTrimmed);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(aTrimmed);
|
||||
Geom2dProp_Curve aProp(aTrimmed);
|
||||
const Geom2dProp::CurveAnalysis aNewExt = aProp.FindCurvatureExtrema();
|
||||
const Geom2dProp::CurveAnalysis aNewInfl = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNewExt.IsDone);
|
||||
@@ -640,8 +618,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, OffsetEllipse_Extrema)
|
||||
anOld.PerformCurExt(anOffset);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -658,8 +635,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, OffsetEllipse_Inflections)
|
||||
anOld.PerformInf(anOffset);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindInflections();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
@@ -676,8 +652,7 @@ TEST(Geom2dProp_VsCurAndInf2dTest, OffsetCircle_NoExtrema)
|
||||
anOld.PerformCurExt(anOffset);
|
||||
ASSERT_TRUE(anOld.IsDone());
|
||||
|
||||
Geom2dProp_Curve aProp;
|
||||
aProp.Initialize(anOffset);
|
||||
Geom2dProp_Curve aProp(anOffset);
|
||||
const Geom2dProp::CurveAnalysis aNew = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aNew.IsDone);
|
||||
|
||||
|
||||
@@ -44,11 +44,29 @@ occ::handle<Geom2d_Curve> ExtractBasisCurve(const occ::handle<Geom2d_Curve>& the
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dGridEval_Curve::Initialize(const Adaptor2d_Curve2d& theCurve)
|
||||
Geom2dGridEval_Curve::Geom2dGridEval_Curve(const Adaptor2d_Curve2d& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
Geom2dGridEval_Curve::Geom2dGridEval_Curve(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dGridEval_Curve::initialization(const Adaptor2d_Curve2d& theCurve)
|
||||
{
|
||||
if (theCurve.IsKind(STANDARD_TYPE(Geom2dAdaptor_Curve)))
|
||||
{
|
||||
Initialize(static_cast<const Geom2dAdaptor_Curve&>(theCurve).Curve());
|
||||
initialization(static_cast<const Geom2dAdaptor_Curve&>(theCurve).Curve());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +78,7 @@ void Geom2dGridEval_Curve::Initialize(const Adaptor2d_Curve2d& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dGridEval_Curve::Initialize(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
void Geom2dGridEval_Curve::initialization(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
{
|
||||
if (theCurve.IsNull())
|
||||
{
|
||||
@@ -122,13 +140,6 @@ void Geom2dGridEval_Curve::Initialize(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool Geom2dGridEval_Curve::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
NCollection_Array1<gp_Pnt2d> Geom2dGridEval_Curve::EvaluateGrid(
|
||||
const NCollection_Array1<double>& theParams) const
|
||||
{
|
||||
|
||||
@@ -52,10 +52,9 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! Geom2dGridEval_Curve anEval;
|
||||
//! anEval.Initialize(myAdaptorCurve2d);
|
||||
//! Geom2dGridEval_Curve anEval(myAdaptorCurve2d);
|
||||
//! // OR
|
||||
//! anEval.Initialize(myGeom2dCurve);
|
||||
//! Geom2dGridEval_Curve anEval(myGeom2dCurve);
|
||||
//! NCollection_Array1<gp_Pnt2d> aGrid = anEval.EvaluateGrid(myParams);
|
||||
//! @endcode
|
||||
class Geom2dGridEval_Curve
|
||||
@@ -75,12 +74,17 @@ public:
|
||||
Geom2dGridEval_OffsetCurve, // Offset curve
|
||||
Geom2dGridEval_OtherCurve>; // Fallback for other types
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
Geom2dGridEval_Curve()
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
}
|
||||
//! Construct from 2D adaptor reference (auto-detects curve type).
|
||||
//! For Geom2dAdaptor_Curve, extracts underlying Geom2d_Curve for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The curve adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param[in] theCurve 2D curve adaptor reference to evaluate
|
||||
Standard_EXPORT Geom2dGridEval_Curve(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Construct from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT Geom2dGridEval_Curve(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
Geom2dGridEval_Curve(const Geom2dGridEval_Curve&) = delete;
|
||||
@@ -88,21 +92,6 @@ public:
|
||||
Geom2dGridEval_Curve(Geom2dGridEval_Curve&&) = delete;
|
||||
Geom2dGridEval_Curve& operator=(Geom2dGridEval_Curve&&) = delete;
|
||||
|
||||
//! Initialize from 2D adaptor reference (auto-detects curve type).
|
||||
//! For Geom2dAdaptor_Curve, extracts underlying Geom2d_Curve for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The curve adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param theCurve 2D curve adaptor reference to evaluate
|
||||
Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Evaluate grid points at all parameters.
|
||||
//! @param theParams array of parameter values
|
||||
//! @return array of 2D points (1-based indexing)
|
||||
@@ -138,6 +127,15 @@ public:
|
||||
//! Returns the detected curve type.
|
||||
GeomAbs_CurveType GetType() const { return myCurveType; }
|
||||
|
||||
protected:
|
||||
//! Initialize from 2D adaptor reference (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D curve adaptor reference to evaluate
|
||||
Standard_EXPORT void initialization(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
private:
|
||||
EvaluatorVariant myEvaluator;
|
||||
GeomAbs_CurveType myCurveType;
|
||||
|
||||
@@ -27,8 +27,7 @@ NCollection_Array1<gp_Pnt2d> Geom2dGridEval_OffsetCurve::EvaluateGrid(
|
||||
}
|
||||
|
||||
// Offset D0 requires basis D1 to compute offset normal direction
|
||||
Geom2dGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
Geom2dGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<Geom2dGridEval::CurveD1> aBasisD1 = aBasisEval.EvaluateGridD1(theParams);
|
||||
if (aBasisD1.IsEmpty())
|
||||
@@ -64,8 +63,7 @@ NCollection_Array1<Geom2dGridEval::CurveD1> Geom2dGridEval_OffsetCurve::Evaluate
|
||||
}
|
||||
|
||||
// Offset D1 requires basis D2
|
||||
Geom2dGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
Geom2dGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<Geom2dGridEval::CurveD2> aBasisD2 = aBasisEval.EvaluateGridD2(theParams);
|
||||
if (aBasisD2.IsEmpty())
|
||||
@@ -102,8 +100,7 @@ NCollection_Array1<Geom2dGridEval::CurveD2> Geom2dGridEval_OffsetCurve::Evaluate
|
||||
}
|
||||
|
||||
// Offset D2 requires basis D3
|
||||
Geom2dGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
Geom2dGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<Geom2dGridEval::CurveD3> aBasisD3 = aBasisEval.EvaluateGridD3(theParams);
|
||||
if (aBasisD3.IsEmpty())
|
||||
@@ -161,8 +158,7 @@ NCollection_Array1<Geom2dGridEval::CurveD3> Geom2dGridEval_OffsetCurve::Evaluate
|
||||
}
|
||||
|
||||
// Offset D3 requires basis D3 + D4
|
||||
Geom2dGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
Geom2dGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<Geom2dGridEval::CurveD3> aBasisD3 = aBasisEval.EvaluateGridD3(theParams);
|
||||
if (aBasisD3.IsEmpty())
|
||||
@@ -270,8 +266,7 @@ NCollection_Array1<gp_Vec2d> Geom2dGridEval_OffsetCurve::EvaluateGridDN(
|
||||
else
|
||||
{
|
||||
// For orders > 3, batch evaluate basis curve DN
|
||||
Geom2dGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
Geom2dGridEval_Curve aBasisEval(myBasis);
|
||||
return aBasisEval.EvaluateGridDN(theParams, theN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,25 @@
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dProp_Curve::Initialize(const Adaptor2d_Curve2d& theCurve)
|
||||
Geom2dProp_Curve::Geom2dProp_Curve(const Adaptor2d_Curve2d& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
Geom2dProp_Curve::Geom2dProp_Curve(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dProp_Curve::initialization(const Adaptor2d_Curve2d& theCurve)
|
||||
{
|
||||
if (theCurve.IsKind(STANDARD_TYPE(Geom2dAdaptor_Curve)))
|
||||
{
|
||||
@@ -36,7 +54,7 @@ void Geom2dProp_Curve::Initialize(const Adaptor2d_Curve2d& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void Geom2dProp_Curve::Initialize(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
void Geom2dProp_Curve::initialization(const occ::handle<Geom2d_Curve>& theCurve)
|
||||
{
|
||||
if (theCurve.IsNull())
|
||||
{
|
||||
@@ -91,13 +109,6 @@ void Geom2dProp_Curve::initFromAdaptor()
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool Geom2dProp_Curve::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
Geom2dProp::TangentResult Geom2dProp_Curve::Tangent(const double theParam,
|
||||
const double theTol) const
|
||||
{
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! Geom2dProp_Curve aProp;
|
||||
//! aProp.Initialize(myGeom2dCurve);
|
||||
//! Geom2dProp_Curve aProp(myGeom2dCurve);
|
||||
//! Geom2dProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
//! if (aCurv.IsDefined)
|
||||
//! {
|
||||
@@ -78,12 +77,14 @@ public:
|
||||
Geom2dProp_OffsetCurve,
|
||||
Geom2dProp_OtherCurve>;
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
Geom2dProp_Curve()
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
}
|
||||
//! Construct from 2D adaptor reference (auto-detects curve type).
|
||||
//! For Geom2dAdaptor_Curve, extracts underlying Geom2d_Curve for optimized evaluation.
|
||||
//! @param[in] theCurve 2D curve adaptor reference
|
||||
Standard_EXPORT Geom2dProp_Curve(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Construct from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT Geom2dProp_Curve(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
Geom2dProp_Curve(const Geom2dProp_Curve&) = delete;
|
||||
@@ -91,18 +92,6 @@ public:
|
||||
Geom2dProp_Curve(Geom2dProp_Curve&&) = delete;
|
||||
Geom2dProp_Curve& operator=(Geom2dProp_Curve&&) = delete;
|
||||
|
||||
//! Initialize from 2D adaptor reference (auto-detects curve type).
|
||||
//! For Geom2dAdaptor_Curve, extracts underlying Geom2d_Curve for optimized evaluation.
|
||||
//! @param[in] theCurve 2D curve adaptor reference
|
||||
Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Returns the detected curve type.
|
||||
GeomAbs_CurveType GetType() const { return myCurveType; }
|
||||
|
||||
@@ -138,6 +127,15 @@ public:
|
||||
//! @return analysis result with inflection points sorted by parameter
|
||||
Standard_EXPORT Geom2dProp::CurveAnalysis FindInflections() const;
|
||||
|
||||
protected:
|
||||
//! Initialize from 2D adaptor reference (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D curve adaptor reference
|
||||
Standard_EXPORT void initialization(const Adaptor2d_Curve2d& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 2D geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom2d_Curve>& theCurve);
|
||||
|
||||
private:
|
||||
//! Initialize from stored adaptor (dispatches to per-geometry evaluator).
|
||||
//! Must be called after myAdaptor is set. Per-geometry evaluators receive
|
||||
|
||||
@@ -260,9 +260,7 @@ TEST(GeomGridEval_CurveTest, LineDispatch)
|
||||
occ::handle<Geom_Line> aGeomLine = new Geom_Line(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0));
|
||||
GeomAdaptor_Curve anAdaptor(aGeomLine);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Line);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 10.0, 11);
|
||||
@@ -284,9 +282,7 @@ TEST(GeomGridEval_CurveTest, CircleDispatch)
|
||||
new Geom_Circle(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
GeomAdaptor_Curve anAdaptor(aGeomCircle);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Circle);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 17);
|
||||
@@ -306,9 +302,7 @@ TEST(GeomGridEval_CurveTest, BSplineDispatch)
|
||||
occ::handle<Geom_BSplineCurve> aCurve = CreateSimpleBSpline();
|
||||
GeomAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BSplineCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 21);
|
||||
@@ -329,9 +323,7 @@ TEST(GeomGridEval_CurveTest, EllipseDispatch)
|
||||
new Geom_Ellipse(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 3.0, 2.0);
|
||||
GeomAdaptor_Curve anAdaptor(anEllipse);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Ellipse);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 13);
|
||||
@@ -352,9 +344,7 @@ TEST(GeomGridEval_CurveTest, HyperbolaDispatch)
|
||||
new Geom_Hyperbola(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 3.0, 2.0);
|
||||
GeomAdaptor_Curve anAdaptor(aHypr);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Hyperbola);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(-2.0, 2.0, 11);
|
||||
@@ -375,9 +365,7 @@ TEST(GeomGridEval_CurveTest, ParabolaDispatch)
|
||||
new Geom_Parabola(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 1.0);
|
||||
GeomAdaptor_Curve anAdaptor(aParab);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Parabola);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(-2.0, 2.0, 11);
|
||||
@@ -403,9 +391,7 @@ TEST(GeomGridEval_CurveTest, BezierCurveDispatch)
|
||||
occ::handle<Geom_BezierCurve> aBezier = new Geom_BezierCurve(aPoles);
|
||||
GeomAdaptor_Curve anAdaptor(aBezier);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BezierCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
@@ -427,9 +413,7 @@ TEST(GeomGridEval_CurveTest, OffsetCurveFallbackDispatch)
|
||||
occ::handle<Geom_OffsetCurve> anOffset = new Geom_OffsetCurve(aLine, 1.0, gp::DZ());
|
||||
GeomAdaptor_Curve anAdaptor(anOffset);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_OffsetCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 5.0, 6);
|
||||
@@ -448,9 +432,7 @@ TEST(GeomGridEval_CurveTest, DirectHandleInit)
|
||||
{
|
||||
occ::handle<Geom_Line> aGeomLine = new Geom_Line(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0));
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(aGeomLine);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(aGeomLine);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Line);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 10.0, 11);
|
||||
@@ -460,24 +442,12 @@ TEST(GeomGridEval_CurveTest, DirectHandleInit)
|
||||
EXPECT_NEAR(aGrid.Value(1).X(), 0.0, THE_TOLERANCE);
|
||||
}
|
||||
|
||||
TEST(GeomGridEval_CurveTest, UninitializedState)
|
||||
{
|
||||
GeomGridEval_Curve anEval;
|
||||
EXPECT_FALSE(anEval.IsInitialized());
|
||||
|
||||
NCollection_Array1<double> aEmptyParams;
|
||||
NCollection_Array1<gp_Pnt> aGrid = anEval.EvaluateGrid(aEmptyParams);
|
||||
EXPECT_TRUE(aGrid.IsEmpty());
|
||||
}
|
||||
|
||||
TEST(GeomGridEval_CurveTest, EmptyParams)
|
||||
{
|
||||
occ::handle<Geom_Line> aGeomLine = new Geom_Line(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0));
|
||||
GeomAdaptor_Curve anAdaptor(aGeomLine);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
// EvaluateGrid with empty params should return empty
|
||||
NCollection_Array1<double> aEmptyParams;
|
||||
@@ -763,8 +733,7 @@ TEST(GeomGridEval_CurveTest, UnifiedDerivativeD1)
|
||||
new Geom_Circle(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
GeomAdaptor_Curve anAdaptor(aGeomCircle);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
|
||||
@@ -786,8 +755,7 @@ TEST(GeomGridEval_CurveTest, UnifiedDerivativeD2)
|
||||
occ::handle<Geom_BSplineCurve> aCurve = CreateSimpleBSpline();
|
||||
GeomAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
|
||||
@@ -865,8 +833,7 @@ TEST(GeomGridEval_CurveTest, OffsetCurveDerivativeD3)
|
||||
occ::handle<Geom_OffsetCurve> anOffset = new Geom_OffsetCurve(aLine, 1.0, gp::DZ());
|
||||
GeomAdaptor_Curve anAdaptor(anOffset);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_OffsetCurve);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 5.0, 6);
|
||||
@@ -891,8 +858,7 @@ TEST(GeomGridEval_CurveTest, UnifiedDerivativeD3)
|
||||
occ::handle<Geom_BSplineCurve> aCurve = CreateSimpleBSpline();
|
||||
GeomAdaptor_Curve anAdaptor(aCurve);
|
||||
|
||||
GeomGridEval_Curve anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Curve anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
|
||||
|
||||
@@ -134,10 +134,8 @@ TEST(GeomGridEval_OffsetSurfaceTest, NestedDispatch)
|
||||
occ::handle<Geom_Plane> aPlane = new Geom_Plane(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
|
||||
occ::handle<Geom_OffsetSurface> anOffset = new Geom_OffsetSurface(aPlane, 5.0);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anOffset);
|
||||
GeomGridEval_Surface anEval(anOffset);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
// Assuming GetType() returns OffsetSurface or similar identifier
|
||||
// (GeomGridEval_Surface::GetType logic might need checking, usually delegates to adaptor or
|
||||
// stored type) Since we added OffsetSurface to variant, it should be supported.
|
||||
|
||||
@@ -245,10 +245,7 @@ TEST(GeomGridEval_SurfaceOfExtrusionTest, UnifiedDispatch)
|
||||
new Geom_SurfaceOfLinearExtrusion(aLine, aDirection);
|
||||
|
||||
// Test dispatch via unified evaluator
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anExtSurf);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anExtSurf);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_SurfaceOfExtrusion);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 10.0, 5);
|
||||
@@ -275,10 +272,7 @@ TEST(GeomGridEval_SurfaceOfExtrusionTest, AdaptorDispatch)
|
||||
|
||||
// Test dispatch via adaptor
|
||||
GeomAdaptor_Surface anAdaptor(anExtSurf);
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_SurfaceOfExtrusion);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 10.0, 5);
|
||||
|
||||
@@ -213,10 +213,7 @@ TEST(GeomGridEval_SurfaceOfRevolutionTest, UnifiedDispatch)
|
||||
occ::handle<Geom_SurfaceOfRevolution> aRevSurf = new Geom_SurfaceOfRevolution(aLine, aRevAxis);
|
||||
|
||||
// Test dispatch via unified evaluator
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(aRevSurf);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(aRevSurf);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_SurfaceOfRevolution);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, M_PI, 5);
|
||||
@@ -242,10 +239,7 @@ TEST(GeomGridEval_SurfaceOfRevolutionTest, AdaptorDispatch)
|
||||
|
||||
// Test dispatch via adaptor
|
||||
GeomAdaptor_Surface anAdaptor(aRevSurf);
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_SurfaceOfRevolution);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, M_PI, 5);
|
||||
|
||||
@@ -251,9 +251,7 @@ TEST(GeomGridEval_SurfaceTest, PlaneDispatch)
|
||||
occ::handle<Geom_Plane> aGeomPlane = new Geom_Plane(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
|
||||
GeomAdaptor_Surface anAdaptor(aGeomPlane);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Plane);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(-5.0, 5.0, 11);
|
||||
@@ -278,9 +276,7 @@ TEST(GeomGridEval_SurfaceTest, SphereDispatch)
|
||||
new Geom_SphericalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
GeomAdaptor_Surface anAdaptor(aGeomSphere);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Sphere);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 13);
|
||||
@@ -304,9 +300,7 @@ TEST(GeomGridEval_SurfaceTest, BSplineDispatch)
|
||||
occ::handle<Geom_BSplineSurface> aSurf = CreateSimpleBSplineSurface();
|
||||
GeomAdaptor_Surface anAdaptor(aSurf);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BSplineSurface);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 1.0, 11);
|
||||
@@ -335,9 +329,7 @@ TEST(GeomGridEval_SurfaceTest, BezierSurfaceDispatch)
|
||||
occ::handle<Geom_BezierSurface> aBezier = new Geom_BezierSurface(aPoles);
|
||||
GeomAdaptor_Surface anAdaptor(aBezier);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_BezierSurface);
|
||||
|
||||
NCollection_Array1<double> aParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
@@ -360,9 +352,7 @@ TEST(GeomGridEval_SurfaceTest, CylinderDispatch)
|
||||
new Geom_CylindricalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
GeomAdaptor_Surface anAdaptor(aCyl);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Cylinder);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
@@ -387,9 +377,7 @@ TEST(GeomGridEval_SurfaceTest, TorusDispatch)
|
||||
new Geom_ToroidalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 4.0, 1.0);
|
||||
GeomAdaptor_Surface anAdaptor(aTorus);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Torus);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
@@ -414,9 +402,7 @@ TEST(GeomGridEval_SurfaceTest, ConeDispatch)
|
||||
new Geom_ConicalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), M_PI / 4, 1.0);
|
||||
GeomAdaptor_Surface anAdaptor(aCone);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Cone);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
@@ -445,9 +431,7 @@ TEST(GeomGridEval_SurfaceTest, SurfaceOfRevolutionFallbackDispatch)
|
||||
|
||||
GeomAdaptor_Surface anAdaptor(aRevSurf);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_SurfaceOfRevolution);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
@@ -471,10 +455,7 @@ TEST(GeomGridEval_SurfaceTest, DirectHandleInit)
|
||||
occ::handle<Geom_Plane> aPlane = new Geom_Plane(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
|
||||
|
||||
// Initialize directly from occ::handle<Geom_Surface>
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(aPlane);
|
||||
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(aPlane);
|
||||
EXPECT_EQ(anEval.GetType(), GeomAbs_Plane);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
@@ -487,26 +468,12 @@ TEST(GeomGridEval_SurfaceTest, DirectHandleInit)
|
||||
EXPECT_NEAR(aGrid.Value(1, 1).Z(), 0.0, THE_TOLERANCE);
|
||||
}
|
||||
|
||||
TEST(GeomGridEval_SurfaceTest, UninitializedState)
|
||||
{
|
||||
GeomGridEval_Surface anEval;
|
||||
EXPECT_FALSE(anEval.IsInitialized());
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
NCollection_Array1<double> aVParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
|
||||
NCollection_Array2<gp_Pnt> aGrid = anEval.EvaluateGrid(aUParams, aVParams);
|
||||
EXPECT_TRUE(aGrid.IsEmpty());
|
||||
}
|
||||
|
||||
TEST(GeomGridEval_SurfaceTest, EmptyParams)
|
||||
{
|
||||
occ::handle<Geom_Plane> aGeomPlane = new Geom_Plane(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
|
||||
GeomAdaptor_Surface anAdaptor(aGeomPlane);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
EXPECT_TRUE(anEval.IsInitialized());
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
|
||||
// EvaluateGrid with empty params should return empty
|
||||
NCollection_Array1<double> aEmptyParams;
|
||||
@@ -627,8 +594,7 @@ TEST(GeomGridEval_SurfaceTest, UnifiedDerivativeD1)
|
||||
new Geom_SphericalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
GeomAdaptor_Surface anAdaptor(aSphere);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
NCollection_Array1<double> aVParams = CreateUniformParams(-M_PI / 2, M_PI / 2, 5);
|
||||
@@ -655,8 +621,7 @@ TEST(GeomGridEval_SurfaceTest, UnifiedDerivativeD2)
|
||||
occ::handle<Geom_BSplineSurface> aSurf = CreateSimpleBSplineSurface();
|
||||
GeomAdaptor_Surface anAdaptor(aSurf);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
NCollection_Array1<double> aVParams = CreateUniformParams(0.0, 1.0, 5);
|
||||
@@ -880,8 +845,7 @@ TEST(GeomGridEval_SurfaceTest, UnifiedDerivativeD3)
|
||||
new Geom_ToroidalSurface(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 4.0, 1.0);
|
||||
GeomAdaptor_Surface anAdaptor(aTorus);
|
||||
|
||||
GeomGridEval_Surface anEval;
|
||||
anEval.Initialize(anAdaptor);
|
||||
GeomGridEval_Surface anEval(anAdaptor);
|
||||
|
||||
NCollection_Array1<double> aUParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
NCollection_Array1<double> aVParams = CreateUniformParams(0.0, 2 * M_PI, 9);
|
||||
|
||||
@@ -181,26 +181,10 @@ TEST(GeomPropTest, ComputeMeanGaussian_Sphere)
|
||||
// GeomProp_Curve - initialization and basic queries
|
||||
// ============================================================================
|
||||
|
||||
TEST(GeomPropCurveTest, UninitializedState)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
}
|
||||
|
||||
TEST(GeomPropCurveTest, InitializeFromNullHandle)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
occ::handle<Geom_Curve> aNullCurve;
|
||||
aProp.Initialize(aNullCurve);
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
}
|
||||
|
||||
TEST(GeomPropCurveTest, Line_ZeroCurvature)
|
||||
{
|
||||
occ::handle<Geom_Line> aLine = new Geom_Line(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0));
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aLine);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(aLine);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Line);
|
||||
|
||||
const GeomProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
@@ -214,9 +198,7 @@ TEST(GeomPropCurveTest, Circle_ConstantCurvature)
|
||||
gp_Circ aCirc(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), aRadius);
|
||||
occ::handle<Geom_Circle> aCircle = new Geom_Circle(aCirc);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(aCircle);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Circle);
|
||||
|
||||
const GeomProp::CurvatureResult aCurv = aProp.Curvature(1.0, Precision::Confusion());
|
||||
@@ -231,9 +213,7 @@ TEST(GeomPropCurveTest, Ellipse_CurvatureExtrema)
|
||||
gp_Elips anElips(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), aMajor, aMinor);
|
||||
occ::handle<Geom_Ellipse> anEllipse = new Geom_Ellipse(anElips);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(anEllipse);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(anEllipse);
|
||||
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aResult.IsDone);
|
||||
@@ -245,9 +225,7 @@ TEST(GeomPropCurveTest, Hyperbola_SingleExtremum)
|
||||
gp_Hypr anHypr(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 6.0, 3.0);
|
||||
occ::handle<Geom_Hyperbola> aHyperbola = new Geom_Hyperbola(anHypr);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aHyperbola);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(aHyperbola);
|
||||
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aResult.IsDone);
|
||||
@@ -260,9 +238,7 @@ TEST(GeomPropCurveTest, Parabola_SingleExtremum)
|
||||
gp_Parab aParab(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 2.0);
|
||||
occ::handle<Geom_Parabola> aParabola = new Geom_Parabola(aParab);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aParabola);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(aParabola);
|
||||
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aResult.IsDone);
|
||||
@@ -275,8 +251,7 @@ TEST(GeomPropCurveTest, Circle_NoExtrema)
|
||||
gp_Circ aCirc(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 5.0);
|
||||
occ::handle<Geom_Circle> aCircle = new Geom_Circle(aCirc);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
GeomProp_Curve aProp(aCircle);
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindCurvatureExtrema();
|
||||
ASSERT_TRUE(aResult.IsDone);
|
||||
EXPECT_EQ(aResult.Points.Length(), 0);
|
||||
@@ -287,8 +262,7 @@ TEST(GeomPropCurveTest, Circle_NoInflections)
|
||||
gp_Circ aCirc(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 5.0);
|
||||
occ::handle<Geom_Circle> aCircle = new Geom_Circle(aCirc);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
GeomProp_Curve aProp(aCircle);
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindInflections();
|
||||
ASSERT_TRUE(aResult.IsDone);
|
||||
EXPECT_EQ(aResult.Points.Length(), 0);
|
||||
@@ -303,9 +277,7 @@ TEST(GeomPropCurveTest, BezierCurve_Inflections)
|
||||
aPoles(4) = gp_Pnt(4, 1, 0);
|
||||
occ::handle<Geom_BezierCurve> aBezier = new Geom_BezierCurve(aPoles);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aBezier);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Curve aProp(aBezier);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_BezierCurve);
|
||||
|
||||
const GeomProp::CurveAnalysis aResult = aProp.FindInflections();
|
||||
@@ -316,8 +288,7 @@ TEST(GeomPropCurveTest, BezierCurve_Inflections)
|
||||
TEST(GeomPropCurveTest, Line_TangentDirection)
|
||||
{
|
||||
occ::handle<Geom_Line> aLine = new Geom_Line(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0));
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aLine);
|
||||
GeomProp_Curve aProp(aLine);
|
||||
|
||||
const GeomProp::TangentResult aTan = aProp.Tangent(5.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aTan.IsDefined);
|
||||
@@ -329,8 +300,7 @@ TEST(GeomPropCurveTest, Circle_Normal)
|
||||
gp_Circ aCirc(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 5.0);
|
||||
occ::handle<Geom_Circle> aCircle = new Geom_Circle(aCirc);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
GeomProp_Curve aProp(aCircle);
|
||||
|
||||
// At param=0, point is (5,0,0), normal should point toward center (-1,0,0)
|
||||
const GeomProp::NormalResult aNorm = aProp.Normal(0.0, Precision::Confusion());
|
||||
@@ -343,8 +313,7 @@ TEST(GeomPropCurveTest, Circle_CentreOfCurvature)
|
||||
gp_Circ aCirc(gp_Ax2(gp_Pnt(1, 2, 3), gp_Dir(0, 0, 1)), 5.0);
|
||||
occ::handle<Geom_Circle> aCircle = new Geom_Circle(aCirc);
|
||||
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(aCircle);
|
||||
GeomProp_Curve aProp(aCircle);
|
||||
|
||||
const GeomProp::CentreResult aCentre = aProp.CentreOfCurvature(0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aCentre.IsDefined);
|
||||
@@ -357,27 +326,11 @@ TEST(GeomPropCurveTest, Circle_CentreOfCurvature)
|
||||
// GeomProp_Surface - initialization and basic queries
|
||||
// ============================================================================
|
||||
|
||||
TEST(GeomPropSurfaceTest, UninitializedState)
|
||||
{
|
||||
GeomProp_Surface aProp;
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
}
|
||||
|
||||
TEST(GeomPropSurfaceTest, InitializeFromNullHandle)
|
||||
{
|
||||
GeomProp_Surface aProp;
|
||||
occ::handle<Geom_Surface> aNullSurf;
|
||||
aProp.Initialize(aNullSurf);
|
||||
EXPECT_FALSE(aProp.IsInitialized());
|
||||
}
|
||||
|
||||
TEST(GeomPropSurfaceTest, Plane_ZeroCurvatures)
|
||||
{
|
||||
occ::handle<Geom_Plane> aPlane = new Geom_Plane(gp_Ax3());
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aPlane);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Surface aProp(aPlane);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Plane);
|
||||
|
||||
const GeomProp::SurfaceCurvatureResult aCurv = aProp.Curvatures(0.0, 0.0, Precision::Confusion());
|
||||
@@ -391,8 +344,7 @@ TEST(GeomPropSurfaceTest, Plane_Normal)
|
||||
{
|
||||
occ::handle<Geom_Plane> aPlane = new Geom_Plane(gp_Ax3());
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aPlane);
|
||||
GeomProp_Surface aProp(aPlane);
|
||||
|
||||
const GeomProp::SurfaceNormalResult aNorm = aProp.Normal(0.0, 0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aNorm.IsDefined);
|
||||
@@ -403,8 +355,7 @@ TEST(GeomPropSurfaceTest, Plane_MeanGaussian)
|
||||
{
|
||||
occ::handle<Geom_Plane> aPlane = new Geom_Plane(gp_Ax3());
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aPlane);
|
||||
GeomProp_Surface aProp(aPlane);
|
||||
|
||||
const GeomProp::MeanGaussianResult aRes = aProp.MeanGaussian(0.0, 0.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
@@ -417,9 +368,7 @@ TEST(GeomPropSurfaceTest, Sphere_ConstantCurvature)
|
||||
const double aRadius = 5.0;
|
||||
occ::handle<Geom_SphericalSurface> aSphere = new Geom_SphericalSurface(gp_Ax3(), aRadius);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aSphere);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Surface aProp(aSphere);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Sphere);
|
||||
|
||||
// Curvature sign depends on normal orientation. For outward-pointing normal,
|
||||
@@ -435,8 +384,7 @@ TEST(GeomPropSurfaceTest, Sphere_MeanGaussian)
|
||||
const double aRadius = 5.0;
|
||||
occ::handle<Geom_SphericalSurface> aSphere = new Geom_SphericalSurface(gp_Ax3(), aRadius);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aSphere);
|
||||
GeomProp_Surface aProp(aSphere);
|
||||
|
||||
const GeomProp::MeanGaussianResult aRes = aProp.MeanGaussian(0.5, 0.5, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
@@ -449,9 +397,7 @@ TEST(GeomPropSurfaceTest, Cylinder_Curvatures)
|
||||
const double aRadius = 3.0;
|
||||
occ::handle<Geom_CylindricalSurface> aCyl = new Geom_CylindricalSurface(gp_Ax3(), aRadius);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aCyl);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Surface aProp(aCyl);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Cylinder);
|
||||
|
||||
const GeomProp::SurfaceCurvatureResult aCurv = aProp.Curvatures(0.5, 1.0, Precision::Confusion());
|
||||
@@ -468,8 +414,7 @@ TEST(GeomPropSurfaceTest, Cylinder_MeanGaussian)
|
||||
const double aRadius = 3.0;
|
||||
occ::handle<Geom_CylindricalSurface> aCyl = new Geom_CylindricalSurface(gp_Ax3(), aRadius);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aCyl);
|
||||
GeomProp_Surface aProp(aCyl);
|
||||
|
||||
const GeomProp::MeanGaussianResult aRes = aProp.MeanGaussian(0.5, 1.0, Precision::Confusion());
|
||||
ASSERT_TRUE(aRes.IsDefined);
|
||||
@@ -482,9 +427,7 @@ TEST(GeomPropSurfaceTest, Cone_CurvaturesVaryAlongV)
|
||||
gp_Ax3 anAx3;
|
||||
occ::handle<Geom_ConicalSurface> aCone = new Geom_ConicalSurface(anAx3, M_PI / 6.0, 5.0);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aCone);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Surface aProp(aCone);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Cone);
|
||||
|
||||
const GeomProp::SurfaceCurvatureResult aCurv1 =
|
||||
@@ -506,9 +449,7 @@ TEST(GeomPropSurfaceTest, Torus_CurvaturesVaryAlongV)
|
||||
const double aMinor = 3.0;
|
||||
occ::handle<Geom_ToroidalSurface> aTorus = new Geom_ToroidalSurface(gp_Ax3(), aMajor, aMinor);
|
||||
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(aTorus);
|
||||
ASSERT_TRUE(aProp.IsInitialized());
|
||||
GeomProp_Surface aProp(aTorus);
|
||||
EXPECT_EQ(aProp.GetType(), GeomAbs_Torus);
|
||||
|
||||
// At V=0 (outer edge): k1=1/r, k2=1/(R+r)
|
||||
|
||||
@@ -48,8 +48,7 @@ constexpr double THE_POINT_TOL = 1.0e-6;
|
||||
//! Compare tangent from new GeomProp_Curve vs old GeomLProp_CLProps.
|
||||
void compareTangent(const occ::handle<Geom_Curve>& theCurve, const double theParam)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(theCurve);
|
||||
GeomProp_Curve aProp(theCurve);
|
||||
const GeomProp::TangentResult aNew = aProp.Tangent(theParam, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_CLProps anOld(theCurve, theParam, 2, THE_LIN_TOL);
|
||||
@@ -68,8 +67,7 @@ void compareTangent(const occ::handle<Geom_Curve>& theCurve, const double thePar
|
||||
//! Compare curvature from new GeomProp_Curve vs old GeomLProp_CLProps.
|
||||
void compareCurvature(const occ::handle<Geom_Curve>& theCurve, const double theParam)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(theCurve);
|
||||
GeomProp_Curve aProp(theCurve);
|
||||
const GeomProp::CurvatureResult aNew = aProp.Curvature(theParam, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_CLProps anOld(theCurve, theParam, 2, THE_LIN_TOL);
|
||||
@@ -84,8 +82,7 @@ void compareCurvature(const occ::handle<Geom_Curve>& theCurve, const double theP
|
||||
//! Compare normal from new GeomProp_Curve vs old GeomLProp_CLProps.
|
||||
void compareNormal(const occ::handle<Geom_Curve>& theCurve, const double theParam)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(theCurve);
|
||||
GeomProp_Curve aProp(theCurve);
|
||||
const GeomProp::NormalResult aNew = aProp.Normal(theParam, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_CLProps anOld(theCurve, theParam, 2, THE_LIN_TOL);
|
||||
@@ -103,8 +100,7 @@ void compareNormal(const occ::handle<Geom_Curve>& theCurve, const double thePara
|
||||
//! Compare centre of curvature from new vs old.
|
||||
void compareCentre(const occ::handle<Geom_Curve>& theCurve, const double theParam)
|
||||
{
|
||||
GeomProp_Curve aProp;
|
||||
aProp.Initialize(theCurve);
|
||||
GeomProp_Curve aProp(theCurve);
|
||||
const GeomProp::CentreResult aNew = aProp.CentreOfCurvature(theParam, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_CLProps anOld(theCurve, theParam, 2, THE_LIN_TOL);
|
||||
|
||||
@@ -41,8 +41,7 @@ constexpr double THE_DIR_TOL = 1.0e-4;
|
||||
//! Compare surface normal from new GeomProp_Surface vs old GeomLProp_SLProps.
|
||||
void compareNormal(const occ::handle<Geom_Surface>& theSurf, const double theU, const double theV)
|
||||
{
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(theSurf);
|
||||
GeomProp_Surface aProp(theSurf);
|
||||
const GeomProp::SurfaceNormalResult aNew = aProp.Normal(theU, theV, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_SLProps anOld(theSurf, theU, theV, 2, THE_LIN_TOL);
|
||||
@@ -61,8 +60,7 @@ void compareCurvatures(const occ::handle<Geom_Surface>& theSurf,
|
||||
const double theU,
|
||||
const double theV)
|
||||
{
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(theSurf);
|
||||
GeomProp_Surface aProp(theSurf);
|
||||
const GeomProp::SurfaceCurvatureResult aNew = aProp.Curvatures(theU, theV, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_SLProps anOld(theSurf, theU, theV, 2, THE_LIN_TOL);
|
||||
@@ -83,8 +81,7 @@ void compareMeanGaussian(const occ::handle<Geom_Surface>& theSurf,
|
||||
const double theU,
|
||||
const double theV)
|
||||
{
|
||||
GeomProp_Surface aProp;
|
||||
aProp.Initialize(theSurf);
|
||||
GeomProp_Surface aProp(theSurf);
|
||||
const GeomProp::MeanGaussianResult aNew = aProp.MeanGaussian(theU, theV, THE_LIN_TOL);
|
||||
|
||||
GeomLProp_SLProps anOld(theSurf, theU, theV, 2, THE_LIN_TOL);
|
||||
|
||||
@@ -81,8 +81,7 @@ NCollection_Array2<gp_Pnt> GeomGridEval_BezierSurface::EvaluateGrid(
|
||||
if (!aCurve.IsNull())
|
||||
{
|
||||
// Use unified curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(aCurve);
|
||||
GeomGridEval_Curve aCurveEval(aCurve);
|
||||
|
||||
NCollection_Array1<gp_Pnt> aCurveResult = aCurveEval.EvaluateGrid(theUParams);
|
||||
|
||||
|
||||
@@ -44,11 +44,29 @@ occ::handle<Geom_Curve> ExtractBasisCurve(const occ::handle<Geom_Curve>& theCurv
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Curve::Initialize(const Adaptor3d_Curve& theCurve)
|
||||
GeomGridEval_Curve::GeomGridEval_Curve(const Adaptor3d_Curve& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomGridEval_Curve::GeomGridEval_Curve(const occ::handle<Geom_Curve>& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Curve::initialization(const Adaptor3d_Curve& theCurve)
|
||||
{
|
||||
if (theCurve.IsKind(STANDARD_TYPE(GeomAdaptor_Curve)))
|
||||
{
|
||||
Initialize(static_cast<const GeomAdaptor_Curve&>(theCurve).Curve());
|
||||
initialization(static_cast<const GeomAdaptor_Curve&>(theCurve).Curve());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +78,7 @@ void GeomGridEval_Curve::Initialize(const Adaptor3d_Curve& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Curve::Initialize(const occ::handle<Geom_Curve>& theCurve)
|
||||
void GeomGridEval_Curve::initialization(const occ::handle<Geom_Curve>& theCurve)
|
||||
{
|
||||
if (theCurve.IsNull())
|
||||
{
|
||||
@@ -123,13 +141,6 @@ void GeomGridEval_Curve::Initialize(const occ::handle<Geom_Curve>& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool GeomGridEval_Curve::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
NCollection_Array1<gp_Pnt> GeomGridEval_Curve::EvaluateGrid(
|
||||
const NCollection_Array1<double>& theParams) const
|
||||
{
|
||||
|
||||
@@ -51,10 +51,9 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! GeomGridEval_Curve anEval;
|
||||
//! anEval.Initialize(myAdaptorCurve);
|
||||
//! GeomGridEval_Curve anEval(myAdaptorCurve);
|
||||
//! // OR
|
||||
//! anEval.Initialize(myGeomCurve);
|
||||
//! GeomGridEval_Curve anEval(myGeomCurve);
|
||||
//! NCollection_Array1<gp_Pnt> aGrid = anEval.EvaluateGrid(myParams);
|
||||
//! @endcode
|
||||
class GeomGridEval_Curve
|
||||
@@ -74,12 +73,17 @@ public:
|
||||
GeomGridEval_OffsetCurve, // Offset curve
|
||||
GeomGridEval_OtherCurve>; // Fallback for other types
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
GeomGridEval_Curve()
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
}
|
||||
//! Construct from adaptor reference (auto-detects curve type).
|
||||
//! For GeomAdaptor_Curve, extracts underlying Geom_Curve for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The curve adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param[in] theCurve curve adaptor reference to evaluate
|
||||
Standard_EXPORT GeomGridEval_Curve(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Construct from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve geometry to evaluate
|
||||
Standard_EXPORT GeomGridEval_Curve(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
GeomGridEval_Curve(const GeomGridEval_Curve&) = delete;
|
||||
@@ -87,21 +91,6 @@ public:
|
||||
GeomGridEval_Curve(GeomGridEval_Curve&&) = delete;
|
||||
GeomGridEval_Curve& operator=(GeomGridEval_Curve&&) = delete;
|
||||
|
||||
//! Initialize from adaptor reference (auto-detects curve type).
|
||||
//! For GeomAdaptor_Curve, extracts underlying Geom_Curve for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The curve adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param theCurve curve adaptor reference to evaluate
|
||||
Standard_EXPORT void Initialize(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param theCurve geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Evaluate grid points at all parameters.
|
||||
//! @param theParams array of parameter values
|
||||
//! @return array of 3D points (1-based indexing)
|
||||
@@ -137,6 +126,15 @@ public:
|
||||
//! Returns the detected curve type.
|
||||
GeomAbs_CurveType GetType() const { return myCurveType; }
|
||||
|
||||
protected:
|
||||
//! Initialize from adaptor reference (auto-detects curve type).
|
||||
//! @param[in] theCurve curve adaptor reference to evaluate
|
||||
Standard_EXPORT void initialization(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
private:
|
||||
EvaluatorVariant myEvaluator;
|
||||
GeomAbs_CurveType myCurveType;
|
||||
|
||||
@@ -28,8 +28,7 @@ NCollection_Array1<gp_Pnt> GeomGridEval_OffsetCurve::EvaluateGrid(
|
||||
|
||||
// Offset D0 requires basis D1 to compute offset direction
|
||||
// Batch evaluate basis curve D1
|
||||
GeomGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD1> aBasisD1 = aBasisEval.EvaluateGridD1(theParams);
|
||||
if (aBasisD1.IsEmpty())
|
||||
@@ -66,8 +65,7 @@ NCollection_Array1<GeomGridEval::CurveD1> GeomGridEval_OffsetCurve::EvaluateGrid
|
||||
|
||||
// Offset D1 requires basis D2
|
||||
// Batch evaluate basis curve D2
|
||||
GeomGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD2> aBasisD2 = aBasisEval.EvaluateGridD2(theParams);
|
||||
if (aBasisD2.IsEmpty())
|
||||
@@ -105,8 +103,7 @@ NCollection_Array1<GeomGridEval::CurveD2> GeomGridEval_OffsetCurve::EvaluateGrid
|
||||
|
||||
// Offset D2 requires basis D3
|
||||
// Batch evaluate basis curve D3
|
||||
GeomGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD3> aBasisD3 = aBasisEval.EvaluateGridD3(theParams);
|
||||
if (aBasisD3.IsEmpty())
|
||||
@@ -169,8 +166,7 @@ NCollection_Array1<GeomGridEval::CurveD3> GeomGridEval_OffsetCurve::EvaluateGrid
|
||||
|
||||
// Offset D3 requires basis D3 + D4
|
||||
// Batch evaluate basis curve D3, get D4 individually
|
||||
GeomGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Curve aBasisEval(myBasis);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD3> aBasisD3 = aBasisEval.EvaluateGridD3(theParams);
|
||||
if (aBasisD3.IsEmpty())
|
||||
@@ -272,8 +268,7 @@ NCollection_Array1<gp_Vec> GeomGridEval_OffsetCurve::EvaluateGridDN(
|
||||
{
|
||||
// For orders > 3, offset curve DN = basis curve DN (no offset contribution)
|
||||
// Batch evaluate basis curve DN
|
||||
GeomGridEval_Curve aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Curve aBasisEval(myBasis);
|
||||
return aBasisEval.EvaluateGridDN(theParams, theN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ NCollection_Array2<gp_Pnt> GeomGridEval_OffsetSurface::EvaluateGrid(
|
||||
if (!anEquivSurf.IsNull() && anEquivSurf.get() != myGeom.get())
|
||||
{
|
||||
// Use the equivalent surface directly
|
||||
GeomGridEval_Surface anEquivEval;
|
||||
anEquivEval.Initialize(anEquivSurf);
|
||||
GeomGridEval_Surface anEquivEval(anEquivSurf);
|
||||
return anEquivEval.EvaluateGrid(theUParams, theVParams);
|
||||
}
|
||||
}
|
||||
@@ -48,8 +47,7 @@ NCollection_Array2<gp_Pnt> GeomGridEval_OffsetSurface::EvaluateGrid(
|
||||
NCollection_Array2<gp_Pnt> aResult(1, aNbU, 1, aNbV);
|
||||
|
||||
// Batch evaluate basis surface D1 (offset D0 requires basis D1)
|
||||
GeomGridEval_Surface aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Surface aBasisEval(myBasis);
|
||||
NCollection_Array2<GeomGridEval::SurfD1> aBasisD1 =
|
||||
aBasisEval.EvaluateGridD1(theUParams, theVParams);
|
||||
|
||||
@@ -105,8 +103,7 @@ NCollection_Array2<GeomGridEval::SurfD1> GeomGridEval_OffsetSurface::EvaluateGri
|
||||
occ::handle<Geom_Surface> anEquivSurf = myGeom->Surface();
|
||||
if (!anEquivSurf.IsNull() && anEquivSurf.get() != myGeom.get())
|
||||
{
|
||||
GeomGridEval_Surface anEquivEval;
|
||||
anEquivEval.Initialize(anEquivSurf);
|
||||
GeomGridEval_Surface anEquivEval(anEquivSurf);
|
||||
return anEquivEval.EvaluateGridD1(theUParams, theVParams);
|
||||
}
|
||||
}
|
||||
@@ -116,8 +113,7 @@ NCollection_Array2<GeomGridEval::SurfD1> GeomGridEval_OffsetSurface::EvaluateGri
|
||||
NCollection_Array2<GeomGridEval::SurfD1> aResult(1, aNbU, 1, aNbV);
|
||||
|
||||
// Batch evaluate basis surface D2 (offset D1 requires basis D2)
|
||||
GeomGridEval_Surface aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Surface aBasisEval(myBasis);
|
||||
NCollection_Array2<GeomGridEval::SurfD2> aBasisD2 =
|
||||
aBasisEval.EvaluateGridD2(theUParams, theVParams);
|
||||
|
||||
@@ -174,8 +170,7 @@ NCollection_Array2<GeomGridEval::SurfD2> GeomGridEval_OffsetSurface::EvaluateGri
|
||||
occ::handle<Geom_Surface> anEquivSurf = myGeom->Surface();
|
||||
if (!anEquivSurf.IsNull() && anEquivSurf.get() != myGeom.get())
|
||||
{
|
||||
GeomGridEval_Surface anEquivEval;
|
||||
anEquivEval.Initialize(anEquivSurf);
|
||||
GeomGridEval_Surface anEquivEval(anEquivSurf);
|
||||
return anEquivEval.EvaluateGridD2(theUParams, theVParams);
|
||||
}
|
||||
}
|
||||
@@ -185,8 +180,7 @@ NCollection_Array2<GeomGridEval::SurfD2> GeomGridEval_OffsetSurface::EvaluateGri
|
||||
NCollection_Array2<GeomGridEval::SurfD2> aResult(1, aNbU, 1, aNbV);
|
||||
|
||||
// Batch evaluate basis surface D3 (offset D2 requires basis D3)
|
||||
GeomGridEval_Surface aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Surface aBasisEval(myBasis);
|
||||
NCollection_Array2<GeomGridEval::SurfD3> aBasisD3 =
|
||||
aBasisEval.EvaluateGridD3(theUParams, theVParams);
|
||||
|
||||
@@ -250,8 +244,7 @@ NCollection_Array2<GeomGridEval::SurfD3> GeomGridEval_OffsetSurface::EvaluateGri
|
||||
occ::handle<Geom_Surface> anEquivSurf = myGeom->Surface();
|
||||
if (!anEquivSurf.IsNull() && anEquivSurf.get() != myGeom.get())
|
||||
{
|
||||
GeomGridEval_Surface anEquivEval;
|
||||
anEquivEval.Initialize(anEquivSurf);
|
||||
GeomGridEval_Surface anEquivEval(anEquivSurf);
|
||||
return anEquivEval.EvaluateGridD3(theUParams, theVParams);
|
||||
}
|
||||
}
|
||||
@@ -313,8 +306,7 @@ NCollection_Array2<gp_Vec> GeomGridEval_OffsetSurface::EvaluateGridDN(
|
||||
occ::handle<Geom_Surface> anEquivSurf = myGeom->Surface();
|
||||
if (!anEquivSurf.IsNull() && anEquivSurf.get() != myGeom.get())
|
||||
{
|
||||
GeomGridEval_Surface anEquivEval;
|
||||
anEquivEval.Initialize(anEquivSurf);
|
||||
GeomGridEval_Surface anEquivEval(anEquivSurf);
|
||||
return anEquivEval.EvaluateGridDN(theUParams, theVParams, theNU, theNV);
|
||||
}
|
||||
}
|
||||
@@ -325,8 +317,7 @@ NCollection_Array2<gp_Vec> GeomGridEval_OffsetSurface::EvaluateGridDN(
|
||||
NCollection_Array2<gp_Vec> aResult(1, aNbU, 1, aNbV);
|
||||
|
||||
// Batch evaluate basis surface D1 (offset DN requires basis D1)
|
||||
GeomGridEval_Surface aBasisEval;
|
||||
aBasisEval.Initialize(myBasis);
|
||||
GeomGridEval_Surface aBasisEval(myBasis);
|
||||
NCollection_Array2<GeomGridEval::SurfD1> aBasisD1 =
|
||||
aBasisEval.EvaluateGridD1(theUParams, theVParams);
|
||||
|
||||
|
||||
@@ -115,7 +115,25 @@ occ::handle<Geom_Surface> CreateExtrusionSurface(
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
GeomGridEval_Surface::GeomGridEval_Surface(const Adaptor3d_Surface& theSurface)
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomGridEval_Surface::GeomGridEval_Surface(const occ::handle<Geom_Surface>& theSurface)
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Surface::initialization(const Adaptor3d_Surface& theSurface)
|
||||
{
|
||||
// Reset transformation
|
||||
myTrsf.reset();
|
||||
@@ -134,7 +152,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
}
|
||||
|
||||
// Initialize with the underlying Geom_Surface
|
||||
Initialize(aTransformed.GeomSurface());
|
||||
initialization(aTransformed.GeomSurface());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,7 +165,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
occ::handle<Geom_Surface> aGeomSurf = CreateGeomSurfaceFromAdaptor(aRevAdaptor);
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -155,7 +173,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
aGeomSurf = aRevAdaptor.Surface();
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,7 +181,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
aGeomSurf = CreateRevolutionSurface(aRevAdaptor);
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,7 +200,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
occ::handle<Geom_Surface> aGeomSurf = CreateGeomSurfaceFromAdaptor(aExtAdaptor);
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +208,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
aGeomSurf = aExtAdaptor.Surface();
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,7 +216,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
aGeomSurf = CreateExtrusionSurface(aExtAdaptor);
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +240,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,7 +254,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
occ::handle<Geom_Surface> aGeomSurf = CreateGeomSurfaceFromAdaptor(theSurface);
|
||||
if (!aGeomSurf.IsNull())
|
||||
{
|
||||
Initialize(aGeomSurf);
|
||||
initialization(aGeomSurf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,7 +265,7 @@ void GeomGridEval_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomGridEval_Surface::Initialize(const occ::handle<Geom_Surface>& theSurface)
|
||||
void GeomGridEval_Surface::initialization(const occ::handle<Geom_Surface>& theSurface)
|
||||
{
|
||||
if (theSurface.IsNull())
|
||||
{
|
||||
@@ -319,13 +337,6 @@ void GeomGridEval_Surface::Initialize(const occ::handle<Geom_Surface>& theSurfac
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool GeomGridEval_Surface::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
NCollection_Array2<gp_Pnt> GeomGridEval_Surface::EvaluateGrid(
|
||||
const NCollection_Array1<double>& theUParams,
|
||||
const NCollection_Array1<double>& theVParams) const
|
||||
|
||||
@@ -60,10 +60,9 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! GeomGridEval_Surface anEval;
|
||||
//! anEval.Initialize(myAdaptorSurface);
|
||||
//! GeomGridEval_Surface anEval(myAdaptorSurface);
|
||||
//! // OR
|
||||
//! anEval.Initialize(myGeomSurface);
|
||||
//! GeomGridEval_Surface anEval(myGeomSurface);
|
||||
//! // Grid evaluation
|
||||
//! NCollection_Array2<gp_Pnt> aGrid = anEval.EvaluateGrid(myUParams, myVParams);
|
||||
//! @endcode
|
||||
@@ -86,12 +85,17 @@ public:
|
||||
GeomGridEval_SurfaceOfExtrusion, // Surface of extrusion
|
||||
GeomGridEval_OtherSurface>; // Fallback for other types
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
GeomGridEval_Surface()
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
}
|
||||
//! Construct from adaptor reference (auto-detects surface type).
|
||||
//! For GeomAdaptor_Surface, extracts underlying Geom_Surface for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The surface adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param[in] theSurface surface adaptor reference to evaluate
|
||||
Standard_EXPORT GeomGridEval_Surface(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Construct from geometry handle (auto-detects surface type).
|
||||
//! @param[in] theSurface geometry to evaluate
|
||||
Standard_EXPORT GeomGridEval_Surface(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
GeomGridEval_Surface(const GeomGridEval_Surface&) = delete;
|
||||
@@ -99,21 +103,6 @@ public:
|
||||
GeomGridEval_Surface(GeomGridEval_Surface&&) = delete;
|
||||
GeomGridEval_Surface& operator=(GeomGridEval_Surface&&) = delete;
|
||||
|
||||
//! Initialize from adaptor reference (auto-detects surface type).
|
||||
//! For GeomAdaptor_Surface, extracts underlying Geom_Surface for optimized evaluation.
|
||||
//! For other adaptors, stores reference for fallback evaluation.
|
||||
//! @note The surface adaptor reference must remain valid during the lifetime
|
||||
//! of this evaluator when using fallback evaluation.
|
||||
//! @param theSurface surface adaptor reference to evaluate
|
||||
Standard_EXPORT void Initialize(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects surface type).
|
||||
//! @param theSurface geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Evaluate grid points at all specified parameters.
|
||||
//! @param[in] theUParams array of U parameter values
|
||||
//! @param[in] theVParams array of V parameter values
|
||||
@@ -167,6 +156,15 @@ public:
|
||||
//! Returns the transformation (empty if not set).
|
||||
const std::optional<gp_Trsf>& GetTransformation() const { return myTrsf; }
|
||||
|
||||
protected:
|
||||
//! Initialize from adaptor reference (auto-detects surface type).
|
||||
//! @param[in] theSurface surface adaptor reference to evaluate
|
||||
Standard_EXPORT void initialization(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects surface type).
|
||||
//! @param[in] theSurface geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
private:
|
||||
//! Apply transformation to grid of points.
|
||||
void applyTransformation(NCollection_Array2<gp_Pnt>& theGrid) const;
|
||||
|
||||
@@ -43,8 +43,7 @@ NCollection_Array2<gp_Pnt> GeomGridEval_SurfaceOfExtrusion::EvaluateGrid(
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve points using optimized curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<gp_Pnt> aCurvePoints = aCurveEval.EvaluateGrid(theUParams);
|
||||
if (aCurvePoints.IsEmpty())
|
||||
@@ -87,8 +86,7 @@ NCollection_Array2<GeomGridEval::SurfD1> GeomGridEval_SurfaceOfExtrusion::Evalua
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D1 using optimized curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD1> aCurveD1 = aCurveEval.EvaluateGridD1(theUParams);
|
||||
if (aCurveD1.IsEmpty())
|
||||
@@ -138,8 +136,7 @@ NCollection_Array2<GeomGridEval::SurfD2> GeomGridEval_SurfaceOfExtrusion::Evalua
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D2 using optimized curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD2> aCurveD2 = aCurveEval.EvaluateGridD2(theUParams);
|
||||
if (aCurveD2.IsEmpty())
|
||||
@@ -194,8 +191,7 @@ NCollection_Array2<GeomGridEval::SurfD3> GeomGridEval_SurfaceOfExtrusion::Evalua
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D3 using optimized curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD3> aCurveD3 = aCurveEval.EvaluateGridD3(theUParams);
|
||||
if (aCurveD3.IsEmpty())
|
||||
@@ -266,8 +262,7 @@ NCollection_Array2<gp_Vec> GeomGridEval_SurfaceOfExtrusion::EvaluateGridDN(
|
||||
if (theNV == 0)
|
||||
{
|
||||
// Pure U derivative = curve derivative
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<gp_Vec> aCurveDN = aCurveEval.EvaluateGridDN(theUParams, theNU);
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ NCollection_Array2<gp_Pnt> GeomGridEval_SurfaceOfRevolution::EvaluateGrid(
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve points using optimized curve evaluator
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<gp_Pnt> aCurvePoints = aCurveEval.EvaluateGrid(theVParams);
|
||||
if (aCurvePoints.IsEmpty())
|
||||
@@ -86,8 +85,7 @@ NCollection_Array2<GeomGridEval::SurfD1> GeomGridEval_SurfaceOfRevolution::Evalu
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D1
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD1> aCurveD1 = aCurveEval.EvaluateGridD1(theVParams);
|
||||
if (aCurveD1.IsEmpty())
|
||||
@@ -136,8 +134,7 @@ NCollection_Array2<GeomGridEval::SurfD2> GeomGridEval_SurfaceOfRevolution::Evalu
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D2
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD2> aCurveD2 = aCurveEval.EvaluateGridD2(theVParams);
|
||||
if (aCurveD2.IsEmpty())
|
||||
@@ -190,8 +187,7 @@ NCollection_Array2<GeomGridEval::SurfD3> GeomGridEval_SurfaceOfRevolution::Evalu
|
||||
const int aNbV = theVParams.Size();
|
||||
|
||||
// Batch evaluate curve D3
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
NCollection_Array1<GeomGridEval::CurveD3> aCurveD3 = aCurveEval.EvaluateGridD3(theVParams);
|
||||
if (aCurveD3.IsEmpty())
|
||||
@@ -254,8 +250,7 @@ NCollection_Array2<gp_Vec> GeomGridEval_SurfaceOfRevolution::EvaluateGridDN(
|
||||
NCollection_Array2<gp_Vec> aResult(1, aNbU, 1, aNbV);
|
||||
|
||||
// Get curve data
|
||||
GeomGridEval_Curve aCurveEval;
|
||||
aCurveEval.Initialize(myBasisCurve);
|
||||
GeomGridEval_Curve aCurveEval(myBasisCurve);
|
||||
|
||||
if (theNU == 0)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,25 @@
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Curve::Initialize(const Adaptor3d_Curve& theCurve)
|
||||
GeomProp_Curve::GeomProp_Curve(const Adaptor3d_Curve& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomProp_Curve::GeomProp_Curve(const occ::handle<Geom_Curve>& theCurve)
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
initialization(theCurve);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Curve::initialization(const Adaptor3d_Curve& theCurve)
|
||||
{
|
||||
if (theCurve.IsKind(STANDARD_TYPE(GeomAdaptor_Curve)))
|
||||
{
|
||||
@@ -36,7 +54,7 @@ void GeomProp_Curve::Initialize(const Adaptor3d_Curve& theCurve)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Curve::Initialize(const occ::handle<Geom_Curve>& theCurve)
|
||||
void GeomProp_Curve::initialization(const occ::handle<Geom_Curve>& theCurve)
|
||||
{
|
||||
if (theCurve.IsNull())
|
||||
{
|
||||
@@ -91,13 +109,6 @@ void GeomProp_Curve::initFromAdaptor()
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool GeomProp_Curve::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomProp::TangentResult GeomProp_Curve::Tangent(const double theParam, const double theTol) const
|
||||
{
|
||||
return std::visit(
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! GeomProp_Curve aProp;
|
||||
//! aProp.Initialize(myGeomCurve);
|
||||
//! GeomProp_Curve aProp(myGeomCurve);
|
||||
//! GeomProp::CurvatureResult aCurv = aProp.Curvature(0.5, Precision::Confusion());
|
||||
//! if (aCurv.IsDefined)
|
||||
//! {
|
||||
@@ -78,12 +77,14 @@ public:
|
||||
GeomProp_OffsetCurve,
|
||||
GeomProp_OtherCurve>;
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
GeomProp_Curve()
|
||||
: myEvaluator(std::monostate{}),
|
||||
myCurveType(GeomAbs_OtherCurve)
|
||||
{
|
||||
}
|
||||
//! Construct from 3D adaptor reference (auto-detects curve type).
|
||||
//! For GeomAdaptor_Curve, extracts underlying Geom_Curve for optimized evaluation.
|
||||
//! @param[in] theCurve 3D curve adaptor reference
|
||||
Standard_EXPORT GeomProp_Curve(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Construct from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 3D geometry to evaluate
|
||||
Standard_EXPORT GeomProp_Curve(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
GeomProp_Curve(const GeomProp_Curve&) = delete;
|
||||
@@ -91,18 +92,6 @@ public:
|
||||
GeomProp_Curve(GeomProp_Curve&&) = delete;
|
||||
GeomProp_Curve& operator=(GeomProp_Curve&&) = delete;
|
||||
|
||||
//! Initialize from 3D adaptor reference (auto-detects curve type).
|
||||
//! For GeomAdaptor_Curve, extracts underlying Geom_Curve for optimized evaluation.
|
||||
//! @param[in] theCurve 3D curve adaptor reference
|
||||
Standard_EXPORT void Initialize(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 3D geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Returns the detected curve type.
|
||||
GeomAbs_CurveType GetType() const { return myCurveType; }
|
||||
|
||||
@@ -138,6 +127,15 @@ public:
|
||||
//! @return analysis result with inflection points sorted by parameter
|
||||
Standard_EXPORT GeomProp::CurveAnalysis FindInflections() const;
|
||||
|
||||
protected:
|
||||
//! Initialize from 3D adaptor reference (auto-detects curve type).
|
||||
//! @param[in] theCurve 3D curve adaptor reference
|
||||
Standard_EXPORT void initialization(const Adaptor3d_Curve& theCurve);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects curve type).
|
||||
//! @param[in] theCurve 3D geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom_Curve>& theCurve);
|
||||
|
||||
private:
|
||||
//! Initialize from stored adaptor (dispatches to per-geometry evaluator).
|
||||
//! Must be called after myAdaptor is set. Per-geometry evaluators receive
|
||||
|
||||
@@ -17,7 +17,25 @@
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
GeomProp_Surface::GeomProp_Surface(const Adaptor3d_Surface& theSurface)
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomProp_Surface::GeomProp_Surface(const occ::handle<Geom_Surface>& theSurface)
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
initialization(theSurface);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Surface::initialization(const Adaptor3d_Surface& theSurface)
|
||||
{
|
||||
if (theSurface.IsKind(STANDARD_TYPE(GeomAdaptor_Surface)))
|
||||
{
|
||||
@@ -35,7 +53,7 @@ void GeomProp_Surface::Initialize(const Adaptor3d_Surface& theSurface)
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
void GeomProp_Surface::Initialize(const occ::handle<Geom_Surface>& theSurface)
|
||||
void GeomProp_Surface::initialization(const occ::handle<Geom_Surface>& theSurface)
|
||||
{
|
||||
if (theSurface.IsNull())
|
||||
{
|
||||
@@ -96,13 +114,6 @@ void GeomProp_Surface::initFromAdaptor()
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
bool GeomProp_Surface::IsInitialized() const
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(myEvaluator);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
GeomProp::SurfaceNormalResult GeomProp_Surface::Normal(const double theU,
|
||||
const double theV,
|
||||
const double theTol) const
|
||||
|
||||
@@ -57,8 +57,7 @@
|
||||
//!
|
||||
//! Usage:
|
||||
//! @code
|
||||
//! GeomProp_Surface aProp;
|
||||
//! aProp.Initialize(myGeomSurface);
|
||||
//! GeomProp_Surface aProp(myGeomSurface);
|
||||
//! GeomProp::SurfaceCurvatureResult aCurv = aProp.Curvatures(0.5, 0.5, Precision::Confusion());
|
||||
//! if (aCurv.IsDefined)
|
||||
//! {
|
||||
@@ -85,12 +84,14 @@ public:
|
||||
GeomProp_OffsetSurface,
|
||||
GeomProp_OtherSurface>;
|
||||
|
||||
//! Default constructor - uninitialized state.
|
||||
GeomProp_Surface()
|
||||
: myEvaluator(std::monostate{}),
|
||||
mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
}
|
||||
//! Construct from 3D adaptor reference (auto-detects surface type).
|
||||
//! For GeomAdaptor_Surface, extracts underlying Geom_Surface for optimized evaluation.
|
||||
//! @param[in] theSurface 3D surface adaptor reference
|
||||
Standard_EXPORT GeomProp_Surface(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Construct from geometry handle (auto-detects surface type).
|
||||
//! @param[in] theSurface 3D geometry to evaluate
|
||||
Standard_EXPORT GeomProp_Surface(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
//! Non-copyable and non-movable.
|
||||
GeomProp_Surface(const GeomProp_Surface&) = delete;
|
||||
@@ -98,18 +99,6 @@ public:
|
||||
GeomProp_Surface(GeomProp_Surface&&) = delete;
|
||||
GeomProp_Surface& operator=(GeomProp_Surface&&) = delete;
|
||||
|
||||
//! Initialize from 3D adaptor reference (auto-detects surface type).
|
||||
//! For GeomAdaptor_Surface, extracts underlying Geom_Surface for optimized evaluation.
|
||||
//! @param[in] theSurface 3D surface adaptor reference
|
||||
Standard_EXPORT void Initialize(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects surface type).
|
||||
//! @param[in] theSurface 3D geometry to evaluate
|
||||
Standard_EXPORT void Initialize(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
//! Returns true if properly initialized.
|
||||
Standard_EXPORT bool IsInitialized() const;
|
||||
|
||||
//! Returns the detected surface type.
|
||||
GeomAbs_SurfaceType GetType() const { return mySurfaceType; }
|
||||
|
||||
@@ -140,6 +129,15 @@ public:
|
||||
double theV,
|
||||
double theTol) const;
|
||||
|
||||
protected:
|
||||
//! Initialize from 3D adaptor reference (auto-detects surface type).
|
||||
//! @param[in] theSurface 3D surface adaptor reference
|
||||
Standard_EXPORT void initialization(const Adaptor3d_Surface& theSurface);
|
||||
|
||||
//! Initialize from geometry handle (auto-detects surface type).
|
||||
//! @param[in] theSurface 3D geometry to evaluate
|
||||
Standard_EXPORT void initialization(const occ::handle<Geom_Surface>& theSurface);
|
||||
|
||||
private:
|
||||
//! Initialize from stored adaptor (dispatches to per-geometry evaluator).
|
||||
//! Must be called after myAdaptor is set. Per-geometry evaluators receive
|
||||
|
||||
@@ -451,8 +451,7 @@ void BndLib_AddSurface::Add(const Adaptor3d_Surface& S,
|
||||
aVParams.SetValue(j, VMin + ((VMax - VMin) * (j - 1) / (Nv - 1)));
|
||||
}
|
||||
|
||||
GeomGridEval_Surface anEvaluator;
|
||||
anEvaluator.Initialize(S);
|
||||
GeomGridEval_Surface anEvaluator(S);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(aUParams, aVParams);
|
||||
for (int i = aGrid.LowerRow(); i <= aGrid.UpperRow(); i++)
|
||||
@@ -577,8 +576,7 @@ void BndLib_AddSurface::AddGenSurf(const Adaptor3d_Surface& S,
|
||||
aVParams.SetValue(j, VMin + (j - 1) * dv2);
|
||||
}
|
||||
|
||||
GeomGridEval_Surface anEvaluator;
|
||||
anEvaluator.Initialize(S);
|
||||
GeomGridEval_Surface anEvaluator(S);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aFineGrid = anEvaluator.EvaluateGrid(aUParams, aVParams);
|
||||
|
||||
|
||||
@@ -249,8 +249,7 @@ void Extrema_GenExtCS::Initialize(const Adaptor3d_Surface& S,
|
||||
}
|
||||
|
||||
// Use batch grid evaluation for optimized surface point computation
|
||||
GeomGridEval_Surface anEvaluator;
|
||||
anEvaluator.Initialize(*myS);
|
||||
GeomGridEval_Surface anEvaluator(*myS);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(aUParams, aVParams);
|
||||
|
||||
|
||||
@@ -538,8 +538,7 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt& thePoint)
|
||||
// If flag was changed and extrema not reinitialized Extrema would fail
|
||||
myPoints.Resize(0, myusample + 1, 0, myvsample + 1, false);
|
||||
|
||||
GeomGridEval_Surface aGridEval;
|
||||
aGridEval.Initialize(*myS);
|
||||
GeomGridEval_Surface aGridEval(*myS);
|
||||
|
||||
NCollection_Array2<gp_Pnt> aGridPoints =
|
||||
aGridEval.EvaluateGrid(myUParams->Array1(), myVParams->Array1());
|
||||
@@ -870,8 +869,7 @@ void Extrema_GenExtPS::BuildTree()
|
||||
mySphereArray = new NCollection_HArray1<Bnd_Sphere>(0, myusample * myvsample);
|
||||
|
||||
// Use unified grid evaluator for all surface types (optimized for BSpline, Bezier, etc.)
|
||||
GeomGridEval_Surface aGridEval;
|
||||
aGridEval.Initialize(*myS);
|
||||
GeomGridEval_Surface aGridEval(*myS);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aGridPoints =
|
||||
aGridEval.EvaluateGrid(myUParams->Array1(), myVParams->Array1());
|
||||
|
||||
@@ -213,8 +213,7 @@ void Extrema_GenExtSS::Initialize(const Adaptor3d_Surface& S2,
|
||||
}
|
||||
|
||||
// Use batch grid evaluation for optimized surface point computation
|
||||
GeomGridEval_Surface anEvaluator;
|
||||
anEvaluator.Initialize(*myS2);
|
||||
GeomGridEval_Surface anEvaluator(*myS2);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(aUParams, aVParams);
|
||||
|
||||
@@ -294,8 +293,7 @@ void Extrema_GenExtSS::Perform(const Adaptor3d_Surface& S1,
|
||||
}
|
||||
|
||||
// Use batch grid evaluation for optimized surface point computation
|
||||
GeomGridEval_Surface anEvaluator;
|
||||
anEvaluator.Initialize(S1);
|
||||
GeomGridEval_Surface anEvaluator(S1);
|
||||
|
||||
const NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(aU1Params, aV1Params);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user