mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0023625: New functionality building reflect lines on a shape
Adding test case for this fix; Small corrections
This commit is contained in:
parent
97acf541ac
commit
bda8360543
@ -146,6 +146,7 @@ p GeomPlate
|
|||||||
p HLRAlgo
|
p HLRAlgo
|
||||||
p HLRBRep
|
p HLRBRep
|
||||||
p HLRTopoBRep
|
p HLRTopoBRep
|
||||||
|
p HLRAppli
|
||||||
p Hatch
|
p Hatch
|
||||||
p HatchGen
|
p HatchGen
|
||||||
p IntCurve
|
p IntCurve
|
||||||
|
@ -528,6 +528,13 @@ is
|
|||||||
raises
|
raises
|
||||||
NullObject from Standard; -- If the edge or the faces are null.
|
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.
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
@ -1117,6 +1117,25 @@ GeomAbs_Shape BRep_Tool::Continuity(const TopoDS_Edge& E,
|
|||||||
return GeomAbs_C0;
|
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
|
//function : Pnt
|
||||||
//purpose : Returns the 3d point.
|
//purpose : Returns the 3d point.
|
||||||
|
@ -1288,7 +1288,8 @@ void Contap_ContourGen::Perform
|
|||||||
//jag 940616 SFunc.Set(1.e-8); // tolerance sur la fonction
|
//jag 940616 SFunc.Set(1.e-8); // tolerance sur la fonction
|
||||||
mySFunc.Set(Precision::Confusion()); // 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()) {
|
if (!solrst.IsDone()) {
|
||||||
return;
|
return;
|
||||||
|
34
src/HLRAppli/HLRAppli.cdl
Normal file
34
src/HLRAppli/HLRAppli.cdl
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
-- 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;
|
60
src/HLRAppli/HLRAppli_ReflectLines.cdl
Normal file
60
src/HLRAppli/HLRAppli_ReflectLines.cdl
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
-- 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;
|
93
src/HLRAppli/HLRAppli_ReflectLines.cxx
Normal file
93
src/HLRAppli/HLRAppli_ReflectLines.cxx
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
@ -148,6 +148,10 @@ is
|
|||||||
U1,U2 : Real from Standard)
|
U1,U2 : Real from Standard)
|
||||||
returns Edge from TopoDS;
|
returns Edge from TopoDS;
|
||||||
|
|
||||||
|
MakeEdge3d(ec : Curve from HLRBRep;
|
||||||
|
U1,U2 : Real from Standard)
|
||||||
|
returns Edge from TopoDS;
|
||||||
|
|
||||||
PolyHLRAngleAndDeflection(InAngl : Real from Standard;
|
PolyHLRAngleAndDeflection(InAngl : Real from Standard;
|
||||||
OutAngl, OutDefl : out Real from Standard);
|
OutAngl, OutDefl : out Real from Standard);
|
||||||
|
|
||||||
|
@ -166,6 +166,59 @@ TopoDS_Edge HLRBRep::MakeEdge (const HLRBRep_Curve& ec,
|
|||||||
return Edg;
|
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
|
//function : PolyHLRAngleAndDeflection
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -285,9 +285,8 @@ is
|
|||||||
LevelFlag : Boolean from Standard;
|
LevelFlag : Boolean from Standard;
|
||||||
Level : out Integer from Standard;
|
Level : out Integer from Standard;
|
||||||
param : Real from Standard)
|
param : Real from Standard)
|
||||||
returns State from TopAbs
|
returns State from TopAbs;
|
||||||
---Purpose: Classification of an edge.
|
---Purpose: Classification of an edge.
|
||||||
is static private;
|
|
||||||
|
|
||||||
RejectedPoint(me : mutable; PInter : IntersectionPoint from IntRes2d;
|
RejectedPoint(me : mutable; PInter : IntersectionPoint from IntRes2d;
|
||||||
BoundOri : Orientation from TopAbs;
|
BoundOri : Orientation from TopAbs;
|
||||||
|
@ -96,6 +96,10 @@ is
|
|||||||
---C++: inline
|
---C++: inline
|
||||||
is static;
|
is static;
|
||||||
|
|
||||||
|
OutLineVCompound3d(me : in out) returns Shape from TopoDS
|
||||||
|
---C++: inline
|
||||||
|
is static;
|
||||||
|
|
||||||
OutLineVCompound(me : in out;
|
OutLineVCompound(me : in out;
|
||||||
S : Shape from TopoDS) returns Shape from TopoDS
|
S : Shape from TopoDS) returns Shape from TopoDS
|
||||||
---C++: inline
|
---C++: inline
|
||||||
@ -157,7 +161,8 @@ is
|
|||||||
|
|
||||||
InternalCompound(me : in out; typ : Integer from Standard;
|
InternalCompound(me : in out; typ : Integer from Standard;
|
||||||
visible : Boolean from Standard;
|
visible : Boolean from Standard;
|
||||||
S : Shape from TopoDS)
|
S : Shape from TopoDS;
|
||||||
|
In3d : Boolean from Standard = Standard_False)
|
||||||
returns Shape from TopoDS
|
returns Shape from TopoDS
|
||||||
is static private;
|
is static private;
|
||||||
|
|
||||||
@ -166,7 +171,8 @@ is
|
|||||||
iface : Integer from Standard;
|
iface : Integer from Standard;
|
||||||
DS : out Data from HLRBRep;
|
DS : out Data from HLRBRep;
|
||||||
Result : out Shape from TopoDS;
|
Result : out Shape from TopoDS;
|
||||||
added : out Boolean from Standard)
|
added : out Boolean from Standard;
|
||||||
|
In3d : Boolean from Standard = Standard_False)
|
||||||
is static private;
|
is static private;
|
||||||
|
|
||||||
DrawEdge(me; visible : Boolean from Standard;
|
DrawEdge(me; visible : Boolean from Standard;
|
||||||
@ -174,10 +180,12 @@ is
|
|||||||
typ : Integer from Standard;
|
typ : Integer from Standard;
|
||||||
ed : out EdgeData from HLRBRep;
|
ed : out EdgeData from HLRBRep;
|
||||||
Result : out Shape from TopoDS;
|
Result : out Shape from TopoDS;
|
||||||
added : out Boolean from Standard)
|
added : out Boolean from Standard;
|
||||||
|
In3d : Boolean from Standard = Standard_False)
|
||||||
is static private;
|
is static private;
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
myAlgo : Algo from HLRBRep;
|
myAlgo : Algo from HLRBRep;
|
||||||
|
|
||||||
end HLRToShape;
|
end HLRToShape;
|
||||||
|
@ -46,7 +46,8 @@ myAlgo(A)
|
|||||||
TopoDS_Shape
|
TopoDS_Shape
|
||||||
HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
||||||
const Standard_Boolean visible,
|
const Standard_Boolean visible,
|
||||||
const TopoDS_Shape& S)
|
const TopoDS_Shape& S,
|
||||||
|
const Standard_Boolean In3d)
|
||||||
{
|
{
|
||||||
Standard_Boolean added = Standard_False;
|
Standard_Boolean added = Standard_False;
|
||||||
TopoDS_Shape Result;
|
TopoDS_Shape Result;
|
||||||
@ -87,7 +88,8 @@ HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
|||||||
Exp.More();
|
Exp.More();
|
||||||
Exp.Next()) {
|
Exp.Next()) {
|
||||||
Standard_Integer iface = Faces.FindIndex(Exp.Current());
|
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 (typ >= 3) {
|
||||||
|
|
||||||
@ -98,7 +100,7 @@ HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
|||||||
if (ie != 0) {
|
if (ie != 0) {
|
||||||
HLRBRep_EdgeData& ed = DS->EDataArray().ChangeValue(ie);
|
HLRBRep_EdgeData& ed = DS->EDataArray().ChangeValue(ie);
|
||||||
if (!ed.Used()) {
|
if (!ed.Used()) {
|
||||||
DrawEdge(visible,Standard_False,typ,ed,Result,added);
|
DrawEdge(visible,Standard_False,typ,ed,Result,added,In3d);
|
||||||
ed.Used(Standard_True);
|
ed.Used(Standard_True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +110,7 @@ HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
for (Standard_Integer iface = f1; iface <= f2; iface++)
|
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) {
|
if (typ >= 3) {
|
||||||
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(e1 - 1));
|
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(e1 - 1));
|
||||||
@ -116,7 +118,7 @@ HLRBRep_HLRToShape::InternalCompound (const Standard_Integer typ,
|
|||||||
for (Standard_Integer ie = e1; ie <= e2; ie++) {
|
for (Standard_Integer ie = e1; ie <= e2; ie++) {
|
||||||
ed++;
|
ed++;
|
||||||
if (!ed->Used()) {
|
if (!ed->Used()) {
|
||||||
DrawEdge(visible,Standard_False,typ,*ed,Result,added);
|
DrawEdge(visible,Standard_False,typ,*ed,Result,added,In3d);
|
||||||
ed->Used(Standard_True);
|
ed->Used(Standard_True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +141,8 @@ HLRBRep_HLRToShape::DrawFace (const Standard_Boolean visible,
|
|||||||
const Standard_Integer iface,
|
const Standard_Integer iface,
|
||||||
Handle(HLRBRep_Data)& DS,
|
Handle(HLRBRep_Data)& DS,
|
||||||
TopoDS_Shape& Result,
|
TopoDS_Shape& Result,
|
||||||
Standard_Boolean& added) const
|
Standard_Boolean& added,
|
||||||
|
const Standard_Boolean In3d) const
|
||||||
{
|
{
|
||||||
HLRBRep_FaceIterator Itf;
|
HLRBRep_FaceIterator Itf;
|
||||||
|
|
||||||
@ -151,7 +154,13 @@ HLRBRep_HLRToShape::DrawFace (const Standard_Boolean visible,
|
|||||||
if (!edf.Used()) {
|
if (!edf.Used()) {
|
||||||
Standard_Boolean todraw;
|
Standard_Boolean todraw;
|
||||||
if (typ == 1) todraw = Itf.IsoLine();
|
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() &&
|
else if (typ == 3) todraw = edf.Rg1Line() &&
|
||||||
!edf.RgNLine() && !Itf.OutLine();
|
!edf.RgNLine() && !Itf.OutLine();
|
||||||
else if (typ == 4) todraw = edf.RgNLine() && !Itf.OutLine();
|
else if (typ == 4) todraw = edf.RgNLine() && !Itf.OutLine();
|
||||||
@ -161,11 +170,13 @@ HLRBRep_HLRToShape::DrawFace (const Standard_Boolean visible,
|
|||||||
(edf.Rg1Line() && !Itf.OutLine()));
|
(edf.Rg1Line() && !Itf.OutLine()));
|
||||||
|
|
||||||
if (todraw) {
|
if (todraw) {
|
||||||
DrawEdge(visible,Standard_True,typ,edf,Result,added);
|
DrawEdge(visible,Standard_True,typ,edf,Result,added,In3d);
|
||||||
edf.Used(Standard_True);
|
edf.Used(Standard_True);
|
||||||
}
|
}
|
||||||
else {
|
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();
|
Standard_Integer hc = edf.HideCount();
|
||||||
if(hc > 0) {
|
if(hc > 0) {
|
||||||
edf.Used(Standard_True);
|
edf.Used(Standard_True);
|
||||||
@ -194,7 +205,8 @@ HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
|
|||||||
const Standard_Integer typ,
|
const Standard_Integer typ,
|
||||||
HLRBRep_EdgeData& ed,
|
HLRBRep_EdgeData& ed,
|
||||||
TopoDS_Shape& Result,
|
TopoDS_Shape& Result,
|
||||||
Standard_Boolean& added) const
|
Standard_Boolean& added,
|
||||||
|
const Standard_Boolean In3d) const
|
||||||
{
|
{
|
||||||
Standard_Boolean todraw = Standard_False;
|
Standard_Boolean todraw = Standard_False;
|
||||||
if (inFace) todraw = Standard_True;
|
if (inFace) todraw = Standard_True;
|
||||||
@ -212,7 +224,10 @@ HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
|
|||||||
{
|
{
|
||||||
for (It.InitVisible(ed.Status()); It.MoreVisible(); It.NextVisible()) {
|
for (It.InitVisible(ed.Status()); It.MoreVisible(); It.NextVisible()) {
|
||||||
It.Visible(sta,tolsta,end,tolend);
|
It.Visible(sta,tolsta,end,tolend);
|
||||||
|
if (!In3d)
|
||||||
E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
|
E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
|
||||||
|
else
|
||||||
|
E = HLRBRep::MakeEdge3d(ed.Geometry(),sta,end);
|
||||||
if (!E.IsNull())
|
if (!E.IsNull())
|
||||||
{
|
{
|
||||||
B.Add(Result,E);
|
B.Add(Result,E);
|
||||||
@ -224,7 +239,10 @@ HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
|
|||||||
{
|
{
|
||||||
for (It.InitHidden(ed.Status()); It.MoreHidden(); It.NextHidden()) {
|
for (It.InitHidden(ed.Status()); It.MoreHidden(); It.NextHidden()) {
|
||||||
It.Hidden(sta,tolsta,end,tolend);
|
It.Hidden(sta,tolsta,end,tolend);
|
||||||
|
if (!In3d)
|
||||||
E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
|
E = HLRBRep::MakeEdge(ed.Geometry(),sta,end);
|
||||||
|
else
|
||||||
|
E = HLRBRep::MakeEdge3d(ed.Geometry(),sta,end);
|
||||||
if (!E.IsNull())
|
if (!E.IsNull())
|
||||||
{
|
{
|
||||||
B.Add(Result,E);
|
B.Add(Result,E);
|
||||||
|
@ -80,6 +80,14 @@ HLRBRep_HLRToShape::RgNLineVCompound(const TopoDS_Shape& S)
|
|||||||
inline TopoDS_Shape HLRBRep_HLRToShape::OutLineVCompound()
|
inline TopoDS_Shape HLRBRep_HLRToShape::OutLineVCompound()
|
||||||
{ return InternalCompound(2,Standard_True,TopoDS_Shape()); }
|
{ 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
|
//function : OutLineVCompound
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <HLRBRep_EdgeInterferenceTool.hxx>
|
#include <HLRBRep_EdgeInterferenceTool.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : HLRBRep_Hider
|
//function : HLRBRep_Hider
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -386,7 +387,7 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
|
|||||||
//IFV
|
//IFV
|
||||||
|
|
||||||
TopAbs_State aBuildIN = TopAbs_IN;
|
TopAbs_State aBuildIN = TopAbs_IN;
|
||||||
Standard_Boolean IsSuspision = Standard_True;
|
Standard_Boolean IsSuspicion = Standard_True;
|
||||||
|
|
||||||
Standard_Real pmax, pmin;
|
Standard_Real pmax, pmin;
|
||||||
Standard_Boolean allInt = Standard_False;
|
Standard_Boolean allInt = Standard_False;
|
||||||
@ -450,9 +451,11 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TopAbs_State aTestState = TopAbs_IN;
|
TopAbs_State aTestState = TopAbs_IN;
|
||||||
if(IsSuspision) {
|
if(IsSuspicion) {
|
||||||
Standard_Integer aNbp = 1;
|
//Standard_Integer aNbp = 1;
|
||||||
aTestState = myDS->SimplClassify(E, ed, aNbp, p1, p2);
|
//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) {
|
if(aTestState != TopAbs_OUT) {
|
||||||
@ -483,9 +486,20 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
|
|||||||
}
|
}
|
||||||
EB.NextVertex();
|
EB.NextVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
ES.Hide(p1,tol1,p2,tol2,
|
||||||
Standard_False, // under the Face
|
Standard_False, // under the Face
|
||||||
Standard_True); // on the boundary
|
Standard_True); // on the boundary
|
||||||
|
|
||||||
EB.NextEdge();
|
EB.NextEdge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include <DBRep.hxx>
|
#include <DBRep.hxx>
|
||||||
#include <HLRBRep_Algo.hxx>
|
#include <HLRBRep_Algo.hxx>
|
||||||
#include <HLRBRep_HLRToShape.hxx>
|
#include <HLRBRep_HLRToShape.hxx>
|
||||||
|
#include <HLRAppli_ReflectLines.hxx>
|
||||||
|
|
||||||
static Handle(HLRBRep_Algo) hider;
|
static Handle(HLRBRep_Algo) hider;
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
Standard_IMPORT Draw_Viewer dout;
|
Standard_IMPORT Draw_Viewer dout;
|
||||||
@ -413,6 +415,43 @@ hres (Draw_Interpretor& , Standard_Integer n, const char** a)
|
|||||||
return 0;
|
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
|
//function : Commands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -436,6 +475,11 @@ void HLRTest::Commands (Draw_Interpretor& theCommands)
|
|||||||
theCommands.Add("hdebug" ,"hdebug" ,__FILE__,hdbg,g);
|
theCommands.Add("hdebug" ,"hdebug" ,__FILE__,hdbg,g);
|
||||||
theCommands.Add("hnullify" ,"hnullify" ,__FILE__,hnul,g);
|
theCommands.Add("hnullify" ,"hnullify" ,__FILE__,hnul,g);
|
||||||
theCommands.Add("hres2d" ,"hres2d" ,__FILE__,hres,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();
|
hider = new HLRBRep_Algo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,70 @@
|
|||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <BRepApprox_ApproxLine.hxx>
|
#include <BRepApprox_ApproxLine.hxx>
|
||||||
#include <BRepApprox_Approx.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 INTERPOLATE 0
|
||||||
#define BRISE 0
|
#define BRISE 0
|
||||||
#define APPROX 1
|
#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
|
//function : Insert
|
||||||
//purpose : explore the faces and insert them
|
//purpose : explore the faces and insert them
|
||||||
@ -140,8 +199,8 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer FI,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const Standard_Integer NbLines = FO.NbLines();
|
const Standard_Integer NbLines = FO.NbLines();
|
||||||
Standard_Integer CurLine = 1;
|
Standard_Integer CurLine;
|
||||||
for (; CurLine <= NbLines; CurLine++)
|
for (CurLine = 1; CurLine <= NbLines; CurLine++)
|
||||||
{
|
{
|
||||||
const Contap_TheLineOfContour& Line = FO.Line(CurLine);
|
const Contap_TheLineOfContour& Line = FO.Line(CurLine);
|
||||||
const Standard_Integer NbPoints = Line.NbVertex();
|
const Standard_Integer NbPoints = Line.NbVertex();
|
||||||
@ -447,6 +506,50 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer FI,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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();
|
||||||
|
}
|
||||||
|
///////////////////////////////////////////////////
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -71,7 +71,8 @@ is
|
|||||||
Perform(me : in out;
|
Perform(me : in out;
|
||||||
F : in out TheFunction;
|
F : in out TheFunction;
|
||||||
Domain: TheTopolTool;
|
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
|
---Purpose: Algorithm to find the points and parts of curves of Domain
|
||||||
-- (domain of of restriction of a surface) which verify
|
-- (domain of of restriction of a surface) which verify
|
||||||
|
@ -73,6 +73,10 @@ static
|
|||||||
const Standard_Real TolBoundary,
|
const Standard_Real TolBoundary,
|
||||||
IntStart_SequenceOfPathPoint& pnt);
|
IntStart_SequenceOfPathPoint& pnt);
|
||||||
|
|
||||||
|
static
|
||||||
|
Standard_Boolean IsRegularity(const TheArc& A,
|
||||||
|
const Handle(TheTopolTool)& aDomain);
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindVertex
|
//function : FindVertex
|
||||||
@ -131,7 +135,8 @@ void BoundedArc (const TheArc& A,
|
|||||||
IntStart_SequenceOfSegment& seg,
|
IntStart_SequenceOfSegment& seg,
|
||||||
const Standard_Real TolBoundary,
|
const Standard_Real TolBoundary,
|
||||||
const Standard_Real TolTangency,
|
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.
|
// Recherche des points solutions et des bouts d arc solution sur un arc donne.
|
||||||
@ -139,7 +144,6 @@ void BoundedArc (const TheArc& A,
|
|||||||
// des arcs ayant un point debut et un point de fin (intervalle ferme de
|
// des arcs ayant un point debut et un point de fin (intervalle ferme de
|
||||||
// parametrage).
|
// parametrage).
|
||||||
|
|
||||||
|
|
||||||
Standard_Integer i,Nbi,Nbp;
|
Standard_Integer i,Nbi,Nbp;
|
||||||
|
|
||||||
gp_Pnt ptdeb,ptfin;
|
gp_Pnt ptdeb,ptfin;
|
||||||
@ -255,6 +259,71 @@ void BoundedArc (const TheArc& A,
|
|||||||
|
|
||||||
Nbp=Sol.NbPoints();
|
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
|
//-- detection du cas ou la fonction est quasi tangente et que les
|
||||||
//-- zeros sont quasi confondus.
|
//-- zeros sont quasi confondus.
|
||||||
//-- Dans ce cas on prend le point "milieu"
|
//-- Dans ce cas on prend le point "milieu"
|
||||||
@ -390,7 +459,7 @@ void BoundedArc (const TheArc& A,
|
|||||||
Nbi=Sol.NbIntervals();
|
Nbi=Sol.NbIntervals();
|
||||||
|
|
||||||
|
|
||||||
if(Nbp) {
|
if (!RecheckOnRegularity && Nbp) {
|
||||||
//--cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx :Nbp>0 0 <- Nbi "<<Nbi<<endl;
|
//--cout<<" Debug : IntStart_SearchOnBoundaries_1.gxx :Nbp>0 0 <- Nbi "<<Nbi<<endl;
|
||||||
Nbi=0;
|
Nbi=0;
|
||||||
}
|
}
|
||||||
@ -704,6 +773,24 @@ void PointProcess (const gp_Pnt& Pt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) { // on n est pas tombe sur un vertex
|
if (!found) { // on n est pas tombe sur un vertex
|
||||||
|
//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;
|
Standard_Real TOL=Tol;
|
||||||
TOL*=1000.0;
|
TOL*=1000.0;
|
||||||
if(TOL>0.001) TOL=0.001;
|
if(TOL>0.001) TOL=0.001;
|
||||||
@ -713,6 +800,7 @@ void PointProcess (const gp_Pnt& Pt,
|
|||||||
Range = pnt.Length();
|
Range = pnt.Length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//modified by NIZNHY-PKV Fri Mar 23 10:53:15 2001
|
//modified by NIZNHY-PKV Fri Mar 23 10:53:15 2001
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
@ -734,6 +822,23 @@ void PointProcess (const gp_Pnt& Pt,
|
|||||||
#include <Extrema_ExtCC.hxx>
|
#include <Extrema_ExtCC.hxx>
|
||||||
#include <Extrema_POnCurv.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
|
//function : TreatLC
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -33,7 +33,8 @@ IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries ()
|
|||||||
void IntStart_SearchOnBoundaries::Perform (TheFunction& Func,
|
void IntStart_SearchOnBoundaries::Perform (TheFunction& Func,
|
||||||
const Handle(TheTopolTool)& Domain,
|
const Handle(TheTopolTool)& Domain,
|
||||||
const Standard_Real TolBoundary,
|
const Standard_Real TolBoundary,
|
||||||
const Standard_Real TolTangency)
|
const Standard_Real TolTangency,
|
||||||
|
const Standard_Boolean RecheckOnRegularity)
|
||||||
{
|
{
|
||||||
|
|
||||||
done = Standard_False;
|
done = Standard_False;
|
||||||
@ -68,7 +69,7 @@ IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries ()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BoundedArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
|
BoundedArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
|
||||||
TolBoundary,TolTangency,Arcsol);
|
TolBoundary,TolTangency,Arcsol,RecheckOnRegularity);
|
||||||
}
|
}
|
||||||
all = (all && Arcsol);
|
all = (all && Arcsol);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
HLRTopoBRep
|
HLRTopoBRep
|
||||||
HLRBRep
|
HLRBRep
|
||||||
HLRAlgo
|
HLRAlgo
|
||||||
|
HLRAppli
|
||||||
Intrv
|
Intrv
|
||||||
TopBas
|
TopBas
|
||||||
TopCnx
|
TopCnx
|
||||||
|
20
tests/bugs/modalg_5/bug23625_1
Executable file
20
tests/bugs/modalg_5/bug23625_1
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
20
tests/bugs/modalg_5/bug23625_2
Executable file
20
tests/bugs/modalg_5/bug23625_2
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
20
tests/bugs/modalg_5/bug23625_3
Executable file
20
tests/bugs/modalg_5/bug23625_3
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
20
tests/bugs/modalg_5/bug23625_4
Executable file
20
tests/bugs/modalg_5/bug23625_4
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
20
tests/bugs/modalg_5/bug23625_5
Executable file
20
tests/bugs/modalg_5/bug23625_5
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user