p HLRAlgo
p HLRBRep
p HLRTopoBRep
+p HLRAppli
p Hatch
p HatchGen
p IntCurve
raises
NullObject from Standard; -- If the edge or the faces are null.
+ HasContinuity(myclass; E : Edge from TopoDS)
+ returns Boolean
+
+ ---Purpose: Returns True if the edge has regularity on some
+ -- two surfaces
+ raises
+ NullObject from Standard; -- If the edge is null.
-----------------------------------------------------------
-----------------------------------------------------------
return GeomAbs_C0;
}
+//=======================================================================
+//function : HasContinuity
+//purpose : Returns True if the edge is on some two surfaces.
+//=======================================================================
+
+Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E)
+{
+ BRep_ListIteratorOfListOfCurveRepresentation itcr
+ ((*((Handle(BRep_TEdge)*)&E.TShape()))->Curves());
+
+ for (; itcr.More(); itcr.Next())
+ {
+ const Handle(BRep_CurveRepresentation)& CR = itcr.Value();
+ if (CR->IsRegularity())
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
//=======================================================================
//function : Pnt
//purpose : Returns the 3d point.
//jag 940616 SFunc.Set(1.e-8); // tolerance sur la fonction
mySFunc.Set(Precision::Confusion()); // tolerance sur la fonction
- solrst.Perform(myAFunc,Domain,TolArc,TolArc);
+ Standard_Boolean RecheckOnRegularity = Standard_True;
+ solrst.Perform(myAFunc,Domain,TolArc,TolArc,RecheckOnRegularity);
if (!solrst.IsDone()) {
return;
--- /dev/null
+-- File: HLRAppli.cdl
+-- Created: 05.12.12 15:50:05
+-- Created by: Julia GERASIMOVA
+-- Copyright (c) 1999-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+package HLRAppli
+
+ ---Purpose : This package represents applications
+ -- of Hidden Lines Removal algorithm
+
+uses
+ TopoDS,
+ HLRAlgo
+
+is
+ class ReflectLines;
+
+end HLRAppli;
--- /dev/null
+-- File: HLRAppli_ReflectLines.cdl
+-- Created: 05.12.12 15:53:35
+-- Created by: Julia GERASIMOVA
+-- Copyright (c) 1999-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+class ReflectLines from HLRAppli
+
+ ---Purpose : This class builds reflect lines on a shape
+ -- according to the axes of view defined by user.
+ -- Reflect lines are represented by edges in 3d.
+
+
+uses
+ Shape from TopoDS,
+ Projector from HLRAlgo
+
+is
+ Create(aShape : Shape from TopoDS)
+ ---Purpose: Constructor
+ --
+ returns ReflectLines from HLRAppli;
+
+ SetAxes(me: in out;
+ Nx, Ny, Nz : Real from Standard;
+ XAt, YAt, ZAt : Real from Standard;
+ XUp, YUp, ZUp : Real from Standard);
+ ---Purpose: Sets the normal to the plane of visualisation,
+ -- the coordinates of the view point and
+ -- the coordinates of the vertical direction vector.
+
+ Perform(me: in out);
+
+ GetResult(me)
+ returns Shape from TopoDS;
+ ---Purpose: returns resulting compound of reflect lines
+ -- represented by edges in 3d
+
+fields
+
+ myProjector : Projector from HLRAlgo;
+ myShape : Shape from TopoDS;
+ myCompound : Shape from TopoDS;
+
+end ReflectLines;
--- /dev/null
+// File: HLRAppli_ReflectLines.cxx
+// Created: 05.12.12 12:55:50
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2001-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#include <HLRAppli_ReflectLines.hxx>
+#include <HLRBRep_Algo.hxx>
+#include <HLRBRep_HLRToShape.hxx>
+#include <BRep_Builder.hxx>
+#include <gp_Ax3.hxx>
+
+//=======================================================================
+//function : HLRAppli_ReflectLines
+//purpose : Constructor
+//=======================================================================
+
+HLRAppli_ReflectLines::HLRAppli_ReflectLines(const TopoDS_Shape& aShape)
+{
+ myShape = aShape;
+}
+
+//=======================================================================
+//function : SetAxes
+//purpose :
+//=======================================================================
+
+void HLRAppli_ReflectLines::SetAxes(const Standard_Real Nx,
+ const Standard_Real Ny,
+ const Standard_Real Nz,
+ const Standard_Real XAt,
+ const Standard_Real YAt,
+ const Standard_Real ZAt,
+ const Standard_Real XUp,
+ const Standard_Real YUp,
+ const Standard_Real ZUp)
+{
+ Standard_Boolean IsPerspective = Standard_False;
+ Standard_Real aFocus = 1;
+ //Prs3d_Projector aPrs3dProjector(IsPerspective, aFocus, Nx, Ny, Nz, XAt, YAt, ZAt, XUp, YUp, ZUp);
+
+ gp_Pnt At (XAt,YAt,ZAt);
+ gp_Dir Zpers (Nx,Ny,Nz);
+ gp_Dir Ypers (XUp,YUp,ZUp);
+ gp_Dir Xpers = Ypers.Crossed(Zpers);
+ gp_Ax3 Axe (At, Zpers, Xpers);
+ gp_Trsf T;
+ T.SetTransformation(Axe);
+
+ //myProjector = aPrs3dProjector.Projector();
+ myProjector = HLRAlgo_Projector(T,IsPerspective,aFocus);
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+
+void HLRAppli_ReflectLines::Perform()
+{
+ Handle(HLRBRep_Algo) aHLRAlgo = new HLRBRep_Algo();
+ aHLRAlgo->Add( myShape, 0 );
+ aHLRAlgo->Projector( myProjector );
+ aHLRAlgo->Update();
+ aHLRAlgo->Hide();
+ HLRBRep_HLRToShape aHLRToShape( aHLRAlgo );
+
+ myCompound = aHLRToShape.OutLineVCompound3d();
+}
+
+//=======================================================================
+//function : GetResult
+//purpose :
+//=======================================================================
+
+TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
+{
+ return myCompound;
+}
U1,U2 : Real from Standard)
returns Edge from TopoDS;
+ MakeEdge3d(ec : Curve from HLRBRep;
+ U1,U2 : Real from Standard)
+ returns Edge from TopoDS;
+
PolyHLRAngleAndDeflection(InAngl : Real from Standard;
OutAngl, OutDefl : out Real from Standard);
return Edg;
}
+//=======================================================================
+//function : MakeEdge3d
+//purpose :
+//=======================================================================
+
+TopoDS_Edge HLRBRep::MakeEdge3d(const HLRBRep_Curve& ec,
+ const Standard_Real U1,
+ const Standard_Real U2)
+{
+ TopoDS_Edge Edg;
+ //const Standard_Real sta = ec.Parameter2d(U1);
+ //const Standard_Real end = ec.Parameter2d(U2);
+
+ TopoDS_Edge anEdge = ec.GetCurve().Edge();
+ Standard_Real fpar, lpar;
+ //BRep_Tool::Range(anEdge, fpar, lpar);
+ //Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
+ BRepAdaptor_Curve BAcurve(anEdge);
+ fpar = BAcurve.FirstParameter();
+ lpar = BAcurve.LastParameter();
+
+ Edg = TopoDS::Edge(anEdge.EmptyCopied());
+ Edg.Orientation(TopAbs_FORWARD);
+ BRep_Builder BB;
+ BB.Range(Edg, U1, U2);
+
+ //Share vertices if possible
+ TopoDS_Vertex V1, V2, V1new, V2new;
+ TopExp::Vertices(anEdge, V1, V2);
+
+ Standard_Real Tol = Precision::PConfusion();
+ if (Abs(fpar - U1) <= Tol)
+ V1new = V1;
+ else
+ {
+ gp_Pnt aPnt = BAcurve.Value(U1);
+ V1new = BRepLib_MakeVertex(aPnt);
+ }
+ if (Abs(lpar - U2) <= Tol)
+ V2new = V2;
+ else
+ {
+ gp_Pnt aPnt = BAcurve.Value(U2);
+ V2new = BRepLib_MakeVertex(aPnt);
+ }
+
+ V1new.Orientation(TopAbs_FORWARD);
+ V2new.Orientation(TopAbs_REVERSED);
+ BB.Add(Edg, V1new);
+ BB.Add(Edg, V2new);
+ return Edg;
+}
+
//=======================================================================
//function : PolyHLRAngleAndDeflection
//purpose :
LevelFlag : Boolean from Standard;
Level : out Integer from Standard;
param : Real from Standard)
- returns State from TopAbs
+ returns State from TopAbs;
---Purpose: Classification of an edge.
- is static private;
RejectedPoint(me : mutable; PInter : IntersectionPoint from IntRes2d;
BoundOri : Orientation from TopAbs;
---C++: inline
is static;
+ OutLineVCompound3d(me : in out) returns Shape from TopoDS
+ ---C++: inline
+ is static;
+
OutLineVCompound(me : in out;
S : Shape from TopoDS) returns Shape from TopoDS
---C++: inline
InternalCompound(me : in out; typ : Integer from Standard;
visible : Boolean from Standard;
- S : Shape from TopoDS)
+ S : Shape from TopoDS;
+ In3d : Boolean from Standard = Standard_False)
returns Shape from TopoDS
is static private;
iface : Integer from Standard;
DS : out Data from HLRBRep;
Result : out Shape from TopoDS;
- added : out Boolean from Standard)
+ added : out Boolean from Standard;
+ In3d : Boolean from Standard = Standard_False)
is static private;
DrawEdge(me; visible : Boolean from Standard;
typ : Integer from Standard;
ed : out EdgeData from HLRBRep;
Result : out Shape from TopoDS;
- added : out Boolean from Standard)
+ added : out Boolean from Standard;
+ In3d : Boolean from Standard = Standard_False)
is static private;
fields
+
myAlgo : Algo from HLRBRep;
end HLRToShape;
TopoDS_Shape
HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
const Standard_Boolean visible,
- const TopoDS_Shape& S)
+ const TopoDS_Shape& S,
+ const Standard_Boolean In3d)
{
Standard_Boolean added = Standard_False;
TopoDS_Shape Result;
Exp.More();
Exp.Next()) {
Standard_Integer iface = Faces.FindIndex(Exp.Current());
- if (iface != 0) DrawFace(visible,typ,iface,DS,Result,added);
+ if (iface != 0)
+ DrawFace(visible,typ,iface,DS,Result,added,In3d);
}
if (typ >= 3) {
if (ie != 0) {
HLRBRep_EdgeData& ed = DS->EDataArray().ChangeValue(ie);
if (!ed.Used()) {
- DrawEdge(visible,Standard_False,typ,ed,Result,added);
+ DrawEdge(visible,Standard_False,typ,ed,Result,added,In3d);
ed.Used(Standard_True);
}
}
else {
for (Standard_Integer iface = f1; iface <= f2; iface++)
- DrawFace(visible,typ,iface,DS,Result,added);
+ DrawFace(visible,typ,iface,DS,Result,added,In3d);
if (typ >= 3) {
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(e1 - 1));
for (Standard_Integer ie = e1; ie <= e2; ie++) {
ed++;
if (!ed->Used()) {
- DrawEdge(visible,Standard_False,typ,*ed,Result,added);
+ DrawEdge(visible,Standard_False,typ,*ed,Result,added,In3d);
ed->Used(Standard_True);
}
}
const Standard_Integer iface,
Handle(HLRBRep_Data)& DS,
TopoDS_Shape& Result,
- Standard_Boolean& added) const
+ Standard_Boolean& added,
+ const Standard_Boolean In3d) const
{
HLRBRep_FaceIterator Itf;
if (!edf.Used()) {
Standard_Boolean todraw;
if (typ == 1) todraw = Itf.IsoLine();
- else if (typ == 2) todraw = Itf.Internal();
+ else if (typ == 2) //outlines
+ {
+ if (In3d)
+ todraw = Itf.Internal() || Itf.OutLine();
+ else
+ todraw = Itf.Internal();
+ }
else if (typ == 3) todraw = edf.Rg1Line() &&
!edf.RgNLine() && !Itf.OutLine();
else if (typ == 4) todraw = edf.RgNLine() && !Itf.OutLine();
(edf.Rg1Line() && !Itf.OutLine()));
if (todraw) {
- DrawEdge(visible,Standard_True,typ,edf,Result,added);
+ DrawEdge(visible,Standard_True,typ,edf,Result,added,In3d);
edf.Used(Standard_True);
}
else {
- if(typ > 4 && (edf.Rg1Line() && !Itf.OutLine())) {
+ if((typ > 4 || typ == 2) && //sharp or outlines
+ (edf.Rg1Line() && !Itf.OutLine()))
+ {
Standard_Integer hc = edf.HideCount();
if(hc > 0) {
edf.Used(Standard_True);
const Standard_Integer typ,
HLRBRep_EdgeData& ed,
TopoDS_Shape& Result,
- Standard_Boolean& added) const
+ Standard_Boolean& added,
+ const Standard_Boolean In3d) const
{
Standard_Boolean todraw = Standard_False;
if (inFace) todraw = Standard_True;
{
for (It.InitVisible(ed.Status()); It.MoreVisible(); It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
- E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
+ if (!In3d)
+ E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
+ else
+ E = HLRBRep::MakeEdge3d(ed.Geometry(),sta,end);
if (!E.IsNull())
{
B.Add(Result,E);
{
for (It.InitHidden(ed.Status()); It.MoreHidden(); It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
- E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
+ if (!In3d)
+ E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
+ else
+ E = HLRBRep::MakeEdge3d(ed.Geometry(),sta,end);
if (!E.IsNull())
{
B.Add(Result,E);
inline TopoDS_Shape HLRBRep_HLRToShape::OutLineVCompound()
{ return InternalCompound(2,Standard_True,TopoDS_Shape()); }
+//=======================================================================
+//function : OutLineVCompound3d
+//purpose :
+//=======================================================================
+
+inline TopoDS_Shape HLRBRep_HLRToShape::OutLineVCompound3d()
+{ return InternalCompound(2,Standard_True,TopoDS_Shape(),Standard_True); }
+
//=======================================================================
//function : OutLineVCompound
//purpose :
#include <HLRBRep_EdgeInterferenceTool.hxx>
#include <Standard_ErrorHandler.hxx>
+
//=======================================================================
//function : HLRBRep_Hider
//purpose :
//IFV
TopAbs_State aBuildIN = TopAbs_IN;
- Standard_Boolean IsSuspision = Standard_True;
+ Standard_Boolean IsSuspicion = Standard_True;
Standard_Real pmax, pmin;
Standard_Boolean allInt = Standard_False;
}
TopAbs_State aTestState = TopAbs_IN;
- if(IsSuspision) {
- Standard_Integer aNbp = 1;
- aTestState = myDS->SimplClassify(E, ed, aNbp, p1, p2);
+ if(IsSuspicion) {
+ //Standard_Integer aNbp = 1;
+ //aTestState = myDS->SimplClassify(E, ed, aNbp, p1, p2);
+ Standard_Integer tmplevel = 0;
+ aTestState = myDS->Classify(E,ed,Standard_True,tmplevel,(p1+p2)/2.);
}
if(aTestState != TopAbs_OUT) {
}
EB.NextVertex();
}
- ES.Hide(p1,tol1,p2,tol2,
- Standard_False, // under the Face
- Standard_True); // on the boundary
+
+ TopAbs_State aTestState = TopAbs_IN;
+ if(IsSuspicion) {
+ //Standard_Integer aNbp = 1;
+ //aTestState = myDS->SimplClassify(E, ed, aNbp, p1, p2);
+ Standard_Integer tmplevel = 0;
+ aTestState = myDS->Classify(E,ed,Standard_True,tmplevel,(p1+p2)/2.);
+ }
+
+ if(aTestState != TopAbs_OUT)
+ ES.Hide(p1,tol1,p2,tol2,
+ Standard_False, // under the Face
+ Standard_True); // on the boundary
+
EB.NextEdge();
}
}
#include <DBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
+#include <HLRAppli_ReflectLines.hxx>
+
static Handle(HLRBRep_Algo) hider;
#ifdef WNT
Standard_IMPORT Draw_Viewer dout;
return 0;
}
+//=======================================================================
+//function : reflectlines
+//purpose :
+//=======================================================================
+
+static Standard_Integer reflectlines(Draw_Interpretor& , Standard_Integer n, const char** a)
+{
+ if (n < 6)
+ return 1;
+
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull())
+ return 1;
+
+ Standard_Real anAISViewProjX = atof(a[3]);
+ Standard_Real anAISViewProjY = atof(a[4]);
+ Standard_Real anAISViewProjZ = atof(a[5]);
+
+ gp_Pnt anOrigin(0.,0.,0.);
+ gp_Dir aNormal(anAISViewProjX, anAISViewProjY, anAISViewProjZ);
+ gp_Ax2 theAxes(anOrigin, aNormal);
+ gp_Dir aDX = theAxes.XDirection();
+
+ HLRAppli_ReflectLines Reflector(aShape);
+
+ Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
+ anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
+ aDX.X(), aDX.Y(), aDX.Z());
+
+ Reflector.Perform();
+
+ TopoDS_Shape Result = Reflector.GetResult();
+ DBRep::Set(a[1], Result);
+
+ return 0;
+}
+
//=======================================================================
//function : Commands
//purpose :
theCommands.Add("hdebug" ,"hdebug" ,__FILE__,hdbg,g);
theCommands.Add("hnullify" ,"hnullify" ,__FILE__,hnul,g);
theCommands.Add("hres2d" ,"hres2d" ,__FILE__,hres,g);
+
+ theCommands.Add("reflectlines",
+ "reflectlines res shape proj_X proj_Y proj_Z",
+ __FILE__, reflectlines, g);
+
hider = new HLRBRep_Algo();
}
#include <Precision.hxx>
#include <BRepApprox_ApproxLine.hxx>
#include <BRepApprox_Approx.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_CurveRepresentation.hxx>
+#include <BRepExtrema_ExtPC.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
#define INTERPOLATE 0
#define BRISE 0
#define APPROX 1
+
+static Standard_Boolean IntLineRisesFromRegularity(const TopoDS_Edge& anIntLine,
+ const TopoDS_Edge& anEdge,
+ const TopoDS_Face& aFace,
+ const TopTools_ListOfShape& aList)
+{
+ TopoDS_Vertex Ver [2];
+ TopExp::Vertices(anIntLine, Ver[0], Ver[1]);
+
+ //find min param and max param
+ Standard_Real MinPar = RealLast(), MaxPar = RealFirst();
+ TopTools_ListIteratorOfListOfShape itl(aList);
+ for (; itl.More(); itl.Next())
+ {
+ const TopoDS_Edge& anOutLine = TopoDS::Edge(itl.Value());
+ Standard_Real aFirst, aLast;
+ BRep_Tool::Range(anOutLine, aFirst, aLast);
+ if (aFirst < MinPar)
+ MinPar = aFirst;
+ if (aLast > MaxPar)
+ MaxPar = aLast;
+ }
+
+ Standard_Real theTol = BRep_Tool::Tolerance(anEdge);
+ Standard_Real ParamTol = Precision::Confusion();
+
+ Standard_Integer i, j;
+ for (i = 0; i < 2; i++)
+ {
+ BRepExtrema_ExtPC anExtPC(Ver[i], anEdge);
+ if (!anExtPC.IsDone())
+ continue;
+ Standard_Integer NbExt = anExtPC.NbExt();
+ if (NbExt == 0)
+ continue;
+ Standard_Integer jmin = 1;
+ for (j = 2; j <= NbExt; j++)
+ if (anExtPC.SquareDistance(j) < anExtPC.SquareDistance(jmin))
+ jmin = j;
+ Standard_Real aDist = anExtPC.SquareDistance(jmin);
+ aDist = Sqrt(aDist);
+ if (aDist > theTol)
+ continue;
+
+ Standard_Real theParam = anExtPC.Parameter(jmin);
+ if (theParam > MinPar + ParamTol &&
+ theParam < MaxPar - ParamTol)
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+
//=======================================================================
//function : Insert
//purpose : explore the faces and insert them
Domain = BRT.GetTopolTool();
Surface = BRT.GetSurface();
}
- FO.Perform(Surface,Domain);
+ FO.Perform(Surface, Domain);
if (FO.IsDone()) {
if (!FO.IsEmpty())
InsertFace(f,S1,FO,DS,withPCurve);
*/
const Standard_Integer NbLines = FO.NbLines();
- Standard_Integer CurLine = 1;
- for (; CurLine <= NbLines; CurLine++)
+ Standard_Integer CurLine;
+ for (CurLine = 1; CurLine <= NbLines; CurLine++)
{
const Contap_TheLineOfContour& Line = FO.Line(CurLine);
const Standard_Integer NbPoints = Line.NbVertex();
}
}
}
+
+ //jgv: correction of internal outlines: remove those that rise from middle of boundary outlines
+ TopTools_ListIteratorOfListOfShape itl(IntL);
+ while (itl.More())
+ {
+ TopoDS_Edge anIntLine = TopoDS::Edge(itl.Value());
+ Standard_Real found = Standard_False;
+ TopExp_Explorer Explo(F, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(Explo.Current());
+ if (!BRep_Tool::HasContinuity(anEdge))
+ continue;
+
+ TopLoc_Location RegLoc;
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) RegCurve = BRep_Tool::Curve(anEdge, RegLoc, fpar, lpar);
+ TopTools_ListOfShape thelist;
+ TopTools_ListIteratorOfListOfShape itoutl(OutL);
+ for (; itoutl.More(); itoutl.Next())
+ {
+ TopoDS_Edge anOutLine = TopoDS::Edge(itoutl.Value());
+ TopLoc_Location aLoc;
+ Standard_Real aFirst, aLast;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anOutLine, aLoc, aFirst, aLast);
+ if (aCurve == RegCurve && aLoc == RegLoc)
+ thelist.Append(anOutLine);
+ }
+
+ if (thelist.IsEmpty())
+ continue;
+
+ if (IntLineRisesFromRegularity(anIntLine, anEdge, F, thelist))
+ {
+ IntL.Remove(itl);
+ found = Standard_True;
+ break;
+ }
+ }
+
+ if (!found)
+ itl.Next();
+ }
+ ///////////////////////////////////////////////////
}
//=======================================================================
Perform(me : in out;
F : in out TheFunction;
Domain: TheTopolTool;
- TolBoundary,TolTangency : Real from Standard)
+ TolBoundary,TolTangency : Real from Standard;
+ RecheckOnRegularity : Boolean from Standard = Standard_False)
---Purpose: Algorithm to find the points and parts of curves of Domain
-- (domain of of restriction of a surface) which verify
const Standard_Real TolBoundary,
IntStart_SequenceOfPathPoint& pnt);
+static
+ Standard_Boolean IsRegularity(const TheArc& A,
+ const Handle(TheTopolTool)& aDomain);
+
//=======================================================================
//function : FindVertex
IntStart_SequenceOfSegment& seg,
const Standard_Real TolBoundary,
const Standard_Real TolTangency,
- Standard_Boolean& Arcsol)
+ Standard_Boolean& Arcsol,
+ const Standard_Boolean RecheckOnRegularity)
{
// Recherche des points solutions et des bouts d arc solution sur un arc donne.
// des arcs ayant un point debut et un point de fin (intervalle ferme de
// parametrage).
-
Standard_Integer i,Nbi,Nbp;
gp_Pnt ptdeb,ptfin;
if (!Sol.IsDone()) {Standard_Failure::Raise();}
Nbp=Sol.NbPoints();
+
+ //jgv: build solution on the whole boundary
+ if (RecheckOnRegularity && Nbp > 0 && IsRegularity(A, Domain))
+ {
+ //Standard_Real theTol = Domain->MaxTolerance(A);
+ //theTol += theTol;
+ Standard_Real theTol = 5.e-4;
+ math_FunctionAllRoots SolAgain(Func,Echant,EpsX,theTol,theTol); //-- TolBoundary,nTolTangency);
+
+ if (!SolAgain.IsDone()) {Standard_Failure::Raise();}
+
+ Standard_Integer Nbp_again = SolAgain.NbPoints();
+ Standard_Integer Nbi_again = SolAgain.NbIntervals();
+
+ if (Nbi_again > 0)
+ {
+ Standard_Integer NbSamples = 10;
+ Standard_Real delta = (Pfin - Pdeb)/NbSamples;
+ Standard_Real GlobalTol = theTol*10;
+ Standard_Boolean SolOnBoundary = Standard_True;
+ for (i = 0; i <= NbSamples; i++)
+ {
+ Standard_Real aParam = Pdeb + i*delta;
+ Standard_Real aValue;
+ Func.Value(aParam, aValue);
+ if (Abs(aValue) > GlobalTol)
+ {
+ SolOnBoundary = Standard_False;
+ break;
+ }
+ }
+
+ if (SolOnBoundary)
+ {
+ for (i = 1; i <= Nbi_again; i++)
+ {
+ IntStart_TheSegment newseg;
+ newseg.SetValue(A);
+ // Recuperer point debut et fin, et leur parametre.
+ SolAgain.GetInterval(i,pardeb,parfin);
+
+ if (Abs(pardeb - Pdeb) <= Precision::PConfusion())
+ pardeb = Pdeb;
+ if (Abs(parfin - Pfin) <= Precision::PConfusion())
+ parfin = Pfin;
+
+ SolAgain.GetIntervalState(i,ideb,ifin);
+
+ //-- cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx : i= "<<i<<" ParDeb:"<<pardeb<<" ParFin:"<<parfin<<endl;
+
+ ptdeb=Func.Valpoint(ideb);
+ ptfin=Func.Valpoint(ifin);
+
+ PointProcess(ptdeb,pardeb,A,Domain,pnt,theTol,ranged);
+ newseg.SetLimitPoint(pnt.Value(ranged),Standard_True);
+ PointProcess(ptfin,parfin,A,Domain,pnt,theTol,rangef);
+ newseg.SetLimitPoint(pnt.Value(rangef),Standard_False);
+ seg.Append(newseg);
+ }
+ Arcsol=Standard_True;
+ return;
+ }
+ }
+ }
+ ////////////////////////////////////////////
//-- detection du cas ou la fonction est quasi tangente et que les
//-- zeros sont quasi confondus.
Nbi=Sol.NbIntervals();
- if(Nbp) {
+ if (!RecheckOnRegularity && Nbp) {
//--cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx :Nbp>0 0 <- Nbi "<<Nbi<<endl;
Nbi=0;
}
}
if (!found) { // on n est pas tombe sur un vertex
- Standard_Real TOL=Tol;
- TOL*=1000.0;
- if(TOL>0.001) TOL=0.001;
-
- ptsol.SetValue(Pt,TOL,A,Para);
- pnt.Append(ptsol);
- Range = pnt.Length();
+ //jgv: do not add segment's extremities if they already exist
+ Standard_Boolean found_internal = Standard_False;
+ for (k = 1; k <= pnt.Length(); k++)
+ {
+ ptsol = pnt.Value(k);
+ if (ptsol.Arc() != A ||
+ !ptsol.IsNew()) //vertex
+ continue;
+ if (Abs(ptsol.Parameter()-Para) <= Precision::PConfusion())
+ {
+ found_internal = Standard_True;
+ Range = k;
+ }
+ }
+ /////////////////////////////////////////////////////////////
+
+ if (!found_internal)
+ {
+ Standard_Real TOL=Tol;
+ TOL*=1000.0;
+ if(TOL>0.001) TOL=0.001;
+
+ ptsol.SetValue(Pt,TOL,A,Para);
+ pnt.Append(ptsol);
+ Range = pnt.Length();
+ }
}
}
#include <Extrema_ExtCC.hxx>
#include <Extrema_POnCurv.hxx>
+//=======================================================================
+//function : IsRegularity
+//purpose :
+//=======================================================================
+Standard_Boolean IsRegularity(const TheArc& A,
+ const Handle(TheTopolTool)& aDomain)
+{
+ Standard_Address anEAddress=aDomain->Edge();
+ if (anEAddress==NULL) {
+ return Standard_False;
+ }
+
+ TopoDS_Edge* anE=(TopoDS_Edge*)anEAddress;
+
+ return (BRep_Tool::HasContinuity(*anE));
+}
+
//=======================================================================
//function : TreatLC
//purpose :
void IntStart_SearchOnBoundaries::Perform (TheFunction& Func,
const Handle(TheTopolTool)& Domain,
const Standard_Real TolBoundary,
- const Standard_Real TolTangency)
+ const Standard_Real TolTangency,
+ const Standard_Boolean RecheckOnRegularity)
{
done = Standard_False;
}
else {
BoundedArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
- TolBoundary,TolTangency,Arcsol);
+ TolBoundary,TolTangency,Arcsol,RecheckOnRegularity);
}
all = (all && Arcsol);
}
HLRTopoBRep
HLRBRep
HLRAlgo
+HLRAppli
Intrv
TopBas
TopCnx
--- /dev/null
+puts "============"
+puts "OCC23625"
+puts "============"
+puts ""
+######################################################
+# New functionality building reflect lines on a shape
+######################################################
+
+smallview
+
+restore [locate_data_file bug23625_a1.brep] a
+
+front
+fit
+
+reflectlines result a 0 1 0
+
+set length 3877.8
+
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC23625"
+puts "============"
+puts ""
+######################################################
+# New functionality building reflect lines on a shape
+######################################################
+
+smallview
+
+restore [locate_data_file bug23625_a2.brep] a
+
+front
+fit
+
+reflectlines result a 0 1 0
+
+set length 4022.72
+
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC23625"
+puts "============"
+puts ""
+######################################################
+# New functionality building reflect lines on a shape
+######################################################
+
+smallview
+
+restore [locate_data_file bug23625_a3.brep] a
+
+top
+fit
+
+reflectlines result a 0 0 1
+
+set length 4843.56
+
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC23625"
+puts "============"
+puts ""
+######################################################
+# New functionality building reflect lines on a shape
+######################################################
+
+smallview
+
+restore [locate_data_file bug23625_a4.brep] a
+
+right
+fit
+
+reflectlines result a 1 0 0
+
+set length 4207.74
+
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC23625"
+puts "============"
+puts ""
+######################################################
+# New functionality building reflect lines on a shape
+######################################################
+
+smallview
+
+restore [locate_data_file bug23625_a4.brep] a
+
+right
+fit
+
+reflectlines result a 0 0 1
+
+set length 6361.07
+
+set only_screen_axo 1