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

0029176: Exception while projection 2D-point on 2D-line

DRAW-command "2dproj" has been changed. Now, it can return not only 2D-line as extrema but 2D-point.

Test case has been updated.
This commit is contained in:
nbv
2017-10-03 10:30:47 +03:00
committed by bugmaster
parent 8157aa285b
commit 23e8067c74
3 changed files with 32 additions and 13 deletions

View File

@@ -69,14 +69,23 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
Geom2dAPI_ProjectPointOnCurve proj(P,GC,GC->FirstParameter(),
GC->LastParameter());
for ( Standard_Integer i = 1; i <= proj.NbPoints(); i++) {
gp_Pnt2d P1 = proj.Point(i);
Handle(Geom2d_Line) L = new Geom2d_Line(P,gp_Vec2d(P,P1));
Handle(Geom2d_TrimmedCurve) CT =
new Geom2d_TrimmedCurve(L, 0., P.Distance(P1));
Sprintf(name,"%s%d","ext_",i);
char* temp = name; // portage WNT
DrawTrSurf::Set(temp, CT);
for (Standard_Integer i = 1; i <= proj.NbPoints(); i++)
{
gp_Pnt2d aP1 = proj.Point(i);
const Standard_Real aDist = P.Distance(aP1);
Sprintf(name, "%s%d", "ext_", i);
if (aDist > Precision::PConfusion())
{
Handle(Geom2d_Line) L = new Geom2d_Line(P, gp_Dir2d(aP1.XY() - P.XY()));
Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., aDist);
DrawTrSurf::Set(name, CT);
}
else
{
DrawTrSurf::Set(name, aP1);
}
di << name << " ";
}