1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024772: Modeling Algorithms - Intersection of cylinder and cone produces incorrect results

GeomInt/GeomInt_IntSS.cxx - handle flat cone case
IntPatch/IntPatch_Intersection.hxx, IntPatch/IntPatch_Intersection.cxx - method for preparing surfaces is added
bugs/lowalgos/intss/bug24772 - test case is changed according new behavior
This commit is contained in:
knosulko
2022-03-16 13:13:15 +03:00
committed by smoskvin
parent 9b337ad8e5
commit 5ae6f08cc6
6 changed files with 219 additions and 63 deletions

View File

@@ -30,34 +30,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
#define myInfinite Precision::Infinite()
static void GetConeApexParam(const gp_Cone& C, Standard_Real& U, Standard_Real& V)
{
const gp_Ax3& Pos = C.Position();
Standard_Real Radius = C.RefRadius();
Standard_Real SAngle = C.SemiAngle();
const gp_Pnt& P = C.Apex();
gp_Trsf T;
T.SetTransformation (Pos);
gp_Pnt Ploc = P.Transformed (T);
if(Ploc.X() ==0.0 && Ploc.Y()==0.0 ) {
U = 0.0;
}
else if ( -Radius > Ploc.Z()* Tan(SAngle) ) {
// the point is at the `wrong` side of the apex
U = atan2(-Ploc.Y(), -Ploc.X());
}
else {
U = atan2(Ploc.Y(),Ploc.X());
}
if (U < -1.e-16) U += (M_PI+M_PI);
else if (U < 0) U = 0;
V = sin(SAngle) * ( Ploc.X() * cos(U) + Ploc.Y() * sin(U) - Radius)
+ cos(SAngle) * Ploc.Z();
}
Adaptor3d_TopolTool::Adaptor3d_TopolTool ()
: myNbSamplesU(-1),
@@ -1376,3 +1348,39 @@ Standard_Boolean Adaptor3d_TopolTool::IsUniformSampling() const
return Standard_False;
return Standard_True;
}
//=======================================================================
//function : GetConeApexParam
//purpose : Computes the cone's apex parameters
//=======================================================================
void Adaptor3d_TopolTool::GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV)
{
const gp_Ax3& Pos = theC.Position();
Standard_Real Radius = theC.RefRadius();
Standard_Real SAngle = theC.SemiAngle();
const gp_Pnt& P = theC.Apex();
gp_Trsf T;
T.SetTransformation(Pos);
gp_Pnt Ploc = P.Transformed(T);
if (Ploc.X() == 0.0 && Ploc.Y() == 0.0)
{
theU = 0.0;
}
else if (-Radius > Ploc.Z() * Tan(SAngle))
{
// the point is at the `wrong` side of the apex
theU = atan2(-Ploc.Y(), -Ploc.X());
}
else
{
theU = atan2(Ploc.Y(), Ploc.X());
}
if (theU < -1.e-16) theU += (M_PI + M_PI);
else if (theU < 0) theU = 0;
theV = sin(SAngle) * (Ploc.X() * cos(theU) + Ploc.Y() * sin(theU) - Radius)
+ cos(SAngle) * Ploc.Z();
}

View File

@@ -146,6 +146,12 @@ public:
//! Returns true if provide uniform sampling of points.
Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const;
//! Computes the cone's apex parameters.
//! @param[in] theC conical surface
//! @param[in] theU U parameter of cone's apex
//! @param[in] theV V parameter of cone's apex
Standard_EXPORT static void GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV);
DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
protected: