mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028054: Regression: Class BRepProj_Projection gives invalid result after projection edge based on the line on the conical surface
Problem of projection of line on the cone in the special case when starting point of the line coincides with the cone apex is fixed (by shifting this point along the source line).
This commit is contained in:
@@ -94,10 +94,19 @@ void ProjLib_Cone::Init(const gp_Cone& Co)
|
||||
|
||||
void ProjLib_Cone::Project(const gp_Lin& L)
|
||||
{
|
||||
gp_Pnt aPnt = L.Location(), anApex = myCone.Apex();
|
||||
|
||||
Standard_Real aDeltaV = 0.0;
|
||||
|
||||
Standard_Real U,V;
|
||||
if (aPnt.IsEqual(anApex, Precision::Confusion()))
|
||||
{
|
||||
//Take another point in the line L, which does not coincide with the cone apex.
|
||||
aPnt.Translate(L.Direction().XYZ());
|
||||
aDeltaV = 1.0; // == ||L.Direction()|| == 1.0
|
||||
}
|
||||
|
||||
ElSLib::ConeParameters(myCone.Position(), myCone.RefRadius(), myCone.SemiAngle(), L.Location(),
|
||||
ElSLib::ConeParameters(myCone.Position(), myCone.RefRadius(), myCone.SemiAngle(), aPnt,
|
||||
U, V);
|
||||
//
|
||||
gp_Pnt P;
|
||||
@@ -107,21 +116,19 @@ void ProjLib_Cone::Project(const gp_Lin& L)
|
||||
P, Vu, Vv);
|
||||
|
||||
gp_Dir Dv(Vv);
|
||||
if(Dv.IsParallel(L.Direction(), Precision::Angular())) {
|
||||
|
||||
if(Dv.IsParallel(L.Direction(), Precision::Angular()))
|
||||
{
|
||||
// L is parallel to U-isoline of the cone.
|
||||
myType = GeomAbs_Line;
|
||||
|
||||
gp_Pnt2d P2d(U,V);
|
||||
|
||||
Standard_Real Signe = L.Direction().Dot(Dv);
|
||||
Signe = (Signe > 0.) ? 1. : -1.;
|
||||
gp_Dir2d D2d(0., Signe);
|
||||
const Standard_Real aSign = Sign(1.0, L.Direction().Dot(Dv));
|
||||
gp_Pnt2d P2d(U, V - aDeltaV*aSign);
|
||||
gp_Dir2d D2d(0., aSign);
|
||||
|
||||
myLin = gp_Lin2d( P2d, D2d);
|
||||
|
||||
isDone = Standard_True;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user