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

0027322: geom/revolution_00/A1: Incorrect pcurve creation

ProjLib_Cone.cxx - correction wrong calculation of projection line on cone
GeomInt_IntSS_1.cxx - modification of method BuildPCurves(...) - adjusting first or last knots of 2d Curve
ProjLib_ComputeApprox.cxx - modification of method Function_SetUVBounds(...) for case projecting line on cone.
Modification of tests - removing first TODO

Test case for issue #27322
This commit is contained in:
ifv
2016-04-07 15:35:39 +03:00
committed by bugmaster
parent 94074ec660
commit 8f8398f6e4
6 changed files with 74 additions and 35 deletions

View File

@@ -225,8 +225,28 @@ static void Function_SetUVBounds(Standard_Real& myU1,
switch ( mySurface->GetType()) {
case GeomAbs_Cone: {
Standard_Real tol = Epsilon(1.);
Standard_Real ptol = Precision::PConfusion();
gp_Cone Cone = mySurface->Cone();
VCouture = Standard_False;
//Calculation of cone parameters for P == ConeApex often produces wrong
//values of U
gp_Pnt ConeApex = Cone.Apex();
if(ConeApex.XYZ().IsEqual(P1.XYZ(), tol))
{
W1 += ptol;
P1 = myCurve->Value(W1);
}
if(ConeApex.XYZ().IsEqual(P2.XYZ(), tol))
{
W2 -= ptol;
P2 = myCurve->Value(W2);
}
if(ConeApex.XYZ().IsEqual(P.XYZ(), tol))
{
W += ptol;
P = myCurve->Value(W);
}
switch( myCurve->GetType() ){
case GeomAbs_Parabola:
@@ -255,6 +275,10 @@ static void Function_SetUVBounds(Standard_Real& myU1,
myU1 = U1; myU2 = U1; Uf = U1;
Standard_Real Step = .1;
Standard_Integer nbp = (Standard_Integer)((W2 - W1) / Step + 1);
if(myCurve->GetType() == GeomAbs_Line)
{
nbp = 3;
}
nbp = Max(nbp, 3);
Step = (W2 - W1) / (nbp - 1);
Standard_Boolean isclandper = (!(myCurve->IsClosed()) && !(myCurve->IsPeriodic()));

View File

@@ -96,48 +96,24 @@ void ProjLib_Cone::Project(const gp_Lin& L)
{
Standard_Real U,V;
// Compute V
V = gp_Vec(myCone.Location(),L.Location())
.Dot(gp_Vec(myCone.Position().Direction()));
V /= Cos( myCone.SemiAngle());
// Compute U
gp_Ax3 CPos = myCone.Position();
gp_Dir ZCone = CPos.XDirection() ^ CPos.YDirection();
gp_Ax3 RightHanded(CPos.Location(), ZCone, CPos.XDirection());
gp_Trsf T;
T.SetTransformation(RightHanded);
gp_Dir D = L.Position().Direction();
D.Transform(T);
if ( D.Z() < 0.) D.Reverse();
D.SetCoord(3, 0.);
U = gp::DX().AngleWithRef( D, gp::DZ());
Standard_Integer a1 =
(ZCone.IsEqual(CPos.Direction(), Precision::Angular())) ? 1 : -1;
Standard_Integer a2 =
(myCone.SemiAngle() > 0) ? 1 : -1;
if ( ( a1 * a2) == -1) U -= M_PI;
if ( U < 0.) U += 2.*M_PI;
ElSLib::ConeParameters(myCone.Position(), myCone.RefRadius(), myCone.SemiAngle(), L.Location(),
U, V);
//
gp_Pnt P;
gp_Vec Vu, Vv;
ElSLib::ConeD1(U, V, CPos, myCone.RefRadius(), myCone.SemiAngle(),
ElSLib::ConeD1(U, V, myCone.Position(), myCone.RefRadius(), myCone.SemiAngle(),
P, Vu, Vv);
if(Vv.IsParallel(gp_Vec(L.Position().Direction()), Precision::Angular())) {
gp_Dir Dv(Vv);
if(Dv.IsParallel(L.Direction(), Precision::Angular())) {
myType = GeomAbs_Line;
gp_Pnt2d P2d(U,V);
Standard_Real Signe = L.Direction().Dot(myCone.Position().Direction());
Standard_Real Signe = L.Direction().Dot(Dv);
Signe = (Signe > 0.) ? 1. : -1.;
gp_Dir2d D2d(0., Signe);