mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0023709: Redesign of hlrtest command: vhlr and vhlrtype commands were added; hlr type changing was added to AIS_Shape, AIS_Drawer and Prs3d_Drawer
QuickHLR and ExactHLR items removed from AIS_DisplayMode enumeration as unused. Minor coding style and CDL documentation corrections applied. Compiler error in AIS_Shape::SetTypeOfHLR() corrected Corrections in HLR algorithm. Compiler error in AIS_Shape::TypeOfHLR() corrected Added test cases bugs vis bug23709_1/bug23709_2/bug23709_3/bug23709_4
This commit is contained in:
@@ -23,9 +23,16 @@
|
||||
#include <BRepLib_MakeEdge2d.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <BRepLib_MakeVertex.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEdge
|
||||
@@ -42,90 +49,119 @@ TopoDS_Edge HLRBRep::MakeEdge (const HLRBRep_Curve& ec,
|
||||
|
||||
switch (ec.GetType())
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Line(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Circle:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Circle(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Ellipse:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Ellipse(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Hyperbola:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Hyperbola(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Parabola:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Parabola(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_BezierCurve: {
|
||||
TColgp_Array1OfPnt2d Poles(1,ec.NbPoles());
|
||||
Handle(Geom2d_BezierCurve) ec2d;
|
||||
if (ec.IsRational()) {
|
||||
TColStd_Array1OfReal Weights(1,ec.NbPoles());
|
||||
ec.PolesAndWeights(Poles,Weights);
|
||||
ec2d = new Geom2d_BezierCurve(Poles,Weights);
|
||||
case GeomAbs_Line:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Line(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Circle:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Circle(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Ellipse:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Ellipse(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Hyperbola:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Hyperbola(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_Parabola:
|
||||
Edg = BRepLib_MakeEdge2d(ec.Parabola(),sta,end);
|
||||
break;
|
||||
|
||||
case GeomAbs_BezierCurve: {
|
||||
TColgp_Array1OfPnt2d Poles(1,ec.NbPoles());
|
||||
Handle(Geom2d_BezierCurve) ec2d;
|
||||
if (ec.IsRational()) {
|
||||
TColStd_Array1OfReal Weights(1,ec.NbPoles());
|
||||
ec.PolesAndWeights(Poles,Weights);
|
||||
ec2d = new Geom2d_BezierCurve(Poles,Weights);
|
||||
}
|
||||
else {
|
||||
ec.Poles(Poles);
|
||||
ec2d = new Geom2d_BezierCurve(Poles);
|
||||
}
|
||||
BRepLib_MakeEdge2d mke2d(ec2d,sta,end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
break;
|
||||
}
|
||||
|
||||
case GeomAbs_BSplineCurve: {
|
||||
Handle(Geom2d_BSplineCurve) ec2d;
|
||||
GeomAdaptor_Curve GAcurve = ec.GetCurve().Curve();
|
||||
TopoDS_Edge anEdge = ec.GetCurve().Edge();
|
||||
Standard_Real fpar, lpar;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||
const Handle(Geom_BSplineCurve)& BSplCurve = Handle(Geom_BSplineCurve)::DownCast(aCurve);
|
||||
Handle(Geom_BSplineCurve) theCurve = Handle(Geom_BSplineCurve)::DownCast(BSplCurve->Copy());
|
||||
if (theCurve->IsPeriodic() && !GAcurve.IsClosed())
|
||||
{
|
||||
theCurve->Segment(sta, end);
|
||||
TColgp_Array1OfPnt2d Poles(1, theCurve->NbPoles());
|
||||
TColStd_Array1OfReal knots(1, theCurve->NbKnots());
|
||||
TColStd_Array1OfInteger mults(1, theCurve->NbKnots());
|
||||
//-- ec.KnotsAndMultiplicities(knots,mults);
|
||||
theCurve->Knots(knots);
|
||||
theCurve->Multiplicities(mults);
|
||||
if (theCurve->IsRational()) {
|
||||
TColStd_Array1OfReal Weights(1, theCurve->NbPoles());
|
||||
ec.PolesAndWeights(theCurve, Poles, Weights);
|
||||
ec2d = new Geom2d_BSplineCurve(Poles, Weights, knots, mults,
|
||||
theCurve->Degree(), theCurve->IsPeriodic());
|
||||
}
|
||||
else {
|
||||
ec.Poles(Poles);
|
||||
ec2d = new Geom2d_BezierCurve(Poles);
|
||||
ec.Poles(theCurve, Poles);
|
||||
ec2d = new Geom2d_BSplineCurve(Poles, knots, mults,
|
||||
theCurve->Degree(), theCurve->IsPeriodic());
|
||||
}
|
||||
BRepLib_MakeEdge2d mke2d(ec2d,sta,end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
break;
|
||||
}
|
||||
|
||||
case GeomAbs_BSplineCurve: {
|
||||
else
|
||||
{
|
||||
TColgp_Array1OfPnt2d Poles(1,ec.NbPoles());
|
||||
TColStd_Array1OfReal knots(1,ec.NbKnots());
|
||||
TColStd_Array1OfInteger mults(1,ec.NbKnots());
|
||||
//-- ec.KnotsAndMultiplicities(knots,mults);
|
||||
ec.Knots(knots);
|
||||
ec.Multiplicities(mults);
|
||||
Handle(Geom2d_BSplineCurve) ec2d;
|
||||
if (ec.IsRational()) {
|
||||
TColStd_Array1OfReal Weights(1,ec.NbPoles());
|
||||
ec.PolesAndWeights(Poles,Weights);
|
||||
ec2d = new Geom2d_BSplineCurve(Poles,Weights,knots,mults,ec.Degree());
|
||||
ec2d = new Geom2d_BSplineCurve(Poles,Weights,knots,mults,ec.Degree(),ec.IsPeriodic());
|
||||
}
|
||||
else {
|
||||
ec.Poles(Poles);
|
||||
ec2d = new Geom2d_BSplineCurve(Poles,knots,mults,ec.Degree());
|
||||
ec2d = new Geom2d_BSplineCurve(Poles,knots,mults,ec.Degree(),ec.IsPeriodic());
|
||||
}
|
||||
BRepLib_MakeEdge2d mke2d(ec2d,sta,end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
const Standard_Integer nbPnt = 15;
|
||||
TColgp_Array1OfPnt2d Poles(1,nbPnt);
|
||||
TColStd_Array1OfReal knots(1,nbPnt);
|
||||
TColStd_Array1OfInteger mults(1,nbPnt);
|
||||
mults.Init(1);
|
||||
mults(1 ) = 2;
|
||||
mults(nbPnt) = 2;
|
||||
const Standard_Real step = (U2-U1)/(nbPnt-1);
|
||||
Standard_Real par3d = U1;
|
||||
for (Standard_Integer i = 1; i < nbPnt; i++) {
|
||||
Poles(i) = ec.Value(par3d);
|
||||
knots(i) = par3d;
|
||||
par3d += step;
|
||||
}
|
||||
Poles(nbPnt) = ec.Value(U2);
|
||||
knots(nbPnt) = U2;
|
||||
|
||||
Handle(Geom2d_BSplineCurve) ec2d = new Geom2d_BSplineCurve(Poles,knots,mults,1);
|
||||
BRepLib_MakeEdge2d mke2d(ec2d,sta,end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
BRepLib_MakeEdge2d mke2d(ec2d, sta, end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const Standard_Integer nbPnt = 15;
|
||||
TColgp_Array1OfPnt2d Poles(1,nbPnt);
|
||||
TColStd_Array1OfReal knots(1,nbPnt);
|
||||
TColStd_Array1OfInteger mults(1,nbPnt);
|
||||
mults.Init(1);
|
||||
mults(1 ) = 2;
|
||||
mults(nbPnt) = 2;
|
||||
const Standard_Real step = (U2-U1)/(nbPnt-1);
|
||||
Standard_Real par3d = U1;
|
||||
for (Standard_Integer i = 1; i < nbPnt; i++) {
|
||||
Poles(i) = ec.Value(par3d);
|
||||
knots(i) = par3d;
|
||||
par3d += step;
|
||||
}
|
||||
Poles(nbPnt) = ec.Value(U2);
|
||||
knots(nbPnt) = U2;
|
||||
|
||||
Handle(Geom2d_BSplineCurve) ec2d = new Geom2d_BSplineCurve(Poles,knots,mults,1);
|
||||
BRepLib_MakeEdge2d mke2d(ec2d,sta,end);
|
||||
if (mke2d.IsDone())
|
||||
Edg = mke2d.Edge();
|
||||
}
|
||||
}
|
||||
return Edg;
|
||||
}
|
||||
|
@@ -47,7 +47,8 @@ uses
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Edge from TopoDS,
|
||||
Curve from BRepAdaptor
|
||||
Curve from BRepAdaptor,
|
||||
BSplineCurve from Geom
|
||||
|
||||
raises
|
||||
NoSuchObject from Standard,
|
||||
@@ -74,6 +75,12 @@ is
|
||||
---Purpose: Sets the 3D curve to be projected.
|
||||
is static;
|
||||
|
||||
GetCurve(me) returns Curve from BRepAdaptor
|
||||
---Purpose: Returns the 3D curve.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Parameter2d(me; P3d : Real from Standard) returns Real from Standard
|
||||
---Purpose: Returns the parameter on the 2d curve from the
|
||||
-- parameter on the 3d curve.
|
||||
@@ -305,6 +312,13 @@ is
|
||||
OutOfRange from Standard -- if TP has not length NbPoles
|
||||
is static;
|
||||
|
||||
Poles(me; aCurve : BSplineCurve from Geom;
|
||||
TP : in out Array1OfPnt2d from TColgp)
|
||||
raises
|
||||
NoSuchObject from Standard, -- if rational
|
||||
OutOfRange from Standard -- if TP has not length NbPoles
|
||||
is static;
|
||||
|
||||
PolesAndWeights(me; TP : in out Array1OfPnt2d from TColgp;
|
||||
TW : in out Array1OfReal from TColStd)
|
||||
raises
|
||||
@@ -312,6 +326,14 @@ is
|
||||
OutOfRange from Standard -- if TW has not length NbPoles
|
||||
is static;
|
||||
|
||||
PolesAndWeights(me; aCurve : BSplineCurve from Geom;
|
||||
TP : in out Array1OfPnt2d from TColgp;
|
||||
TW : in out Array1OfReal from TColStd)
|
||||
raises
|
||||
NoSuchObject from Standard, -- if not rational
|
||||
OutOfRange from Standard -- if TW has not length NbPoles
|
||||
is static;
|
||||
|
||||
NbKnots(me) returns Integer from Standard
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
|
@@ -520,6 +520,26 @@ void HLRBRep_Curve::Poles (TColgp_Array1OfPnt2d& TP) const
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Poles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void HLRBRep_Curve::Poles (const Handle(Geom_BSplineCurve)& aCurve,
|
||||
TColgp_Array1OfPnt2d& TP) const
|
||||
{
|
||||
Standard_Integer i1 = TP.Lower();
|
||||
Standard_Integer i2 = TP.Upper();
|
||||
TColgp_Array1OfPnt TP3(i1,i2);
|
||||
//-- HLRBRep_BCurveTool::Poles(myCurve,TP3);
|
||||
aCurve->Poles(TP3);
|
||||
|
||||
for (Standard_Integer i = i1; i <= i2; i++) {
|
||||
((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
|
||||
TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesAndWeights
|
||||
//purpose :
|
||||
@@ -551,6 +571,30 @@ void HLRBRep_Curve::PolesAndWeights (TColgp_Array1OfPnt2d& TP,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesAndWeights
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void HLRBRep_Curve::PolesAndWeights (const Handle(Geom_BSplineCurve)& aCurve,
|
||||
TColgp_Array1OfPnt2d& TP,
|
||||
TColStd_Array1OfReal& TW) const
|
||||
{
|
||||
Standard_Integer i1 = TP.Lower();
|
||||
Standard_Integer i2 = TP.Upper();
|
||||
TColgp_Array1OfPnt TP3(i1,i2);
|
||||
//-- HLRBRep_BCurveTool::PolesAndWeights(myCurve,TP3,TW);
|
||||
|
||||
aCurve->Poles(TP3);
|
||||
aCurve->Weights(TW);
|
||||
//-- (HLRBRep_BCurveTool::BSpline(myCurve))->PolesAndWeights(TP3,TW);
|
||||
|
||||
for (Standard_Integer i = i1; i <= i2; i++) {
|
||||
((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
|
||||
TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Knots
|
||||
//purpose :
|
||||
|
@@ -45,6 +45,14 @@ inline void HLRBRep_Curve::Projector(const Standard_Address Proj)
|
||||
inline BRepAdaptor_Curve& HLRBRep_Curve::Curve()
|
||||
{ return myCurve; }
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const BRepAdaptor_Curve& HLRBRep_Curve::GetCurve() const
|
||||
{ return myCurve; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Value3D
|
||||
//purpose :
|
||||
|
@@ -820,7 +820,7 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
|
||||
fd->Side(FS.IsSide(tol,myToler*10));
|
||||
Standard_Boolean inverted = Standard_False;
|
||||
if (fd->WithOutL() && !fd->Side()) {
|
||||
inverted = OrientOutLine(face,*fd);
|
||||
//inverted = OrientOutLine(face,*fd);
|
||||
OrientOthEdge(face,*fd);
|
||||
}
|
||||
if (fd->Side()) {
|
||||
|
@@ -203,7 +203,11 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
|
||||
Standard_Integer ne = 0;
|
||||
|
||||
for (Ex2.Init(Ex1.Current(), TopAbs_EDGE); Ex2.More(); Ex2.Next())
|
||||
ne++;
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(Ex2.Current());
|
||||
if (!BRep_Tool::Degenerated(anEdge))
|
||||
ne++;
|
||||
}
|
||||
|
||||
fd.SetWire (nw, ne);
|
||||
ne = 0;
|
||||
@@ -211,8 +215,10 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
|
||||
for (Ex2.Init(Ex1.Current(), TopAbs_EDGE);
|
||||
Ex2.More();
|
||||
Ex2.Next()) {
|
||||
ne++;
|
||||
const TopoDS_Edge& E = TopoDS::Edge(Ex2.Current());
|
||||
if (BRep_Tool::Degenerated(E))
|
||||
continue;
|
||||
ne++;
|
||||
Standard_Integer ie = EM.FindIndex(E);
|
||||
TopAbs_Orientation orient = E.Orientation();
|
||||
Standard_Boolean Int = TopDS.IsIntLFaceEdge(F,E);
|
||||
|
Reference in New Issue
Block a user