mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
238
src/IntTools/IntTools.cdl
Executable file
238
src/IntTools/IntTools.cdl
Executable file
@@ -0,0 +1,238 @@
|
||||
-- File: IntTools.cdl
|
||||
-- Created: Thu May 18 13:34:39 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
package IntTools
|
||||
|
||||
---Purpose: Contains classes for intersection and classification
|
||||
--- purposes and accompanying classes
|
||||
uses
|
||||
|
||||
TCollection,
|
||||
TopoDS,
|
||||
TopAbs,
|
||||
TColStd,
|
||||
BRepAdaptor,
|
||||
BRepTopAdaptor,
|
||||
SortTools,
|
||||
TopTools,
|
||||
math,
|
||||
gp,
|
||||
Bnd,
|
||||
Adaptor3d,
|
||||
GeomAdaptor,
|
||||
Geom,
|
||||
Geom2d,
|
||||
GeomInt,
|
||||
GeomAbs,
|
||||
GeomAPI,
|
||||
Extrema,
|
||||
IntPatch,
|
||||
IntSurf,
|
||||
BRepClass3d,
|
||||
TColgp
|
||||
|
||||
is
|
||||
|
||||
class Range;
|
||||
class CommonPrt;
|
||||
class Root;
|
||||
class Compare;
|
||||
class CompareRange;
|
||||
|
||||
class EdgeEdge;
|
||||
---Purpose: class provides the Edge/Edge algorithm
|
||||
|
||||
class EdgeFace;
|
||||
---Purpose: class provides the Edge/Face algorithm
|
||||
|
||||
class FClass2d;
|
||||
---Purpose: class provides classification of a point in a face
|
||||
|
||||
class LineConstructor;
|
||||
---Purpose: class provides post-processing of results of
|
||||
--- surfaces intersection
|
||||
|
||||
-----
|
||||
class MarkedRangeSet;
|
||||
---Purpose: auxiliary class for range management
|
||||
|
||||
--modified by NIZHNY-MKK Wed Oct 5 18:08:38 2005.BEGIN
|
||||
class BaseRangeSample;
|
||||
---Purpose: base class for range index management
|
||||
|
||||
class CurveRangeSample;
|
||||
---Purpose: class for range index management of curve
|
||||
|
||||
class SurfaceRangeSample;
|
||||
---Purpose: class for range index management of surface
|
||||
|
||||
class CurveRangeLocalizeData;
|
||||
|
||||
class SurfaceRangeLocalizeData;
|
||||
--modified by NIZHNY-MKK Wed Oct 5 18:08:43 2005.END
|
||||
|
||||
class BeanFaceIntersector;
|
||||
---Purpose: class provides computing ranges of parameters
|
||||
--- of edge/face intersection.
|
||||
|
||||
class BeanBeanIntersector;
|
||||
---Purpose: class provides computing ranges of parameters
|
||||
--- of edge/edge intersection.
|
||||
|
||||
-----
|
||||
class Curve;
|
||||
---Purpose: class is a container of
|
||||
--- one 3d curve
|
||||
--- two 2d curves
|
||||
-----
|
||||
|
||||
class PntOnFace;
|
||||
class PntOn2Faces;
|
||||
|
||||
class TopolTool;
|
||||
---Purpose: class redefines TopolTool from Adaptor3d
|
||||
|
||||
class FaceFace;
|
||||
---Purpose: class provides the Face/Face algorithm
|
||||
---
|
||||
|
||||
class ShrunkRange;
|
||||
---Purpose: class provides computing and storage of shrunk range
|
||||
--- for an edge bounded by two vertices
|
||||
|
||||
class Context;
|
||||
---Purpose: class is a container of a large number of reusable
|
||||
--- projection and classification algorithms
|
||||
|
||||
class Tools;
|
||||
---Purpose: class is a container of usefull geometrical and
|
||||
--- topological algorithms
|
||||
|
||||
generic class CArray1;
|
||||
---
|
||||
--- P o i n t e r s
|
||||
---
|
||||
pointer PContext to Context from IntTools;
|
||||
---
|
||||
--- I n s t a n t i a t i o n s
|
||||
---
|
||||
class SequenceOfPntOn2Faces instantiates
|
||||
Sequence from TCollection(PntOn2Faces from IntTools);
|
||||
--
|
||||
class SequenceOfCurves instantiates
|
||||
Sequence from TCollection(Curve from IntTools);
|
||||
|
||||
|
||||
class SequenceOfRanges instantiates
|
||||
Sequence from TCollection(Range from IntTools);
|
||||
|
||||
class CArray1OfInteger instantiates
|
||||
CArray1(Integer from Standard);
|
||||
|
||||
class CArray1OfReal instantiates
|
||||
CArray1(Real from Standard);
|
||||
|
||||
class SequenceOfRoots instantiates
|
||||
Sequence from TCollection(Root from IntTools);
|
||||
|
||||
class Array1OfRoots instantiates
|
||||
Array1 from TCollection (Root from IntTools);
|
||||
|
||||
class Array1OfRange instantiates
|
||||
Array1 from TCollection (Range from IntTools);
|
||||
|
||||
class QuickSort instantiates
|
||||
QuickSort from SortTools (Root from IntTools,
|
||||
Array1OfRoots from IntTools,
|
||||
Compare from IntTools);
|
||||
|
||||
class QuickSortRange instantiates
|
||||
QuickSort from SortTools (Range from IntTools,
|
||||
Array1OfRange from IntTools,
|
||||
CompareRange from IntTools);
|
||||
class SequenceOfCommonPrts instantiates
|
||||
Sequence from TCollection(CommonPrt from IntTools);
|
||||
|
||||
class IndexedDataMapOfTransientAddress instantiates
|
||||
IndexedDataMap from TCollection(Transient from Standard,
|
||||
Address from Standard,
|
||||
MapTransientHasher from TColStd);
|
||||
|
||||
--modified by NIZHNY-MKK Wed Oct 5 18:06:39 2005
|
||||
class ListOfCurveRangeSample instantiates
|
||||
List from TCollection(CurveRangeSample from IntTools);
|
||||
|
||||
class ListOfSurfaceRangeSample instantiates
|
||||
List from TCollection(SurfaceRangeSample from IntTools);
|
||||
|
||||
class ListOfBox instantiates
|
||||
List from TCollection(Box from Bnd);
|
||||
|
||||
class CurveRangeSampleMapHasher;
|
||||
---Purpose: class for range index management of curve
|
||||
|
||||
class SurfaceRangeSampleMapHasher;
|
||||
|
||||
class MapOfCurveSample instantiates
|
||||
Map from TCollection(CurveRangeSample from IntTools,
|
||||
CurveRangeSampleMapHasher from IntTools);
|
||||
|
||||
class MapOfSurfaceSample instantiates
|
||||
Map from TCollection(SurfaceRangeSample from IntTools,
|
||||
SurfaceRangeSampleMapHasher from IntTools);
|
||||
|
||||
class DataMapOfCurveSampleBox instantiates
|
||||
DataMap from TCollection(CurveRangeSample from IntTools,
|
||||
Box from Bnd,
|
||||
CurveRangeSampleMapHasher from IntTools);
|
||||
|
||||
class DataMapOfSurfaceSampleBox instantiates
|
||||
DataMap from TCollection(SurfaceRangeSample from IntTools,
|
||||
Box from Bnd,
|
||||
SurfaceRangeSampleMapHasher from IntTools);
|
||||
-----------------------------------------------------
|
||||
-- Block of static functions
|
||||
-----------------------------------------------------
|
||||
Length (E : Edge from TopoDS)
|
||||
returns Real from Standard;
|
||||
---Purpose: returns the length of the edge;
|
||||
|
||||
RemoveIdenticalRoots (aSeq :out SequenceOfRoots from IntTools;
|
||||
anEpsT: Real from Standard);
|
||||
---Purpose: Remove from the sequence aSeq the Roots that have
|
||||
-- values ti and tj such as |ti-tj] < anEpsT.
|
||||
|
||||
SortRoots (aSeq :out SequenceOfRoots from IntTools;
|
||||
anEpsT: Real from Standard);
|
||||
---Purpose: Sort the sequence aSeq of the Roots to arrange the
|
||||
-- Roons in increasing order
|
||||
FindRootStates (aSeq :out SequenceOfRoots from IntTools;
|
||||
anEpsNull: Real from Standard);
|
||||
---Purpose: Find the states (before and after) for each Root
|
||||
-- from the sequence aSeq
|
||||
|
||||
Parameter (P : Pnt from gp;
|
||||
Curve : Curve from Geom;
|
||||
aParm : out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
GetRadius(C: Curve from BRepAdaptor;
|
||||
t1,t3:Real from Standard;
|
||||
R:out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
PrepareArgs(C: in out Curve from BRepAdaptor;
|
||||
tMax,tMin: Real from Standard;
|
||||
Discret : Integer from Standard;
|
||||
Deflect : Real from Standard;
|
||||
anArgs : out CArray1OfReal from IntTools)
|
||||
returns Integer from Standard;
|
||||
|
||||
end IntTools;
|
||||
|
||||
|
||||
|
371
src/IntTools/IntTools.cxx
Executable file
371
src/IntTools/IntTools.cxx
Executable file
@@ -0,0 +1,371 @@
|
||||
// File: IntTools.cxx
|
||||
// Created: Tue Aug 1 09:24:34 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools.ixx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <IntTools_Array1OfRoots.hxx>
|
||||
#include <IntTools_Compare.hxx>
|
||||
#include <IntTools_QuickSort.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <TColStd_ListOfReal.hxx>
|
||||
#include <GCPnts_QuasiUniformDeflection.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
#include <gce_ErrorType.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning ( disable : 4101 )
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : IntTools::GetRadius
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools::GetRadius(const BRepAdaptor_Curve& C,
|
||||
const Standard_Real t1,
|
||||
const Standard_Real t3,
|
||||
Standard_Real& aR)
|
||||
{
|
||||
GeomAbs_CurveType aType=C.GetType();
|
||||
if (aType==GeomAbs_Line) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aType==GeomAbs_Circle) {
|
||||
gp_Circ aCrc=C.Circle();
|
||||
aR=aCrc.Radius();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real t2;
|
||||
gp_Pnt P1, P2, P3;
|
||||
|
||||
t2=0.5*(t1+t3);
|
||||
|
||||
P1=C.Value(t1);
|
||||
P2=C.Value(t2);
|
||||
P3=C.Value(t3);
|
||||
//
|
||||
//
|
||||
gce_MakeCirc aMakeCirc(P1, P2, P3);
|
||||
gce_ErrorType anErrorType;
|
||||
|
||||
anErrorType=aMakeCirc.Status();
|
||||
|
||||
if (!aMakeCirc.IsDone()) {
|
||||
|
||||
if (anErrorType==gce_ConfusedPoints ||
|
||||
anErrorType==gce_IntersectionError ||
|
||||
anErrorType==gce_ColinearPoints) {//modified by NIZNHY-PKV Fri Sep 24 09:54:05 2004ft
|
||||
return 2;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
//
|
||||
gp_Circ aCirc=aMakeCirc.Value();
|
||||
aR=aCirc.Radius();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareArgs
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools::PrepareArgs(BRepAdaptor_Curve& C,
|
||||
const Standard_Real Tmax,
|
||||
const Standard_Real Tmin,
|
||||
const Standard_Integer Discret,
|
||||
const Standard_Real Deflection,
|
||||
IntTools_CArray1OfReal& anArgs)
|
||||
{
|
||||
|
||||
TColStd_ListOfReal aPars;
|
||||
Standard_Real dt, tCurrent, tNext, aR, anAbsDeflection;
|
||||
Standard_Integer ip, i, j, aNbDeflectionPoints, aDiscretBis;
|
||||
Standard_Boolean aRFlag;
|
||||
|
||||
GeomAbs_CurveType aCurveType;
|
||||
aCurveType=C.GetType();
|
||||
|
||||
dt=(Tmax-Tmin)/Discret;
|
||||
aRFlag=(dt > 1.e-5);
|
||||
for (i=1; i<=Discret; i++) {
|
||||
tCurrent=Tmin+(i-1)*dt;
|
||||
aPars.Append(tCurrent);
|
||||
tNext=tCurrent+dt;
|
||||
if (i==Discret)
|
||||
tNext=Tmax;
|
||||
///////////////////////////////////////////////////
|
||||
if (!aRFlag) {
|
||||
continue;
|
||||
}
|
||||
if (aCurveType==GeomAbs_BSplineCurve||
|
||||
aCurveType==GeomAbs_BezierCurve ||
|
||||
aCurveType==GeomAbs_Ellipse ||
|
||||
aCurveType==GeomAbs_OtherCurve) { //modified by NIZNHY-PKV Fri Sep 24 09:52:42 2004ft
|
||||
continue;
|
||||
}
|
||||
//
|
||||
ip=IntTools::GetRadius (C, tCurrent, tNext, aR);
|
||||
if (ip<0) {
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
if (!ip) {
|
||||
anAbsDeflection=Deflection*aR;
|
||||
GCPnts_QuasiUniformDeflection anUD;
|
||||
anUD.Initialize (C, anAbsDeflection, tCurrent, tNext);
|
||||
if (!anUD.IsDone()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
aNbDeflectionPoints=anUD.NbPoints();
|
||||
if (aNbDeflectionPoints > 2) {
|
||||
aNbDeflectionPoints--;
|
||||
for (j=2; j<=aNbDeflectionPoints; j++) {
|
||||
tCurrent=anUD.Parameter(j);
|
||||
aPars.Append(tCurrent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aPars.Append(Tmax);
|
||||
aDiscretBis=aPars.Extent();
|
||||
anArgs.Resize(aDiscretBis);
|
||||
TColStd_ListIteratorOfListOfReal anIt(aPars);
|
||||
for (i=0; anIt.More(); anIt.Next(), i++) {
|
||||
anArgs(i)=anIt.Value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools::Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools::Length (const TopoDS_Edge& anEdge)
|
||||
{
|
||||
Standard_Real aLength=0;
|
||||
|
||||
if (!BRep_Tool::Degenerated(anEdge) &&
|
||||
BRep_Tool::IsGeometric(anEdge)) {
|
||||
|
||||
GProp_GProps Temp;
|
||||
BRepGProp::LinearProperties(anEdge, Temp);
|
||||
aLength = Temp.Mass();
|
||||
}
|
||||
return aLength;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveIdenticalRoots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools::RemoveIdenticalRoots(IntTools_SequenceOfRoots& aSR,
|
||||
const Standard_Real anEpsT)
|
||||
{
|
||||
Standard_Integer aNbRoots, j, k;
|
||||
Standard_Real anEpsT2=0.5*anEpsT;
|
||||
aNbRoots=aSR.Length();
|
||||
for (j=1; j<=aNbRoots; j++) {
|
||||
const IntTools_Root& aRj=aSR(j);
|
||||
for (k=j+1; k<=aNbRoots; k++) {
|
||||
const IntTools_Root& aRk=aSR(k);
|
||||
if (fabs (aRj.Root()-aRk.Root()) < anEpsT2) {
|
||||
aSR.Remove(k);
|
||||
aNbRoots=aSR.Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SortRoots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools::SortRoots(IntTools_SequenceOfRoots& mySequenceOfRoots,
|
||||
const Standard_Real myEpsT)
|
||||
{
|
||||
Standard_Integer j, aNbRoots;
|
||||
|
||||
aNbRoots=mySequenceOfRoots.Length();
|
||||
|
||||
IntTools_Array1OfRoots anArray1OfRoots(1, aNbRoots);
|
||||
IntTools_Compare aComparator(myEpsT);
|
||||
|
||||
for (j=1; j<=aNbRoots; j++) {
|
||||
anArray1OfRoots(j)=mySequenceOfRoots(j);
|
||||
}
|
||||
|
||||
IntTools_QuickSort aQS;
|
||||
aQS.Sort(anArray1OfRoots, aComparator);
|
||||
|
||||
mySequenceOfRoots.Clear();
|
||||
for (j=1; j<=aNbRoots; j++) {
|
||||
mySequenceOfRoots.Append(anArray1OfRoots(j));
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function :FindRootStates
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools::FindRootStates(IntTools_SequenceOfRoots& mySequenceOfRoots,
|
||||
const Standard_Real myEpsNull)
|
||||
{
|
||||
Standard_Integer aType, j, aNbRoots;
|
||||
Standard_Real t, t1, t2, f1, f2, absf1, absf2;
|
||||
|
||||
aNbRoots=mySequenceOfRoots.Length();
|
||||
|
||||
for (j=1; j<=aNbRoots; j++) {
|
||||
IntTools_Root& aR=mySequenceOfRoots.ChangeValue(j);
|
||||
|
||||
t=aR.Root();
|
||||
aR.Interval (t1, t2, f1, f2);
|
||||
|
||||
aType=aR.Type();
|
||||
switch (aType) {
|
||||
case 0: // Simple Root
|
||||
if (f1>0. && f2<0.) {
|
||||
aR.SetStateBefore(TopAbs_OUT);
|
||||
aR.SetStateAfter (TopAbs_IN);
|
||||
}
|
||||
else {
|
||||
aR.SetStateBefore(TopAbs_IN);
|
||||
aR.SetStateAfter (TopAbs_OUT);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Complete 0;
|
||||
aR.SetStateBefore(TopAbs_ON);
|
||||
aR.SetStateAfter (TopAbs_ON);
|
||||
break;
|
||||
|
||||
case 2: // Smart;
|
||||
absf1=fabs(f1);
|
||||
absf2=fabs(f2);
|
||||
if (absf2 < myEpsNull) {
|
||||
aR.SetStateAfter (TopAbs_ON);
|
||||
if (f1>0.) {
|
||||
aR.SetStateBefore(TopAbs_OUT);
|
||||
}
|
||||
else {
|
||||
aR.SetStateBefore(TopAbs_IN);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
aR.SetStateBefore(TopAbs_ON);
|
||||
if (f2>0.) {
|
||||
aR.SetStateAfter (TopAbs_OUT);
|
||||
}
|
||||
else {
|
||||
aR.SetStateAfter (TopAbs_IN);
|
||||
}
|
||||
}
|
||||
|
||||
default: break;
|
||||
} // switch (aType)
|
||||
}
|
||||
}
|
||||
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :Parameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools::Parameter (const gp_Pnt& aP,
|
||||
const Handle(Geom_Curve)& aCurve,
|
||||
Standard_Real& aParameter)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
GeomAbs_CurveType aCurveType;
|
||||
|
||||
aFirst=aCurve->FirstParameter();
|
||||
aLast =aCurve->LastParameter ();
|
||||
|
||||
GeomAdaptor_Curve aGAC;
|
||||
|
||||
aGAC.Load (aCurve, aFirst, aLast);
|
||||
|
||||
aCurveType=aGAC.GetType();
|
||||
|
||||
switch (aCurveType){
|
||||
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
gp_Lin aLin=aGAC.Line();
|
||||
aParameter=ElCLib::Parameter (aLin, aP);
|
||||
return 0;
|
||||
}
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
gp_Circ aCircle=aGAC.Circle();
|
||||
aParameter=ElCLib::Parameter (aCircle, aP);
|
||||
return 0;
|
||||
}
|
||||
case GeomAbs_Ellipse:
|
||||
{
|
||||
gp_Elips aElips=aGAC.Ellipse();
|
||||
aParameter=ElCLib::Parameter (aElips, aP);
|
||||
return 0;
|
||||
}
|
||||
case GeomAbs_Hyperbola:
|
||||
{
|
||||
gp_Hypr aHypr=aGAC.Hyperbola();
|
||||
aParameter=ElCLib::Parameter (aHypr, aP);
|
||||
return 0;
|
||||
}
|
||||
case GeomAbs_Parabola:
|
||||
{
|
||||
gp_Parab aParab=aGAC.Parabola();
|
||||
aParameter=ElCLib::Parameter (aParab, aP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case GeomAbs_BezierCurve:
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
GeomAPI_ProjectPointOnCurve aProjector;
|
||||
|
||||
aProjector.Init(aP, aCurve, aFirst, aLast);
|
||||
Standard_Integer aNbPoints=aProjector.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aParameter=aProjector.LowerDistanceParameter();
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning ( default : 4101 )
|
||||
#endif
|
27
src/IntTools/IntTools_BaseRangeSample.cdl
Executable file
27
src/IntTools/IntTools_BaseRangeSample.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: IntTools_BaseRangeSample.cdl
|
||||
-- Created: Wed Oct 5 16:22:27 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class BaseRangeSample from IntTools
|
||||
|
||||
|
||||
is
|
||||
Create
|
||||
returns BaseRangeSample from IntTools;
|
||||
|
||||
Create(theDepth: Integer from Standard)
|
||||
returns BaseRangeSample from IntTools;
|
||||
|
||||
SetDepth(me: in out; theDepth: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetDepth(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
myDepth: Integer from Standard;
|
||||
|
||||
end BaseRangeSample from IntTools;
|
17
src/IntTools/IntTools_BaseRangeSample.cxx
Executable file
17
src/IntTools/IntTools_BaseRangeSample.cxx
Executable file
@@ -0,0 +1,17 @@
|
||||
// File: IntTools_BaseRangeSample.cxx
|
||||
// Created: Wed Oct 5 16:52:02 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_BaseRangeSample.ixx>
|
||||
|
||||
IntTools_BaseRangeSample::IntTools_BaseRangeSample()
|
||||
{
|
||||
myDepth = 0;
|
||||
}
|
||||
|
||||
IntTools_BaseRangeSample::IntTools_BaseRangeSample(const Standard_Integer theDepth)
|
||||
{
|
||||
myDepth = theDepth;
|
||||
}
|
15
src/IntTools/IntTools_BaseRangeSample.lxx
Executable file
15
src/IntTools/IntTools_BaseRangeSample.lxx
Executable file
@@ -0,0 +1,15 @@
|
||||
// File: IntTools_BaseRangeSample.lxx
|
||||
// Created: Wed Oct 5 16:52:18 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
inline void IntTools_BaseRangeSample::SetDepth(const Standard_Integer theDepth)
|
||||
{
|
||||
myDepth = theDepth;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_BaseRangeSample::GetDepth() const
|
||||
{
|
||||
return myDepth;
|
||||
}
|
167
src/IntTools/IntTools_BeanBeanIntersector.cdl
Executable file
167
src/IntTools/IntTools_BeanBeanIntersector.cdl
Executable file
@@ -0,0 +1,167 @@
|
||||
-- File: IntTools_BeanBeanIntersector.cdl
|
||||
-- Created: Fri Jul 6 10:16:43 2001
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
class BeanBeanIntersector from IntTools
|
||||
|
||||
---Purpose: The class BeanBeanIntersector computes ranges of parameters on
|
||||
--- the curve of a first bean (part of edge) that bounds the parts of bean which
|
||||
--- are on the other bean according to tolerance of edges.
|
||||
|
||||
uses
|
||||
SequenceOfRoots from IntTools,
|
||||
MarkedRangeSet from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
Range from IntTools,
|
||||
ExtCC from Extrema,
|
||||
ProjectPointOnCurve from GeomAPI,
|
||||
Edge from TopoDS,
|
||||
Curve from BRepAdaptor,
|
||||
Curve from Geom
|
||||
|
||||
|
||||
is
|
||||
Create returns BeanBeanIntersector from IntTools;
|
||||
|
||||
Create(theEdge1: Edge from TopoDS;
|
||||
theEdge2: Edge from TopoDS)
|
||||
returns BeanBeanIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Create(theCurve1 : Curve from BRepAdaptor;
|
||||
theCurve2 : Curve from BRepAdaptor;
|
||||
theBeanTolerance1: Real from Standard;
|
||||
theBeanTolerance2: Real from Standard)
|
||||
returns BeanBeanIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Create(theCurve1 : Curve from BRepAdaptor;
|
||||
theCurve2 : Curve from BRepAdaptor;
|
||||
theFirstParOnCurve1: Real from Standard;
|
||||
theLastParOnCurve1 : Real from Standard;
|
||||
theFirstParOnCurve2: Real from Standard;
|
||||
theLastParOnCurve2 : Real from Standard;
|
||||
theBeanTolerance1 : Real from Standard;
|
||||
theBeanTolerance2 : Real from Standard)
|
||||
returns BeanBeanIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Init(me: in out;theEdge1: Edge from TopoDS;
|
||||
theEdge2: Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
|
||||
|
||||
Init(me: in out;theCurve1 : Curve from BRepAdaptor;
|
||||
theCurve2 : Curve from BRepAdaptor;
|
||||
theBeanTolerance1: Real from Standard;
|
||||
theBeanTolerance2: Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Init(me: in out;theCurve1 : Curve from BRepAdaptor;
|
||||
theCurve2 : Curve from BRepAdaptor;
|
||||
theFirstParOnCurve1: Real from Standard;
|
||||
theLastParOnCurve1 : Real from Standard;
|
||||
theFirstParOnCurve2: Real from Standard;
|
||||
theLastParOnCurve2 : Real from Standard;
|
||||
theBeanTolerance1 : Real from Standard;
|
||||
theBeanTolerance2 : Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
SetBeanParameters(me: in out;IsFirstBean : Boolean from Standard;
|
||||
theFirstParOnCurve: Real from Standard;
|
||||
theLastParOnCurve : Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets bounding parameters for first bean if IsFirstBean is true
|
||||
--- and for second bean if IsFirstBean is false
|
||||
---
|
||||
|
||||
|
||||
Perform(me: in out);
|
||||
---Purpose:
|
||||
--- Launches the algorithm
|
||||
---
|
||||
|
||||
IsDone(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns true if the computations was successfull
|
||||
--- otherwise returns false
|
||||
|
||||
Result(me)
|
||||
returns SequenceOfRanges from IntTools;
|
||||
---C++: return const &
|
||||
|
||||
Result(me; theResults: out SequenceOfRanges from IntTools);
|
||||
|
||||
|
||||
-- private
|
||||
|
||||
ComputeRoughIntersection(me: in out)
|
||||
is private;
|
||||
|
||||
FastComputeIntersection(me: in out)
|
||||
returns Boolean from Standard is private;
|
||||
|
||||
ComputeUsingExtrema(me: in out; theRange2: Range from IntTools)
|
||||
is private;
|
||||
|
||||
ComputeNearRangeBoundaries(me: in out; theRange2: Range from IntTools)
|
||||
is private;
|
||||
|
||||
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
|
||||
theParameter : Real from Standard;
|
||||
theIndex : Integer from Standard;
|
||||
theParameter2 : Real from Standard;
|
||||
theRange2 : Range from IntTools)
|
||||
is private;
|
||||
|
||||
Distance(me: in out; theArg : Real from Standard;
|
||||
theArgOnOtherBean: out Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
-- sources
|
||||
myCurve1 : Curve from BRepAdaptor;
|
||||
myCurve2 : Curve from BRepAdaptor;
|
||||
myTrsfCurve1 : Curve from Geom;
|
||||
myTrsfCurve2 : Curve from Geom;
|
||||
|
||||
myFirstParameter1 : Real from Standard;
|
||||
myLastParameter1 : Real from Standard;
|
||||
myFirstParameter2 : Real from Standard;
|
||||
myLastParameter2 : Real from Standard;
|
||||
|
||||
myBeanTolerance1 : Real from Standard;
|
||||
myBeanTolerance2 : Real from Standard;
|
||||
|
||||
myCurveResolution1: Real from Standard;
|
||||
myCriteria : Real from Standard;
|
||||
|
||||
-- tools
|
||||
myProjector : ProjectPointOnCurve from GeomAPI;
|
||||
myRangeManager : MarkedRangeSet from IntTools;
|
||||
myDeflection : Real from Standard;
|
||||
|
||||
-- results
|
||||
myResults : SequenceOfRanges from IntTools;
|
||||
|
||||
myIsDone : Boolean from Standard;
|
||||
|
||||
end BeanBeanIntersector from IntTools;
|
1138
src/IntTools/IntTools_BeanBeanIntersector.cxx
Executable file
1138
src/IntTools/IntTools_BeanBeanIntersector.cxx
Executable file
File diff suppressed because it is too large
Load Diff
6
src/IntTools/IntTools_BeanBeanIntersector.lxx
Executable file
6
src/IntTools/IntTools_BeanBeanIntersector.lxx
Executable file
@@ -0,0 +1,6 @@
|
||||
inline Standard_Boolean IntTools_BeanBeanIntersector::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
|
236
src/IntTools/IntTools_BeanFaceIntersector.cdl
Executable file
236
src/IntTools/IntTools_BeanFaceIntersector.cdl
Executable file
@@ -0,0 +1,236 @@
|
||||
-- File: IntTools_BeanFaceIntersector.cdl
|
||||
-- Created: Fri Jun 29 10:17:11 2001
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
class BeanFaceIntersector from IntTools
|
||||
|
||||
---Purpose: The class BeanFaceIntersector computes ranges of parameters on
|
||||
-- the curve of a bean(part of edge) that bound the parts of bean which
|
||||
-- are on the surface of a face according to edge and face tolerances.
|
||||
-- Warning: The real boundaries of the face are not taken into account,
|
||||
-- Most of the result parts of the bean lays only inside the region of the surface,
|
||||
-- which includes the inside of the face. And the parts which are out of this region can be
|
||||
-- excluded from the result.
|
||||
|
||||
uses
|
||||
|
||||
SequenceOfRoots from IntTools,
|
||||
MarkedRangeSet from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
PContext from IntTools,
|
||||
ExtCS from Extrema,
|
||||
ProjectPointOnSurf from GeomAPI,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Curve from BRepAdaptor,
|
||||
Surface from BRepAdaptor,
|
||||
Box from Bnd,
|
||||
CurveRangeSample from IntTools,
|
||||
SurfaceRangeSample from IntTools,
|
||||
ListOfCurveRangeSample from IntTools,
|
||||
ListOfSurfaceRangeSample from IntTools,
|
||||
CurveRangeLocalizeData from IntTools,
|
||||
SurfaceRangeLocalizeData from IntTools,
|
||||
Surface from Geom
|
||||
|
||||
is
|
||||
Create returns BeanFaceIntersector from IntTools;
|
||||
|
||||
Create(theEdge: Edge from TopoDS;
|
||||
theFace: Face from TopoDS)
|
||||
returns BeanFaceIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
-- Warning:
|
||||
--- The parts of the edge which are on
|
||||
--- the surface of the face and belong to
|
||||
--- the whole in the face (if there is)
|
||||
--- is considered as result
|
||||
---
|
||||
|
||||
Create(theCurve : Curve from BRepAdaptor;
|
||||
theSurface : Surface from BRepAdaptor;
|
||||
theBeanTolerance: Real from Standard;
|
||||
theFaceTolerance: Real from Standard)
|
||||
returns BeanFaceIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Create(theCurve : Curve from BRepAdaptor;
|
||||
theSurface : Surface from BRepAdaptor;
|
||||
theFirstParOnCurve: Real from Standard;
|
||||
theLastParOnCurve : Real from Standard;
|
||||
theUMinParameter : Real from Standard;
|
||||
theUMaxParameter : Real from Standard;
|
||||
theVMinParameter : Real from Standard;
|
||||
theVMaxParameter : Real from Standard;
|
||||
theBeanTolerance : Real from Standard;
|
||||
theFaceTolerance : Real from Standard)
|
||||
returns BeanFaceIntersector from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
--- theUMinParameter, ... are used for
|
||||
--- optimization purposes
|
||||
---
|
||||
|
||||
Init(me: in out;theEdge: Edge from TopoDS;
|
||||
theFace: Face from TopoDS);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
-- Warning:
|
||||
--- The parts of the edge which are on
|
||||
--- the surface of the face and belong to
|
||||
--- the whole in the face (if there is)
|
||||
--- is considered as result
|
||||
---
|
||||
|
||||
Init(me: in out;theCurve : Curve from BRepAdaptor;
|
||||
theSurface : Surface from BRepAdaptor;
|
||||
theBeanTolerance: Real from Standard;
|
||||
theFaceTolerance: Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
---
|
||||
|
||||
Init(me: in out;theCurve : Curve from BRepAdaptor;
|
||||
theSurface : Surface from BRepAdaptor;
|
||||
theFirstParOnCurve: Real from Standard;
|
||||
theLastParOnCurve : Real from Standard;
|
||||
theUMinParameter : Real from Standard;
|
||||
theUMaxParameter : Real from Standard;
|
||||
theVMinParameter : Real from Standard;
|
||||
theVMaxParameter : Real from Standard;
|
||||
theBeanTolerance : Real from Standard;
|
||||
theFaceTolerance : Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes the algorithm
|
||||
--- theUMinParameter, ... are used for
|
||||
--- optimization purposes
|
||||
---
|
||||
|
||||
SetContext(me: in out; theContext: PContext from IntTools);
|
||||
---Purpose:
|
||||
--- Sets the context
|
||||
---
|
||||
|
||||
SetBeanParameters(me: in out;theFirstParOnCurve : Real from Standard;
|
||||
theLastParOnCurve : Real from Standard);
|
||||
---Purpose:
|
||||
--- Set restrictions for curve
|
||||
---
|
||||
|
||||
SetSurfaceParameters(me: in out;theUMinParameter : Real from Standard;
|
||||
theUMaxParameter : Real from Standard;
|
||||
theVMinParameter : Real from Standard;
|
||||
theVMaxParameter : Real from Standard);
|
||||
---Purpose:
|
||||
--- Set restrictions for surface
|
||||
---
|
||||
|
||||
Perform(me: in out);
|
||||
---Purpose:
|
||||
--- Launches the algorithm
|
||||
---
|
||||
|
||||
IsDone(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
Result(me)
|
||||
returns SequenceOfRanges from IntTools;
|
||||
---C++: return const &
|
||||
|
||||
Result(me; theResults: out SequenceOfRanges from IntTools);
|
||||
|
||||
-- private
|
||||
|
||||
ComputeAroundExactIntersection(me: in out)
|
||||
is private;
|
||||
|
||||
ComputeLinePlane(me: in out)
|
||||
is private;
|
||||
|
||||
FastComputeExactIntersection(me: in out)
|
||||
returns Boolean from Standard is private;
|
||||
|
||||
ComputeUsingExtremum(me: in out)
|
||||
is private;
|
||||
|
||||
ComputeNearRangeBoundaries(me: in out)
|
||||
is private;
|
||||
|
||||
ComputeLocalized(me: in out)
|
||||
returns Boolean from Standard is private;
|
||||
|
||||
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
|
||||
theParameter : Real from Standard;
|
||||
theUParameter : Real from Standard;
|
||||
theVParameter : Real from Standard)
|
||||
is private;
|
||||
|
||||
ComputeRangeFromStartPoint(me: in out; ToIncreaseParameter : Boolean from Standard;
|
||||
theParameter : Real from Standard;
|
||||
theUParameter : Real from Standard;
|
||||
theVParameter : Real from Standard;
|
||||
theIndex : Integer from Standard)
|
||||
is private;
|
||||
|
||||
Distance(me: in out; theArg : Real from Standard;
|
||||
theUParameter: out Real from Standard;
|
||||
theVParameter: out Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
Distance(me: in out; theArg: Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
LocalizeSolutions(me: in out; theCurveRange : CurveRangeSample from IntTools;
|
||||
theBoxCurve : Box from Bnd;
|
||||
theSurfaceRange: SurfaceRangeSample from IntTools;
|
||||
theBoxSurface : Box from Bnd;
|
||||
theCurveData : in out CurveRangeLocalizeData from IntTools;
|
||||
theSurfaceData : in out SurfaceRangeLocalizeData from IntTools;
|
||||
theListCurveRange: in out ListOfCurveRangeSample from IntTools;
|
||||
theListSurfaceRange: in out ListOfSurfaceRangeSample from IntTools)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
TestComputeCoinside(me: in out)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
-- sources
|
||||
myCurve : Curve from BRepAdaptor;
|
||||
mySurface : Surface from BRepAdaptor;
|
||||
myTrsfSurface : Surface from Geom;
|
||||
myFirstParameter : Real from Standard;
|
||||
myLastParameter : Real from Standard;
|
||||
myUMinParameter : Real from Standard;
|
||||
myUMaxParameter : Real from Standard;
|
||||
myVMinParameter : Real from Standard;
|
||||
myVMaxParameter : Real from Standard;
|
||||
myBeanTolerance : Real from Standard;
|
||||
myFaceTolerance : Real from Standard;
|
||||
|
||||
myCurveResolution: Real from Standard;
|
||||
myCriteria : Real from Standard;
|
||||
|
||||
-- tools
|
||||
myExtrema : ExtCS from Extrema;
|
||||
myProjector : ProjectPointOnSurf from GeomAPI;
|
||||
myRangeManager : MarkedRangeSet from IntTools;
|
||||
myDeflection : Real from Standard;
|
||||
myContext : PContext from IntTools;
|
||||
|
||||
-- results
|
||||
myResults : SequenceOfRanges from IntTools;
|
||||
myIsDone : Boolean from Standard;
|
||||
|
||||
end BeanFaceIntersector from IntTools;
|
2454
src/IntTools/IntTools_BeanFaceIntersector.cxx
Executable file
2454
src/IntTools/IntTools_BeanFaceIntersector.cxx
Executable file
File diff suppressed because it is too large
Load Diff
6
src/IntTools/IntTools_BeanFaceIntersector.lxx
Executable file
6
src/IntTools/IntTools_BeanFaceIntersector.lxx
Executable file
@@ -0,0 +1,6 @@
|
||||
inline Standard_Boolean IntTools_BeanFaceIntersector::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
|
133
src/IntTools/IntTools_CArray1.cdl
Executable file
133
src/IntTools/IntTools_CArray1.cdl
Executable file
@@ -0,0 +1,133 @@
|
||||
-- File: IntTools_CArray1.cdl
|
||||
-- Created: Fri May 26 10:55:45 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
---Purpose:
|
||||
|
||||
generic class CArray1 from IntTools (Array1Item as any)
|
||||
|
||||
---Purpose: The class CArray1 represents unidimensionnal arrays
|
||||
-- of fixed size known at run time. Run-time boundary
|
||||
-- check is performed
|
||||
--
|
||||
-- The range of the index is user defined from 0 to Length
|
||||
|
||||
raises
|
||||
|
||||
ConstructionError from Standard,
|
||||
OutOfRange from Standard,
|
||||
OutOfMemory from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (Length: Integer from Standard = 0)
|
||||
returns CArray1 from IntTools
|
||||
---Purpose:
|
||||
--- Creates an array of given Length.
|
||||
---
|
||||
raises
|
||||
ConstructionError from Standard, -- when Length < 0
|
||||
OutOfMemory from Standard; -- when not enough memory
|
||||
|
||||
Create (AnArray : CArray1 from IntTools)
|
||||
returns CArray1 from IntTools
|
||||
---Purpose:
|
||||
--- Prohibits the creator by copy
|
||||
---
|
||||
is private;
|
||||
|
||||
Create(Item: Array1Item;
|
||||
Length: Integer from Standard)
|
||||
---Purpose:
|
||||
--- Creates an array sharing datas with an other.
|
||||
-- Example:
|
||||
--- Item tab[100];
|
||||
--- CArray1OfItem thetab (tab[0],100);
|
||||
---
|
||||
--- CArray1OfItem aArray1(100);
|
||||
--- CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
|
||||
---
|
||||
-- Warning:
|
||||
--- The validity of length are under the responsability
|
||||
--- of the user.
|
||||
--- The sahred array must have a valid address during the life of
|
||||
--- the Array1.
|
||||
---
|
||||
returns CArray1 from IntTools
|
||||
raises ConstructionError from Standard; -- when Length < 0
|
||||
|
||||
Init (me: in out; V: Array1Item);
|
||||
---Purpose:
|
||||
--- Initializes the array with a given value.
|
||||
---
|
||||
|
||||
|
||||
Resize(me: in out;
|
||||
theNewLength: Integer from Standard);
|
||||
---Purpose:
|
||||
--- destroy current content and realloc the new size
|
||||
--- does nothing if Length() == theLength
|
||||
---
|
||||
|
||||
Destroy (me: in out);
|
||||
---Purpose:
|
||||
--- Frees the allocated area corresponding to the
|
||||
--- array.
|
||||
---
|
||||
---C++: alias ~
|
||||
|
||||
Length (me) returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns the number of elements of <me>.
|
||||
---
|
||||
---C++: inline
|
||||
|
||||
Append (me:out; Value: Array1Item);
|
||||
---Purpose:
|
||||
|
||||
SetValue (me : out; Index: Integer from Standard; Value: Array1Item)
|
||||
raises OutOfRange from Standard;
|
||||
---Purpose:
|
||||
--- Sets the <Index>th element of the array to
|
||||
--- <Value>.
|
||||
---
|
||||
|
||||
|
||||
Value (me; Index:Integer from Standard) returns any Array1Item
|
||||
---Purpose:
|
||||
--- Returns the value of the <Index>th element of the
|
||||
--- array.
|
||||
---
|
||||
---C++: alias operator ()
|
||||
---C++: return const &
|
||||
raises OutOfRange from Standard;
|
||||
|
||||
ChangeValue (me: in out; Index:Integer from Standard) returns any Array1Item
|
||||
---Purpose:
|
||||
--- Returns the value of the <Index>th element of the
|
||||
--- array.
|
||||
---
|
||||
---C++: alias operator ()
|
||||
---C++: return &
|
||||
raises OutOfRange from Standard;
|
||||
|
||||
IsEqual(me; Other: CArray1 from IntTools)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Applys the == operator on each array item
|
||||
---
|
||||
---C++: alias operator ==
|
||||
|
||||
fields
|
||||
|
||||
myStart: Address;
|
||||
myLength: Integer;
|
||||
myIsAllocated: Boolean;
|
||||
|
||||
end CArray1;
|
||||
|
||||
|
||||
|
159
src/IntTools/IntTools_CArray1.gxx
Executable file
159
src/IntTools/IntTools_CArray1.gxx
Executable file
@@ -0,0 +1,159 @@
|
||||
// File: IntTools_CArray1.gxx
|
||||
// Created: Fri May 26 11:00:00 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Standard_Integer Length):
|
||||
myStart(NULL),
|
||||
myLength(0),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Resize(Length);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Array1Item& Item,
|
||||
const Standard_Integer Length):
|
||||
myLength(Length),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(Length < 0,"IntTools_CArray1:: Length < 0");
|
||||
myStart = (void*)(&Item);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Init (const Array1Item& V)
|
||||
{
|
||||
Array1Item* p = (Array1Item*) myStart;
|
||||
for(Standard_Integer i = 0; i < Length() ; i++) {
|
||||
*p++ = V;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Destroy()
|
||||
{
|
||||
if (myIsAllocated) {
|
||||
delete [] (Array1Item *)myStart;
|
||||
myIsAllocated = Standard_False;
|
||||
}
|
||||
myStart = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CArray1::IsEqual(const IntTools_CArray1& Other) const
|
||||
{
|
||||
if (&Other == this)
|
||||
return Standard_True;
|
||||
else if (Length() != Other.Length())
|
||||
return Standard_False;
|
||||
else if (Length() == 0)
|
||||
return Standard_True;
|
||||
//
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Resize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Resize(const Standard_Integer theNewLength)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(theNewLength < 0,"IntTools_CArray1: length < 0");
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
Destroy();
|
||||
|
||||
myLength = theNewLength;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) Standard_OutOfMemory::Raise("IntTools_CArray1 : Allocation failed.");
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Append (const Array1Item& Value)
|
||||
{
|
||||
const Standard_Integer theNewLength=myLength+1;
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) Standard_OutOfMemory::Raise("IntTools_CArray1 : Allocation failed.");
|
||||
|
||||
if (myLength!=0) {
|
||||
Standard_Integer aBytesPerItem=sizeof(Array1Item);
|
||||
memcpy (p, myStart, myLength*aBytesPerItem);
|
||||
}
|
||||
|
||||
*(p+myLength)=Value;
|
||||
Destroy();
|
||||
myLength = theNewLength;
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Array1Item& IntTools_CArray1::Value(const Standard_Integer Index) const
|
||||
{
|
||||
if (myLength <1 || Index < 0 || Index >= myLength)
|
||||
Standard_OutOfRange::Raise("IntTools_CArray1::Value");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::SetValue (const Standard_Integer Index,
|
||||
const Array1Item& Value)
|
||||
{
|
||||
ChangeValue(Index) = Value;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Array1Item& IntTools_CArray1::ChangeValue(const Standard_Integer Index)
|
||||
{
|
||||
if (myLength < 1 || Index < 0 || Index >= myLength)
|
||||
Standard_OutOfRange::Raise("IntTools_CArray1::ChangeValue");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
17
src/IntTools/IntTools_CArray1.lxx
Executable file
17
src/IntTools/IntTools_CArray1.lxx
Executable file
@@ -0,0 +1,17 @@
|
||||
// File: IntTools_CArray1.lxx
|
||||
// Created: Fri May 26 11:10:00 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer IntTools_CArray1::Length() const
|
||||
{
|
||||
return myLength;
|
||||
}
|
||||
|
188
src/IntTools/IntTools_CommonPrt.cdl
Executable file
188
src/IntTools/IntTools_CommonPrt.cdl
Executable file
@@ -0,0 +1,188 @@
|
||||
-- File: IntTools_CommonPrt.cdl
|
||||
-- Created: Fri Oct 27 15:15:53 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class CommonPrt from IntTools
|
||||
|
||||
---Purpose: The class is to describe a common part
|
||||
-- between two edges in 3-d space.
|
||||
|
||||
uses
|
||||
Edge from TopoDS,
|
||||
ShapeEnum from TopAbs,
|
||||
Range from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
Pnt from gp
|
||||
is
|
||||
Create
|
||||
returns CommonPrt from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aCPrt:CommonPrt from IntTools)
|
||||
returns CommonPrt from IntTools;
|
||||
---Purpose:
|
||||
--- Copy constructor
|
||||
---
|
||||
|
||||
Assign (me:out; Other : CommonPrt from IntTools)
|
||||
returns CommonPrt from IntTools;
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
SetEdge1 (me:out; anE:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the first edge.
|
||||
---
|
||||
|
||||
SetEdge2 (me:out; anE:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the second edge.
|
||||
---
|
||||
|
||||
SetType (me:out; aType:ShapeEnum from TopAbs);
|
||||
---Purpose:
|
||||
--- Sets the type of the common part
|
||||
--- Vertex or Edge
|
||||
---
|
||||
|
||||
SetRange1 (me:out; aR: Range from IntTools);
|
||||
---Purpose:
|
||||
--- Sets the range of first edge.
|
||||
---
|
||||
|
||||
SetRange1 (me:out; tf,tl: Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the range of first edge.
|
||||
---
|
||||
|
||||
AppendRange2 (me:out; aR: Range from IntTools);
|
||||
---Purpose:
|
||||
--- Appends the range of second edge.
|
||||
---
|
||||
|
||||
AppendRange2 (me:out; tf,tl: Real from Standard);
|
||||
---Purpose:
|
||||
--- Appends the range of second edge.
|
||||
---
|
||||
|
||||
SetVertexParameter1( me:out; tV: Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets a parameter of first vertex
|
||||
---
|
||||
|
||||
SetVertexParameter2( me:out; tV: Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets a parameter of second vertex
|
||||
---
|
||||
|
||||
Edge1 (me)
|
||||
returns Edge from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns the first edge.
|
||||
---
|
||||
|
||||
Edge2 (me)
|
||||
returns Edge from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns the second edge
|
||||
---
|
||||
|
||||
Type (me)
|
||||
returns ShapeEnum from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns the type of the common part
|
||||
---
|
||||
|
||||
Range1 (me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns the range of first edge
|
||||
---
|
||||
|
||||
Range1 (me; tf,tl:out Real from Standard);
|
||||
---Purpose:
|
||||
--- Returns the range of first edge.
|
||||
---
|
||||
|
||||
Ranges2 (me)
|
||||
returns SequenceOfRanges from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns the ranges of second edge.
|
||||
---
|
||||
|
||||
ChangeRanges2 (me:out)
|
||||
returns SequenceOfRanges from IntTools;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns the ranges of second edge.
|
||||
---
|
||||
|
||||
VertexParameter1(me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns parameter of first vertex
|
||||
---
|
||||
|
||||
VertexParameter2(me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns parameter of second vertex
|
||||
---
|
||||
|
||||
Copy (me; anOther:out CommonPrt from IntTools);
|
||||
---Purpose:
|
||||
--- Copies me to anOther
|
||||
---
|
||||
|
||||
AllNullFlag(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetAllNullFlag(me:out;
|
||||
aFlag:Boolean from Standard);
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
--
|
||||
SetBoundingPoints(me:out;
|
||||
aP1: Pnt from gp;
|
||||
aP2: Pnt from gp);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
BoundingPoints(me;
|
||||
aP1:out Pnt from gp;
|
||||
aP2:out Pnt from gp);
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
--
|
||||
fields
|
||||
myEdge1 : Edge from TopoDS;
|
||||
myEdge2 : Edge from TopoDS;
|
||||
myType : ShapeEnum from TopAbs;
|
||||
myRange1 : Range from IntTools;
|
||||
myVertPar1 : Real from Standard;
|
||||
myVertPar2 : Real from Standard;
|
||||
myRanges2: SequenceOfRanges from IntTools;
|
||||
|
||||
myAllNullFlag: Boolean from Standard;
|
||||
--
|
||||
myPnt1 : Pnt from gp;
|
||||
myPnt2 : Pnt from gp;
|
||||
--
|
||||
|
||||
end CommonPrt;
|
301
src/IntTools/IntTools_CommonPrt.cxx
Executable file
301
src/IntTools/IntTools_CommonPrt.cxx
Executable file
@@ -0,0 +1,301 @@
|
||||
// File: IntTools_CommonPrt.cxx
|
||||
// Created: Fri Oct 27 15:24:30 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_CommonPrt.ixx>
|
||||
#include <IntTools_Range.hxx>
|
||||
#include <IntTools_SequenceOfRanges.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CommonPrt::IntTools_CommonPr
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CommonPrt::IntTools_CommonPrt()
|
||||
:
|
||||
myType(TopAbs_SHAPE),
|
||||
myAllNullFlag(Standard_False)
|
||||
|
||||
{
|
||||
//
|
||||
myPnt1.SetCoord(0.,0.,0.);
|
||||
myPnt2.SetCoord(0.,0.,0.);
|
||||
//
|
||||
// modified by NIZHNY-MKK Wed Jun 8 16:47:04 2005.BEGIN
|
||||
myVertPar1 = 0.;
|
||||
myVertPar2 = 0.;
|
||||
// modified by NIZHNY-MKK Wed Jun 8 16:47:07 2005.END
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CommonPrt::IntTools_CommonPrt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CommonPrt::IntTools_CommonPrt(const IntTools_CommonPrt& Other)
|
||||
:
|
||||
myEdge1(Other.myEdge1),
|
||||
myEdge2(Other.myEdge2),
|
||||
myType (Other.myType),
|
||||
myRange1 (Other.myRange1),
|
||||
myVertPar1(Other.myVertPar1),
|
||||
myVertPar2(Other.myVertPar2),
|
||||
myAllNullFlag(Standard_False),
|
||||
//
|
||||
myPnt1(Other.myPnt1),
|
||||
myPnt2(Other.myPnt2)
|
||||
//
|
||||
{
|
||||
Standard_Integer i, aNb=Other.myRanges2.Length();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
myRanges2.Append(Other.myRanges2(i));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CommonPrt::Assign
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CommonPrt& IntTools_CommonPrt::Assign(const IntTools_CommonPrt& Other)
|
||||
{
|
||||
myEdge1=Other.myEdge1;
|
||||
myEdge2=Other.myEdge2;
|
||||
myType =Other.myType;
|
||||
myRange1 =Other.myRange1;
|
||||
myVertPar1=Other.myVertPar1;
|
||||
myVertPar2=Other.myVertPar2;
|
||||
//
|
||||
myPnt1=Other.myPnt1;
|
||||
myPnt2=Other.myPnt2;
|
||||
//
|
||||
Standard_Integer i, aNb=Other.myRanges2.Length();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
myRanges2.Append(Other.myRanges2(i));
|
||||
}
|
||||
myAllNullFlag=Other.myAllNullFlag;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetEdge1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetEdge1(const TopoDS_Edge& anEdge)
|
||||
{
|
||||
myEdge1=anEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetEdge2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetEdge2(const TopoDS_Edge& anEdge)
|
||||
{
|
||||
myEdge2=anEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetType (const TopAbs_ShapeEnum aType)
|
||||
{
|
||||
myType=aType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRange1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetRange1 (const IntTools_Range& aRange)
|
||||
{
|
||||
myRange1=aRange;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRange1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetRange1 (const Standard_Real tf,
|
||||
const Standard_Real tl)
|
||||
{
|
||||
myRange1.SetFirst(tf);
|
||||
myRange1.SetLast (tl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AppendRange2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::AppendRange2 (const IntTools_Range& aRange)
|
||||
{
|
||||
myRanges2.Append(aRange);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AppendRange2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::AppendRange2 (const Standard_Real tf,
|
||||
const Standard_Real tl)
|
||||
{
|
||||
IntTools_Range aRange(tf, tl);
|
||||
myRanges2.Append(aRange);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetVertexParameter1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetVertexParameter1(const Standard_Real tV)
|
||||
{
|
||||
myVertPar1=tV;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetVertexParameter2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetVertexParameter2(const Standard_Real tV)
|
||||
{
|
||||
myVertPar2=tV;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Edge& IntTools_CommonPrt::Edge1() const
|
||||
{
|
||||
return myEdge1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Edge2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Edge& IntTools_CommonPrt::Edge2() const
|
||||
{
|
||||
return myEdge2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TopAbs_ShapeEnum
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_ShapeEnum IntTools_CommonPrt::Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Range1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_Range& IntTools_CommonPrt::Range1() const
|
||||
{
|
||||
return myRange1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Range1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::Range1(Standard_Real& tf,
|
||||
Standard_Real& tl) const
|
||||
{
|
||||
tf=myRange1.First();
|
||||
tl=myRange1.Last();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Ranges2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_SequenceOfRanges& IntTools_CommonPrt::Ranges2() const
|
||||
{
|
||||
return myRanges2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ChangeRanges2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_SequenceOfRanges& IntTools_CommonPrt::ChangeRanges2()
|
||||
{
|
||||
return myRanges2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VertexParameter1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_CommonPrt::VertexParameter1() const
|
||||
{
|
||||
return myVertPar1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : VertexParameter2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_CommonPrt::VertexParameter2() const
|
||||
{
|
||||
return myVertPar2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Copy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::Copy(IntTools_CommonPrt& aCP) const
|
||||
{
|
||||
aCP.SetEdge1(Edge1());
|
||||
aCP.SetEdge2(Edge2());
|
||||
aCP.SetType (Type());
|
||||
aCP.SetRange1(Range1());
|
||||
aCP.SetVertexParameter1(myVertPar1);
|
||||
aCP.SetVertexParameter2(myVertPar2);
|
||||
|
||||
IntTools_SequenceOfRanges aSeqRanges;
|
||||
Standard_Integer i, aNb;
|
||||
aNb=myRanges2.Length();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
aCP.AppendRange2(myRanges2(i));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAllNullFlag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetAllNullFlag(const Standard_Boolean aFlag)
|
||||
{
|
||||
myAllNullFlag=aFlag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AllNullFlag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CommonPrt::AllNullFlag()const
|
||||
{
|
||||
return myAllNullFlag;
|
||||
}
|
||||
|
||||
//
|
||||
//=======================================================================
|
||||
//function : SetBoundingPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::SetBoundingPoints(const gp_Pnt& aP1,
|
||||
const gp_Pnt& aP2)
|
||||
{
|
||||
myPnt1=aP1;
|
||||
myPnt2=aP2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BoundingPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CommonPrt::BoundingPoints(gp_Pnt& aP1,
|
||||
gp_Pnt& aP2) const
|
||||
{
|
||||
aP1=myPnt1;
|
||||
aP2=myPnt2;
|
||||
}
|
||||
//
|
52
src/IntTools/IntTools_Compare.cdl
Executable file
52
src/IntTools/IntTools_Compare.cdl
Executable file
@@ -0,0 +1,52 @@
|
||||
-- File: IntTools_Compare.cdl
|
||||
-- Created: Mon May 22 16:56:20 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class Compare from IntTools
|
||||
|
||||
---Purpose: Auxiliary class to provide a sorting Roots.
|
||||
|
||||
uses
|
||||
Root from IntTools
|
||||
|
||||
is
|
||||
Create
|
||||
returns Compare from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aTol:Real from Standard)
|
||||
returns Compare from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes me by tolerance
|
||||
---
|
||||
|
||||
IsLower (me; Left, Right: Root from IntTools)
|
||||
---Purpose:
|
||||
--- Returns True if <Left> is lower than <Right>.
|
||||
---
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsGreater (me; Left, Right: Root from IntTools)
|
||||
---Level: Public
|
||||
---Purpose:
|
||||
--- Returns True if <Left> is greater than <Right>.
|
||||
---
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsEqual(me; Left, Right: Root from IntTools)
|
||||
---Level: Public
|
||||
---Purpose:
|
||||
--- Returns True when <Right> and <Left> are equal.
|
||||
---
|
||||
returns Boolean from Standard ;
|
||||
|
||||
|
||||
fields
|
||||
myTol: Real from Standard;
|
||||
|
||||
end Compare;
|
60
src/IntTools/IntTools_Compare.cxx
Executable file
60
src/IntTools/IntTools_Compare.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
// File: IntTools_Compare.cxx
|
||||
// Created: Mon May 22 17:02:11 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_Compare.ixx>
|
||||
//=======================================================================
|
||||
//function :IntTools_Compare::IntTools_Compare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Compare::IntTools_Compare() :myTol(1.e-12) {}
|
||||
|
||||
//=======================================================================
|
||||
//function :IntTools_Compare::IntTools_Compare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Compare::IntTools_Compare(const Standard_Real aTol)
|
||||
{
|
||||
myTol=aTol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsLower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Compare::IsLower(const IntTools_Root& aLeft,
|
||||
const IntTools_Root& aRight)const
|
||||
{
|
||||
return aLeft.Root()<aRight.Root();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsGreater
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Compare::IsGreater(const IntTools_Root& aLeft,
|
||||
const IntTools_Root& aRight)const
|
||||
{
|
||||
return !IsLower(aLeft,aRight);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Compare::IsEqual(const IntTools_Root& aLeft,
|
||||
const IntTools_Root& aRight)const
|
||||
{
|
||||
Standard_Real a, b;
|
||||
a=aLeft.Root();
|
||||
b=aRight.Root();
|
||||
return fabs(a-b) < myTol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
53
src/IntTools/IntTools_CompareRange.cdl
Executable file
53
src/IntTools/IntTools_CompareRange.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: IntTools_CompareRange.cdl
|
||||
-- Created: Tue Oct 24 14:07:14 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class CompareRange from IntTools
|
||||
|
||||
---Purpose: Auxiliary class to provide a sorting Ranges,
|
||||
-- taking into account a value of Left .
|
||||
|
||||
uses
|
||||
Range from IntTools
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns CompareRange from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aTol:Real from Standard)
|
||||
returns CompareRange from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes me by tolerance
|
||||
---
|
||||
|
||||
IsLower (me; Left, Right: Range from IntTools)
|
||||
---Purpose:
|
||||
--- Returns True if <Left> is lower than <Right>.
|
||||
---
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsGreater (me; Left, Right: Range from IntTools)
|
||||
---Level: Public
|
||||
---Purpose:
|
||||
--- Returns True if <Left> is greater than <Right>.
|
||||
---
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsEqual(me; Left, Right: Range from IntTools)
|
||||
---Level: Public
|
||||
---Purpose:
|
||||
--- Returns True when <Right> and <Left> are equal.
|
||||
---
|
||||
returns Boolean from Standard ;
|
||||
|
||||
fields
|
||||
myTol: Real from Standard;
|
||||
|
||||
end CompareRange;
|
57
src/IntTools/IntTools_CompareRange.cxx
Executable file
57
src/IntTools/IntTools_CompareRange.cxx
Executable file
@@ -0,0 +1,57 @@
|
||||
// File: IntTools_CompareRange.cxx
|
||||
// Created: Tue Oct 24 14:09:45 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_CompareRange.ixx>
|
||||
//=======================================================================
|
||||
//function :IntTools_CompareRange::IntTools_CompareRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CompareRange::IntTools_CompareRange() :myTol(1.e-12) {}
|
||||
|
||||
//=======================================================================
|
||||
//function :IntTools_CompareRange::IntTools_CompareRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CompareRange::IntTools_CompareRange(const Standard_Real aTol)
|
||||
{
|
||||
myTol=aTol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsLower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CompareRange::IsLower(const IntTools_Range& aLeft,
|
||||
const IntTools_Range& aRight)const
|
||||
{
|
||||
return aLeft.First()<aRight.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsGreater
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CompareRange::IsGreater(const IntTools_Range& aLeft,
|
||||
const IntTools_Range& aRight)const
|
||||
{
|
||||
return !IsLower(aLeft,aRight);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CompareRange::IsEqual(const IntTools_Range& aLeft,
|
||||
const IntTools_Range& aRight)const
|
||||
{
|
||||
Standard_Real a, b;
|
||||
a=aLeft.First();
|
||||
b=aRight.First();
|
||||
return fabs(a-b) < myTol;
|
||||
}
|
||||
|
||||
|
||||
|
293
src/IntTools/IntTools_Context.cdl
Executable file
293
src/IntTools/IntTools_Context.cdl
Executable file
@@ -0,0 +1,293 @@
|
||||
-- File: IntTools_Context.cdl
|
||||
-- Created: Wed Apr 3 16:44:34 2002
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
|
||||
class Context from IntTools
|
||||
|
||||
---Purpose:
|
||||
--- The class is to provide direct access
|
||||
--- to the frequently using objects like
|
||||
--- IntTools_FClass2d,
|
||||
--- GeomAPI_ProjectPointOnSurf, etc.
|
||||
--- The instance of the class allows to avoid repeated
|
||||
--- computations by mapping internal objects in the
|
||||
-- instance.
|
||||
|
||||
uses
|
||||
State from TopAbs,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp,
|
||||
Curve from Geom,
|
||||
ProjectPointOnCurve from GeomAPI,
|
||||
ProjectPointOnSurf from GeomAPI,
|
||||
Vertex from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Solid from TopoDS,
|
||||
SolidClassifier from BRepClass3d,
|
||||
IndexedDataMapOfShapeAddress from TopTools,
|
||||
IndexedDataMapOfTransientAddress from IntTools,
|
||||
FClass2d from IntTools,
|
||||
SurfaceRangeLocalizeData from IntTools,
|
||||
Curve from IntTools
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns Context from IntTools;
|
||||
---C++: alias "Standard_EXPORT virtual ~IntTools_Context();"
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
FClass2d(me: in out;
|
||||
aF: Face from TopoDS)
|
||||
returns FClass2d from IntTools;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point classifier
|
||||
--- for given face
|
||||
---
|
||||
|
||||
ProjPS (me: in out;
|
||||
aF: Face from TopoDS)
|
||||
returns ProjectPointOnSurf from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given face
|
||||
---
|
||||
|
||||
ProjPC (me: in out;
|
||||
aE: Edge from TopoDS)
|
||||
returns ProjectPointOnCurve from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given edge
|
||||
---
|
||||
|
||||
ProjPT (me: in out;
|
||||
aC: Curve from Geom)
|
||||
returns ProjectPointOnCurve from GeomAPI;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to point projector
|
||||
--- for given curve
|
||||
---
|
||||
|
||||
SurfaceData(me: in out;
|
||||
aF: Face from TopoDS)
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to surface localization data
|
||||
--- for given face
|
||||
|
||||
|
||||
SolidClassifier(me: in out;
|
||||
aSolid: Solid from TopoDS)
|
||||
returns SolidClassifier from BRepClass3d;
|
||||
---C++: return &
|
||||
---Purpose:
|
||||
--- Returns a reference to solid classifier
|
||||
--- for given solid
|
||||
---
|
||||
|
||||
--- API Block
|
||||
---
|
||||
ComputeVE (me:out;
|
||||
aV : Vertex from TopoDS;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the edge aE.
|
||||
--- Returns zero if the distance between vertex
|
||||
--- and edge is less than sum of tolerances,
|
||||
--- otherwise and for following conditions returns
|
||||
--- negative value
|
||||
--- 1. the edge is degenerated (-1)
|
||||
--- 2. the edge does not contain 3d curve and pcurves (-2)
|
||||
--- 3. projection algorithm failed (-3)
|
||||
---
|
||||
|
||||
--modified by NIZNHY-PKV Tue Feb 2 08:20:43 2010f
|
||||
ComputeVE (me:out;
|
||||
aV : Vertex from TopoDS;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard;
|
||||
bToUpdateVertex:out Boolean from Standard;
|
||||
aDist :out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter aT of the vertex aV on
|
||||
--- the edge aE.
|
||||
--- Returns zero if the distance between vertex
|
||||
--- and edge is less than sum of tolerances,
|
||||
--- otherwise and for following conditions returns
|
||||
--- negative value
|
||||
--- 1. the edge is degenerated (-1)
|
||||
--- 2. the edge does not contain 3d curve and pcurves (-2)
|
||||
--- 3. projection algorithm failed (-3)
|
||||
---
|
||||
--- Output parameters
|
||||
---
|
||||
--- bToUpdateVertex - the flag that indicates whether the
|
||||
--- vertex tolerance should be modified or not
|
||||
--- aDist - the value of the distance between the vertex
|
||||
--- and the edge
|
||||
--modified by NIZNHY-PKV Tue Feb 2 08:20:55 2010t
|
||||
|
||||
ComputeVS (me:out;
|
||||
aV : Vertex from TopoDS;
|
||||
aF : Face from TopoDS;
|
||||
U : out Real from Standard;
|
||||
V : out Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes UV parameters of the vertex aV on face aF
|
||||
--- Returns zero if the distance between vertex and face is
|
||||
--- less than or equal the sum of tolerances and the projection
|
||||
--- point lays inside boundaries of the face.
|
||||
--- For following conditions returns negative value
|
||||
--- 1. projection algorithm failed (-1)
|
||||
--- 2. distance is more than sum of tolerances (-2)
|
||||
--- 3. projection point out or on the boundaries of face (-3)
|
||||
---
|
||||
|
||||
StatePointFace(me:out;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns the state of the point aP2D
|
||||
--- relative to face aF
|
||||
---
|
||||
|
||||
IsPointInFace(me:out;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the point aP2D is
|
||||
--- inside the boundaries of the face aF,
|
||||
--- otherwise returns false
|
||||
---
|
||||
|
||||
IsPointInOnFace(me:out;
|
||||
aF : Face from TopoDS;
|
||||
aP2D : Pnt2d from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the point aP2D is
|
||||
--- inside or on the boundaries of aF
|
||||
---
|
||||
|
||||
IsValidPointForFace(me:out;
|
||||
aP3D : Pnt from gp;
|
||||
aF : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if the distance between point aP3D
|
||||
--- and face aF is less or equal to tolerance aTol
|
||||
--- and projection point is inside or on the boundaries
|
||||
--- of the face aF
|
||||
---
|
||||
|
||||
IsValidPointForFaces(me:out;
|
||||
aP3D : Pnt from gp;
|
||||
aF1 : Face from TopoDS;
|
||||
aF2 : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidPointForFace returns true
|
||||
--- for both face aF1 and aF2
|
||||
---
|
||||
|
||||
IsValidBlockForFace (me:out;
|
||||
aT1 : Real from Standard;
|
||||
aT2 : Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aF : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidPointForFace returns true
|
||||
--- for some 3d point that lay on the curve aIC bounded by
|
||||
--- parameters aT1 and aT2
|
||||
---
|
||||
|
||||
IsValidBlockForFaces (me:out;
|
||||
aT1 : Real from Standard;
|
||||
aT2 : Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aF1 : Face from TopoDS;
|
||||
aF2 : Face from TopoDS;
|
||||
aTol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if IsValidBlockForFace returns true
|
||||
--- for both faces aF1 and aF2
|
||||
---
|
||||
|
||||
IsVertexOnLine(me:out;
|
||||
aV : Vertex from TopoDS;
|
||||
aIC : Curve from IntTools;
|
||||
aTolC: Real from Standard;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the curve aIC.
|
||||
--- Returns true if the distance between vertex and
|
||||
--- curve is less than sum of tolerance of aV and aTolC,
|
||||
--- otherwise or if projection algorithm failed
|
||||
--- returns false (in this case aT isn't significant)
|
||||
---
|
||||
|
||||
IsVertexOnLine(me:out;
|
||||
aV : Vertex from TopoDS;
|
||||
aTolV: Real from Standard;
|
||||
aIC : Curve from IntTools;
|
||||
aTolC: Real from Standard;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the vertex aV on
|
||||
--- the curve aIC.
|
||||
--- Returns true if the distance between vertex and
|
||||
--- curve is less than sum of tolerance of aV and aTolC,
|
||||
--- otherwise or if projection algorithm failed
|
||||
--- returns false (in this case aT isn't significant)
|
||||
---
|
||||
|
||||
ProjectPointOnEdge (me:out;
|
||||
aP : Pnt from gp;
|
||||
aE : Edge from TopoDS;
|
||||
aT :out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes parameter of the point aP on
|
||||
--- the edge aE.
|
||||
--- Returns false if projection algorithm failed
|
||||
--- other wiese returns true.
|
||||
---
|
||||
|
||||
fields
|
||||
myFClass2dMap : IndexedDataMapOfShapeAddress from TopTools;
|
||||
myProjPSMap : IndexedDataMapOfShapeAddress from TopTools;
|
||||
myProjPCMap : IndexedDataMapOfShapeAddress from TopTools;
|
||||
myProjPTMap : IndexedDataMapOfTransientAddress from IntTools;
|
||||
mySClassMap : IndexedDataMapOfShapeAddress from TopTools;
|
||||
myProjSDataMap: IndexedDataMapOfShapeAddress from TopTools;
|
||||
|
||||
end Context;
|
||||
|
697
src/IntTools/IntTools_Context.cxx
Executable file
697
src/IntTools/IntTools_Context.cxx
Executable file
@@ -0,0 +1,697 @@
|
||||
// File: IntTools_Context.cxx
|
||||
// Created: Wed Apr 3 16:57:54 2002
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_Context.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
|
||||
#include <IntTools_Tools.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
//
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Context::IntTools_Context()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Context::~IntTools_Context()
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
Standard_Integer i, aNb;
|
||||
//
|
||||
IntTools_FClass2d* pFClass2d;
|
||||
aNb=myFClass2dMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myFClass2dMap(i);
|
||||
pFClass2d=(IntTools_FClass2d*)anAdr;
|
||||
delete pFClass2d;
|
||||
}
|
||||
myFClass2dMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnSurf* pProjPS;
|
||||
aNb=myProjPSMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPSMap(i);
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
|
||||
delete pProjPS;
|
||||
}
|
||||
myProjPSMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve* pProjPC;
|
||||
aNb=myProjPCMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPCMap(i);
|
||||
pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
delete pProjPC;
|
||||
}
|
||||
myProjPCMap.Clear();
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve* pProjPT;
|
||||
aNb=myProjPTMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjPTMap(i);
|
||||
pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
delete pProjPT;
|
||||
}
|
||||
myProjPTMap.Clear();
|
||||
//
|
||||
BRepClass3d_SolidClassifier* pSC;
|
||||
aNb=mySClassMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=mySClassMap(i);
|
||||
pSC=(BRepClass3d_SolidClassifier*)anAdr;
|
||||
delete pSC;
|
||||
}
|
||||
mySClassMap.Clear();
|
||||
//
|
||||
IntTools_SurfaceRangeLocalizeData* pSData = NULL;
|
||||
aNb = myProjSDataMap.Extent();
|
||||
for (i=1; i<=aNb; ++i) {
|
||||
anAdr=myProjSDataMap(i);
|
||||
pSData = (IntTools_SurfaceRangeLocalizeData*)anAdr;
|
||||
if(pSData)
|
||||
delete pSData;
|
||||
pSData = NULL;
|
||||
}
|
||||
myProjSDataMap.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FClass2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_FClass2d& IntTools_Context::FClass2d(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
IntTools_FClass2d* pFClass2d;
|
||||
|
||||
if (!myFClass2dMap.Contains(aF)) {
|
||||
Standard_Real aTolF;
|
||||
TopoDS_Face aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
aTolF=BRep_Tool::Tolerance(aFF);
|
||||
//
|
||||
pFClass2d=new IntTools_FClass2d(aFF, aTolF);
|
||||
//
|
||||
anAdr=(Standard_Address)pFClass2d;
|
||||
myFClass2dMap.Add(aFF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=myFClass2dMap.FindFromKey(aF);
|
||||
pFClass2d=(IntTools_FClass2d*)anAdr;
|
||||
}
|
||||
|
||||
return *pFClass2d;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf& IntTools_Context::ProjPS(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnSurf* pProjPS;
|
||||
|
||||
if (!myProjPSMap.Contains(aF)) {
|
||||
Standard_Real Umin, Usup, Vmin, Vsup, anEpsT=1.e-12 ;
|
||||
BRepAdaptor_Surface aBAS;
|
||||
//
|
||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF);
|
||||
aBAS.Initialize (aF, Standard_True);
|
||||
//
|
||||
Umin=aBAS.FirstUParameter();
|
||||
Usup=aBAS.LastUParameter ();
|
||||
Vmin=aBAS.FirstVParameter();
|
||||
Vsup=aBAS.LastVParameter ();
|
||||
//
|
||||
pProjPS=new GeomAPI_ProjectPointOnSurf;
|
||||
pProjPS->Init(aS ,Umin, Usup, Vmin, Vsup, anEpsT);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPS;
|
||||
myProjPSMap.Add(aF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=myProjPSMap.FindFromKey(aF);
|
||||
pProjPS=(GeomAPI_ProjectPointOnSurf*)anAdr;
|
||||
}
|
||||
return *pProjPS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPC
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPC(const TopoDS_Edge& aE)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnCurve* pProjPC;
|
||||
|
||||
if (!myProjPCMap.Contains(aE)) {
|
||||
Standard_Real f, l;
|
||||
//
|
||||
Handle(Geom_Curve)aC3D=BRep_Tool::Curve (aE, f, l);
|
||||
//
|
||||
pProjPC=new GeomAPI_ProjectPointOnCurve;
|
||||
pProjPC->Init(aC3D, f, l);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPC;
|
||||
myProjPCMap.Add(aE, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=myProjPCMap.FindFromKey(aE);
|
||||
pProjPC=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
}
|
||||
return *pProjPC;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjPT
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnCurve& IntTools_Context::ProjPT(const Handle(Geom_Curve)& aC3D)
|
||||
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
GeomAPI_ProjectPointOnCurve* pProjPT;
|
||||
|
||||
if (!myProjPTMap.Contains(aC3D)) {
|
||||
Standard_Real f, l;
|
||||
f=aC3D->FirstParameter();
|
||||
l=aC3D->LastParameter();
|
||||
//
|
||||
pProjPT=new GeomAPI_ProjectPointOnCurve;
|
||||
pProjPT->Init(aC3D, f, l);
|
||||
//
|
||||
anAdr=(Standard_Address)pProjPT;
|
||||
myProjPTMap.Add(aC3D, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=myProjPTMap.FindFromKey(aC3D);
|
||||
pProjPT=(GeomAPI_ProjectPointOnCurve*)anAdr;
|
||||
}
|
||||
return *pProjPT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SurfaceData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_SurfaceRangeLocalizeData& IntTools_Context::SurfaceData(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
IntTools_SurfaceRangeLocalizeData* pSData;
|
||||
|
||||
if (!myProjSDataMap.Contains(aF)) {
|
||||
//
|
||||
pSData=new IntTools_SurfaceRangeLocalizeData(3,
|
||||
3,
|
||||
10. * Precision::PConfusion(),
|
||||
10. * Precision::PConfusion());
|
||||
//
|
||||
anAdr=(Standard_Address)pSData;
|
||||
myProjSDataMap.Add(aF, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=myProjSDataMap.FindFromKey(aF);
|
||||
pSData=(IntTools_SurfaceRangeLocalizeData*)anAdr;
|
||||
}
|
||||
return *pSData;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SolidClassifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepClass3d_SolidClassifier& IntTools_Context::SolidClassifier(const TopoDS_Solid& aSolid)
|
||||
{
|
||||
Standard_Address anAdr;
|
||||
BRepClass3d_SolidClassifier* pSC;
|
||||
|
||||
if (!mySClassMap.Contains(aSolid)) {
|
||||
//
|
||||
pSC=new BRepClass3d_SolidClassifier(aSolid);
|
||||
//
|
||||
anAdr=(Standard_Address)pSC;
|
||||
mySClassMap.Add(aSolid, anAdr);
|
||||
}
|
||||
|
||||
else {
|
||||
anAdr=mySClassMap.FindFromKey(aSolid);
|
||||
pSC =(BRepClass3d_SolidClassifier*)anAdr;
|
||||
}
|
||||
return *pSC;
|
||||
}
|
||||
|
||||
|
||||
//modified by NIZNHY-PKV Tue Feb 2 08:33:16 2010f
|
||||
//=======================================================================
|
||||
//function : ComputeVE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVE(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Edge& aE2,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Boolean bToUpdate;
|
||||
Standard_Integer iFlag;
|
||||
Standard_Real aDist;
|
||||
//
|
||||
iFlag= IntTools_Context::ComputeVE(aV1, aE2, aT, bToUpdate, aDist);
|
||||
//
|
||||
return iFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeVE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVE(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Edge& aE2,
|
||||
Standard_Real& aT,
|
||||
Standard_Boolean& bToUpdateVertex,
|
||||
Standard_Real& aDist)
|
||||
{
|
||||
bToUpdateVertex=Standard_False;
|
||||
aDist=0.;
|
||||
//
|
||||
if (BRep_Tool::Degenerated(aE2)) {
|
||||
return -1;
|
||||
}
|
||||
if (!BRep_Tool::IsGeometric(aE2)) {
|
||||
return -2;
|
||||
}
|
||||
//
|
||||
Standard_Real aTolV1, aTolE2, aTolSum, aTolVx;
|
||||
Standard_Integer aNbProj;
|
||||
gp_Pnt aP;
|
||||
//
|
||||
aP=BRep_Tool::Pnt(aV1);
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
|
||||
aProjector.Perform(aP);
|
||||
aNbProj=aProjector.NbPoints();
|
||||
if (!aNbProj) {
|
||||
return -3;
|
||||
}
|
||||
//
|
||||
aDist=aProjector.LowerDistance();
|
||||
aTolV1=BRep_Tool::Tolerance(aV1);
|
||||
aTolE2=BRep_Tool::Tolerance(aE2);
|
||||
aTolSum=aTolV1+aTolE2;
|
||||
//
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
if (aDist > aTolSum) {
|
||||
return -4;
|
||||
}
|
||||
//
|
||||
aTolVx=aDist+aTolE2;
|
||||
if (aTolVx>aTolV1) {
|
||||
bToUpdateVertex=!bToUpdateVertex;
|
||||
aDist=aTolVx;
|
||||
}
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Feb 2 08:33:21 2010t
|
||||
//=======================================================================
|
||||
//function : ComputeVS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Context::ComputeVS(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Face& aF2,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
{
|
||||
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
|
||||
gp_Pnt aP;
|
||||
|
||||
aP=BRep_Tool::Pnt(aV1);
|
||||
//
|
||||
// 1. Check if the point is projectable on the surface
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF2);
|
||||
aProjector.Perform(aP);
|
||||
//
|
||||
if (!aProjector.IsDone()) {
|
||||
// the point is not projectable on the surface
|
||||
return -1;
|
||||
}
|
||||
//
|
||||
// 2. Check the distance between the projection point and
|
||||
// the original point
|
||||
aDist=aProjector.LowerDistance();
|
||||
|
||||
aTolV1=BRep_Tool::Tolerance(aV1);
|
||||
aTolF2=BRep_Tool::Tolerance(aF2);
|
||||
aTolSum=aTolV1+aTolF2;
|
||||
if (aDist > aTolSum) {
|
||||
// the distance is too large
|
||||
return -2;
|
||||
}
|
||||
aProjector.LowerDistanceParameters(U, V);
|
||||
//
|
||||
gp_Pnt2d aP2d(U, V);
|
||||
Standard_Boolean pri=IsPointInFace (aF2, aP2d);
|
||||
if (!pri) {
|
||||
// the point lays on the surface but out of the face
|
||||
return -3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : StatePointFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_Context::StatePointFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState;
|
||||
IntTools_FClass2d& aClass2d=FClass2d(aF);
|
||||
aState=aClass2d.Perform(aP2d);
|
||||
return aState;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsPointInFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState=StatePointFace(aF, aP2d);
|
||||
if (aState==TopAbs_OUT || aState==TopAbs_ON) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPointInOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsPointInOnFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
TopAbs_State aState=StatePointFace(aF, aP2d);
|
||||
if (aState==TopAbs_OUT) {
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidPointForFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidPointForFace(const gp_Pnt& aP,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Real Umin, myEpsT, U, V;
|
||||
myEpsT=1.e-12;
|
||||
|
||||
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
|
||||
aProjector.Perform(aP);
|
||||
|
||||
bFlag=aProjector.IsDone();
|
||||
if (bFlag) {
|
||||
|
||||
Umin=aProjector.LowerDistance();
|
||||
//if (Umin > 1.e-3) { // it was
|
||||
if (Umin > aTol) {
|
||||
return !bFlag;
|
||||
}
|
||||
//
|
||||
aProjector.LowerDistanceParameters(U, V);
|
||||
gp_Pnt2d aP2D(U, V);
|
||||
bFlag=IsPointInOnFace (aF, aP2D);
|
||||
}
|
||||
return bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidPointForFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidPointForFaces (const gp_Pnt& aP,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag1, bFlag2;
|
||||
|
||||
bFlag1=IsValidPointForFace(aP, aF1, aTol);
|
||||
if (!bFlag1) {
|
||||
return bFlag1;
|
||||
}
|
||||
bFlag2=IsValidPointForFace(aP, aF2, aTol);
|
||||
return bFlag2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidBlockForFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidBlockForFace (const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const IntTools_Curve& aC,
|
||||
const TopoDS_Face& aF,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Real aTInterm, aFirst, aLast;
|
||||
gp_Pnt aPInterm;
|
||||
|
||||
aTInterm=IntTools_Tools::IntermediatePoint(aT1, aT2);
|
||||
|
||||
Handle(Geom_Curve) aC3D=aC.Curve();
|
||||
aFirst=aC3D->FirstParameter();
|
||||
aLast =aC3D->LastParameter();
|
||||
// point 3D
|
||||
aC3D->D0(aTInterm, aPInterm);
|
||||
//
|
||||
bFlag=IsValidPointForFace (aPInterm, aF, aTol);
|
||||
return bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValidBlockForFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsValidBlockForFaces (const Standard_Real aT1,
|
||||
const Standard_Real aT2,
|
||||
const IntTools_Curve& aC,
|
||||
const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTol)
|
||||
{
|
||||
Standard_Boolean bFlag1, bFlag2;
|
||||
//
|
||||
Handle(Geom2d_Curve) aPC1 = aC.FirstCurve2d();
|
||||
Handle(Geom2d_Curve) aPC2 = aC.SecondCurve2d();
|
||||
if( !aPC1.IsNull() && !aPC2.IsNull() ) {
|
||||
Standard_Real aMidPar = IntTools_Tools::IntermediatePoint(aT1, aT2);
|
||||
gp_Pnt2d aPnt2D;
|
||||
|
||||
|
||||
aPC1->D0(aMidPar, aPnt2D);
|
||||
bFlag1 = IsPointInOnFace(aF1, aPnt2D);
|
||||
|
||||
if( !bFlag1 )
|
||||
return bFlag1;
|
||||
|
||||
aPC2->D0(aMidPar, aPnt2D);
|
||||
bFlag2 = IsPointInOnFace(aF2, aPnt2D);
|
||||
return bFlag2;
|
||||
}
|
||||
//
|
||||
|
||||
bFlag1=IsValidBlockForFace (aT1, aT2, aC, aF1, aTol);
|
||||
if (!bFlag1) {
|
||||
return bFlag1;
|
||||
}
|
||||
bFlag2=IsValidBlockForFace (aT1, aT2, aC, aF2, aTol);
|
||||
return bFlag2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsVertexOnLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
|
||||
const IntTools_Curve& aC,
|
||||
const Standard_Real aTolC,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aTolV;
|
||||
//
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
bRet=IntTools_Context::IsVertexOnLine(aV, aTolV, aC, aTolC , aT);
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsVertexOnLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::IsVertexOnLine (const TopoDS_Vertex& aV,
|
||||
const Standard_Real aTolV,
|
||||
const IntTools_Curve& aC,
|
||||
const Standard_Real aTolC,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Real aFirst, aLast, aDist, aTolSum;
|
||||
Standard_Integer aNbProj;
|
||||
gp_Pnt aPv;
|
||||
|
||||
aPv=BRep_Tool::Pnt(aV);
|
||||
|
||||
Handle(Geom_Curve) aC3D=aC.Curve();
|
||||
|
||||
|
||||
aTolSum=aTolV+aTolC;
|
||||
//
|
||||
GeomAdaptor_Curve aGAC(aC3D);
|
||||
GeomAbs_CurveType aType=aGAC.GetType();
|
||||
if (aType==GeomAbs_BSplineCurve ||
|
||||
aType==GeomAbs_BezierCurve) {
|
||||
aTolSum=2.*aTolSum;
|
||||
if (aTolSum<1.e-5) {
|
||||
aTolSum=1.e-5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
aTolSum=2.*aTolSum;//xft
|
||||
if(aTolSum < 1.e-6)
|
||||
aTolSum = 1.e-6;
|
||||
}
|
||||
//
|
||||
aFirst=aC3D->FirstParameter();
|
||||
aLast =aC3D->LastParameter();
|
||||
//
|
||||
//Checking extermities first
|
||||
if (!Precision::IsInfinite(aFirst)) {
|
||||
gp_Pnt aPCFirst=aC3D->Value(aFirst);
|
||||
aDist=aPv.Distance(aPCFirst);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aFirst;
|
||||
//
|
||||
if(aDist > aTolV) {
|
||||
Extrema_LocateExtPC anExt(aPv, aGAC, aFirst, 1.e-10);
|
||||
|
||||
if(anExt.IsDone()) {
|
||||
Extrema_POnCurv aPOncurve = anExt.Point();
|
||||
aT = aPOncurve.Parameter();
|
||||
|
||||
if((aT > (aLast + aFirst) * 0.5) ||
|
||||
(aPv.Distance(aPOncurve.Value()) > aTolSum) ||
|
||||
(aPCFirst.Distance(aPOncurve.Value()) < Precision::Confusion()))
|
||||
aT = aFirst;
|
||||
}
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!Precision::IsInfinite(aLast)) {
|
||||
gp_Pnt aPCLast=aC3D->Value(aLast);
|
||||
aDist=aPv.Distance(aPCLast);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aLast;
|
||||
//
|
||||
if(aDist > aTolV) {
|
||||
Extrema_LocateExtPC anExt(aPv, aGAC, aLast, 1.e-10);
|
||||
|
||||
if(anExt.IsDone()) {
|
||||
Extrema_POnCurv aPOncurve = anExt.Point();
|
||||
aT = aPOncurve.Parameter();
|
||||
|
||||
if((aT < (aLast + aFirst) * 0.5) ||
|
||||
(aPv.Distance(aPOncurve.Value()) > aTolSum) ||
|
||||
(aPCLast.Distance(aPOncurve.Value()) < Precision::Confusion()))
|
||||
aT = aLast;
|
||||
}
|
||||
}
|
||||
//
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPT(aC3D);
|
||||
aProjector.Perform(aPv);
|
||||
|
||||
aNbProj=aProjector.NbPoints();
|
||||
if (!aNbProj) {
|
||||
Handle(Geom_BoundedCurve) aBC=
|
||||
Handle(Geom_BoundedCurve)::DownCast(aC3D);
|
||||
if (!aBC.IsNull()) {
|
||||
gp_Pnt aPStart=aBC->StartPoint();
|
||||
gp_Pnt aPEnd =aBC->EndPoint();
|
||||
|
||||
aDist=aPv.Distance(aPStart);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aFirst;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
aDist=aPv.Distance(aPEnd);
|
||||
if (aDist < aTolSum) {
|
||||
aT=aLast;
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aDist=aProjector.LowerDistance();
|
||||
|
||||
if (aDist > aTolSum) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Context::ProjectPointOnEdge(const gp_Pnt& aP,
|
||||
const TopoDS_Edge& anEdge,
|
||||
Standard_Real& aT)
|
||||
{
|
||||
Standard_Integer aNbPoints;
|
||||
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(anEdge);
|
||||
aProjector.Perform(aP);
|
||||
|
||||
aNbPoints=aProjector.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
126
src/IntTools/IntTools_Curve.cdl
Executable file
126
src/IntTools/IntTools_Curve.cdl
Executable file
@@ -0,0 +1,126 @@
|
||||
-- File: IntTools_Curve.cdl
|
||||
-- Created: Thu Nov 23 15:00:22 2000
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@redfox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
class Curve from IntTools
|
||||
|
||||
|
||||
uses
|
||||
Curve from Geom,
|
||||
Curve from Geom2d,
|
||||
Pnt from gp,
|
||||
CurveType from GeomAbs
|
||||
is
|
||||
Create
|
||||
returns Curve from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create(Curve3d: Curve from Geom;
|
||||
FirstCurve2d : Curve from Geom2d;
|
||||
SecondCurve2d: Curve from Geom2d)
|
||||
returns Curve from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes me by a 3d curve
|
||||
--- and two 2d curves
|
||||
---
|
||||
|
||||
SetCurves(me: in out;
|
||||
Curve3d: Curve from Geom;
|
||||
FirstCurve2d : Curve from Geom2d;
|
||||
SecondCurve2d : Curve from Geom2d);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetCurve(me: in out;
|
||||
Curve3d: Curve from Geom);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetFirstCurve2d(me: in out;
|
||||
FirstCurve2d: Curve from Geom2d);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetSecondCurve2d(me: in out;
|
||||
SecondCurve2d: Curve from Geom2d);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
Curve(me)
|
||||
returns any Curve from Geom;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
FirstCurve2d(me)
|
||||
returns any Curve from Geom2d;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
SecondCurve2d(me)
|
||||
returns any Curve from Geom2d;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
HasBounds (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if 3d curve is BoundedCurve from Geom
|
||||
---
|
||||
|
||||
Bounds (me; aT1:out Real from Standard;
|
||||
aT2:out Real from Standard;
|
||||
aP1:out Pnt from gp;
|
||||
aP2:out Pnt from gp);
|
||||
---Purpose:
|
||||
--- Returns boundary parameters
|
||||
--- and corresponded 3d point.
|
||||
---
|
||||
-- Warning:
|
||||
--- If HasBounds returns false
|
||||
--- the returned parameters are equal
|
||||
--- to zero.
|
||||
---
|
||||
|
||||
D0 (me;
|
||||
aT1:out Real from Standard;
|
||||
aP1:out Pnt from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes 3d point corresponded to parameter aT1
|
||||
--- Returns true if given parameter aT1
|
||||
--- is inside the boundaries of the curve
|
||||
---
|
||||
|
||||
Type (me)
|
||||
returns CurveType from GeomAbs;
|
||||
---Purpose:
|
||||
--- Returns the type of 3d curve
|
||||
---
|
||||
|
||||
fields
|
||||
|
||||
my3dCurve : Curve from Geom;
|
||||
my2dCurve1: Curve from Geom2d;
|
||||
my2dCurve2: Curve from Geom2d;
|
||||
|
||||
end Curve from IntTools;
|
99
src/IntTools/IntTools_Curve.cxx
Executable file
99
src/IntTools/IntTools_Curve.cxx
Executable file
@@ -0,0 +1,99 @@
|
||||
#include <IntTools_Curve.ixx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_Curve::IntTools_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Curve::IntTools_Curve()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IntTools_Curve::IntTools_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Curve::IntTools_Curve(const Handle(Geom_Curve)& Curve3d,
|
||||
const Handle(Geom2d_Curve)& FirstCurve2d,
|
||||
const Handle(Geom2d_Curve)& SecondCurve2d)
|
||||
{
|
||||
SetCurves(Curve3d, FirstCurve2d, SecondCurve2d);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Curve::SetCurves(const Handle(Geom_Curve)& Curve3d,
|
||||
const Handle(Geom2d_Curve)& FirstCurve2d,
|
||||
const Handle(Geom2d_Curve)& SecondCurve2d)
|
||||
{
|
||||
SetCurve(Curve3d);
|
||||
SetFirstCurve2d(FirstCurve2d);
|
||||
SetSecondCurve2d(SecondCurve2d);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Curve::HasBounds() const
|
||||
{
|
||||
Standard_Boolean bBounded;
|
||||
|
||||
Handle(Geom_BoundedCurve) aC3DBounded =
|
||||
Handle(Geom_BoundedCurve)::DownCast(my3dCurve);
|
||||
|
||||
bBounded=!aC3DBounded.IsNull();
|
||||
|
||||
return bBounded ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Curve::Bounds(Standard_Real& aT1,
|
||||
Standard_Real& aT2,
|
||||
gp_Pnt& aP1,
|
||||
gp_Pnt& aP2) const
|
||||
{
|
||||
aT1=0.;
|
||||
aT2=0.;
|
||||
aP1.SetCoord(0.,0.,0.);
|
||||
aP2.SetCoord(0.,0.,0.);
|
||||
if (HasBounds()) {
|
||||
aT1=my3dCurve->FirstParameter();
|
||||
aT2=my3dCurve->LastParameter();
|
||||
my3dCurve->D0(aT1, aP1);
|
||||
my3dCurve->D0(aT2, aP2);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Curve::D0(Standard_Real& aT,
|
||||
gp_Pnt& aP) const
|
||||
{
|
||||
Standard_Real aF, aL;
|
||||
|
||||
aF=my3dCurve->FirstParameter();
|
||||
aL=my3dCurve->LastParameter();
|
||||
if (aT<aF || aT>aL) {
|
||||
return Standard_False;
|
||||
}
|
||||
my3dCurve->D0(aT, aP);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAbs_CurveType IntTools_Curve::Type() const
|
||||
{
|
||||
GeomAdaptor_Curve aGAC(my3dCurve);
|
||||
GeomAbs_CurveType aType=aGAC.GetType();
|
||||
return aType;
|
||||
}
|
53
src/IntTools/IntTools_Curve.lxx
Executable file
53
src/IntTools/IntTools_Curve.lxx
Executable file
@@ -0,0 +1,53 @@
|
||||
//=======================================================================
|
||||
//function : SetCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void IntTools_Curve::SetCurve(const Handle(Geom_Curve)& Curve3d)
|
||||
{
|
||||
my3dCurve = Curve3d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFirstCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void IntTools_Curve::SetFirstCurve2d(const Handle(Geom2d_Curve)& FirstCurve2d)
|
||||
{
|
||||
my2dCurve1 = FirstCurve2d;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetSecondCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void IntTools_Curve::SetSecondCurve2d(const Handle(Geom2d_Curve)& SecondCurve2d)
|
||||
{
|
||||
my2dCurve2 = SecondCurve2d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom_Curve)& IntTools_Curve::Curve() const
|
||||
{
|
||||
return my3dCurve;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FirstCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom2d_Curve)& IntTools_Curve::FirstCurve2d() const
|
||||
{
|
||||
return my2dCurve1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SecondCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(Geom2d_Curve)& IntTools_Curve::SecondCurve2d() const
|
||||
{
|
||||
return my2dCurve2;
|
||||
}
|
||||
|
||||
|
48
src/IntTools/IntTools_CurveRangeLocalizeData.cdl
Executable file
48
src/IntTools/IntTools_CurveRangeLocalizeData.cdl
Executable file
@@ -0,0 +1,48 @@
|
||||
-- File: IntTools_CurveRangeLocalizeData.cdl
|
||||
-- Created: Fri Oct 14 19:26:52 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class CurveRangeLocalizeData from IntTools
|
||||
uses
|
||||
Box from Bnd,
|
||||
CurveRangeSample from IntTools,
|
||||
MapOfCurveSample from IntTools,
|
||||
ListOfCurveRangeSample from IntTools,
|
||||
DataMapOfCurveSampleBox from IntTools
|
||||
|
||||
is
|
||||
Create(theNbSample: Integer from Standard;
|
||||
theMinRange: Real from Standard)
|
||||
returns CurveRangeLocalizeData from IntTools;
|
||||
|
||||
GetNbSample(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetMinRange(me)
|
||||
returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
AddOutRange(me: in out; theRange: CurveRangeSample from IntTools);
|
||||
|
||||
AddBox(me: in out; theRange: CurveRangeSample from IntTools;
|
||||
theBox: Box from Bnd);
|
||||
|
||||
FindBox(me; theRange: CurveRangeSample from IntTools;
|
||||
theBox: out Box from Bnd)
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsRangeOut(me; theRange: CurveRangeSample from IntTools)
|
||||
returns Boolean from Standard;
|
||||
|
||||
ListRangeOut(me; theList: out ListOfCurveRangeSample from IntTools);
|
||||
|
||||
fields
|
||||
myNbSampleC: Integer from Standard;
|
||||
myMinRangeC: Real from Standard;
|
||||
myMapRangeOut: MapOfCurveSample from IntTools;
|
||||
myMapBox : DataMapOfCurveSampleBox from IntTools;
|
||||
|
||||
end CurveRangeLocalizeData from IntTools;
|
52
src/IntTools/IntTools_CurveRangeLocalizeData.cxx
Executable file
52
src/IntTools/IntTools_CurveRangeLocalizeData.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
// File: IntTools_CurveRangeLocalizeData.cxx
|
||||
// Created: Fri Oct 14 19:59:41 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeLocalizeData.ixx>
|
||||
#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfBox.hxx>
|
||||
#include <IntTools_MapIteratorOfMapOfCurveSample.hxx>
|
||||
|
||||
IntTools_CurveRangeLocalizeData::IntTools_CurveRangeLocalizeData(const Standard_Integer theNbSample,
|
||||
const Standard_Real theMinRange)
|
||||
{
|
||||
myNbSampleC = theNbSample;
|
||||
myMinRangeC = theMinRange;
|
||||
}
|
||||
|
||||
void IntTools_CurveRangeLocalizeData::AddOutRange(const IntTools_CurveRangeSample& theRange)
|
||||
{
|
||||
myMapRangeOut.Add(theRange);
|
||||
myMapBox.UnBind(theRange);
|
||||
}
|
||||
|
||||
void IntTools_CurveRangeLocalizeData::AddBox(const IntTools_CurveRangeSample& theRange,
|
||||
const Bnd_Box& theBox)
|
||||
{
|
||||
myMapBox.Bind(theRange, theBox);
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_CurveRangeLocalizeData::FindBox(const IntTools_CurveRangeSample& theRange,Bnd_Box& theBox) const
|
||||
{
|
||||
if(myMapBox.IsBound(theRange)) {
|
||||
theBox = myMapBox(theRange);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_CurveRangeLocalizeData::IsRangeOut(const IntTools_CurveRangeSample& theRange) const
|
||||
{
|
||||
return myMapRangeOut.Contains(theRange);
|
||||
}
|
||||
|
||||
void IntTools_CurveRangeLocalizeData::ListRangeOut(IntTools_ListOfCurveRangeSample& theList) const
|
||||
{
|
||||
IntTools_MapIteratorOfMapOfCurveSample anIt(myMapRangeOut);
|
||||
|
||||
for(; anIt.More(); anIt.Next())
|
||||
theList.Append(anIt.Key());
|
||||
}
|
||||
|
17
src/IntTools/IntTools_CurveRangeLocalizeData.lxx
Executable file
17
src/IntTools/IntTools_CurveRangeLocalizeData.lxx
Executable file
@@ -0,0 +1,17 @@
|
||||
// File: IntTools_CurveRangeLocalizeData.lxx
|
||||
// Created: Fri Oct 14 19:58:59 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeLocalizeData::GetNbSample() const
|
||||
{
|
||||
return myNbSampleC;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_CurveRangeLocalizeData::GetMinRange() const
|
||||
{
|
||||
return myMinRangeC;
|
||||
}
|
||||
|
||||
|
40
src/IntTools/IntTools_CurveRangeSample.cdl
Executable file
40
src/IntTools/IntTools_CurveRangeSample.cdl
Executable file
@@ -0,0 +1,40 @@
|
||||
-- File: IntTools_CurveRangeSample.cdl
|
||||
-- Created: Wed Oct 5 16:26:08 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class CurveRangeSample from IntTools inherits BaseRangeSample from IntTools
|
||||
uses
|
||||
Range from IntTools
|
||||
is
|
||||
|
||||
Create
|
||||
returns CurveRangeSample from IntTools;
|
||||
|
||||
Create(theIndex: Integer from Standard)
|
||||
returns CurveRangeSample from IntTools;
|
||||
|
||||
SetRangeIndex(me: in out; theIndex: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetRangeIndex(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
IsEqual(me; Other: CurveRangeSample from IntTools)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetRange(me; theFirst, theLast: Real from Standard;
|
||||
theNbSample: Integer from Standard)
|
||||
returns Range from IntTools;
|
||||
|
||||
GetRangeIndexDeeper(me; theNbSample: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
myIndex: Integer from Standard;
|
||||
|
||||
end CurveRangeSample from IntTools;
|
39
src/IntTools/IntTools_CurveRangeSample.cxx
Executable file
39
src/IntTools/IntTools_CurveRangeSample.cxx
Executable file
@@ -0,0 +1,39 @@
|
||||
// File: IntTools_CurveRangeSample.cxx
|
||||
// Created: Wed Oct 5 17:04:22 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeSample.ixx>
|
||||
|
||||
IntTools_CurveRangeSample::IntTools_CurveRangeSample()
|
||||
{
|
||||
myIndex = 0;
|
||||
}
|
||||
|
||||
IntTools_CurveRangeSample::IntTools_CurveRangeSample(const Standard_Integer theIndex)
|
||||
{
|
||||
myIndex = theIndex;
|
||||
}
|
||||
|
||||
IntTools_Range IntTools_CurveRangeSample::GetRange(const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Integer theNbSample) const
|
||||
{
|
||||
Standard_Real diffC = theLast - theFirst;
|
||||
IntTools_Range aResult;
|
||||
|
||||
if(GetDepth() <= 0) {
|
||||
aResult.SetFirst(theFirst);
|
||||
aResult.SetLast(theLast);
|
||||
}
|
||||
else {
|
||||
Standard_Real tmp = pow(Standard_Real(theNbSample), Standard_Real(GetDepth()));
|
||||
Standard_Real localdiffC = diffC / Standard_Real(tmp);
|
||||
Standard_Real aFirstC = theFirst + Standard_Real(myIndex) * localdiffC;
|
||||
Standard_Real aLastC = aFirstC + localdiffC;
|
||||
aResult.SetFirst(aFirstC);
|
||||
aResult.SetLast(aLastC);
|
||||
}
|
||||
return aResult;
|
||||
}
|
26
src/IntTools/IntTools_CurveRangeSample.lxx
Executable file
26
src/IntTools/IntTools_CurveRangeSample.lxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: IntTools_CurveRangeSample.lxx
|
||||
// Created: Wed Oct 5 17:05:28 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
inline void IntTools_CurveRangeSample::SetRangeIndex(const Standard_Integer theIndex)
|
||||
{
|
||||
myIndex = theIndex;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeSample::GetRangeIndex() const
|
||||
{
|
||||
return myIndex;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_CurveRangeSample::IsEqual(const IntTools_CurveRangeSample& Other) const
|
||||
{
|
||||
return ((myIndex == Other.myIndex) && (GetDepth() == Other.GetDepth()));
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeSample::GetRangeIndexDeeper(const Standard_Integer theNbSample) const
|
||||
{
|
||||
return myIndex * theNbSample;
|
||||
}
|
27
src/IntTools/IntTools_CurveRangeSampleMapHasher.cdl
Executable file
27
src/IntTools/IntTools_CurveRangeSampleMapHasher.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: IntTools_CurveRangeSampleMapHasher.cdl
|
||||
-- Created: Fri Oct 14 20:54:10 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class CurveRangeSampleMapHasher from IntTools
|
||||
uses
|
||||
CurveRangeSample from IntTools
|
||||
|
||||
is
|
||||
HashCode(myclass; K : CurveRangeSample from IntTools; Upper : Integer) returns Integer;
|
||||
---Purpose: Returns a HasCode value for the Key <K> in the
|
||||
-- range 0..Upper.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
IsEqual(myclass; S1, S2 : CurveRangeSample from IntTools) returns Boolean;
|
||||
---Purpose: Returns True when the two keys are the same. Two
|
||||
-- same keys must have the same hashcode, the
|
||||
-- contrary is not necessary.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
end CurveRangeSampleMapHasher from IntTools;
|
7
src/IntTools/IntTools_CurveRangeSampleMapHasher.cxx
Executable file
7
src/IntTools/IntTools_CurveRangeSampleMapHasher.cxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: IntTools_CurveRangeSampleMapHasher.cxx
|
||||
// Created: Fri Oct 14 21:12:30 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeSampleMapHasher.ixx>
|
14
src/IntTools/IntTools_CurveRangeSampleMapHasher.lxx
Executable file
14
src/IntTools/IntTools_CurveRangeSampleMapHasher.lxx
Executable file
@@ -0,0 +1,14 @@
|
||||
// File: IntTools_CurveRangeSampleMapHasher.lxx
|
||||
// Created: Fri Oct 14 21:00:44 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeSampleMapHasher::HashCode(const IntTools_CurveRangeSample& K,
|
||||
const Standard_Integer Upper) {
|
||||
return (K.GetDepth() % Upper);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_CurveRangeSampleMapHasher::IsEqual(const IntTools_CurveRangeSample& S1,
|
||||
const IntTools_CurveRangeSample& S2) {
|
||||
return S1.IsEqual(S2);
|
||||
}
|
310
src/IntTools/IntTools_EdgeEdge.cdl
Executable file
310
src/IntTools/IntTools_EdgeEdge.cdl
Executable file
@@ -0,0 +1,310 @@
|
||||
-- File: IntTools_EdgeEdge.cdl
|
||||
-- Created: Thu Oct 26 10:08:05 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class EdgeEdge from IntTools
|
||||
|
||||
---Purpose: The class provides Edge/Edge algorithm to determine
|
||||
-- common parts between two edges in 3-d space.
|
||||
-- Common parts can be : Vertices or Edges.
|
||||
---
|
||||
uses
|
||||
Edge from TopoDS,
|
||||
Curve from BRepAdaptor,
|
||||
SequenceOfRoots from IntTools,
|
||||
SequenceOfRanges from IntTools,
|
||||
CArray1OfReal from IntTools,
|
||||
CommonPrt from IntTools,
|
||||
SequenceOfCommonPrts from IntTools,
|
||||
Range from IntTools
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns EdgeEdge from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
SetEdge1 (me:out; anEdge:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the first edge
|
||||
---
|
||||
|
||||
SetTolerance1 (me:out; aTolEdge1:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of tolerance pipe for the first edge
|
||||
---
|
||||
|
||||
SetEdge2 (me:out; anEdge:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Sets the second edge
|
||||
---
|
||||
|
||||
SetTolerance2 (me:out; aTolEdge2:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of tolerance pipe for the first edge
|
||||
---
|
||||
|
||||
SetDiscretize (me:out; aDiscret:Integer from Standard);
|
||||
---Purpose:
|
||||
--- Sets the number of division for the shortest
|
||||
--- edge among the two. The deflection is not taken
|
||||
--- into account
|
||||
---
|
||||
|
||||
SetDeflection (me:out; aDeflection:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the value of maximum reative deflection between
|
||||
--- the two nearest points on a curve.
|
||||
---
|
||||
|
||||
SetEpsilonT (me:out; anEpsT:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the criteria of equality of two arguments,
|
||||
--- i.e. |t2-t1|<anEpsT will mean that t2=t1
|
||||
---
|
||||
|
||||
SetEpsilonNull (me:out; anEpsNull:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the criteria of equality of two functions' values
|
||||
--- i.e. |f(t2)-f(t1)|<anEpsNull will mean that f(t2)=f(t1)
|
||||
---
|
||||
|
||||
SetRange1 (me:out; aRange:Range from IntTools);
|
||||
|
||||
SetRange2 (me:out; aRange:Range from IntTools);
|
||||
|
||||
SetRange1 (me:out; aFirst, aLast:Real from Standard);
|
||||
|
||||
SetRange2 (me:out; aFirst, aLast:Real from Standard);
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose:
|
||||
--- The main method of the algorithm to determine
|
||||
--- common parts between two edges in 3-d space
|
||||
---
|
||||
|
||||
IsDone (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- True if the common parts are found
|
||||
---
|
||||
|
||||
Order (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- False if the common parts are coherented with Edge1, Edge2
|
||||
---
|
||||
|
||||
ErrorStatus(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Returns the number that corresponds to the error.
|
||||
--- The list of error-codes is in ...cxx file
|
||||
---
|
||||
|
||||
CommonParts(me)
|
||||
returns SequenceOfCommonPrts from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns the common parts (Output)
|
||||
---
|
||||
|
||||
Range1 (me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
|
||||
Range2 (me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
|
||||
-----------------------------------------------------
|
||||
-- Block of private methods of the algorithm --
|
||||
-----------------------------------------------------
|
||||
|
||||
CheckData (me:out) is private;
|
||||
---Purpose:
|
||||
--- Fool-proof chechking the input data.
|
||||
--- The following data is not available
|
||||
--- * Degenerated edges is not available;
|
||||
--- * Egdes, that don't contain 3d-curve.
|
||||
---
|
||||
|
||||
Prepare (me:out) is private;
|
||||
---Purpose:
|
||||
--- Preparing the main fields for the algorithm
|
||||
--- * From-Curve (myCFrom,myTminFrom,myTmaxFrom),
|
||||
--- * To -Curve (myCTo ,myTminTo ,myTmaxTo ),
|
||||
--- * myCreiteria=myTol1+myTol2 ,
|
||||
--- * myProjectableRanges.
|
||||
---
|
||||
|
||||
IsProjectable (me; t:Real from Standard)
|
||||
returns Integer from Standard is private;
|
||||
---Purpose:
|
||||
--- Returns the flag 1 if it is possible to project
|
||||
--- the point from the From-Curve at the parameter t
|
||||
--- to the To-Curve.
|
||||
--- Othrwise it returns 0.
|
||||
---
|
||||
|
||||
FindProjectableRoot (me:out;
|
||||
t1,t2:Real from Standard;
|
||||
f1,f2:Integer from Standard;
|
||||
tRoot:out Real from Standard) is private;
|
||||
---Purpose:
|
||||
--- Find a bound of a projectable range for the From-Curve
|
||||
--- using bisection method.
|
||||
--- t1, t2 - interval for searching along t.
|
||||
--- f1, f2 - values of the function IsProjectable()
|
||||
--- at t1 and t2.
|
||||
---
|
||||
|
||||
|
||||
DistanceFunction (me:out;t:Real from Standard)
|
||||
returns Real from Standard is private;
|
||||
---Purpose:
|
||||
--- Calculates the DistanceFunction D(t).
|
||||
--- D(t)=D1(t) - myCriteria;
|
||||
--- where
|
||||
--- D1(t) - the lower distance between a point from
|
||||
--- the From-Curve at parameter t and
|
||||
--- projection point of this point on To-Curve;
|
||||
--- myCriteria=myTol1+myTol2.
|
||||
---
|
||||
|
||||
DerivativeFunction (me:out;t:Real from Standard)
|
||||
returns Real from Standard is private;
|
||||
---Purpose:
|
||||
--- Calculates the first derivative of
|
||||
--- the DistanceFunction D(t).
|
||||
---
|
||||
|
||||
|
||||
FindSimpleRoot (me:out; IP:Integer from Standard;
|
||||
ta, tb, fA:Real from Standard)
|
||||
returns Real from Standard is private;
|
||||
---Purpose:
|
||||
--- Find the Root of the function on given interval
|
||||
--- of the argument [ta,tb] using bisection method .
|
||||
--- IP - a flag;
|
||||
--- =1 - use DistanceFunction;
|
||||
--- =2 - use DerivativeFunction;
|
||||
---
|
||||
|
||||
FindGoldRoot (me:out; ta, tb, coeff:Real from Standard)
|
||||
returns Real from Standard is private;
|
||||
---Purpose:
|
||||
--- Find the Root of the function on given interval
|
||||
--- of the argument [ta,tb] using Fibonacci method .
|
||||
---
|
||||
|
||||
FindRangeOnCurve2 (me:out;
|
||||
aCP:out CommonPrt from IntTools)
|
||||
returns Integer from Standard is private;
|
||||
---Purpose:
|
||||
--- Find the range on the curve Curve-To that corresponds
|
||||
--- to the given range on the curve Curve-From.
|
||||
---
|
||||
|
||||
GetParameterOnCurve2 (me;
|
||||
aT1:Real from Standard;
|
||||
aT2:out Real from Standard)
|
||||
returns Integer from Standard is private ;
|
||||
---Purpose:
|
||||
--- Find the value of the parameter on the curve Curve-To
|
||||
--- that corresponds to the given parameter on the curve
|
||||
--- Curve-From.
|
||||
---
|
||||
|
||||
TreatVertexType (me:out; am1, am2:Real from Standard;
|
||||
aCP:out CommonPrt from IntTools)
|
||||
returns Integer from Standard is private;
|
||||
|
||||
IsIntersection (me:out;
|
||||
t1 : Real from Standard;
|
||||
t2 : Real from Standard) is private ;
|
||||
|
||||
FindDerivativeRoot (me:out;
|
||||
t,f:CArray1OfReal from IntTools)
|
||||
is private;
|
||||
--
|
||||
RemoveIdenticalRoots(me:out)
|
||||
is private;
|
||||
|
||||
CheckTouch(me: out;
|
||||
aCP: CommonPrt from IntTools;
|
||||
t1 : out Real from Standard;
|
||||
t2 : out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
CheckTouchVertex(me;
|
||||
aCP: CommonPrt from IntTools;
|
||||
t1 : out Real from Standard;
|
||||
t2 : out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
CheckInterval(me:out;
|
||||
t1 : Real from Standard;
|
||||
t2 : Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
|
||||
ComputeLineLine(me:out)
|
||||
is private;
|
||||
|
||||
--
|
||||
fields
|
||||
-- Data
|
||||
myEdge1 : Edge from TopoDS;
|
||||
myEdge2 : Edge from TopoDS;
|
||||
myTol1 : Real from Standard;
|
||||
myTol2 : Real from Standard;
|
||||
|
||||
myDiscret : Integer from Standard;
|
||||
|
||||
myEpsT : Real from Standard;
|
||||
myEpsNull : Real from Standard;
|
||||
myDeflection : Real from Standard;
|
||||
|
||||
-- data curves
|
||||
myCFrom : Curve from BRepAdaptor;
|
||||
myTminFrom : Real from Standard;
|
||||
myTmaxFrom : Real from Standard;
|
||||
myTolFrom : Real from Standard;
|
||||
|
||||
myCTo : Curve from BRepAdaptor;
|
||||
myTminTo : Real from Standard;
|
||||
myTmaxTo : Real from Standard;
|
||||
myTolTo : Real from Standard;
|
||||
|
||||
myCriteria : Real from Standard;
|
||||
-- IsDone
|
||||
myIsDone : Boolean from Standard;
|
||||
myErrorStatus : Integer from Standard;
|
||||
|
||||
--- internal members
|
||||
myProjectableRanges: SequenceOfRanges from IntTools;
|
||||
myFuncArray : CArray1OfReal from IntTools;
|
||||
myArgsArray : CArray1OfReal from IntTools;
|
||||
|
||||
mySequenceOfRoots : SequenceOfRoots from IntTools;
|
||||
mySeqOfCommonPrts : SequenceOfCommonPrts from IntTools;
|
||||
|
||||
myOrder : Boolean from Standard; -- 0-strait; 1-reversed
|
||||
myPar1 : Real from Standard;
|
||||
myParallel : Boolean from Standard;
|
||||
myAllNullFlag : Boolean from Standard;
|
||||
|
||||
myRange1 : Range from IntTools;
|
||||
myRange2 : Range from IntTools;
|
||||
|
||||
end EdgeEdge;
|
||||
|
||||
|
1927
src/IntTools/IntTools_EdgeEdge.cxx
Executable file
1927
src/IntTools/IntTools_EdgeEdge.cxx
Executable file
File diff suppressed because it is too large
Load Diff
258
src/IntTools/IntTools_EdgeFace.cdl
Executable file
258
src/IntTools/IntTools_EdgeFace.cdl
Executable file
@@ -0,0 +1,258 @@
|
||||
-- File: IntTools_EdgeFace.cdl
|
||||
-- Created: Mon Feb 26 10:12:13 2001
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class EdgeFace from IntTools
|
||||
|
||||
---Purpose: The class provides Edge/Face algorithm to determine
|
||||
--- common parts between edge and face in 3-d space.
|
||||
-- Common parts can be : Vertices or Edges.
|
||||
---
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Curve from BRepAdaptor,
|
||||
Surface from BRepAdaptor,
|
||||
SequenceOfRanges from IntTools,
|
||||
CArray1OfReal from IntTools,
|
||||
CommonPrt from IntTools,
|
||||
FClass2d from IntTools,
|
||||
SequenceOfRoots from IntTools,
|
||||
SequenceOfCommonPrts from IntTools,
|
||||
PContext from IntTools,
|
||||
Range from IntTools
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns EdgeFace from IntTools;
|
||||
---Purpose:
|
||||
--- Empty Constructor
|
||||
---
|
||||
|
||||
SetEdge (me:out; anEdge:Edge from TopoDS);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by the edge anEdge
|
||||
---
|
||||
|
||||
SetTolE (me:out; aTolEdge1:Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by edge tolerance
|
||||
---
|
||||
|
||||
SetFace (me:out; aFace:Face from TopoDS);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by the face aFace
|
||||
---
|
||||
|
||||
SetTolF (me:out; aTolFace:Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by face tolerance
|
||||
---
|
||||
|
||||
SetDiscretize (me:out; aDiscret:Integer from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by discretization value
|
||||
---
|
||||
|
||||
SetDeflection (me:out; aDeflection:Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by deflection value
|
||||
---
|
||||
|
||||
SetEpsilonT (me:out; anEpsT:Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by parameter tolerance
|
||||
---
|
||||
|
||||
SetEpsilonNull (me:out; anEpsNull:Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by distance tolerance
|
||||
---
|
||||
|
||||
SetRange (me:out; aRange:Range from IntTools);
|
||||
---Purpose:
|
||||
--- Sets boundaries for edge.
|
||||
--- The algorithm processes edge inside these boundaries.
|
||||
---
|
||||
|
||||
SetRange (me:out; aFirst, aLast:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets boundaries for edge.
|
||||
--- The algorithm processes edge inside these boundaries.
|
||||
---
|
||||
|
||||
SetContext (me: in out; theContext: PContext from IntTools);
|
||||
---Purpose:
|
||||
--- Set container of projection algorithms
|
||||
---
|
||||
|
||||
Perform (me:out);
|
||||
---Purpose:
|
||||
--- Launches the process
|
||||
---
|
||||
|
||||
IsDone (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if computation was done
|
||||
--- successfully, otherwise returns false
|
||||
---
|
||||
|
||||
ErrorStatus(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns code of completion
|
||||
--- 0 - means successful completion
|
||||
--- 1 - the process was not started
|
||||
--- 2,3,4,5 - invalid source data for the algorithm
|
||||
--- 6 - discretization failed
|
||||
--- 7 - no projectable ranges found
|
||||
--- 11 - distance computing error
|
||||
---
|
||||
|
||||
CommonParts(me)
|
||||
returns SequenceOfCommonPrts from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns results
|
||||
---
|
||||
|
||||
Range (me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns boundaries for edge
|
||||
---
|
||||
|
||||
--
|
||||
IsEqDistance(myclass;
|
||||
aP: Pnt from gp;
|
||||
aS: Surface from BRepAdaptor;
|
||||
aT: Real from Standard;
|
||||
aD:out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
---
|
||||
---
|
||||
--
|
||||
|
||||
-----------------------------------------------------
|
||||
-- Block of private methods of the algorithm --
|
||||
-----------------------------------------------------
|
||||
|
||||
CheckData (me:out) is private;
|
||||
|
||||
Prepare (me:out) is private;
|
||||
|
||||
IsProjectable (me; t:Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
FindProjectableRoot (me:out;
|
||||
t1,t2:Real from Standard;
|
||||
f1,f2:Integer from Standard;
|
||||
tRoot:out Real from Standard)
|
||||
is private;
|
||||
|
||||
DistanceFunction (me:out;t:Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
DerivativeFunction (me:out;t:Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
PrepareArgsFuncArrays (me:out;t1,t2:Real from Standard)
|
||||
is private;
|
||||
|
||||
|
||||
AddDerivativePoints (me:out; t,f:CArray1OfReal from IntTools)
|
||||
is private;
|
||||
|
||||
|
||||
FindSimpleRoot (me:out; IP:Integer from Standard;
|
||||
ta, tb, fA:Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
FindGoldRoot (me:out; ta, tb, coeff:Real from Standard)
|
||||
returns Real from Standard
|
||||
is private;
|
||||
|
||||
MakeType (me:out;
|
||||
aCP: out CommonPrt from IntTools)
|
||||
returns Integer from Standard
|
||||
is private;
|
||||
|
||||
|
||||
IsIntersection (me:out; ta,tb:Real from Standard)
|
||||
is private;
|
||||
|
||||
FindDerivativeRoot (me:out;t,f:CArray1OfReal from IntTools)
|
||||
is private;
|
||||
|
||||
--
|
||||
RemoveIdenticalRoots(me:out)
|
||||
is private;
|
||||
|
||||
CheckTouch (me: out;
|
||||
aCP: CommonPrt from IntTools;
|
||||
aTX:out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
CheckTouchVertex (me:out;
|
||||
aCP: CommonPrt from IntTools;
|
||||
aTX:out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
--
|
||||
|
||||
fields
|
||||
-- Data
|
||||
myEdge : Edge from TopoDS;
|
||||
myFace : Face from TopoDS;
|
||||
myTolE : Real from Standard;
|
||||
myTolF : Real from Standard;
|
||||
|
||||
myDiscret : Integer from Standard;
|
||||
|
||||
myEpsT : Real from Standard;
|
||||
myEpsNull : Real from Standard;
|
||||
myDeflection : Real from Standard;
|
||||
|
||||
-- data curves
|
||||
myC : Curve from BRepAdaptor;
|
||||
myTmin : Real from Standard;
|
||||
myTmax : Real from Standard;
|
||||
|
||||
myS : Surface from BRepAdaptor;
|
||||
|
||||
myCriteria : Real from Standard;
|
||||
|
||||
-- IsDone
|
||||
myIsDone : Boolean from Standard;
|
||||
myErrorStatus : Integer from Standard;
|
||||
|
||||
--- internal members
|
||||
myContext : PContext from IntTools;
|
||||
myProjectableRanges: SequenceOfRanges from IntTools;
|
||||
myFClass2d : FClass2d from IntTools;
|
||||
myFuncArray : CArray1OfReal from IntTools;
|
||||
myArgsArray : CArray1OfReal from IntTools;
|
||||
mySequenceOfRoots : SequenceOfRoots from IntTools;
|
||||
mySeqOfCommonPrts : SequenceOfCommonPrts from IntTools;
|
||||
|
||||
myPar1 : Real from Standard;
|
||||
myParallel : Boolean from Standard;
|
||||
myAllNullFlag : Boolean from Standard;
|
||||
|
||||
myRange : Range from IntTools;
|
||||
|
||||
end EdgeFace;
|
1599
src/IntTools/IntTools_EdgeFace.cxx
Executable file
1599
src/IntTools/IntTools_EdgeFace.cxx
Executable file
File diff suppressed because it is too large
Load Diff
103
src/IntTools/IntTools_FClass2d.cdl
Executable file
103
src/IntTools/IntTools_FClass2d.cdl
Executable file
@@ -0,0 +1,103 @@
|
||||
-- File: IntTools_FClass2d.cdl
|
||||
-- Created: Wed Mar 22 09:29:42 1995
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@mastox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class FClass2d from IntTools
|
||||
|
||||
---Purpose: Class provides an algorithm to classify a 2d Point
|
||||
--- in 2d space of face using boundaries of the face.
|
||||
|
||||
uses
|
||||
Pnt2d from gp,
|
||||
Face from TopoDS,
|
||||
State from TopAbs,
|
||||
SequenceOfInteger from TColStd,
|
||||
SeqOfPtr from BRepTopAdaptor
|
||||
|
||||
is
|
||||
Create
|
||||
returns FClass2d from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create( F: Face from TopoDS;
|
||||
Tol: Real from Standard)
|
||||
returns FClass2d from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes algorithm by the face F
|
||||
--- and tolerance Tol
|
||||
---
|
||||
|
||||
Init (me:out;
|
||||
F: Face from TopoDS;
|
||||
Tol: Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes algorithm by the face F
|
||||
--- and tolerance Tol
|
||||
---
|
||||
|
||||
PerformInfinitePoint(me)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns state of infinite 2d point relatively to (0, 0)
|
||||
---
|
||||
|
||||
Perform(me;
|
||||
Puv: Pnt2d from gp;
|
||||
RecadreOnPeriodic: Boolean from Standard=Standard_True)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns state of the 2d point Puv.
|
||||
--- If RecadreOnPeriodic is true (defalut value),
|
||||
--- for the periodic surface 2d point, adjusted to period, is
|
||||
--- classified.
|
||||
---
|
||||
|
||||
Destroy(me: in out);
|
||||
---C++: alias ~
|
||||
---Purpose:
|
||||
--- Destructor
|
||||
---
|
||||
|
||||
|
||||
TestOnRestriction(me;
|
||||
Puv: Pnt2d from gp;
|
||||
Tol: Real from Standard;
|
||||
RecadreOnPeriodic: Boolean from Standard = Standard_True)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Test a point with +- an offset (Tol) and returns
|
||||
--- On if some points are OUT an some are IN
|
||||
-- (Caution: Internal use . see the code for more details)
|
||||
---
|
||||
|
||||
--modified by NIZNHY-PKV Mon May 29 10:47:52 2006f
|
||||
IsHole(me)
|
||||
returns Boolean from Standard;
|
||||
--modified by NIZNHY-PKV Mon May 29 10:47:54 2006t
|
||||
|
||||
fields
|
||||
|
||||
TabClass : SeqOfPtr from BRepTopAdaptor;
|
||||
TabOrien : SequenceOfInteger from TColStd;
|
||||
Toluv : Real from Standard;
|
||||
Face : Face from TopoDS;
|
||||
U1 : Real from Standard;
|
||||
V1 : Real from Standard;
|
||||
U2 : Real from Standard;
|
||||
V2 : Real from Standard;
|
||||
|
||||
Umin : Real from Standard;
|
||||
Umax : Real from Standard;
|
||||
Vmin : Real from Standard;
|
||||
Vmax : Real from Standard;
|
||||
--modified by NIZNHY-PKV Mon May 29 10:44:12 2006f
|
||||
myIsHole : Boolean from Standard;
|
||||
--modified by NIZNHY-PKV Mon May 29 10:44:14 2006t
|
||||
|
||||
|
||||
end FClass2d ;
|
811
src/IntTools/IntTools_FClass2d.cxx
Executable file
811
src/IntTools/IntTools_FClass2d.cxx
Executable file
@@ -0,0 +1,811 @@
|
||||
// File: IntTools_FClass2d.cxx
|
||||
// Created: Wed Mar 22 09:44:18 1995
|
||||
// Author: Laurent BUCHARD
|
||||
// <lbr@mastox>
|
||||
|
||||
#include <IntTools_FClass2d.ixx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#include <Geom2dInt_Geom2dCurveTool.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <BRepClass_FaceClassifier.hxx>
|
||||
#include <CSLib_Class2d.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TColStd_DataMapOfIntegerInteger.hxx>
|
||||
#include <TColgp_SequenceOfVec2d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_FClass2d:IntTools:_FClass2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_FClass2d::IntTools_FClass2d()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IntTools_FClass2d::IntTools_FClass2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_FClass2d::IntTools_FClass2d(const TopoDS_Face& aFace,
|
||||
const Standard_Real TolUV)
|
||||
: Toluv(TolUV), Face(aFace)
|
||||
{
|
||||
Init(Face, Toluv);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsHole
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_FClass2d::IsHole() const
|
||||
{
|
||||
return myIsHole;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_FClass2d::Init(const TopoDS_Face& aFace,
|
||||
const Standard_Real TolUV)
|
||||
{
|
||||
Standard_Boolean WireIsNotEmpty, Ancienpnt3dinitialise, degenerated;
|
||||
Standard_Integer nbpnts, firstpoint, NbEdges;
|
||||
Standard_Integer iX, aNbs1, nbs, Avant, BadWire;
|
||||
Standard_Real u, du, Tole, Tol, pfbid, plbid;
|
||||
Standard_Real FlecheU, FlecheV, TolVertex1, TolVertex;
|
||||
Standard_Real uFirst, uLast;
|
||||
Standard_Real aPrCf, aPrCf2;
|
||||
//
|
||||
TopoDS_Edge edge;
|
||||
TopoDS_Vertex Va,Vb;
|
||||
TopAbs_Orientation Or;
|
||||
BRepTools_WireExplorer aWExp;
|
||||
TopExp_Explorer aExpF, aExp;
|
||||
Handle(Geom2d_Curve) aC2D;
|
||||
gp_Pnt Ancienpnt3d;
|
||||
TColgp_SequenceOfPnt2d SeqPnt2d;
|
||||
TColStd_DataMapOfIntegerInteger anIndexMap;
|
||||
TColgp_SequenceOfVec2d aD1Prev;
|
||||
TColgp_SequenceOfVec2d aD1Next;
|
||||
//
|
||||
aPrCf=Precision::Confusion();
|
||||
aPrCf2=aPrCf*aPrCf;
|
||||
myIsHole=Standard_True;
|
||||
//
|
||||
Toluv=TolUV;
|
||||
Face=aFace;
|
||||
Face.Orientation(TopAbs_FORWARD);
|
||||
Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
|
||||
surf->ChangeSurface().Initialize(aFace, Standard_False);
|
||||
//
|
||||
Tole = 0.;
|
||||
Tol=0.;
|
||||
Umin = Vmin = RealLast();
|
||||
Umax = Vmax = -Umin;
|
||||
BadWire=0;
|
||||
//
|
||||
//if face has several wires and one of them is bad,
|
||||
//it is necessary to process all of them for correct
|
||||
//calculation of Umin, Umax, Vmin, Vmax - ifv, 23.08.06
|
||||
//
|
||||
aExpF.Init(Face,TopAbs_WIRE);
|
||||
for(; aExpF.More(); aExpF.Next()) {
|
||||
const TopoDS_Wire& aW=*((TopoDS_Wire*)&aExpF.Current());
|
||||
//
|
||||
nbpnts = 0;
|
||||
firstpoint =1;
|
||||
FlecheU = 0.;
|
||||
FlecheV = 0.;
|
||||
TolVertex1=0.;
|
||||
TolVertex=0.;
|
||||
WireIsNotEmpty = Standard_False;
|
||||
Ancienpnt3dinitialise=Standard_False;
|
||||
Ancienpnt3d.SetCoord(0.,0.,0.);
|
||||
//
|
||||
SeqPnt2d.Clear();
|
||||
anIndexMap.Clear();
|
||||
aD1Prev.Clear();
|
||||
aD1Next.Clear();
|
||||
//
|
||||
// NbEdges
|
||||
NbEdges=0;
|
||||
aExp.Init(aW, TopAbs_EDGE);
|
||||
for(; aExp.More(); aExp.Next()) {
|
||||
NbEdges++;
|
||||
}
|
||||
//
|
||||
aWExp.Init(aW, Face);
|
||||
for(;aWExp.More(); aWExp.Next()) {
|
||||
NbEdges--;
|
||||
edge = aWExp.Current();
|
||||
Or = edge.Orientation();
|
||||
if(!(Or==TopAbs_FORWARD || Or==TopAbs_REVERSED)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aC2D=BRep_Tool::CurveOnSurface(edge, Face, pfbid, plbid);
|
||||
if (aC2D.IsNull()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BRepAdaptor_Curve2d C(edge,Face);
|
||||
BRepAdaptor_Curve C3d;
|
||||
//------------------------------------------
|
||||
degenerated=Standard_False;
|
||||
if(BRep_Tool::Degenerated(edge) ||
|
||||
BRep_Tool::IsClosed(edge, Face)) {
|
||||
degenerated=Standard_True;
|
||||
}
|
||||
//
|
||||
TopExp::Vertices(edge,Va,Vb);
|
||||
//
|
||||
TolVertex1=0.;
|
||||
TolVertex=0.;
|
||||
if (Va.IsNull()) {
|
||||
degenerated=Standard_True;
|
||||
}
|
||||
else {
|
||||
TolVertex1=BRep_Tool::Tolerance(Va);
|
||||
}
|
||||
if (Vb.IsNull()){
|
||||
degenerated=Standard_True;
|
||||
}
|
||||
else {
|
||||
TolVertex=BRep_Tool::Tolerance(Vb);
|
||||
}
|
||||
//
|
||||
if(TolVertex<TolVertex1) {
|
||||
TolVertex=TolVertex1;
|
||||
}
|
||||
//
|
||||
//-- Verification des cas ou on a oublie de coder degenereted
|
||||
if(!degenerated) {
|
||||
Standard_Real aR2;
|
||||
gp_Pnt P3da, P3db;
|
||||
//
|
||||
C3d.Initialize(edge,Face);
|
||||
du=(plbid-pfbid)*0.1;
|
||||
u=pfbid+du;
|
||||
P3da=C3d.Value(u);
|
||||
degenerated=Standard_True;
|
||||
u+=du;
|
||||
do {
|
||||
P3db=C3d.Value(u);
|
||||
aR2=P3da.SquareDistance(P3db);
|
||||
if(aR2>0.) {
|
||||
degenerated=Standard_False;
|
||||
break;
|
||||
}
|
||||
u+=du;
|
||||
}
|
||||
while(u<plbid);
|
||||
}//if(!degenerated)
|
||||
//-- ----------------------------------------
|
||||
Tole = BRep_Tool::Tolerance(edge);
|
||||
if(Tole>Tol) {
|
||||
Tol=Tole;
|
||||
}
|
||||
//
|
||||
// NbSamples +> nbs
|
||||
nbs = Geom2dInt_Geom2dCurveTool::NbSamples(C);
|
||||
if (nbs > 2) {
|
||||
nbs*=4;
|
||||
}
|
||||
du = (plbid-pfbid)/(Standard_Real)(nbs-1);
|
||||
//
|
||||
if(Or==TopAbs_FORWARD) {
|
||||
u = pfbid;
|
||||
uFirst=pfbid;
|
||||
uLast=plbid;
|
||||
}
|
||||
else {
|
||||
u = plbid;
|
||||
uFirst=plbid;
|
||||
uLast=pfbid;
|
||||
du=-du;
|
||||
}
|
||||
//
|
||||
// aPrms
|
||||
aNbs1=nbs+1;
|
||||
TColStd_Array1OfReal aPrms(1, aNbs1);
|
||||
//
|
||||
if (nbs==2) {
|
||||
Standard_Real aCoef=0.0025;
|
||||
aPrms(1)=uFirst;
|
||||
aPrms(2)=uFirst+aCoef*(uLast-uFirst);
|
||||
aPrms(3)=uLast;
|
||||
}
|
||||
else if (nbs>2) {
|
||||
aNbs1=nbs;
|
||||
aPrms(1)=uFirst;
|
||||
for (iX=2; iX<aNbs1; ++iX) {
|
||||
aPrms(iX)=u+(iX-1)*du;
|
||||
}
|
||||
aPrms(aNbs1)=uLast;
|
||||
}
|
||||
//
|
||||
//-- ------------------------------------------------------------
|
||||
//-- On regarde la distance uv entre le point de debut de l edge
|
||||
//-- et le dernier point enregistre dans SeqPnt2d
|
||||
//-- On cherche a eloigner le premier point de l edge courant
|
||||
//-- du dernier point enregistre
|
||||
Avant = nbpnts;
|
||||
for(iX=firstpoint; iX<=aNbs1; iX++) {
|
||||
Standard_Boolean IsRealCurve3d;
|
||||
Standard_Integer ii;
|
||||
Standard_Real aDstX;
|
||||
gp_Pnt2d P2d;
|
||||
gp_Pnt P3d;
|
||||
//
|
||||
u=aPrms(iX);
|
||||
P2d = C.Value(u);
|
||||
if(P2d.X()<Umin) Umin = P2d.X();
|
||||
if(P2d.X()>Umax) Umax = P2d.X();
|
||||
if(P2d.Y()<Vmin) Vmin = P2d.Y();
|
||||
if(P2d.Y()>Vmax) Vmax = P2d.Y();
|
||||
//
|
||||
aDstX=RealLast();
|
||||
if(degenerated==Standard_False) {
|
||||
P3d=C3d.Value(u);
|
||||
if(nbpnts>1) {
|
||||
if(Ancienpnt3dinitialise) {
|
||||
aDstX=P3d.SquareDistance(Ancienpnt3d);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
IsRealCurve3d = Standard_True;
|
||||
if (aDstX < aPrCf2) {
|
||||
if(iX>1) {
|
||||
Standard_Real aDstX1;
|
||||
gp_Pnt MidP3d;
|
||||
//
|
||||
MidP3d = C3d.Value(0.5*(u+aPrms(iX-1)));
|
||||
aDstX1=P3d.SquareDistance( MidP3d );
|
||||
if (aDstX1 < aPrCf2){
|
||||
IsRealCurve3d = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (IsRealCurve3d) {
|
||||
if(degenerated==Standard_False) {
|
||||
Ancienpnt3d=P3d;
|
||||
Ancienpnt3dinitialise=Standard_True;
|
||||
}
|
||||
nbpnts++;
|
||||
SeqPnt2d.Append(P2d);
|
||||
}
|
||||
//
|
||||
ii=nbpnts;
|
||||
if(ii>(Avant+4)) {
|
||||
Standard_Real ul, dU, dV;
|
||||
gp_Pnt2d Pp;
|
||||
//
|
||||
gp_Lin2d Lin(SeqPnt2d(ii-2),gp_Dir2d(gp_Vec2d(SeqPnt2d(ii-2),SeqPnt2d(ii))));
|
||||
ul = ElCLib::Parameter(Lin,SeqPnt2d(ii-1));
|
||||
Pp = ElCLib::Value(ul,Lin);
|
||||
dU = Abs(Pp.X()-SeqPnt2d(ii-1).X());
|
||||
dV = Abs(Pp.Y()-SeqPnt2d(ii-1).Y());
|
||||
if(dU>FlecheU) {
|
||||
FlecheU = dU;
|
||||
}
|
||||
if(dV>FlecheV) {
|
||||
FlecheV = dV;
|
||||
}
|
||||
}
|
||||
}// for(iX=firstpoint; iX<=aNbs1; iX++) {
|
||||
//
|
||||
if(BadWire) {
|
||||
continue; //if face has several wires and one of them is bad,
|
||||
//it is necessary to process all of them for correct
|
||||
//calculation of Umin, Umax, Vmin, Vmax - ifv, 23.08.06
|
||||
}
|
||||
//
|
||||
if(firstpoint==1) firstpoint=2;
|
||||
WireIsNotEmpty = Standard_True;
|
||||
// Append the derivative of the first parameter.
|
||||
Standard_Real aU = aPrms(1);
|
||||
gp_Pnt2d aP;
|
||||
gp_Vec2d aV;
|
||||
|
||||
C.D1(aU, aP, aV);
|
||||
|
||||
if(Or == TopAbs_REVERSED)
|
||||
aV.Reverse();
|
||||
|
||||
aD1Next.Append(aV);
|
||||
|
||||
// Append the derivative of the last parameter.
|
||||
aU = aPrms(aNbs1);
|
||||
C.D1(aU, aP, aV);
|
||||
|
||||
if(Or == TopAbs_REVERSED)
|
||||
aV.Reverse();
|
||||
|
||||
if (NbEdges > 0)
|
||||
aD1Prev.Append(aV);
|
||||
else
|
||||
aD1Prev.Prepend(aV);
|
||||
|
||||
// Fill the map anIndexMap.
|
||||
if (Avant > 0)
|
||||
anIndexMap.Bind(Avant, aD1Next.Length());
|
||||
else
|
||||
anIndexMap.Bind(1, aD1Next.Length());
|
||||
} //for(;aWExp.More(); aWExp.Next()) {
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
//
|
||||
if(NbEdges) {
|
||||
//-- on compte ++ avec un explorateur normal et -- avec le Wire Exploreur
|
||||
TColgp_Array1OfPnt2d PClass(1,2);
|
||||
gp_Pnt2d anInitPnt(0., 0.);
|
||||
//
|
||||
PClass.Init(anInitPnt);
|
||||
TabClass.Append((void *)new CSLib_Class2d(PClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
|
||||
BadWire=1;
|
||||
TabOrien.Append(-1);
|
||||
}
|
||||
//
|
||||
else if(WireIsNotEmpty) {
|
||||
TColgp_Array1OfPnt2d PClass(1,nbpnts);
|
||||
gp_Pnt2d anInitPnt(0., 0.);
|
||||
//
|
||||
PClass.Init(anInitPnt);
|
||||
if(nbpnts>3) {
|
||||
Standard_Integer im2=nbpnts-2;
|
||||
Standard_Integer im1=nbpnts-1;
|
||||
Standard_Integer im0=1;
|
||||
Standard_Integer ii;
|
||||
Standard_Real angle = 0.0;
|
||||
Standard_Real aX0, aY0, aX1, aY1, aS;
|
||||
//
|
||||
aS=0.;
|
||||
//
|
||||
|
||||
Standard_Integer iFlag=1;
|
||||
PClass(im2)=SeqPnt2d.Value(im2);
|
||||
PClass(im1)=SeqPnt2d.Value(im1);
|
||||
PClass(nbpnts)=SeqPnt2d.Value(nbpnts);
|
||||
for(ii=1; ii<nbpnts; ii++,im0++,im1++,im2++) {
|
||||
if(im2>=nbpnts) im2=1;
|
||||
if(im1>=nbpnts) im1=1;
|
||||
PClass(ii)=SeqPnt2d.Value(ii);
|
||||
//
|
||||
const gp_Pnt2d& aP2D1=PClass(im1);
|
||||
const gp_Pnt2d& aP2D0=PClass(im0);
|
||||
//aP2D0 is next to aP2D1
|
||||
aP2D0.Coord(aX0, aY0);
|
||||
aP2D1.Coord(aX1, aY1);
|
||||
aS=aS+(aY0+aY1)*(aX1-aX0);
|
||||
|
||||
gp_Vec2d A(PClass(im2),PClass(im1));
|
||||
gp_Vec2d B(PClass(im1),PClass(im0));
|
||||
|
||||
Standard_Real N = A.Magnitude() * B.Magnitude();
|
||||
if(N>1e-16) {
|
||||
Standard_Real a=A.Angle(B);
|
||||
//
|
||||
if (anIndexMap.IsBound(im1)) {
|
||||
Standard_Integer anInd = anIndexMap.Find(im1);
|
||||
const gp_Vec2d &aVPrev = aD1Prev.Value(anInd);
|
||||
const gp_Vec2d &aVNext = aD1Next.Value(anInd);
|
||||
|
||||
Standard_Real aN = aVPrev.Magnitude() * aVNext.Magnitude();
|
||||
if(aN > 1e-16) {
|
||||
Standard_Real aDerivAngle = aVPrev.Angle(aVNext);
|
||||
//ifv 23.08.06
|
||||
if(Abs(aDerivAngle) <= Precision::Angular()) aDerivAngle = 0.;
|
||||
//ifv 23.08.06 : if edges continuity > G1, |aDerivAngle| ~0,
|
||||
//but can has wrong sign and causes condition aDerivAngle * a < 0.
|
||||
//that is wrong in such situation
|
||||
if (iFlag && aDerivAngle * a < 0.) {
|
||||
iFlag=0;
|
||||
// Bad case.
|
||||
angle = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
angle+=a;
|
||||
}
|
||||
}//for(ii=1; ii<nbpnts; ii++,im0++,im1++,im2++) {
|
||||
if (!iFlag) {
|
||||
angle = 0.;
|
||||
}
|
||||
if(aS>0.){
|
||||
myIsHole=Standard_False;
|
||||
}
|
||||
//
|
||||
if(FlecheU<Toluv)
|
||||
FlecheU = Toluv;
|
||||
|
||||
if(FlecheV<Toluv)
|
||||
FlecheV = Toluv;
|
||||
|
||||
TabClass.Append((void *)new CSLib_Class2d(PClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
|
||||
//
|
||||
if((angle<2 && angle>-2)||(angle>10)||(angle<-10)) {
|
||||
BadWire=1;
|
||||
TabOrien.Append(-1);
|
||||
}
|
||||
else {
|
||||
TabOrien.Append((angle>0.0)? 1 : 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BadWire=1;
|
||||
TabOrien.Append(-1);
|
||||
TColgp_Array1OfPnt2d PPClass(1,2);
|
||||
PPClass.Init(anInitPnt);
|
||||
TabClass.Append((void *)new CSLib_Class2d(PPClass,FlecheU,FlecheV,Umin,Vmin,Umax,Vmax));
|
||||
}
|
||||
}// else if(WireIsNotEmpty)
|
||||
} // for(; aExpF.More(); aExpF.Next()) {
|
||||
//
|
||||
Standard_Integer nbtabclass = TabClass.Length();
|
||||
//
|
||||
if(nbtabclass>0) {
|
||||
//-- Si une erreur sur un wire a ete detecte : On met tous les TabOrien a -1
|
||||
if(BadWire) {
|
||||
TabOrien(1)=-1;
|
||||
}
|
||||
|
||||
if( surf->GetType()==GeomAbs_Cone
|
||||
|| surf->GetType()==GeomAbs_Cylinder
|
||||
|| surf->GetType()==GeomAbs_Torus
|
||||
|| surf->GetType()==GeomAbs_Sphere
|
||||
|| surf->GetType()==GeomAbs_SurfaceOfRevolution) {
|
||||
Standard_Real uuu=PI+PI-(Umax-Umin);
|
||||
if(uuu<0) uuu=0;
|
||||
U1 = Umin-uuu*0.5;
|
||||
U2 = U1+PI+PI;
|
||||
}
|
||||
else {
|
||||
U1=U2=0.0;
|
||||
}
|
||||
|
||||
if(surf->GetType()==GeomAbs_Torus) {
|
||||
Standard_Real uuu=PI+PI-(Vmax-Vmin);
|
||||
if(uuu<0) uuu=0;
|
||||
|
||||
V1 = Vmin-uuu*0.5;
|
||||
V2 = V1+PI+PI;
|
||||
}
|
||||
else {
|
||||
V1=V2=0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInfinitePoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_FClass2d::PerformInfinitePoint() const
|
||||
{
|
||||
if(Umax==-RealLast() || Vmax==-RealLast() || Umin==RealLast() || Vmin==RealLast()) {
|
||||
return(TopAbs_IN);
|
||||
}
|
||||
gp_Pnt2d P(Umin-(Umax-Umin),Vmin-(Vmax-Vmin));
|
||||
return(Perform(P,Standard_False));
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_FClass2d::Perform(const gp_Pnt2d& _Puv,
|
||||
const Standard_Boolean RecadreOnPeriodic) const
|
||||
{
|
||||
Standard_Integer dedans, nbtabclass;
|
||||
|
||||
nbtabclass = TabClass.Length();
|
||||
|
||||
if(nbtabclass==0) {
|
||||
return(TopAbs_IN);
|
||||
}
|
||||
|
||||
//-- U1 est le First Param et U2 ds ce cas est U1+Period
|
||||
Standard_Real u, v, uu, vv, uperiod, vperiod;
|
||||
Standard_Boolean IsUPer, IsVPer, urecadre, vrecadre;
|
||||
TopAbs_State Status= TopAbs_UNKNOWN;
|
||||
|
||||
u=_Puv.X();
|
||||
v=_Puv.Y();
|
||||
uu = u, vv = v;
|
||||
|
||||
Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
|
||||
surf->ChangeSurface().Initialize( Face, Standard_False );
|
||||
|
||||
uperiod=0., vperiod=0.;
|
||||
IsUPer = surf->IsUPeriodic();
|
||||
IsVPer = surf->IsVPeriodic();
|
||||
|
||||
if (IsUPer){
|
||||
uperiod = surf->UPeriod();
|
||||
}
|
||||
|
||||
if (IsVPer){
|
||||
vperiod = surf->VPeriod();
|
||||
}
|
||||
|
||||
urecadre = Standard_False;
|
||||
vrecadre = Standard_False;
|
||||
|
||||
if (RecadreOnPeriodic) {
|
||||
|
||||
if (IsUPer) {
|
||||
if (uu < Umin)
|
||||
while (uu < Umin) {
|
||||
uu += uperiod;
|
||||
}
|
||||
else {
|
||||
while (uu >= Umin){
|
||||
uu -= uperiod;
|
||||
}
|
||||
uu += uperiod;
|
||||
}
|
||||
}// if (IsUPer) {
|
||||
|
||||
if (IsVPer) {
|
||||
if (vv < Vmin)
|
||||
while (vv < Vmin){
|
||||
vv += vperiod;
|
||||
}
|
||||
else {
|
||||
while (vv >= Vmin) {
|
||||
vv -= vperiod;
|
||||
}
|
||||
vv += vperiod;
|
||||
}
|
||||
}//if (IsVPer) {
|
||||
}
|
||||
|
||||
while (1) {
|
||||
dedans = 1;
|
||||
gp_Pnt2d Puv(u,v);
|
||||
|
||||
if(TabOrien(1)!=-1) {
|
||||
Standard_Integer n, cur, TabOrien_n ;
|
||||
for(n=1; n<=nbtabclass; n++) {
|
||||
cur = ((CSLib_Class2d *)TabClass(n))->SiDans(Puv);
|
||||
TabOrien_n=TabOrien(n);
|
||||
|
||||
if(cur==1) {
|
||||
if(TabOrien_n==0) {
|
||||
dedans = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(cur==-1) {
|
||||
if(TabOrien_n==1) {
|
||||
dedans = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dedans = 0;
|
||||
break;
|
||||
}
|
||||
} // for(n=1; n<=nbtabclass; n++)
|
||||
|
||||
if(dedans==0) {
|
||||
BRepClass_FaceClassifier aClassifier;
|
||||
aClassifier.Perform(Face,Puv,Toluv);
|
||||
Status = aClassifier.State();
|
||||
}
|
||||
if(dedans == 1) {
|
||||
Status = TopAbs_IN;
|
||||
}
|
||||
if(dedans == -1) {
|
||||
Status = TopAbs_OUT;
|
||||
}
|
||||
} // if(TabOrien(1)!=-1) {
|
||||
|
||||
else { //-- TabOrien(1)=-1 Wire Faux
|
||||
BRepClass_FaceClassifier aClassifier;
|
||||
aClassifier.Perform(Face,Puv,Toluv);
|
||||
Status = aClassifier.State();
|
||||
}
|
||||
|
||||
if (!RecadreOnPeriodic || !IsUPer && !IsVPer)
|
||||
return Status;
|
||||
|
||||
if (Status == TopAbs_IN || Status == TopAbs_ON)
|
||||
return Status;
|
||||
|
||||
if (!urecadre){
|
||||
u = uu;
|
||||
urecadre = Standard_True;
|
||||
}
|
||||
else {
|
||||
if (IsUPer){
|
||||
u += uperiod;
|
||||
}
|
||||
}
|
||||
|
||||
if (u > Umax || !IsUPer) {
|
||||
if (!vrecadre){
|
||||
v = vv;
|
||||
vrecadre = Standard_True;
|
||||
}
|
||||
else {
|
||||
if (IsVPer){
|
||||
v += vperiod;
|
||||
}
|
||||
}
|
||||
|
||||
u = uu;
|
||||
|
||||
if (v > Vmax || !IsVPer) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
} //while (1)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TestOnRestriction
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_FClass2d::TestOnRestriction(const gp_Pnt2d& _Puv,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean RecadreOnPeriodic) const
|
||||
{
|
||||
|
||||
Standard_Integer dedans, nbtabclass;
|
||||
|
||||
nbtabclass = TabClass.Length();
|
||||
|
||||
if(nbtabclass==0) {
|
||||
return(TopAbs_IN);
|
||||
}
|
||||
|
||||
//-- U1 est le First Param et U2 ds ce cas est U1+Period
|
||||
Standard_Real u=_Puv.X();
|
||||
Standard_Real v=_Puv.Y();
|
||||
Standard_Real uu = u, vv = v;
|
||||
|
||||
Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface();
|
||||
surf->ChangeSurface().Initialize( Face, Standard_False );
|
||||
Standard_Boolean IsUPer, IsVPer;
|
||||
Standard_Real uperiod=0, vperiod=0;
|
||||
if ((IsUPer = surf->IsUPeriodic()))
|
||||
uperiod = surf->UPeriod();
|
||||
if ((IsVPer = surf->IsVPeriodic()))
|
||||
vperiod = surf->VPeriod();
|
||||
TopAbs_State Status = TopAbs_UNKNOWN;
|
||||
Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False;
|
||||
|
||||
if (RecadreOnPeriodic)
|
||||
{
|
||||
if (IsUPer)
|
||||
{
|
||||
if (uu < Umin)
|
||||
while (uu < Umin)
|
||||
uu += uperiod;
|
||||
else
|
||||
{
|
||||
while (uu >= Umin)
|
||||
uu -= uperiod;
|
||||
uu += uperiod;
|
||||
}
|
||||
}
|
||||
if (IsVPer)
|
||||
{
|
||||
if (vv < Vmin)
|
||||
while (vv < Vmin)
|
||||
vv += vperiod;
|
||||
else
|
||||
{
|
||||
while (vv >= Vmin)
|
||||
vv -= vperiod;
|
||||
vv += vperiod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
dedans = 1;
|
||||
gp_Pnt2d Puv(u,v);
|
||||
|
||||
if(TabOrien(1)!=-1) {
|
||||
for(Standard_Integer n=1; n<=nbtabclass; n++) {
|
||||
Standard_Integer cur = ((CSLib_Class2d *)TabClass(n))->SiDans_OnMode(Puv,Tol);
|
||||
if(cur==1) {
|
||||
if(TabOrien(n)==0) {
|
||||
dedans = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(cur==-1) {
|
||||
if(TabOrien(n)==1) {
|
||||
dedans = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dedans = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dedans==0) {
|
||||
Status = TopAbs_ON;
|
||||
}
|
||||
if(dedans == 1) {
|
||||
Status = TopAbs_IN;
|
||||
}
|
||||
if(dedans == -1) {
|
||||
Status = TopAbs_OUT;
|
||||
}
|
||||
}
|
||||
else { //-- TabOrien(1)=-1 Wire Faux
|
||||
BRepClass_FaceClassifier aClassifier;
|
||||
aClassifier.Perform(Face,Puv,Tol);
|
||||
Status = aClassifier.State();
|
||||
}
|
||||
|
||||
if (!RecadreOnPeriodic || !IsUPer && !IsVPer)
|
||||
return Status;
|
||||
if (Status == TopAbs_IN || Status == TopAbs_ON)
|
||||
return Status;
|
||||
|
||||
if (!urecadre)
|
||||
{
|
||||
u = uu;
|
||||
urecadre = Standard_True;
|
||||
}
|
||||
else
|
||||
if (IsUPer)
|
||||
u += uperiod;
|
||||
if (u > Umax || !IsUPer)
|
||||
{
|
||||
if (!vrecadre)
|
||||
{
|
||||
v = vv;
|
||||
vrecadre = Standard_True;
|
||||
}
|
||||
else
|
||||
if (IsVPer)
|
||||
v += vperiod;
|
||||
|
||||
u = uu;
|
||||
|
||||
if (v > Vmax || !IsVPer)
|
||||
return Status;
|
||||
}
|
||||
} //for (;;)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_FClass2d::Destroy()
|
||||
{
|
||||
Standard_Integer nbtabclass = TabClass.Length();
|
||||
for(Standard_Integer d=1; d<=nbtabclass;d++) {
|
||||
if(TabClass(d)) {
|
||||
delete ((CSLib_Class2d *)TabClass(d));
|
||||
TabClass(d)=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
155
src/IntTools/IntTools_FaceFace.cdl
Executable file
155
src/IntTools/IntTools_FaceFace.cdl
Executable file
@@ -0,0 +1,155 @@
|
||||
-- File: IntTools_FaceFace.cdl
|
||||
-- Created: Thu Nov 23 14:52:53 2000
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@redfox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
class FaceFace from IntTools
|
||||
|
||||
---Purpose: This class provides the intersection of
|
||||
--- face's underlying surfaces.
|
||||
|
||||
uses
|
||||
|
||||
Face from TopoDS,
|
||||
SequenceOfCurves from IntTools,
|
||||
Intersection from IntPatch,
|
||||
LineConstructor from IntTools,
|
||||
HSurface from GeomAdaptor,
|
||||
TopolTool from Adaptor3d,
|
||||
SequenceOfPntOn2Faces from IntTools,
|
||||
--amv
|
||||
ListOfPntOn2S from IntSurf
|
||||
|
||||
raises NotDone from StdFail
|
||||
is
|
||||
|
||||
Create
|
||||
returns FaceFace from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor.
|
||||
---
|
||||
|
||||
|
||||
SetParameters(me: in out;
|
||||
ApproxCurves : Boolean from Standard;
|
||||
ComputeCurveOnS1: Boolean from Standard;
|
||||
ComputeCurveOnS2: Boolean from Standard;
|
||||
ApproximationTolerance: Real from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
Perform(me: in out;
|
||||
F1: Face from TopoDS;
|
||||
F2: Face from TopoDS);
|
||||
---Purpose:
|
||||
--- Intersects underliing surfaces of F1 and F2
|
||||
--- Use sum of tolerance of F1 and F2 as intersection
|
||||
--- criteria
|
||||
---
|
||||
|
||||
IsDone(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if the intersection was successful
|
||||
---
|
||||
|
||||
Lines(me)
|
||||
returns SequenceOfCurves from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns sequence of 3d curves as result of intersection
|
||||
---
|
||||
|
||||
Points(me)
|
||||
returns SequenceOfPntOn2Faces from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns sequence of 3d curves as result of intersection
|
||||
---
|
||||
|
||||
TolReached3d(me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns tolerance reached during approximation.
|
||||
--- If approximation was not done, returns zero.
|
||||
---
|
||||
|
||||
TolReached2d(me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns tolerance reached during approximation.
|
||||
--- If approximation was not done, returns zero.
|
||||
---
|
||||
|
||||
Face1 (me)
|
||||
returns Face from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns first of processed faces
|
||||
---
|
||||
|
||||
Face2 (me)
|
||||
returns Face from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns second of processed faces
|
||||
---
|
||||
|
||||
TangentFaces (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if faces are tangent
|
||||
---
|
||||
|
||||
PrepareLines3D (me:out);
|
||||
---Purpose:
|
||||
--- Provides post-processing the result lines,
|
||||
--- which includes spliting closed curves.
|
||||
---
|
||||
--amv
|
||||
SetList (me: in out; ListOfPnts: in out ListOfPntOn2S from IntSurf);
|
||||
|
||||
----------------------------------------------------------
|
||||
-- private block
|
||||
----------------------------------------------------------
|
||||
MakeCurve(me: in out; Index : Integer from Standard;
|
||||
D1 : TopolTool from Adaptor3d;
|
||||
D2 : TopolTool from Adaptor3d)
|
||||
is protected;
|
||||
|
||||
--modified by NIZNHY-PKV Tue Jul 10 10:01:27 2007f
|
||||
ComputeTolReached3d(me:out)
|
||||
is protected;
|
||||
--modified by NIZNHY-PKV Tue Jul 10 10:01:30 2007t
|
||||
|
||||
fields
|
||||
|
||||
myIsDone : Boolean from Standard;
|
||||
myIntersector : Intersection from IntPatch;
|
||||
myLConstruct : LineConstructor from IntTools;
|
||||
myHS1 : HSurface from GeomAdaptor;
|
||||
myHS2 : HSurface from GeomAdaptor;
|
||||
myNbrestr : Integer from Standard;
|
||||
|
||||
myTolReached2d : Real from Standard;
|
||||
myTolReached3d : Real from Standard;
|
||||
|
||||
myApprox : Boolean from Standard;
|
||||
myApprox1 : Boolean from Standard;
|
||||
myApprox2 : Boolean from Standard;
|
||||
myTolApprox : Real from Standard;
|
||||
|
||||
mySeqOfCurve : SequenceOfCurves from IntTools;
|
||||
|
||||
myTangentFaces: Boolean from Standard;
|
||||
myFace1 : Face from TopoDS;
|
||||
myFace2 : Face from TopoDS;
|
||||
myPnts : SequenceOfPntOn2Faces from IntTools;
|
||||
|
||||
--amv
|
||||
myListOfPnts : ListOfPntOn2S from IntSurf;
|
||||
|
||||
end FaceFace from IntTools;
|
||||
|
4238
src/IntTools/IntTools_FaceFace.cxx
Executable file
4238
src/IntTools/IntTools_FaceFace.cxx
Executable file
File diff suppressed because it is too large
Load Diff
82
src/IntTools/IntTools_LineConstructor.cdl
Executable file
82
src/IntTools/IntTools_LineConstructor.cdl
Executable file
@@ -0,0 +1,82 @@
|
||||
-- File: IntTools_LineConstructor.cdl
|
||||
-- Created: Tue Feb 7 10:07:01 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class LineConstructor from IntTools
|
||||
|
||||
---Purpose: Splits given Line.
|
||||
|
||||
uses Line from IntPatch,
|
||||
TopolTool from Adaptor3d,
|
||||
HSurface from GeomAdaptor,
|
||||
SequenceOfReal from TColStd
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns LineConstructor from IntTools;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Load(me: in out; D1,D2: TopolTool from Adaptor3d;
|
||||
S1,S2: HSurface from GeomAdaptor)
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Initializes me by two surfaces and corresponding
|
||||
--- tools which represent boundaries of surfaces
|
||||
---
|
||||
|
||||
Perform(me: in out; L: Line from IntPatch)
|
||||
is static;
|
||||
---Purpose:
|
||||
--- Splits line
|
||||
---
|
||||
|
||||
IsDone(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns True if splitting was successful
|
||||
---
|
||||
|
||||
NbParts(me)
|
||||
returns Integer from Standard
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns number of splits
|
||||
---
|
||||
|
||||
Part(me; I: Integer from Standard; WFirst,WLast: out Real from Standard)
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Return first and last parameters
|
||||
--- for given index of split
|
||||
---
|
||||
|
||||
PeriodicLine(me; L: Line from IntPatch)
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
seqp : SequenceOfReal from TColStd;
|
||||
myDom1: TopolTool from Adaptor3d;
|
||||
myDom2: TopolTool from Adaptor3d;
|
||||
myHS1 : HSurface from GeomAdaptor;
|
||||
myHS2 : HSurface from GeomAdaptor;
|
||||
|
||||
end LineConstructor;
|
756
src/IntTools/IntTools_LineConstructor.cxx
Executable file
756
src/IntTools/IntTools_LineConstructor.cxx
Executable file
@@ -0,0 +1,756 @@
|
||||
// File: IntTools_LineConstructor.cxx
|
||||
// Created: Tue Feb 7 10:12:45 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
#include <IntTools_LineConstructor.ixx>
|
||||
|
||||
#include <GeomInt_LineTool.hxx>
|
||||
#include <GeomInt_SequenceOfParameterAndOrientation.hxx>
|
||||
#include <GeomInt_ParameterAndOrientation.hxx>
|
||||
|
||||
#include <IntPatch_Point.hxx>
|
||||
#include <IntPatch_GLine.hxx>
|
||||
#include <IntPatch_WLine.hxx>
|
||||
#include <IntPatch_ALine.hxx>
|
||||
#include <IntSurf_Transition.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
//
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Recadre
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2)
|
||||
{
|
||||
Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
||||
switch (typs1)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS1IsUPeriodic = Standard_True;
|
||||
myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Le cas de biparametrees periodiques est gere en amont
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
||||
switch (typs2)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS2IsUPeriodic = Standard_True;
|
||||
myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Le cas de biparametrees periodiques est gere en amont
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(myHS1IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->UPeriod();
|
||||
const Standard_Real f = myHS1->FirstUParameter();
|
||||
const Standard_Real l = myHS1->LastUParameter();
|
||||
while(u1 < f) { u1+=lmf; }
|
||||
while(u1 > l) { u1-=lmf; }
|
||||
}
|
||||
if(myHS1IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->VPeriod();
|
||||
const Standard_Real f = myHS1->FirstVParameter();
|
||||
const Standard_Real l = myHS1->LastVParameter();
|
||||
while(v1 < f) { v1+=lmf; }
|
||||
while(v1 > l) { v1-=lmf; }
|
||||
}
|
||||
if(myHS2IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->UPeriod();
|
||||
const Standard_Real f = myHS2->FirstUParameter();
|
||||
const Standard_Real l = myHS2->LastUParameter();
|
||||
while(u2 < f) { u2+=lmf; }
|
||||
while(u2 > l) { u2-=lmf; }
|
||||
}
|
||||
if(myHS2IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->VPeriod();
|
||||
const Standard_Real f = myHS2->FirstVParameter();
|
||||
const Standard_Real l = myHS2->LastVParameter();
|
||||
while(v2 < f) { v2+=lmf; }
|
||||
while(v2 > l) { v2-=lmf; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2)
|
||||
{
|
||||
IntSurf_Quadric quad1,quad2;
|
||||
switch (myHS1->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
switch (myHS2->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
quad1.Parameters(Ptref,U1,V1);
|
||||
quad2.Parameters(Ptref,U2,V2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
{
|
||||
Standard_Integer i,nbvtx;
|
||||
Standard_Real firstp,lastp;
|
||||
const Standard_Real Tol = Precision::PConfusion() * 35.0;
|
||||
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
if(typl == IntPatch_Analytic)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
const gp_Pnt Pmid = ALine->Value(pmid);
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if(typl == IntPatch_Walking)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
if(lastp != firstp+1)
|
||||
{
|
||||
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
|
||||
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
|
||||
Pmid.Parameters(u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) { //-- !=ON
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
|
||||
Pfirst.Parameters(u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||
TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) { //-- !=ON
|
||||
const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer)(lastp));
|
||||
Plast.Parameters(u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||
in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//XX
|
||||
// 904/L7
|
||||
//
|
||||
// The One resulting curve consists of 7 segments that are
|
||||
// connected between each other.
|
||||
// The aim of the block is to reject these segments and have
|
||||
// one segment instead of 7.
|
||||
// The other reason to do that is value of TolReached3D=49.
|
||||
// Why -? It is not known yet.
|
||||
// PKV 22.Apr.2002
|
||||
//
|
||||
const GeomAbs_SurfaceType aST1 = myHS1->Surface().GetType();
|
||||
const GeomAbs_SurfaceType aST2 = myHS2->Surface().GetType();
|
||||
if ((aST1==GeomAbs_Plane && aST2==GeomAbs_SurfaceOfExtrusion) ||
|
||||
(aST2==GeomAbs_Plane && aST1==GeomAbs_SurfaceOfExtrusion))
|
||||
{
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
TColStd_SequenceOfReal aSeqTmp;
|
||||
|
||||
Standard_Integer aNb, anIndex, aNbTmp, jx;
|
||||
|
||||
aNb=seqp.Length();
|
||||
for(i=1; i<=aNb;++i) {
|
||||
lastp =seqp(i);
|
||||
anIndex=(Standard_Integer)lastp;
|
||||
if (!aMap.Contains(anIndex)){
|
||||
aMap.Add(anIndex);
|
||||
aSeqTmp.Append(lastp);
|
||||
}
|
||||
else {
|
||||
aNbTmp=aSeqTmp.Length();
|
||||
aSeqTmp.Remove(aNbTmp);
|
||||
}
|
||||
}
|
||||
//
|
||||
seqp.Clear();
|
||||
//
|
||||
aNb=aSeqTmp.Length()/2;
|
||||
for(i=1; i<=aNb;++i) {
|
||||
jx=2*i;
|
||||
firstp=aSeqTmp(jx-1);
|
||||
lastp =aSeqTmp(jx);
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
////XX
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if (typl != IntPatch_Restriction)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
Standard_Boolean intrvtested = Standard_False;
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion())
|
||||
{
|
||||
intrvtested = Standard_True;
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
gp_Pnt Pmid;
|
||||
switch (typl)
|
||||
{
|
||||
case IntPatch_Lin: Pmid = ElCLib::Value(pmid,GLine->Line()); break;
|
||||
case IntPatch_Circle: Pmid = ElCLib::Value(pmid,GLine->Circle()); break;
|
||||
case IntPatch_Ellipse: Pmid = ElCLib::Value(pmid,GLine->Ellipse()); break;
|
||||
case IntPatch_Hyperbola: Pmid = ElCLib::Value(pmid,GLine->Hyperbola()); break;
|
||||
case IntPatch_Parabola: Pmid = ElCLib::Value(pmid,GLine->Parabola()); break;
|
||||
}
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
|
||||
{
|
||||
firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
|
||||
lastp = PI + PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
|
||||
const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
|
||||
const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
|
||||
Standard_Real acadr = (firstp+lastp)*0.5;
|
||||
while(acadr < cadrinf) { acadr+=PI+PI; }
|
||||
while(acadr > cadrsup) { acadr-=PI+PI; }
|
||||
if(acadr>=cadrinf && acadr<=cadrsup)
|
||||
{
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion())
|
||||
{
|
||||
intrvtested = Standard_True;
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
gp_Pnt Pmid;
|
||||
if (typl == IntPatch_Circle)
|
||||
Pmid = ElCLib::Value(pmid,GLine->Circle());
|
||||
else
|
||||
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||
if(in1 != TopAbs_OUT) {
|
||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||
if(in2 != TopAbs_OUT) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!intrvtested) {
|
||||
// on garde a priori. Il faudrait un point 2d sur chaque
|
||||
// surface pour prendre la decision. Sera fait dans
|
||||
// l`appelant
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Mon Jan 21 17:02:12 2002 f
|
||||
//
|
||||
// Unite neighbouring intervals if it's possible.
|
||||
// It is valid when 3D intersection curve does not go through
|
||||
// the apex on surface. So for the moment we take into account
|
||||
// Plane and Cylinder - surfaces that do not contain an apex.
|
||||
// by NIZNHY-PKV Tue Jan 22 14:00:51 2002
|
||||
|
||||
const GeomAbs_SurfaceType aST1 = myHS1->Surface().GetType();
|
||||
const GeomAbs_SurfaceType aST2 = myHS2->Surface().GetType();
|
||||
if ((aST1==GeomAbs_Plane || aST1==GeomAbs_Cylinder) &&
|
||||
(aST2==GeomAbs_Plane || aST2==GeomAbs_Cylinder))
|
||||
{
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
|
||||
{
|
||||
Standard_Integer aNbParts = seqp.Length()/2;
|
||||
//
|
||||
if (aNbParts > 1)
|
||||
{
|
||||
Standard_Integer j, i2, j2;
|
||||
Standard_Real aFi = seqp(1), aLi, aFj, aLj, aF, aL;
|
||||
TColStd_SequenceOfReal aSeq;
|
||||
aSeq.Append(aFi);
|
||||
for (i=1; i<aNbParts; ++i)
|
||||
{
|
||||
j=i+1;
|
||||
i2=2*i;
|
||||
j2=2*j;
|
||||
|
||||
aFi=seqp(i2-1);
|
||||
aLi=seqp(i2);
|
||||
|
||||
aFj=seqp(j2-1);
|
||||
aLj=seqp(j2);
|
||||
|
||||
if (fabs (aFj-aLi) < Tol)
|
||||
{
|
||||
aL=aLj;
|
||||
}
|
||||
else
|
||||
{
|
||||
aL=aLi;
|
||||
aSeq.Append(aL);
|
||||
aF=aFj;
|
||||
aSeq.Append(aF);
|
||||
}
|
||||
}
|
||||
aSeq.Append(aLj);
|
||||
//
|
||||
seqp.Clear();
|
||||
aNbParts=aSeq.Length();
|
||||
for (i=1; i<=aNbParts; ++i)
|
||||
{
|
||||
aF=aSeq(i);
|
||||
seqp.Append(aF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Mon Jan 21 17:02:17 2002 t
|
||||
//
|
||||
done =Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
done = Standard_False;
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
if (nbvtx == 0) { // on garde a priori. Il faudrait un point 2d sur chaque
|
||||
// surface pour prendre la decision. Sera fait dans
|
||||
// l`appelant
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
GeomInt_SequenceOfParameterAndOrientation seqpss;
|
||||
TopAbs_Orientation or1=TopAbs_FORWARD,or2=TopAbs_FORWARD;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
const IntPatch_Point& thevtx = GeomInt_LineTool::Vertex(L,i);
|
||||
const Standard_Real prm = thevtx.ParameterOnLine();
|
||||
if (thevtx.IsOnDomS1())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc1().TransitionType())
|
||||
{
|
||||
case IntSurf_In: or1 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or1 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or1 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or1 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
or1 = TopAbs_INTERNAL;
|
||||
|
||||
if (thevtx.IsOnDomS2())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc2().TransitionType())
|
||||
{
|
||||
case IntSurf_In: or2 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or2 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or2 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or2 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
or2 = TopAbs_INTERNAL;
|
||||
|
||||
const Standard_Integer nbinserted = seqpss.Length();
|
||||
Standard_Boolean inserted = Standard_False;
|
||||
for (Standard_Integer j=1; j<=nbinserted;j++)
|
||||
{
|
||||
if (Abs(prm-seqpss(j).Parameter()) <= Tol)
|
||||
{
|
||||
// on cumule
|
||||
GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
|
||||
if (or1 != TopAbs_INTERNAL) {
|
||||
if (valj.Orientation1() != TopAbs_INTERNAL) {
|
||||
if (or1 != valj.Orientation1()) {
|
||||
valj.SetOrientation1(TopAbs_INTERNAL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
valj.SetOrientation1(or1);
|
||||
}
|
||||
}
|
||||
|
||||
if (or2 != TopAbs_INTERNAL) {
|
||||
if (valj.Orientation2() != TopAbs_INTERNAL) {
|
||||
if (or2 != valj.Orientation2()) {
|
||||
valj.SetOrientation2(TopAbs_INTERNAL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
valj.SetOrientation2(or2);
|
||||
}
|
||||
}
|
||||
inserted = Standard_True;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prm < seqpss(j).Parameter()-Tol ) {
|
||||
// on insere avant la position j
|
||||
seqpss.InsertBefore(j,GeomInt_ParameterAndOrientation(prm,or1,or2));
|
||||
inserted = Standard_True;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!inserted) {
|
||||
seqpss.Append(GeomInt_ParameterAndOrientation(prm,or1,or2));
|
||||
}
|
||||
}
|
||||
|
||||
// on determine l`etat en debut de ligne
|
||||
Standard_Boolean trim = Standard_False;
|
||||
Standard_Boolean dansS1 = Standard_False;
|
||||
Standard_Boolean dansS2 = Standard_False;
|
||||
|
||||
nbvtx = seqpss.Length();
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
or1 = seqpss(i).Orientation1();
|
||||
if (or1 != TopAbs_INTERNAL)
|
||||
{
|
||||
trim = Standard_True;
|
||||
dansS1 = (or1 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() )
|
||||
{
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS1(U,V);
|
||||
gp_Pnt2d PPCC(U,V);
|
||||
if (myDom1->Classify(PPCC,Tol) == TopAbs_OUT) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
dansS1 = Standard_True; // on garde dans le doute
|
||||
}
|
||||
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (or2 != TopAbs_INTERNAL)
|
||||
{
|
||||
trim = Standard_True;
|
||||
dansS2 = (or2 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() )
|
||||
{
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS2(U,V);
|
||||
if (myDom2->Classify(gp_Pnt2d(U,V),Tol) == TopAbs_OUT) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
dansS2 = Standard_True; // on garde dans le doute
|
||||
}
|
||||
|
||||
if (!trim) { // on a necessairement dansS1 == dansS2 == Standard_True
|
||||
seqp.Append(GeomInt_LineTool::FirstParameter(L));
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
// On epluche la sequence seqpss pour constituer les bouts valides
|
||||
// et les stocker dans seqp(2*i+1) et seqp(2*i+2)
|
||||
|
||||
Standard_Real thefirst = GeomInt_LineTool::FirstParameter(L);
|
||||
Standard_Real thelast = GeomInt_LineTool::LastParameter(L);
|
||||
firstp = thefirst;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
or1 = seqpss(i).Orientation1();
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (!dansS1 || !dansS2)
|
||||
{
|
||||
lastp = seqpss(i).Parameter();
|
||||
Standard_Real stofirst = Max(firstp, thefirst);
|
||||
Standard_Real stolast = Min(lastp, thelast) ;
|
||||
|
||||
if (stolast > stofirst) {
|
||||
seqp.Append(stofirst);
|
||||
seqp.Append(stolast);
|
||||
}
|
||||
if (lastp > thelast)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dansS1)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or1 == TopAbs_FORWARD)
|
||||
dansS1 = Standard_True;
|
||||
/*else if (or1 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS2)
|
||||
{
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or2 == TopAbs_FORWARD)
|
||||
dansS2 = Standard_True;
|
||||
/*else if (or2 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS1 && dansS2)
|
||||
firstp = seqpss(i).Parameter();
|
||||
}
|
||||
}
|
||||
|
||||
// le petit dernier a rajouter
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
lastp = thelast;
|
||||
firstp = Max(firstp,thefirst);
|
||||
if (lastp > firstp) {
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PeriodicLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) const
|
||||
{
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
if (typl != IntPatch_Circle && typl != IntPatch_Ellipse)
|
||||
return;
|
||||
|
||||
const Standard_Real Tol = Precision::PConfusion();
|
||||
Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
|
||||
Standard_Integer i,j,nbvtx = glin->NbVertex();
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
IntPatch_Point thevtx = glin->Vertex(i);
|
||||
const Standard_Real prm = thevtx.ParameterOnLine();
|
||||
Standard_Boolean changevtx = Standard_False;
|
||||
if (thevtx.IsOnDomS1() || thevtx.IsOnDomS2())
|
||||
{
|
||||
for (j=1; j<=nbvtx; j++)
|
||||
{
|
||||
if (j!=i)
|
||||
{
|
||||
const IntPatch_Point& thevtxbis = glin->Vertex(j);
|
||||
const Standard_Real prmbis = thevtxbis.ParameterOnLine();
|
||||
if (Abs(prm-prmbis) <= Tol)
|
||||
{
|
||||
Standard_Real u,v;
|
||||
gp_Pnt2d p2d;
|
||||
if (thevtx.IsOnDomS1() && thevtxbis.IsOnDomS1() &&
|
||||
thevtxbis.TransitionLineArc1().TransitionType()==IntSurf_In)
|
||||
{
|
||||
p2d = thevtx.ArcOnS1()->Value(thevtx.ParameterOnArc1());
|
||||
u = p2d.X(); v = p2d.Y();
|
||||
p2d = thevtxbis.ArcOnS1()->Value(thevtxbis.ParameterOnArc1());
|
||||
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
|
||||
{
|
||||
changevtx = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (thevtx.IsOnDomS2() && thevtxbis.IsOnDomS2() &&
|
||||
thevtxbis.TransitionLineArc2().TransitionType()==IntSurf_In)
|
||||
{
|
||||
p2d = thevtx.ArcOnS2()->Value(thevtx.ParameterOnArc2());
|
||||
u = p2d.X(); v = p2d.Y();
|
||||
p2d = thevtxbis.ArcOnS2()->Value(thevtxbis.ParameterOnArc2());
|
||||
if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
|
||||
{
|
||||
changevtx = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changevtx) {
|
||||
thevtx.SetParameter(prm + 2.*PI);
|
||||
glin->Replace(i,thevtx);
|
||||
}
|
||||
}
|
||||
}
|
70
src/IntTools/IntTools_LineConstructor.lxx
Executable file
70
src/IntTools/IntTools_LineConstructor.lxx
Executable file
@@ -0,0 +1,70 @@
|
||||
// File: IntTools_LineConstructor.lxx
|
||||
// Created: Tue Feb 7 10:12:45 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomInt_LineConstructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline IntTools_LineConstructor::IntTools_LineConstructor ()
|
||||
: done(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void IntTools_LineConstructor::Load(const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Handle(GeomAdaptor_HSurface)& S1,
|
||||
const Handle(GeomAdaptor_HSurface)& S2)
|
||||
{
|
||||
myDom1 = D1;
|
||||
myDom2 = D2;
|
||||
myHS1 = S1;
|
||||
myHS2 = S2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean IntTools_LineConstructor::IsDone () const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer IntTools_LineConstructor::NbParts () const
|
||||
{
|
||||
if (!done) { StdFail_NotDone::Raise(); }
|
||||
return (seqp.Length() / 2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Part
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void IntTools_LineConstructor::Part (const Standard_Integer I,
|
||||
Standard_Real& WFirst,
|
||||
Standard_Real& WLast) const
|
||||
{
|
||||
if (!done) { StdFail_NotDone::Raise(); }
|
||||
WFirst = seqp(2*I-1);
|
||||
WLast = seqp(2*I);
|
||||
}
|
160
src/IntTools/IntTools_MarkedRangeSet.cdl
Executable file
160
src/IntTools/IntTools_MarkedRangeSet.cdl
Executable file
@@ -0,0 +1,160 @@
|
||||
-- File: IntTools_MarkedRangeSet.cdl
|
||||
-- Created: Wed Sep 26 16:06:40 2001
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
class MarkedRangeSet from IntTools
|
||||
|
||||
---Purpose: class MarkedRangeSet provides continuous set of ranges marked with flags
|
||||
|
||||
uses
|
||||
SequenceOfInteger from TColStd,
|
||||
CArray1OfReal from IntTools,
|
||||
SequenceOfReal from TColStd,
|
||||
Range from IntTools
|
||||
|
||||
is
|
||||
Create returns MarkedRangeSet from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create(theFirstBoundary, theLastBoundary: Real from Standard;
|
||||
theInitFlag: Integer from Standard) returns MarkedRangeSet from IntTools;
|
||||
---Purpose:
|
||||
--- build set of ranges which consists of one range with
|
||||
--- boundary values theFirstBoundary and theLastBoundary
|
||||
---
|
||||
|
||||
Create(theSortedArray: CArray1OfReal from IntTools;
|
||||
theInitFlag: Integer from Standard) returns MarkedRangeSet from IntTools;
|
||||
---Purpose:
|
||||
--- Build set of ranges based on the array of progressive sorted values
|
||||
---
|
||||
-- Warning:
|
||||
--- The constructor do not check if the values of array are not sorted
|
||||
--- It should be checked before function invocation
|
||||
---
|
||||
|
||||
SetBoundaries(me: in out; theFirstBoundary, theLastBoundary: Real from Standard;
|
||||
theInitFlag: Integer from Standard);
|
||||
---Purpose:
|
||||
--- build set of ranges which consists of one range with
|
||||
--- boundary values theFirstBoundary and theLastBoundary
|
||||
---
|
||||
|
||||
SetRanges(me: in out; theSortedArray: CArray1OfReal from IntTools;
|
||||
theInitFlag: Integer from Standard);
|
||||
---Purpose:
|
||||
--- Build set of ranges based on the array of progressive sorted values
|
||||
---
|
||||
-- Warning:
|
||||
--- The function do not check if the values of array are not sorted
|
||||
--- It should be checked before function invocation
|
||||
---
|
||||
|
||||
InsertRange(me: in out; theFirstBoundary, theLastBoundary: Real from Standard;
|
||||
theFlag: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Inserts a new range marked with flag theFlag
|
||||
--- It replace the existing ranges or parts of ranges
|
||||
--- and their flags.
|
||||
--- Returns True if the range is inside the initial boundaries,
|
||||
--- otherwise or in case of some error returns False
|
||||
---
|
||||
|
||||
InsertRange(me: in out; theRange: Range from IntTools;
|
||||
theFlag: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Inserts a new range marked with flag theFlag
|
||||
--- It replace the existing ranges or parts of ranges
|
||||
--- and their flags.
|
||||
--- Returns True if the range is inside the initial boundaries,
|
||||
--- otherwise or in case of some error returns False
|
||||
---
|
||||
|
||||
InsertRange(me: in out; theFirstBoundary, theLastBoundary: Real from Standard;
|
||||
theFlag: Integer from Standard;
|
||||
theIndex: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Inserts a new range marked with flag theFlag
|
||||
--- It replace the existing ranges or parts of ranges
|
||||
--- and their flags.
|
||||
--- The index theIndex is a position where the range will be inserted.
|
||||
--- Returns True if the range is inside the initial boundaries,
|
||||
--- otherwise or in case of some error returns False
|
||||
---
|
||||
|
||||
InsertRange(me: in out; theRange: Range from IntTools;
|
||||
theFlag: Integer from Standard;
|
||||
theIndex: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Inserts a new range marked with flag theFlag
|
||||
--- It replace the existing ranges or parts of ranges
|
||||
--- and their flags.
|
||||
--- The index theIndex is a position where the range will be inserted.
|
||||
--- Returns True if the range is inside the initial boundaries,
|
||||
--- otherwise or in case of some error returns False
|
||||
---
|
||||
|
||||
SetFlag(me: in out; theIndex: Integer from Standard;
|
||||
theFlag: Integer from Standard);
|
||||
---Purpose:
|
||||
--- Set flag theFlag for range with index theIndex
|
||||
---
|
||||
|
||||
Flag(me; theIndex: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns flag of the range with index theIndex
|
||||
---
|
||||
|
||||
GetIndex(me; theValue: Real from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns index of range which contains theValue.
|
||||
--- If theValue do not belong any range returns 0.
|
||||
---
|
||||
|
||||
GetIndices(me: in out; theValue: Real from Standard)
|
||||
returns SequenceOfInteger from TColStd;
|
||||
---C++: return const &
|
||||
|
||||
|
||||
GetIndex(me; theValue: Real from Standard;
|
||||
UseLower : Boolean from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns index of range which contains theValue
|
||||
--- If theValue do not belong any range returns 0.
|
||||
--- If UseLower is Standard_True then lower boundary of the range
|
||||
--- can be equal to theValue, otherwise upper boundary of the range
|
||||
--- can be equal to theValue.
|
||||
---
|
||||
|
||||
Length(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
--- Returns number of ranges
|
||||
---
|
||||
|
||||
Range(me; theIndex: Integer from Standard)
|
||||
returns Range from IntTools;
|
||||
---Purpose:
|
||||
--- Returns the range with index theIndex.
|
||||
--- the Index can be from 1 to Length()
|
||||
---
|
||||
|
||||
fields
|
||||
myRangeSetStorer : SequenceOfReal from TColStd;
|
||||
myRangeNumber : Integer from Standard;
|
||||
myFlags : SequenceOfInteger from TColStd;
|
||||
myFoundIndices : SequenceOfInteger from TColStd;
|
||||
|
||||
end MarkedRangeSet from IntTools;
|
246
src/IntTools/IntTools_MarkedRangeSet.cxx
Executable file
246
src/IntTools/IntTools_MarkedRangeSet.cxx
Executable file
@@ -0,0 +1,246 @@
|
||||
#include <IntTools_MarkedRangeSet.ixx>
|
||||
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet() :
|
||||
myRangeNumber(0)
|
||||
{
|
||||
}
|
||||
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet(const Standard_Real theFirstBoundary,
|
||||
const Standard_Real theLastBoundary,
|
||||
const Standard_Integer theInitFlag)
|
||||
{
|
||||
SetBoundaries(theFirstBoundary, theLastBoundary, theInitFlag);
|
||||
}
|
||||
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet(const IntTools_CArray1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
|
||||
{
|
||||
SetRanges(theSortedArray, theInitFlag);
|
||||
}
|
||||
|
||||
void IntTools_MarkedRangeSet::SetBoundaries(const Standard_Real theFirstBoundary,
|
||||
const Standard_Real theLastBoundary,
|
||||
const Standard_Integer theInitFlag)
|
||||
{
|
||||
myRangeSetStorer.Clear();
|
||||
myRangeSetStorer.Append(theFirstBoundary);
|
||||
myRangeSetStorer.Append(theLastBoundary);
|
||||
myRangeNumber = 1;
|
||||
myFlags.Clear();
|
||||
myFlags.Append(theInitFlag);
|
||||
}
|
||||
|
||||
void IntTools_MarkedRangeSet::SetRanges(const IntTools_CArray1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
{
|
||||
myRangeSetStorer.Clear();
|
||||
myFlags.Clear();
|
||||
Standard_Integer i = 0;
|
||||
|
||||
for(i = 0; i < theSortedArray.Length(); i++) {
|
||||
myRangeSetStorer.Append(theSortedArray(i));
|
||||
}
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
|
||||
for(i = 1; i <= myRangeNumber; i++) {
|
||||
myFlags.Append(theInitFlag);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_MarkedRangeSet::InsertRange(const Standard_Real theFirstBoundary,
|
||||
const Standard_Real theLastBoundary,
|
||||
const Standard_Integer theFlag)
|
||||
{
|
||||
Standard_Integer anIndex1 = GetIndex(theFirstBoundary, Standard_True);
|
||||
|
||||
if(!anIndex1)
|
||||
return Standard_False;
|
||||
Standard_Integer anIndex2 = GetIndex(theLastBoundary, Standard_False);
|
||||
|
||||
if(!anIndex2)
|
||||
return Standard_False;
|
||||
|
||||
if(anIndex2 < anIndex1) { // it can be if theLastBoundary==theFirstBoundary==boundary_of_a_range or theFirstBoundary > theLastBoundary
|
||||
Standard_Integer atmpindex = anIndex1;
|
||||
anIndex1 = anIndex2;
|
||||
anIndex2 = atmpindex;
|
||||
|
||||
if(theLastBoundary < theFirstBoundary)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean areEqualIndices = (anIndex1 == anIndex2);
|
||||
Standard_Integer aPrevFlag = myFlags(anIndex1);
|
||||
|
||||
myRangeSetStorer.InsertAfter(anIndex1, theFirstBoundary);
|
||||
anIndex2++;
|
||||
myFlags.InsertAfter(anIndex1, theFlag);
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
|
||||
myRangeSetStorer.InsertAfter(anIndex2, theLastBoundary);
|
||||
|
||||
if(areEqualIndices) {
|
||||
myFlags.InsertAfter(anIndex2, aPrevFlag);
|
||||
}
|
||||
else {
|
||||
myFlags.InsertBefore(anIndex2, theFlag);
|
||||
}
|
||||
|
||||
if(!areEqualIndices) {
|
||||
anIndex1++;
|
||||
anIndex2++;
|
||||
|
||||
for(Standard_Integer i = anIndex1; i < anIndex2; i++) {
|
||||
myFlags.SetValue(i, theFlag);
|
||||
}
|
||||
}
|
||||
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_MarkedRangeSet::InsertRange(const IntTools_Range& theRange,
|
||||
const Standard_Integer theFlag)
|
||||
{
|
||||
return InsertRange(theRange.First(), theRange.Last(), theFlag);
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_MarkedRangeSet::InsertRange(const Standard_Real theFirstBoundary,
|
||||
const Standard_Real theLastBoundary,
|
||||
const Standard_Integer theFlag,
|
||||
const Standard_Integer theIndex)
|
||||
{
|
||||
Standard_Real aTolerance = 1.e-15;
|
||||
Standard_Integer anIndex = theIndex;
|
||||
|
||||
if((theIndex <= 0) || (theIndex > myRangeNumber))
|
||||
return Standard_False;
|
||||
|
||||
if((theFirstBoundary < myRangeSetStorer(theIndex)) ||
|
||||
(theLastBoundary > myRangeSetStorer(theIndex+1)) ||
|
||||
(Abs(theFirstBoundary - theLastBoundary) < aTolerance)) {
|
||||
return InsertRange(theFirstBoundary, theLastBoundary, theFlag);
|
||||
}
|
||||
else {
|
||||
Standard_Integer aPrevFlag = myFlags(anIndex);
|
||||
|
||||
if((Abs(theFirstBoundary - myRangeSetStorer(anIndex)) > aTolerance) &&
|
||||
(Abs(theFirstBoundary - myRangeSetStorer(anIndex+1)) > aTolerance)) {
|
||||
myRangeSetStorer.InsertAfter(anIndex, theFirstBoundary);
|
||||
myFlags.InsertAfter(anIndex, theFlag);
|
||||
anIndex++;
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
}
|
||||
else {
|
||||
myFlags.SetValue(anIndex, theFlag);
|
||||
}
|
||||
|
||||
if((Abs(theLastBoundary - myRangeSetStorer(anIndex)) > aTolerance) &&
|
||||
(Abs(theLastBoundary - myRangeSetStorer(anIndex+1)) > aTolerance)) {
|
||||
myRangeSetStorer.InsertAfter(anIndex, theLastBoundary);
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
myFlags.InsertAfter(anIndex, aPrevFlag);
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_MarkedRangeSet::InsertRange(const IntTools_Range& theRange,
|
||||
const Standard_Integer theFlag,
|
||||
const Standard_Integer theIndex)
|
||||
{
|
||||
return InsertRange(theRange.First(), theRange.Last(), theFlag, theIndex);
|
||||
}
|
||||
|
||||
void IntTools_MarkedRangeSet::SetFlag(const Standard_Integer theIndex,
|
||||
const Standard_Integer theFlag)
|
||||
{
|
||||
myFlags.SetValue(theIndex, theFlag);
|
||||
}
|
||||
|
||||
Standard_Integer IntTools_MarkedRangeSet::Flag(const Standard_Integer theIndex) const
|
||||
{
|
||||
return myFlags(theIndex);
|
||||
}
|
||||
|
||||
const TColStd_SequenceOfInteger& IntTools_MarkedRangeSet::GetIndices(const Standard_Real theValue)
|
||||
{
|
||||
myFoundIndices.Clear();
|
||||
|
||||
if(theValue < myRangeSetStorer(1))
|
||||
return myFoundIndices;
|
||||
else {
|
||||
Standard_Boolean found = Standard_False;
|
||||
|
||||
for(Standard_Integer i = 2; i <= myRangeSetStorer.Length(); i++) {
|
||||
if(found) {
|
||||
if(theValue >= myRangeSetStorer(i-1)) {
|
||||
myFoundIndices.Append(i-1);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(theValue <= myRangeSetStorer(i)) {
|
||||
myFoundIndices.Append(i-1);
|
||||
found = Standard_True;
|
||||
}
|
||||
else {
|
||||
if(found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return myFoundIndices;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IntTools_MarkedRangeSet::GetIndex(const Standard_Real theValue) const
|
||||
{
|
||||
Standard_Integer anIndex = 0;
|
||||
|
||||
if(theValue < myRangeSetStorer(1))
|
||||
anIndex = 0;
|
||||
else {
|
||||
for(Standard_Integer i = 2; i <= myRangeSetStorer.Length(); i++) {
|
||||
if(theValue <= myRangeSetStorer(i)) {
|
||||
anIndex = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
Standard_Integer IntTools_MarkedRangeSet::GetIndex(const Standard_Real theValue,
|
||||
const Standard_Boolean UseLower) const
|
||||
{
|
||||
Standard_Integer anIndex = 0;
|
||||
|
||||
if(UseLower && (theValue < myRangeSetStorer(1)) ||
|
||||
(!UseLower && (theValue <= myRangeSetStorer(1))))
|
||||
anIndex = 0;
|
||||
else {
|
||||
for(Standard_Integer i = 2; i <= myRangeSetStorer.Length(); i++) {
|
||||
if((UseLower && theValue < myRangeSetStorer(i)) ||
|
||||
(!UseLower && theValue <= myRangeSetStorer(i))) {
|
||||
anIndex = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
IntTools_Range IntTools_MarkedRangeSet::Range(const Standard_Integer theIndex) const
|
||||
{
|
||||
IntTools_Range aRange(myRangeSetStorer(theIndex), myRangeSetStorer(theIndex+1));
|
||||
return aRange;
|
||||
}
|
4
src/IntTools/IntTools_MarkedRangeSet.lxx
Executable file
4
src/IntTools/IntTools_MarkedRangeSet.lxx
Executable file
@@ -0,0 +1,4 @@
|
||||
inline Standard_Integer IntTools_MarkedRangeSet::Length() const
|
||||
{
|
||||
return myRangeNumber;
|
||||
}
|
74
src/IntTools/IntTools_PntOn2Faces.cdl
Executable file
74
src/IntTools/IntTools_PntOn2Faces.cdl
Executable file
@@ -0,0 +1,74 @@
|
||||
-- File: IntTools_PntOn2Faces.cdl
|
||||
-- Created: Thu Dec 13 12:00:07 2001
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class PntOn2Faces from IntTools
|
||||
|
||||
---Purpose: Contains two points PntOnFace from IntTools and a flag
|
||||
|
||||
uses
|
||||
PntOnFace from IntTools
|
||||
---raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns PntOn2Faces from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create(aP1: PntOnFace from IntTools;
|
||||
aP2: PntOnFace from IntTools);
|
||||
---Purpose:
|
||||
--- Initializes me by two points aP1 and aP2
|
||||
---
|
||||
|
||||
SetP1 (me:out;
|
||||
aP1: PntOnFace from IntTools);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetP2 (me:out;
|
||||
aP2: PntOnFace from IntTools);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetValid(me:out;
|
||||
bF : Boolean from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
P1(me)
|
||||
returns PntOnFace from IntTools;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
P2(me)
|
||||
returns PntOnFace from IntTools;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
IsValid(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
fields
|
||||
|
||||
myIsValid : Boolean from Standard;
|
||||
myPnt1 : PntOnFace from IntTools;
|
||||
myPnt2 : PntOnFace from IntTools;
|
||||
|
||||
|
||||
end PntOn2Faces;
|
77
src/IntTools/IntTools_PntOn2Faces.cxx
Executable file
77
src/IntTools/IntTools_PntOn2Faces.cxx
Executable file
@@ -0,0 +1,77 @@
|
||||
// File: IntTools_PntOn2Faces.cxx
|
||||
// Created: Thu Dec 13 14:26:44 2001
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
#include <IntTools_PntOn2Faces.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_PntOn2Faces::IntTools_PntOn2Faces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_PntOn2Faces::IntTools_PntOn2Faces()
|
||||
:
|
||||
myIsValid(Standard_False)
|
||||
{}
|
||||
//=======================================================================
|
||||
//function : IntTools_PntOn2Faces::IntTools_PntOn2Faces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_PntOn2Faces::IntTools_PntOn2Faces(const IntTools_PntOnFace& aP1,
|
||||
const IntTools_PntOnFace& aP2)
|
||||
:
|
||||
myIsValid(Standard_False)
|
||||
{
|
||||
myPnt1=aP1;
|
||||
myPnt2=aP2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetP1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOn2Faces::SetP1(const IntTools_PntOnFace& aP)
|
||||
{
|
||||
myPnt1=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetP2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOn2Faces::SetP2(const IntTools_PntOnFace& aP)
|
||||
{
|
||||
myPnt2=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : P1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_PntOnFace& IntTools_PntOn2Faces::P1()const
|
||||
{
|
||||
return myPnt1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : P2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_PntOnFace& IntTools_PntOn2Faces::P2()const
|
||||
{
|
||||
return myPnt2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOn2Faces::SetValid(const Standard_Boolean bF)
|
||||
{
|
||||
myIsValid=bF;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_PntOn2Faces::IsValid()const
|
||||
{
|
||||
return myIsValid;
|
||||
}
|
||||
|
98
src/IntTools/IntTools_PntOnFace.cdl
Executable file
98
src/IntTools/IntTools_PntOnFace.cdl
Executable file
@@ -0,0 +1,98 @@
|
||||
-- File: IntTools_PntOnFace.cdl
|
||||
-- Created: Thu Dec 13 12:06:44 2001
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class PntOnFace from IntTools
|
||||
|
||||
---Purpose: Contains a Face, a 3d point, corresponded UV parameters and a flag
|
||||
|
||||
uses
|
||||
Face from TopoDS,
|
||||
Pnt from gp
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns PntOnFace from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Init(me:out;
|
||||
aF: Face from TopoDS;
|
||||
aP: Pnt from gp;
|
||||
U : Real from Standard;
|
||||
V : Real from Standard);
|
||||
---Purpose:
|
||||
--- Initializes me by aFace, a 3d point
|
||||
--- and it's UV parameters on face
|
||||
---
|
||||
|
||||
SetFace(me:out;
|
||||
aF:Face from TopoDS);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetPnt (me:out;
|
||||
aP:Pnt from gp);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetParameters (me:out;
|
||||
U : Real from Standard;
|
||||
V : Real from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetValid(me:out;
|
||||
bF : Boolean from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
Valid(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
Face(me)
|
||||
returns Face from TopoDS;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
Pnt (me)
|
||||
returns Pnt from gp;
|
||||
---C++: return const &
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
Parameters (me;
|
||||
U :out Real from Standard;
|
||||
V :out Real from Standard);
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
IsValid(me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Selector
|
||||
|
||||
fields
|
||||
|
||||
myIsValid : Boolean from Standard;
|
||||
myPnt : Pnt from gp;
|
||||
myU : Real from Standard;
|
||||
myV : Real from Standard;
|
||||
myFace: Face from TopoDS;
|
||||
end PntOnFace;
|
107
src/IntTools/IntTools_PntOnFace.cxx
Executable file
107
src/IntTools/IntTools_PntOnFace.cxx
Executable file
@@ -0,0 +1,107 @@
|
||||
// File: IntTools_PntOnFace.cxx
|
||||
// Created: Thu Dec 13 14:16:59 2001
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_PntOnFace.ixx>
|
||||
//=======================================================================
|
||||
//function : IntTools_PntOnFace::IntTools_PntOnFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_PntOnFace::IntTools_PntOnFace()
|
||||
:
|
||||
myIsValid(Standard_False),
|
||||
myU(99.),
|
||||
myV(99.)
|
||||
{}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::Init(const TopoDS_Face& aF,
|
||||
const gp_Pnt& aP,
|
||||
const Standard_Real anU,
|
||||
const Standard_Real aV)
|
||||
{
|
||||
myFace=aF;
|
||||
myPnt=aP;
|
||||
myU=anU;
|
||||
myV=aV;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::SetFace(const TopoDS_Face& aF)
|
||||
{
|
||||
myFace=aF;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::SetPnt(const gp_Pnt& aP)
|
||||
{
|
||||
myPnt=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::SetParameters(const Standard_Real anU,
|
||||
const Standard_Real aV)
|
||||
{
|
||||
myU=anU;
|
||||
myV=aV;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::SetValid(const Standard_Boolean bF)
|
||||
{
|
||||
myIsValid=bF;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Face& IntTools_PntOnFace::Face()const
|
||||
{
|
||||
return myFace;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Pnt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Pnt& IntTools_PntOnFace::Pnt()const
|
||||
{
|
||||
return myPnt;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_PntOnFace::Parameters(Standard_Real& anU,
|
||||
Standard_Real& aV)const
|
||||
{
|
||||
anU=myU;
|
||||
aV=myV;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Valid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_PntOnFace::Valid()const
|
||||
{
|
||||
return myIsValid;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
58
src/IntTools/IntTools_Range.cdl
Executable file
58
src/IntTools/IntTools_Range.cdl
Executable file
@@ -0,0 +1,58 @@
|
||||
-- File: IntTools_Range.cdl
|
||||
-- Created: Thu May 18 13:35:47 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class Range from IntTools
|
||||
|
||||
---Purpose: The class describes the 1-d range
|
||||
-- [myFirst, myLast].
|
||||
|
||||
--uses
|
||||
is
|
||||
Create
|
||||
returns Range from IntTools ;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aFirst:Real from Standard; aLast:Real from Standard)
|
||||
returns Range from IntTools ;
|
||||
---Purpose:
|
||||
--- Initialize me by range boundaries
|
||||
---
|
||||
|
||||
SetFirst(me:out; aFirst:Real from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
SetLast (me:out; aLast:Real from Standard);
|
||||
---Purpose:
|
||||
--- Modifier
|
||||
---
|
||||
|
||||
First (me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
Last (me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
Range (me; aFirst:out Real from Standard;
|
||||
aLast :out Real from Standard);
|
||||
---Purpose:
|
||||
--- Selector
|
||||
---
|
||||
|
||||
fields
|
||||
myFirst: Real from Standard;
|
||||
myLast : Real from Standard;
|
||||
end Range;
|
63
src/IntTools/IntTools_Range.cxx
Executable file
63
src/IntTools/IntTools_Range.cxx
Executable file
@@ -0,0 +1,63 @@
|
||||
// File: IntTools_Range.cxx
|
||||
// Created: Thu May 18 13:44:43 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_Range.ixx>
|
||||
//=======================================================================
|
||||
//function : IntTools_Range::IntTools_Range
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Range::IntTools_Range():myFirst(0.), myLast(0.) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_Range::IntTools_Range
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Range::IntTools_Range(const Standard_Real aFirst,const Standard_Real aLast)
|
||||
{
|
||||
myFirst=aFirst;
|
||||
myLast=aLast;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFirst
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Range::SetFirst(const Standard_Real aFirst)
|
||||
{
|
||||
myFirst=aFirst;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetLast
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Range::SetLast(const Standard_Real aLast)
|
||||
{
|
||||
myLast=aLast;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Range::First() const
|
||||
{
|
||||
return myFirst;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Range::Last() const
|
||||
{
|
||||
return myLast;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Range
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Range::Range(Standard_Real& aFirst,Standard_Real& aLast) const
|
||||
{
|
||||
aFirst=myFirst;
|
||||
aLast =myLast;
|
||||
}
|
135
src/IntTools/IntTools_Root.cdl
Executable file
135
src/IntTools/IntTools_Root.cdl
Executable file
@@ -0,0 +1,135 @@
|
||||
-- File: IntTools_Root.cdl
|
||||
-- Created: Mon May 22 16:46:21 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class Root from IntTools
|
||||
|
||||
---Purpose: The class is to describe the root of
|
||||
-- function of one variable for Edge/Edge
|
||||
-- and Edge/Surface algorithms.
|
||||
|
||||
uses
|
||||
State from TopAbs
|
||||
|
||||
---raises
|
||||
is
|
||||
Create
|
||||
returns Root from IntTools ;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create(aRoot: Real from Standard;
|
||||
aType: Integer from Standard)
|
||||
returns Root from IntTools ;
|
||||
---Purpose:
|
||||
--- Initializes my by range of parameters
|
||||
--- and type of root
|
||||
---
|
||||
|
||||
SetRoot (me:out; aRoot: Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the Root's value
|
||||
---
|
||||
|
||||
SetType (me:out; aType: Integer from Standard);
|
||||
---Purpose:
|
||||
--- Sets the Root's Type
|
||||
---
|
||||
|
||||
SetStateBefore (me:out; aState: State from TopAbs);
|
||||
---Purpose:
|
||||
--- Set the value of the state before the root
|
||||
--- (at t=Root-dt)
|
||||
---
|
||||
|
||||
SetStateAfter (me:out; aState: State from TopAbs);
|
||||
---Purpose:
|
||||
--- Set the value of the state after the root
|
||||
--- (at t=Root-dt)
|
||||
---
|
||||
|
||||
SetLayerHeight (me:out; aHeight:Real from Standard);
|
||||
---Purpose:
|
||||
--- Not used in Edge/Edge algorithm
|
||||
---
|
||||
|
||||
SetInterval (me:out; t1, t2, f1, f2:Real from Standard);
|
||||
---Purpose:
|
||||
--- Sets the interval from which the Root was
|
||||
--- found [t1,t2] and the corresponding values
|
||||
--- of the function on the bounds f(t1), f(t2).
|
||||
---
|
||||
|
||||
Root (me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns the Root value
|
||||
---
|
||||
|
||||
Type (me)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns the type of the root
|
||||
--- =0 - Simple (was found by bisection method);
|
||||
--- =2 - Smart when f1=0, f2!=0 or vice versa
|
||||
--- (was found by Fibbonacci method);
|
||||
--- =1 - Pure (pure zero for all t [t1,t2] );
|
||||
|
||||
StateBefore(me)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns the state before the root
|
||||
---
|
||||
|
||||
StateAfter(me)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
--- Returns the state after the root
|
||||
---
|
||||
|
||||
LayerHeight (me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Not used in Edge/Edge algorithm
|
||||
---
|
||||
|
||||
IsValid (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns the validity flag for the root,
|
||||
--- True if
|
||||
--- myStateBefore==TopAbs_OUT && myStateAfter==TopAbs_IN or
|
||||
--- myStateBefore==TopAbs_OUT && myStateAfter==TopAbs_ON or
|
||||
--- myStateBefore==TopAbs_ON && myStateAfter==TopAbs_OUT or
|
||||
--- myStateBefore==TopAbs_IN && myStateAfter==TopAbs_OUT .
|
||||
--- For other cases it returns False.
|
||||
---
|
||||
|
||||
Interval (me; t1:out Real from Standard;
|
||||
t2:out Real from Standard;
|
||||
f1:out Real from Standard;
|
||||
f2:out Real from Standard);
|
||||
---Purpose:
|
||||
--- Returns the values of interval from which the Root was
|
||||
--- found [t1,t2] and the corresponding values
|
||||
--- of the function on the bounds f(t1), f(t2).
|
||||
---
|
||||
|
||||
fields
|
||||
myRoot: Real from Standard;
|
||||
|
||||
myType: Integer from Standard;
|
||||
|
||||
myLayerHeight: Real from Standard;
|
||||
myStateBefore: State from TopAbs;
|
||||
myStateAfter : State from TopAbs;
|
||||
|
||||
myt1: Real from Standard;
|
||||
myt2: Real from Standard;
|
||||
myf1: Real from Standard;
|
||||
myf2: Real from Standard;
|
||||
end Root;
|
168
src/IntTools/IntTools_Root.cxx
Executable file
168
src/IntTools/IntTools_Root.cxx
Executable file
@@ -0,0 +1,168 @@
|
||||
// File: IntTools_Root.cxx
|
||||
// Created: Mon May 22 16:49:56 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <IntTools_Root.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function :IntTools_Root::IntTools_Root
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Root::IntTools_Root():
|
||||
myRoot(0.),myType(-1),myLayerHeight(0.),
|
||||
myStateBefore(TopAbs_UNKNOWN),
|
||||
myStateAfter(TopAbs_UNKNOWN),
|
||||
myt1(0.),
|
||||
myt2(0.),
|
||||
myf1(0.),
|
||||
myf2(0.)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function :IntTools_Root::IntTools_Root
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_Root::IntTools_Root(const Standard_Real aRoot,
|
||||
const Standard_Integer aType):
|
||||
myLayerHeight(0.),
|
||||
myStateBefore(TopAbs_UNKNOWN),
|
||||
myStateAfter(TopAbs_UNKNOWN),
|
||||
myt1(0.),
|
||||
myt2(0.),
|
||||
myf1(0.),
|
||||
myf2(0.)
|
||||
{
|
||||
myRoot=aRoot;
|
||||
myType=aType;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :SetRoot
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetRoot(const Standard_Real aRoot)
|
||||
{
|
||||
myRoot=aRoot;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetType(const Standard_Integer aType)
|
||||
{
|
||||
myType=aType;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetStateBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetStateBefore(const TopAbs_State aState)
|
||||
{
|
||||
myStateBefore=aState;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetStateAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetStateAfter(const TopAbs_State aState)
|
||||
{
|
||||
myStateAfter=aState;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetLayerHeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetLayerHeight(const Standard_Real aHeight)
|
||||
{
|
||||
myLayerHeight=aHeight;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :SetInterval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::SetInterval(const Standard_Real t1,
|
||||
const Standard_Real t2,
|
||||
const Standard_Real f1,
|
||||
const Standard_Real f2)
|
||||
{
|
||||
myt1=t1;
|
||||
myt2=t2;
|
||||
myf1=f1;
|
||||
myf2=f2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Root::Interval(Standard_Real& t1,
|
||||
Standard_Real& t2,
|
||||
Standard_Real& f1,
|
||||
Standard_Real& f2) const
|
||||
{
|
||||
t1=myt1;
|
||||
t2=myt2;
|
||||
f1=myf1;
|
||||
f2=myf2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :Root
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Root::Root() const
|
||||
{
|
||||
return myRoot;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Root::Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :StateBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_Root::StateBefore() const
|
||||
{
|
||||
return myStateBefore;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :StateAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_Root::StateAfter() const
|
||||
{
|
||||
return myStateAfter;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :LayerHeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Root::LayerHeight() const
|
||||
{
|
||||
return myLayerHeight;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Root::IsValid() const
|
||||
{
|
||||
if (myStateBefore==TopAbs_OUT && myStateAfter==TopAbs_IN )
|
||||
return Standard_True;
|
||||
if (myStateBefore==TopAbs_OUT && myStateAfter==TopAbs_ON )
|
||||
return Standard_True;
|
||||
if (myStateBefore==TopAbs_ON && myStateAfter==TopAbs_OUT)
|
||||
return Standard_True;
|
||||
if (myStateBefore==TopAbs_IN && myStateAfter==TopAbs_OUT)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
111
src/IntTools/IntTools_ShrunkRange.cdl
Executable file
111
src/IntTools/IntTools_ShrunkRange.cdl
Executable file
@@ -0,0 +1,111 @@
|
||||
-- File: IntTools_ShrunkRange.cdl
|
||||
-- Created: Sun Mar 11 10:31:46 2001
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class ShrunkRange from IntTools
|
||||
|
||||
---Purpose:
|
||||
--- The class provides the computation of
|
||||
--- a working (shrunk) range [t1, t2] for
|
||||
--- the 3D-curve of the edge.
|
||||
|
||||
uses
|
||||
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
Range from IntTools,
|
||||
Box from Bnd,
|
||||
Context from IntTools,
|
||||
PContext from IntTools
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns ShrunkRange from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create (aE : Edge from TopoDS;
|
||||
aV1 : Vertex from TopoDS;
|
||||
aV2 : Vertex from TopoDS;
|
||||
aR : Range from IntTools;
|
||||
ICtx: Context from IntTools)
|
||||
returns ShrunkRange from IntTools;
|
||||
---Purpose:
|
||||
---
|
||||
|
||||
SetShrunkRange(me:out; aR:Range from IntTools);
|
||||
---Purpose:
|
||||
--- Sets an shrunk range
|
||||
---
|
||||
|
||||
ShrunkRange(me)
|
||||
returns Range from IntTools;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns shrunk range
|
||||
---
|
||||
|
||||
BndBox (me)
|
||||
returns Box from Bnd;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns bounding box for edge restricted
|
||||
--- by shrunk range
|
||||
---
|
||||
|
||||
Edge (me)
|
||||
returns Edge from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
--- Returns edge for which
|
||||
--- the shrunk range is computed
|
||||
---
|
||||
|
||||
Perform(me:out);
|
||||
---Purpose:
|
||||
--- Computes shrunk range for
|
||||
--- an edge given in constructor
|
||||
---
|
||||
|
||||
|
||||
IsDone (me)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns true if no error occured
|
||||
--- during shrunk range computation
|
||||
---
|
||||
|
||||
ErrorStatus(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Returns code of computing shrunk range
|
||||
--- completion
|
||||
--- 0 - means successful completion
|
||||
--- 1 - nothing has been done
|
||||
--- 2 - initial range is out of edge's range
|
||||
--- 3 - first boundary of initial range is more than
|
||||
--- last boundary
|
||||
--- 4 - projection of first vertex failed
|
||||
--- 5 - projection of second vertex failed
|
||||
--- 6 - shrunk range can not be computed
|
||||
--- shrunk range is setted to initial range
|
||||
---
|
||||
|
||||
fields
|
||||
myEdge : Edge from TopoDS;
|
||||
myV1 : Vertex from TopoDS;
|
||||
myV2 : Vertex from TopoDS;
|
||||
myRange : Range from IntTools;
|
||||
myShrunkRange : Range from IntTools;
|
||||
myBndBox : Box from Bnd;
|
||||
myCtx : PContext from IntTools;
|
||||
myIsDone : Boolean from Standard;
|
||||
myErrorStatus : Integer from Standard;
|
||||
|
||||
end ShrunkRange;
|
432
src/IntTools/IntTools_ShrunkRange.cxx
Executable file
432
src/IntTools/IntTools_ShrunkRange.cxx
Executable file
@@ -0,0 +1,432 @@
|
||||
// File: IntTools_ShrunkRange.cxx
|
||||
// Created: Sun Mar 11 10:38:43 2001
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#include <IntTools_ShrunkRange.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BndLib_Add3dCurve.hxx>
|
||||
|
||||
#include <IntTools_Tools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_ShrunkRange::IntTools_ShrunkRange ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_ShrunkRange::IntTools_ShrunkRange (const TopoDS_Edge& aE,
|
||||
const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Vertex& aV2,
|
||||
const IntTools_Range& aR,
|
||||
const IntTools_Context& aCtx)
|
||||
{
|
||||
myEdge=aE;
|
||||
myV1=aV1;
|
||||
myV2=aV2;
|
||||
myRange=aR;
|
||||
myCtx=(IntTools_PContext)&aCtx;
|
||||
myIsDone=Standard_False;
|
||||
myErrorStatus=1;
|
||||
Perform();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Edge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Edge& IntTools_ShrunkRange::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const IntTools_Range& IntTools_ShrunkRange::ShrunkRange() const
|
||||
{
|
||||
return myShrunkRange;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BndBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Bnd_Box& IntTools_ShrunkRange::BndBox() const
|
||||
{
|
||||
return myBndBox;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_ShrunkRange::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ErrorStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_ShrunkRange::ErrorStatus() const
|
||||
{
|
||||
return myErrorStatus;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_ShrunkRange::Perform()
|
||||
{
|
||||
Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C;
|
||||
Standard_Real aCoeff, dt1, dt2, aR;
|
||||
Standard_Integer pri;
|
||||
Standard_Boolean bInf1, bInf2;
|
||||
GeomAbs_CurveType aCurveType;
|
||||
Handle(Geom_Curve) aC;
|
||||
//
|
||||
aTolE =BRep_Tool::Tolerance(myEdge);
|
||||
aTolV1=BRep_Tool::Tolerance(myV1);
|
||||
aTolV2=BRep_Tool::Tolerance(myV2);
|
||||
//xf
|
||||
//dt1=aCoeff*(aTolV1+aTolE);
|
||||
//dt2=aCoeff*(aTolV2+aTolE);
|
||||
//xt
|
||||
myRange.Range (t1, t2);
|
||||
//
|
||||
BRepAdaptor_Curve aBAC(myEdge);
|
||||
aCurveType=aBAC.GetType();
|
||||
//
|
||||
aC=BRep_Tool::Curve(myEdge, aCF, aCL);
|
||||
BRep_Tool::Range(myEdge, aCF, aCL);
|
||||
//
|
||||
if (t1 < aCF || t2 > aCL) {
|
||||
myErrorStatus=2;
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (t1 > t2 ) {
|
||||
myErrorStatus=3;
|
||||
return;
|
||||
}
|
||||
//
|
||||
aCoeff=2.;
|
||||
// xf
|
||||
if (aCurveType==GeomAbs_Line) {
|
||||
Standard_Real aTV1, aTV2, aEps;
|
||||
gp_Pnt aPV1, aPV2, aPC1, aPC2;
|
||||
gp_Lin aL;
|
||||
//
|
||||
aEps=Precision::Confusion();
|
||||
aEps=aEps*aEps;//1.e-14;
|
||||
aL=aBAC.Line();
|
||||
//
|
||||
aPV1=BRep_Tool::Pnt(myV1);
|
||||
aTV1=ElCLib::Parameter(aL, aPV1);
|
||||
//
|
||||
aPV2=BRep_Tool::Pnt(myV2);
|
||||
aTV2=ElCLib::Parameter(aL, aPV2);
|
||||
//
|
||||
if (fabs(aTV1-aCF)<aEps && fabs(aTV2-aCL)<aEps) {
|
||||
aCoeff=1.;
|
||||
}
|
||||
}
|
||||
//
|
||||
dt1=aCoeff*(aTolV1+aTolE);
|
||||
dt2=aCoeff*(aTolV2+aTolE);
|
||||
// xt
|
||||
//
|
||||
if (aCurveType==GeomAbs_Line) {
|
||||
Standard_Real dt1x, dt2x;
|
||||
|
||||
dt1x = aBAC.Resolution(dt1);
|
||||
t11=t1+dt1x;
|
||||
|
||||
dt2x = aBAC.Resolution(dt2);
|
||||
t12=t2-dt2x;
|
||||
|
||||
if (t11>t2 || t12<t1) {
|
||||
t1C=t1;
|
||||
t2C=t2;
|
||||
myShrunkRange.SetFirst(t1C);
|
||||
myShrunkRange.SetLast (t2C);
|
||||
//
|
||||
// BndBox
|
||||
Standard_Real ddx=aTolE;//1.e-12;
|
||||
BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
|
||||
|
||||
myErrorStatus=6;
|
||||
myIsDone=Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aCurveType==GeomAbs_Circle) {
|
||||
gp_Circ aCrc=aBAC.Circle();
|
||||
aR=aCrc.Radius();
|
||||
t1C=t1+dt1/aR;
|
||||
t2C=t2-dt2/aR;
|
||||
}
|
||||
|
||||
else {
|
||||
//
|
||||
// Vertex1 => t1C
|
||||
gp_Pnt aP1,aP11;
|
||||
aC->D0 (t1, aP1);
|
||||
//
|
||||
bInf1=Precision::IsNegativeInfinite(t1);
|
||||
if (bInf1) {
|
||||
t1C=t1;
|
||||
}
|
||||
//
|
||||
else {
|
||||
Standard_Real d1 = aCoeff*(aTolV1+aTolE);
|
||||
// dt1 = aBAC.Resolution(d1);
|
||||
//
|
||||
gp_Vec aD1vec1;
|
||||
gp_Pnt aPoint;
|
||||
aBAC.D1(t1, aPoint, aD1vec1);
|
||||
Standard_Real ad1length1 = aD1vec1.Magnitude();
|
||||
Standard_Boolean bTryOtherPoints = Standard_False;
|
||||
dt1 = (t2 - t1) * 0.5;
|
||||
|
||||
if(ad1length1 > 1.e-12) {
|
||||
dt1 = d1 / ad1length1;
|
||||
|
||||
if(dt1 > (t2 - t1)) {
|
||||
// bad parametrization, big tolerance or too small range
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
|
||||
if(bTryOtherPoints) {
|
||||
Standard_Integer nbsamples = 5;
|
||||
Standard_Integer ii = 0;
|
||||
Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
|
||||
Standard_Boolean bFound = Standard_False;
|
||||
|
||||
for(ii = 1; ii <= nbsamples; ii++) {
|
||||
Standard_Real aparameter = t1 + (adelta * ii);
|
||||
gp_Pnt aPoint2;
|
||||
aBAC.D1(aparameter, aPoint2, aD1vec1);
|
||||
|
||||
if(aPoint.Distance(aPoint2) < d1)
|
||||
dt1 = adelta * ii;
|
||||
ad1length1 = aD1vec1.Magnitude();
|
||||
|
||||
if(ad1length1 > 1.e-12) {
|
||||
dt1 = d1 / ad1length1;
|
||||
|
||||
if(dt1 < (t2 - t1)) {
|
||||
bFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound) {
|
||||
if(dt1 > (t2 - t1)) {
|
||||
dt1 = aBAC.Resolution(d1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
t11=t1+dt1;
|
||||
aC->D0 (t11, aP11);
|
||||
|
||||
gp_Vec aV11(aP1, aP11);
|
||||
// avoid exception if aP1 == aP11
|
||||
if (aV11.SquareMagnitude() < gp::Resolution())
|
||||
t1C = t1;
|
||||
else {
|
||||
gp_Dir aD11(aV11);
|
||||
|
||||
gp_Pnt aP1L;
|
||||
//
|
||||
aP1L.SetCoord (aP1.X()+d1*aD11.X(),
|
||||
aP1.Y()+d1*aD11.Y(),
|
||||
aP1.Z()+d1*aD11.Z());
|
||||
|
||||
BRepBuilderAPI_MakeVertex aMV1(aP1L);
|
||||
const TopoDS_Vertex& aV1L=aMV1.Vertex();
|
||||
//
|
||||
pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
|
||||
//
|
||||
if (pri==-3) {
|
||||
//modified by NIZNHY-PKV Tue Apr 6 14:06:29 2010
|
||||
t1C = t1;
|
||||
//myErrorStatus=4;
|
||||
//return;
|
||||
//modified by NIZNHY-PKV Tue Apr 6 14:06:31 2010
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Vertex2 => t2C
|
||||
gp_Pnt aP2, aP12;
|
||||
aC->D0 (t2, aP2);
|
||||
//
|
||||
bInf2=Precision::IsPositiveInfinite(t2);
|
||||
if (bInf2) {
|
||||
t2C=t2;
|
||||
}
|
||||
//
|
||||
else {
|
||||
Standard_Real d2 = aCoeff*(aTolV2+aTolE);
|
||||
// dt2 = aBAC.Resolution(d2);
|
||||
|
||||
//
|
||||
gp_Vec aD1vec2;
|
||||
gp_Pnt aPoint;
|
||||
aBAC.D1(t2, aPoint, aD1vec2);
|
||||
Standard_Real ad1length2 = aD1vec2.Magnitude();
|
||||
Standard_Boolean bTryOtherPoints = Standard_False;
|
||||
dt2 = (t2 - t1) * 0.5;
|
||||
|
||||
if(ad1length2 > 1.e-12) {
|
||||
dt2 = d2 / ad1length2;
|
||||
|
||||
if(dt2 > (t2 - t1)) {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bTryOtherPoints = Standard_True;
|
||||
}
|
||||
|
||||
if(bTryOtherPoints) {
|
||||
Standard_Integer nbsamples = 5;
|
||||
Standard_Integer ii = 0;
|
||||
Standard_Real adelta = (t2 - t1) / (nbsamples + 1);
|
||||
Standard_Boolean bFound = Standard_False;
|
||||
|
||||
for(ii = 1; ii <= nbsamples; ii++) {
|
||||
Standard_Real aparameter = t2 - (adelta * ii);
|
||||
gp_Pnt aPoint2;
|
||||
aBAC.D1(aparameter, aPoint2, aD1vec2);
|
||||
|
||||
if(aPoint.Distance(aPoint2) < d2)
|
||||
dt2 = adelta * ii;
|
||||
ad1length2 = aD1vec2.Magnitude();
|
||||
|
||||
if(ad1length2 > 1.e-12) {
|
||||
dt2 = d2 / ad1length2;
|
||||
|
||||
if(dt2 < (t2 - t1)) {
|
||||
bFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound) {
|
||||
if(dt2 > (t2 - t1)) {
|
||||
dt2 = aBAC.Resolution(d2);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
t12=t2-dt2;
|
||||
aC->D0 (t12, aP12);
|
||||
|
||||
gp_Vec aV12(aP2, aP12);
|
||||
// avoid exception if aP1 == aP11
|
||||
if (aV12.SquareMagnitude() < gp::Resolution())
|
||||
t2C = t2;
|
||||
else {
|
||||
gp_Dir aD12(aV12);
|
||||
|
||||
gp_Pnt aP2L;
|
||||
//
|
||||
aP2L.SetCoord (aP2.X()+d2*aD12.X(),
|
||||
aP2.Y()+d2*aD12.Y(),
|
||||
aP2.Z()+d2*aD12.Z());
|
||||
|
||||
BRepBuilderAPI_MakeVertex aMV2(aP2L);
|
||||
const TopoDS_Vertex& aV2L=aMV2.Vertex();
|
||||
//
|
||||
pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
|
||||
//
|
||||
if (pri==-3) {
|
||||
//modified by NIZNHY-PKV Tue Apr 6 14:07:34 2010f
|
||||
t2C = t2;
|
||||
//myErrorStatus=5;
|
||||
//return;
|
||||
//modified by NIZNHY-PKV Tue Apr 6 14:07:39 2010t
|
||||
}
|
||||
}
|
||||
}
|
||||
} // else {
|
||||
|
||||
|
||||
if (t1C>t2){
|
||||
t1C=0.5*(t2+t1);
|
||||
t2C=t1C+0.1*(t2-t1C);
|
||||
}
|
||||
|
||||
if (t1C>t2C) {
|
||||
t2C=t1C+0.1*(t2-t1C);
|
||||
}
|
||||
|
||||
myShrunkRange.SetFirst(t1C);
|
||||
myShrunkRange.SetLast (t2C);
|
||||
//
|
||||
// BndBox
|
||||
Standard_Real ddx=aTolE;//1.e-12;
|
||||
BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
|
||||
//
|
||||
// Ok
|
||||
myErrorStatus=0;
|
||||
myIsDone=Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetShrunkRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_ShrunkRange::SetShrunkRange(const IntTools_Range& aR)
|
||||
{
|
||||
Standard_Real f, l;
|
||||
aR.Range(f, l);
|
||||
|
||||
myShrunkRange.SetFirst(f);
|
||||
myShrunkRange.SetLast (l);
|
||||
|
||||
BRepAdaptor_Curve aBAC(myEdge);
|
||||
BndLib_Add3dCurve::Add (aBAC, f, l, 0., myBndBox);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// myErrorStatus :
|
||||
//
|
||||
// 1- Nothing has been done
|
||||
// 2- The source range is out of the edge's range
|
||||
// 3- t1 < t2 for source range
|
||||
// 4- Can not project V1L to the Edge;
|
||||
// 5- Can not project V2L to the Edge;
|
||||
// 6- for obtained shrunk range [t11, t12] -> t11>t2 || t12<t1;
|
180
src/IntTools/IntTools_SurfaceRangeLocalizeData.cdl
Executable file
180
src/IntTools/IntTools_SurfaceRangeLocalizeData.cdl
Executable file
@@ -0,0 +1,180 @@
|
||||
-- File: IntTools_SurfaceRangeLocalizeData.cdl
|
||||
-- Created: Fri Oct 14 19:27:27 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class SurfaceRangeLocalizeData from IntTools
|
||||
uses
|
||||
Box from Bnd,
|
||||
SurfaceRangeSample from IntTools,
|
||||
MapOfSurfaceSample from IntTools,
|
||||
ListOfSurfaceRangeSample from IntTools,
|
||||
DataMapOfSurfaceSampleBox from IntTools,
|
||||
Pnt from gp,
|
||||
HArray1OfReal from TColStd,
|
||||
HArray2OfPnt from TColgp
|
||||
|
||||
is
|
||||
Create
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
|
||||
Create(theNbSampleU: Integer from Standard;
|
||||
theNbSampleV: Integer from Standard;
|
||||
theMinRangeU: Real from Standard;
|
||||
theMinRangeV: Real from Standard)
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
|
||||
Create(Other: SurfaceRangeLocalizeData from IntTools)
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
|
||||
Assign(me: in out; Other: SurfaceRangeLocalizeData from IntTools)
|
||||
returns SurfaceRangeLocalizeData from IntTools;
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
GetNbSampleU(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetNbSampleV(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetMinRangeU(me)
|
||||
returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetMinRangeV(me)
|
||||
returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
AddOutRange(me: in out; theRange: SurfaceRangeSample from IntTools);
|
||||
|
||||
AddBox(me: in out; theRange: SurfaceRangeSample from IntTools;
|
||||
theBox: Box from Bnd);
|
||||
|
||||
FindBox(me; theRange: SurfaceRangeSample from IntTools;
|
||||
theBox: out Box from Bnd)
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsRangeOut(me; theRange: SurfaceRangeSample from IntTools)
|
||||
returns Boolean from Standard;
|
||||
|
||||
ListRangeOut(me; theList: out ListOfSurfaceRangeSample from IntTools);
|
||||
|
||||
RemoveRangeOutAll(me: in out);
|
||||
|
||||
-- Modified by skv - Wed Nov 2 18:37:33 2005 Optimization Begin
|
||||
SetGridDeflection(me: in out; theDeflection: Real from Standard);
|
||||
---Purpose: Set the grid deflection.
|
||||
---C++: inline
|
||||
|
||||
GetGridDeflection(me)
|
||||
---Purpose: Query the grid deflection.
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
SetRangeUGrid(me: in out; theNbUGrid: Integer from Standard);
|
||||
---Purpose: Set the range U of the grid of points.
|
||||
|
||||
GetRangeUGrid(me)
|
||||
---Purpose: Query the range U of the grid of points.
|
||||
---C++: inline
|
||||
returns Integer from Standard;
|
||||
|
||||
SetUParam(me: in out; theIndex: Integer from Standard;
|
||||
theUParam: Real from Standard);
|
||||
---Purpose: Set the U parameter of the grid points at that index.
|
||||
---C++: inline
|
||||
|
||||
GetUParam(me; theIndex: Integer from Standard)
|
||||
---Purpose: Query the U parameter of the grid points at that index.
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
SetRangeVGrid(me: in out; theNbVGrid: Integer from Standard);
|
||||
---Purpose: Set the range V of the grid of points.
|
||||
|
||||
GetRangeVGrid(me)
|
||||
---Purpose: Query the range V of the grid of points.
|
||||
---C++: inline
|
||||
returns Integer from Standard;
|
||||
|
||||
SetVParam(me: in out; theIndex: Integer from Standard;
|
||||
theVParam: Real from Standard);
|
||||
---Purpose: Set the V parameter of the grid points at that index.
|
||||
---C++: inline
|
||||
|
||||
GetVParam(me; theIndex: Integer from Standard)
|
||||
---Purpose: Query the V parameter of the grid points at that index.
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
SetGridPoint(me: in out; theUIndex: Integer from Standard;
|
||||
theVIndex: Integer from Standard;
|
||||
thePoint: Pnt from gp);
|
||||
---Purpose: Set the grid point.
|
||||
---C++: inline
|
||||
|
||||
GetGridPoint(me; theUIndex: Integer from Standard;
|
||||
theVIndex: Integer from Standard)
|
||||
---Purpose: Set the grid point.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
returns Pnt from gp;
|
||||
|
||||
SetFrame(me: in out; theUMin: Real from Standard;
|
||||
theUMax: Real from Standard;
|
||||
theVMin: Real from Standard;
|
||||
theVMax: Real from Standard);
|
||||
---Purpose: Sets the frame area. Used to work with grid points.
|
||||
|
||||
GetNBUPointsInFrame(me)
|
||||
---Purpose: Returns the number of grid points on U direction in frame.
|
||||
---C++: inline
|
||||
returns Integer from Standard;
|
||||
|
||||
GetNBVPointsInFrame(me)
|
||||
---Purpose: Returns the number of grid points on V direction in frame.
|
||||
---C++: inline
|
||||
returns Integer from Standard;
|
||||
|
||||
GetPointInFrame(me; theUIndex: Integer from Standard;
|
||||
theVIndex: Integer from Standard)
|
||||
---Purpose: Returns the grid point in frame.
|
||||
---C++: return const &
|
||||
returns Pnt from gp;
|
||||
|
||||
GetUParamInFrame(me; theIndex: Integer from Standard)
|
||||
---Purpose: Query the U parameter of the grid points
|
||||
-- at that index in frame.
|
||||
returns Real from Standard;
|
||||
|
||||
GetVParamInFrame(me; theIndex: Integer from Standard)
|
||||
---Purpose: Query the V parameter of the grid points
|
||||
-- at that index in frame.
|
||||
returns Real from Standard;
|
||||
|
||||
ClearGrid(me: in out);
|
||||
---Purpose: Clears the grid of points.
|
||||
|
||||
-- Modified by skv - Wed Nov 2 18:37:33 2005 Optimization End
|
||||
|
||||
fields
|
||||
myNbSampleU: Integer from Standard;
|
||||
myNbSampleV: Integer from Standard;
|
||||
myMinRangeU: Real from Standard;
|
||||
myMinRangeV: Real from Standard;
|
||||
myMapRangeOut: MapOfSurfaceSample from IntTools;
|
||||
myMapBox : DataMapOfSurfaceSampleBox from IntTools;
|
||||
myUParams : HArray1OfReal from TColStd;
|
||||
myVParams : HArray1OfReal from TColStd;
|
||||
myGridPoints : HArray2OfPnt from TColgp;
|
||||
myUIndMin : Integer from Standard;
|
||||
myUIndMax : Integer from Standard;
|
||||
myVIndMin : Integer from Standard;
|
||||
myVIndMax : Integer from Standard;
|
||||
myDeflection : Real from Standard;
|
||||
|
||||
end SurfaceRangeLocalizeData from IntTools;
|
263
src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx
Executable file
263
src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx
Executable file
@@ -0,0 +1,263 @@
|
||||
// File: IntTools_SurfaceRangeLocalizeData.cxx
|
||||
// Created: Fri Oct 14 19:53:14 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_SurfaceRangeLocalizeData.ixx>
|
||||
#include <IntTools_ListIteratorOfListOfSurfaceRangeSample.hxx>
|
||||
#include <IntTools_ListIteratorOfListOfBox.hxx>
|
||||
#include <IntTools_MapIteratorOfMapOfSurfaceSample.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IntTools_SurfaceRangeLocalizeData::IntTools_SurfaceRangeLocalizeData()
|
||||
{
|
||||
myNbSampleU = 1;
|
||||
myNbSampleV = 1;
|
||||
myMinRangeU = 0.;
|
||||
myMinRangeV = 0.;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization Begin
|
||||
myDeflection = 0.;
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization End
|
||||
}
|
||||
|
||||
|
||||
IntTools_SurfaceRangeLocalizeData::IntTools_SurfaceRangeLocalizeData(const Standard_Integer theNbSampleU,
|
||||
const Standard_Integer theNbSampleV,
|
||||
const Standard_Real theMinRangeU,
|
||||
const Standard_Real theMinRangeV)
|
||||
{
|
||||
myNbSampleU = theNbSampleU;
|
||||
myNbSampleV = theNbSampleV;
|
||||
myMinRangeU = theMinRangeU;
|
||||
myMinRangeV = theMinRangeV;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization Begin
|
||||
myDeflection = 0.;
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization End
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeLocalizeData::IntTools_SurfaceRangeLocalizeData(const IntTools_SurfaceRangeLocalizeData& Other)
|
||||
{
|
||||
Assign(Other);
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeLocalizeData& IntTools_SurfaceRangeLocalizeData::Assign(const IntTools_SurfaceRangeLocalizeData& Other)
|
||||
{
|
||||
myNbSampleU = Other.myNbSampleU;
|
||||
myNbSampleV = Other.myNbSampleV;
|
||||
myMinRangeU = Other.myMinRangeU;
|
||||
myMinRangeV = Other.myMinRangeV;
|
||||
myMapRangeOut.Clear();
|
||||
myMapRangeOut = Other.myMapRangeOut;
|
||||
myMapBox.Clear();
|
||||
myMapBox = Other.myMapBox;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization Begin
|
||||
myDeflection = Other.myDeflection;
|
||||
myUIndMin = Other.myUIndMin;
|
||||
myUIndMax = Other.myUIndMax;
|
||||
myVIndMin = Other.myVIndMin;
|
||||
myVIndMax = Other.myVIndMax;
|
||||
|
||||
if (!Other.myUParams.IsNull())
|
||||
myUParams = Other.myUParams;
|
||||
|
||||
if (!Other.myVParams.IsNull())
|
||||
myVParams = Other.myVParams;
|
||||
|
||||
if (!Other.myGridPoints.IsNull())
|
||||
myGridPoints = Other.myGridPoints;
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization End
|
||||
return *(this);
|
||||
}
|
||||
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::AddOutRange(const IntTools_SurfaceRangeSample& theRange)
|
||||
{
|
||||
myMapRangeOut.Add(theRange);
|
||||
// myMapBox.UnBind(theRange);
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::AddBox(const IntTools_SurfaceRangeSample& theRange,
|
||||
const Bnd_Box& theBox)
|
||||
{
|
||||
myMapBox.Bind(theRange, theBox);
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_SurfaceRangeLocalizeData::FindBox(const IntTools_SurfaceRangeSample& theRange,
|
||||
Bnd_Box& theBox) const
|
||||
{
|
||||
if(myMapBox.IsBound(theRange)) {
|
||||
theBox = myMapBox(theRange);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IntTools_SurfaceRangeLocalizeData::IsRangeOut(const IntTools_SurfaceRangeSample& theRange) const
|
||||
{
|
||||
return myMapRangeOut.Contains(theRange);
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::ListRangeOut(IntTools_ListOfSurfaceRangeSample& theList) const
|
||||
{
|
||||
IntTools_MapIteratorOfMapOfSurfaceSample anIt( myMapRangeOut);
|
||||
|
||||
for(; anIt.More(); anIt.Next())
|
||||
theList.Append(anIt.Key());
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::RemoveRangeOutAll()
|
||||
{
|
||||
myMapRangeOut.Clear();
|
||||
}
|
||||
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization Begin
|
||||
void IntTools_SurfaceRangeLocalizeData::SetRangeUGrid
|
||||
(const Standard_Integer theNbUGrid)
|
||||
{
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
|
||||
if (myUParams.IsNull() || theNbUGrid != myUParams->Length()) {
|
||||
myUParams = new TColStd_HArray1OfReal(1, theNbUGrid);
|
||||
|
||||
if (!myVParams.IsNull()) {
|
||||
myGridPoints = new TColgp_HArray2OfPnt(1, theNbUGrid,
|
||||
1, myVParams->Length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::SetRangeVGrid
|
||||
(const Standard_Integer theNbVGrid)
|
||||
{
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
|
||||
if (myVParams.IsNull() || theNbVGrid != myVParams->Length()) {
|
||||
myVParams = new TColStd_HArray1OfReal(1, theNbVGrid);
|
||||
|
||||
if (!myUParams.IsNull()) {
|
||||
myGridPoints = new TColgp_HArray2OfPnt(1, myUParams->Length(),
|
||||
1, theNbVGrid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::SetFrame(const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax)
|
||||
{
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
|
||||
if (myUParams.IsNull() || myVParams.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer i;
|
||||
Standard_Integer aLmI;
|
||||
Standard_Integer aLen = myUParams->Length();
|
||||
|
||||
// Compute frame along U.
|
||||
for (i = 1; i <= aLen; i++) {
|
||||
if (myUIndMin == 0 && theUMin < myUParams->Value(i))
|
||||
myUIndMin = i;
|
||||
|
||||
aLmI = aLen - i + 1;
|
||||
|
||||
if (myUIndMax == 0 && theUMax > myUParams->Value(aLmI))
|
||||
myUIndMax = aLmI;
|
||||
}
|
||||
|
||||
if (myUIndMin == 0)
|
||||
myUIndMin = aLen + 1;
|
||||
|
||||
// Compute frame along V.
|
||||
aLen = myVParams->Length();
|
||||
|
||||
for (i = 1; i <= aLen; i++) {
|
||||
if (myVIndMin == 0 && theVMin < myVParams->Value(i))
|
||||
myVIndMin = i;
|
||||
|
||||
aLmI = aLen - i + 1;
|
||||
|
||||
if (myVIndMax == 0 && theVMax > myVParams->Value(aLmI))
|
||||
myVIndMax = aLmI;
|
||||
}
|
||||
|
||||
if (myVIndMin == 0)
|
||||
myVIndMin = aLen + 1;
|
||||
|
||||
}
|
||||
|
||||
const gp_Pnt &IntTools_SurfaceRangeLocalizeData::GetPointInFrame
|
||||
(const Standard_Integer theUIndex,
|
||||
const Standard_Integer theVIndex) const
|
||||
{
|
||||
static gp_Pnt aNullPnt(0., 0., 0.);
|
||||
|
||||
Standard_Integer aFrmUInd = theUIndex + myUIndMin - 1;
|
||||
Standard_Integer aFrmVInd = theVIndex + myVIndMin - 1;
|
||||
|
||||
if (aFrmUInd > myUIndMax || aFrmVInd > myVIndMax)
|
||||
return aNullPnt;
|
||||
|
||||
return myGridPoints->Value(aFrmUInd, aFrmVInd);
|
||||
}
|
||||
|
||||
Standard_Real IntTools_SurfaceRangeLocalizeData::GetUParamInFrame
|
||||
(const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aFrmInd = theIndex + myUIndMin - 1;
|
||||
|
||||
if (aFrmInd > myUIndMax)
|
||||
return Precision::Infinite();
|
||||
|
||||
return myUParams->Value(aFrmInd);
|
||||
}
|
||||
|
||||
Standard_Real IntTools_SurfaceRangeLocalizeData::GetVParamInFrame
|
||||
(const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aFrmInd = theIndex + myVIndMin - 1;
|
||||
|
||||
if (aFrmInd > myVIndMax)
|
||||
return Precision::Infinite();
|
||||
|
||||
return myVParams->Value(aFrmInd);
|
||||
}
|
||||
|
||||
void IntTools_SurfaceRangeLocalizeData::ClearGrid()
|
||||
{
|
||||
myDeflection = 0.;
|
||||
myUIndMin = 0;
|
||||
myUIndMax = 0;
|
||||
myVIndMin = 0;
|
||||
myVIndMax = 0;
|
||||
|
||||
if (!myUParams.IsNull())
|
||||
myUParams.Nullify();
|
||||
|
||||
if (!myVParams.IsNull())
|
||||
myVParams.Nullify();
|
||||
|
||||
if (!myGridPoints.IsNull())
|
||||
myGridPoints.Nullify();
|
||||
}
|
||||
// Modified by skv - Thu Nov 3 11:58:24 2005 Optimization End
|
118
src/IntTools/IntTools_SurfaceRangeLocalizeData.lxx
Executable file
118
src/IntTools/IntTools_SurfaceRangeLocalizeData.lxx
Executable file
@@ -0,0 +1,118 @@
|
||||
// File: IntTools_SurfaceRangeLocalizeData.lxx
|
||||
// Created: Fri Oct 14 19:52:29 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::GetNbSampleU() const
|
||||
{
|
||||
return myNbSampleU;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::GetNbSampleV() const
|
||||
{
|
||||
return myNbSampleV;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_SurfaceRangeLocalizeData::GetMinRangeU() const
|
||||
{
|
||||
return myMinRangeU;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_SurfaceRangeLocalizeData::GetMinRangeV() const
|
||||
{
|
||||
return myMinRangeV;
|
||||
}
|
||||
|
||||
|
||||
// Modified by skv - Thu Nov 3 09:59:43 2005 Optimization Begin
|
||||
inline void IntTools_SurfaceRangeLocalizeData::SetGridDeflection
|
||||
(const Standard_Real theDeflection)
|
||||
{
|
||||
myDeflection = theDeflection;
|
||||
}
|
||||
|
||||
inline Standard_Real IntTools_SurfaceRangeLocalizeData::GetGridDeflection() const
|
||||
{
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::GetRangeUGrid() const
|
||||
{
|
||||
return (myUParams.IsNull()) ? 0 : myUParams->Length();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeLocalizeData::SetUParam
|
||||
(const Standard_Integer theIndex,
|
||||
const Standard_Real theUParam)
|
||||
{
|
||||
myUParams->SetValue(theIndex, theUParam);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_SurfaceRangeLocalizeData::GetUParam
|
||||
(const Standard_Integer theIndex) const
|
||||
{
|
||||
return myUParams->Value(theIndex);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::GetRangeVGrid() const
|
||||
{
|
||||
return (myVParams.IsNull()) ? 0 : myVParams->Length();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeLocalizeData::SetVParam
|
||||
(const Standard_Integer theIndex,
|
||||
const Standard_Real theVParam)
|
||||
{
|
||||
myVParams->SetValue(theIndex, theVParam);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_SurfaceRangeLocalizeData::GetVParam
|
||||
(const Standard_Integer theIndex) const
|
||||
{
|
||||
return myVParams->Value(theIndex);
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeLocalizeData::SetGridPoint
|
||||
(const Standard_Integer theUIndex,
|
||||
const Standard_Integer theVIndex,
|
||||
const gp_Pnt &thePoint)
|
||||
{
|
||||
myGridPoints->SetValue(theUIndex, theVIndex, thePoint);
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Pnt &IntTools_SurfaceRangeLocalizeData::GetGridPoint
|
||||
(const Standard_Integer theUIndex,
|
||||
const Standard_Integer theVIndex) const
|
||||
{
|
||||
return myGridPoints->Value(theUIndex, theVIndex);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::
|
||||
GetNBUPointsInFrame() const
|
||||
{
|
||||
return myUIndMax - myUIndMin + 1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::
|
||||
GetNBVPointsInFrame() const
|
||||
{
|
||||
return myVIndMax - myVIndMin + 1;
|
||||
}
|
||||
// Modified by skv - Thu Nov 3 09:59:43 2005 Optimization End
|
118
src/IntTools/IntTools_SurfaceRangeSample.cdl
Executable file
118
src/IntTools/IntTools_SurfaceRangeSample.cdl
Executable file
@@ -0,0 +1,118 @@
|
||||
-- File: IntTools_SurfaceRangeSample.cdl
|
||||
-- Created: Wed Oct 5 16:46:45 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class SurfaceRangeSample from IntTools
|
||||
uses
|
||||
Range from IntTools,
|
||||
CurveRangeSample from IntTools
|
||||
|
||||
is
|
||||
Create
|
||||
returns SurfaceRangeSample from IntTools;
|
||||
|
||||
Create(theIndexU, theDepthU,theIndexV, theDepthV: Integer from Standard)
|
||||
returns SurfaceRangeSample from IntTools;
|
||||
|
||||
Create(theRangeU, theRangeV: CurveRangeSample from IntTools)
|
||||
returns SurfaceRangeSample from IntTools;
|
||||
|
||||
Create(Other: SurfaceRangeSample from IntTools)
|
||||
returns SurfaceRangeSample from IntTools;
|
||||
|
||||
Assign(me: in out; Other: SurfaceRangeSample from IntTools)
|
||||
returns SurfaceRangeSample from IntTools;
|
||||
---C++: alias operator =
|
||||
---C++: return &
|
||||
|
||||
SetRanges(me: in out; theRangeU, theRangeV: CurveRangeSample from IntTools);
|
||||
---C++: inline
|
||||
|
||||
GetRanges(me; theRangeU, theRangeV: out CurveRangeSample from IntTools);
|
||||
---C++: inline
|
||||
|
||||
SetIndexes(me: in out; theIndexU, theIndexV: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetIndexes(me; theIndexU: out Integer from Standard;
|
||||
theIndexV: out Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetDepths(me; theDepthU: out Integer from Standard;
|
||||
theDepthV: out Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
SetSampleRangeU(me: in out; theRangeSampleU: CurveRangeSample from IntTools);
|
||||
---C++: inline
|
||||
|
||||
GetSampleRangeU(me)
|
||||
returns CurveRangeSample from IntTools;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
SetSampleRangeV(me: in out; theRangeSampleV: CurveRangeSample from IntTools);
|
||||
---C++: inline
|
||||
|
||||
GetSampleRangeV(me)
|
||||
returns CurveRangeSample from IntTools;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
SetIndexU(me: in out; theIndexU: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetIndexU(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetIndexV(me: in out; theIndexV: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetIndexV(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
--
|
||||
SetDepthU(me: in out; theDepthU: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetDepthU(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDepthV(me: in out; theDepthV: Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetDepthV(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
GetRangeU(me; theFirstU, theLastU: Real from Standard;
|
||||
theNbSampleU: Integer from Standard)
|
||||
returns Range from IntTools;
|
||||
|
||||
GetRangeV(me; theFirstV, theLastV: Real from Standard;
|
||||
theNbSampleV: Integer from Standard)
|
||||
returns Range from IntTools;
|
||||
|
||||
IsEqual(me; Other: SurfaceRangeSample from IntTools)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetRangeIndexUDeeper(me; theNbSampleU: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
GetRangeIndexVDeeper(me; theNbSampleV: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
myRangeU: CurveRangeSample from IntTools;
|
||||
myRangeV: CurveRangeSample from IntTools;
|
||||
|
||||
end SurfaceRangeSample from IntTools;
|
52
src/IntTools/IntTools_SurfaceRangeSample.cxx
Executable file
52
src/IntTools/IntTools_SurfaceRangeSample.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
// File: IntTools_SurfaceRangeSample.cxx
|
||||
// Created: Wed Oct 5 16:54:37 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_SurfaceRangeSample.ixx>
|
||||
|
||||
IntTools_SurfaceRangeSample::IntTools_SurfaceRangeSample()
|
||||
{
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeSample::IntTools_SurfaceRangeSample(const Standard_Integer theIndexU,const Standard_Integer theDepthU,
|
||||
const Standard_Integer theIndexV,const Standard_Integer theDepthV)
|
||||
{
|
||||
myRangeU.SetRangeIndex(theIndexU);
|
||||
myRangeU.SetDepth(theDepthU);
|
||||
myRangeV.SetRangeIndex(theIndexV);
|
||||
myRangeV.SetDepth(theDepthV);
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeSample::IntTools_SurfaceRangeSample(const IntTools_CurveRangeSample& theRangeU,
|
||||
const IntTools_CurveRangeSample& theRangeV)
|
||||
{
|
||||
myRangeU = theRangeU;
|
||||
myRangeV = theRangeV;
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeSample::IntTools_SurfaceRangeSample(const IntTools_SurfaceRangeSample& Other)
|
||||
{
|
||||
Assign(Other);
|
||||
}
|
||||
|
||||
IntTools_SurfaceRangeSample& IntTools_SurfaceRangeSample::Assign(const IntTools_SurfaceRangeSample& Other)
|
||||
{
|
||||
myRangeU = Other.myRangeU;
|
||||
myRangeV = Other.myRangeV;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
IntTools_Range IntTools_SurfaceRangeSample::GetRangeU(const Standard_Real theFirstU,const Standard_Real theLastU,
|
||||
const Standard_Integer theNbSampleU) const
|
||||
{
|
||||
return myRangeU.GetRange(theFirstU, theLastU, theNbSampleU);
|
||||
}
|
||||
|
||||
IntTools_Range IntTools_SurfaceRangeSample::GetRangeV(const Standard_Real theFirstV,const Standard_Real theLastV,
|
||||
const Standard_Integer theNbSampleV) const
|
||||
{
|
||||
return myRangeV.GetRange(theFirstV, theLastV, theNbSampleV);
|
||||
}
|
131
src/IntTools/IntTools_SurfaceRangeSample.lxx
Executable file
131
src/IntTools/IntTools_SurfaceRangeSample.lxx
Executable file
@@ -0,0 +1,131 @@
|
||||
// File: IntTools_SurfaceRangeSample.lxx
|
||||
// Created: Wed Oct 5 16:55:26 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetRanges(const IntTools_CurveRangeSample& theRangeU,
|
||||
const IntTools_CurveRangeSample& theRangeV)
|
||||
{
|
||||
myRangeU = theRangeU;
|
||||
myRangeV = theRangeV;
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::GetRanges(IntTools_CurveRangeSample& theRangeU,
|
||||
IntTools_CurveRangeSample& theRangeV) const
|
||||
{
|
||||
theRangeU = myRangeU;
|
||||
theRangeV = myRangeV;
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetIndexes(const Standard_Integer theIndexU,
|
||||
const Standard_Integer theIndexV)
|
||||
{
|
||||
myRangeU.SetRangeIndex(theIndexU);
|
||||
myRangeV.SetRangeIndex(theIndexV);
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::GetIndexes(Standard_Integer& theIndexU,Standard_Integer& theIndexV) const
|
||||
{
|
||||
theIndexU = myRangeU.GetRangeIndex();
|
||||
theIndexV = myRangeV.GetRangeIndex();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::GetDepths(Standard_Integer& theDepthU,Standard_Integer& theDepthV) const
|
||||
{
|
||||
theDepthU = myRangeU.GetDepth();
|
||||
theDepthV = myRangeV.GetDepth();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetSampleRangeU(const IntTools_CurveRangeSample& theRangeSampleU)
|
||||
{
|
||||
myRangeU = theRangeSampleU;
|
||||
}
|
||||
|
||||
|
||||
inline const IntTools_CurveRangeSample& IntTools_SurfaceRangeSample::GetSampleRangeU() const
|
||||
{
|
||||
return myRangeU;
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetSampleRangeV(const IntTools_CurveRangeSample& theRangeSampleV)
|
||||
{
|
||||
myRangeV = theRangeSampleV;
|
||||
}
|
||||
|
||||
|
||||
inline const IntTools_CurveRangeSample& IntTools_SurfaceRangeSample::GetSampleRangeV() const
|
||||
{
|
||||
return myRangeV;
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetIndexU(const Standard_Integer theIndexU)
|
||||
{
|
||||
myRangeU.SetRangeIndex(theIndexU);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetIndexU() const
|
||||
{
|
||||
return myRangeU.GetRangeIndex();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetIndexV(const Standard_Integer theIndexV)
|
||||
{
|
||||
myRangeV.SetRangeIndex(theIndexV);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetIndexV() const
|
||||
{
|
||||
return myRangeV.GetRangeIndex();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetDepthU(const Standard_Integer theDepthU)
|
||||
{
|
||||
myRangeU.SetDepth(theDepthU);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetDepthU() const
|
||||
{
|
||||
return myRangeU.GetDepth();
|
||||
}
|
||||
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetDepthV(const Standard_Integer theDepthV)
|
||||
{
|
||||
myRangeV.SetDepth(theDepthV);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetDepthV() const
|
||||
{
|
||||
return myRangeV.GetDepth();
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_SurfaceRangeSample::IsEqual(const IntTools_SurfaceRangeSample& Other) const
|
||||
{
|
||||
return (myRangeU.IsEqual(Other.myRangeU) && myRangeV.IsEqual(Other.myRangeV));
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetRangeIndexUDeeper(const Standard_Integer theNbSampleU) const
|
||||
{
|
||||
return myRangeU.GetRangeIndexDeeper(theNbSampleU);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSample::GetRangeIndexVDeeper(const Standard_Integer theNbSampleV) const
|
||||
{
|
||||
return myRangeV.GetRangeIndexDeeper(theNbSampleV);
|
||||
}
|
25
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.cdl
Executable file
25
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.cdl
Executable file
@@ -0,0 +1,25 @@
|
||||
-- File: IntTools_SurfaceRangeSampleMapHasher.cdl
|
||||
-- Created: Fri Oct 14 20:55:48 2005
|
||||
-- Author: Mikhail KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2005
|
||||
|
||||
class SurfaceRangeSampleMapHasher from IntTools
|
||||
uses
|
||||
SurfaceRangeSample from IntTools
|
||||
is
|
||||
HashCode(myclass; K : SurfaceRangeSample from IntTools; Upper : Integer) returns Integer;
|
||||
---Purpose: Returns a HasCode value for the Key <K> in the
|
||||
-- range 0..Upper.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
IsEqual(myclass; S1, S2 : SurfaceRangeSample from IntTools) returns Boolean;
|
||||
---Purpose: Returns True when the two keys are the same. Two
|
||||
-- same keys must have the same hashcode, the
|
||||
-- contrary is not necessary.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
|
||||
end SurfaceRangeSampleMapHasher from IntTools;
|
7
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.cxx
Executable file
7
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.cxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: IntTools_SurfaceRangeSampleMapHasher.cxx
|
||||
// Created: Fri Oct 14 21:12:21 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
#include <IntTools_SurfaceRangeSampleMapHasher.ixx>
|
16
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.lxx
Executable file
16
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.lxx
Executable file
@@ -0,0 +1,16 @@
|
||||
// File: IntTools_SurfaceRangeSampleMapHasher.lxx
|
||||
// Created: Fri Oct 14 20:56:50 2005
|
||||
// Author: Mikhail KLOKOV
|
||||
// <mkk@kurox>
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_SurfaceRangeSampleMapHasher::HashCode(const IntTools_SurfaceRangeSample& K,
|
||||
const Standard_Integer Upper) {
|
||||
// return (((K.GetDepthU() % Upper) ^ (K.GetDepthV() % Upper)) % Upper);
|
||||
return ((K.GetIndexU() * K.GetIndexV()) % Upper);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_SurfaceRangeSampleMapHasher::IsEqual(const IntTools_SurfaceRangeSample& S1,
|
||||
const IntTools_SurfaceRangeSample& S2) {
|
||||
return S1.IsEqual(S2);
|
||||
}
|
179
src/IntTools/IntTools_Tools.cdl
Executable file
179
src/IntTools/IntTools_Tools.cdl
Executable file
@@ -0,0 +1,179 @@
|
||||
-- File: IntTools_Tools.cdl
|
||||
-- Created: Thu Nov 16 11:40:16 2000
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class Tools from IntTools
|
||||
|
||||
---Purpose:
|
||||
--- The class contains handy static functions
|
||||
--- dealing with the geometry and topology.
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Wire from TopoDS,
|
||||
Face from TopoDS,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
CommonPrt from IntTools,
|
||||
Curve from IntTools,
|
||||
SequenceOfCurves from IntTools,
|
||||
Curve from Geom,
|
||||
State from TopAbs
|
||||
|
||||
is
|
||||
ComputeVV (myclass;V1,V2:Vertex from TopoDS)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Computes distance between vertex V1 and vertex V2,
|
||||
--- if the distance is less than sum of vertex tolerances
|
||||
--- returns zero,
|
||||
--- otherwise returns negative value
|
||||
---
|
||||
|
||||
HasInternalEdge (myclass;
|
||||
aW: Wire from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if wire aW contains edges
|
||||
--- with INTERNAL orientation
|
||||
---
|
||||
|
||||
MakeFaceFromWireAndFace (myclass;
|
||||
aW: Wire from TopoDS;
|
||||
aF: Face from TopoDS;
|
||||
aFNew:out Face from TopoDS);
|
||||
---Purpose:
|
||||
--- Build a face based on surface of given face aF
|
||||
--- and bounded by wire aW
|
||||
---
|
||||
|
||||
ClassifyPointByFace (myclass;
|
||||
aF: Face from TopoDS;
|
||||
P: Pnt2d from gp)
|
||||
returns State from TopAbs;
|
||||
---Purpose:
|
||||
---
|
||||
---
|
||||
|
||||
IsVertex (myclass; E: Edge from TopoDS;
|
||||
t: Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Computes square distance between a point on the edge E
|
||||
--- corresponded to parameter t and vertices of edge E.
|
||||
--- Returns True if this distance is less than square
|
||||
--- tolerance of vertex, otherwise returns false.
|
||||
---
|
||||
|
||||
IsVertex (myclass; E: Edge from TopoDS;
|
||||
V: Vertex from TopoDS;
|
||||
t: Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if square distance between vertex V
|
||||
--- and a point on the edge E corresponded to parameter t
|
||||
--- is less than square tolerance of V
|
||||
---
|
||||
|
||||
IsVertex (myclass; aCmnPrt: CommonPrt from IntTools)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if IsVertx for middle parameter of fist range
|
||||
--- and first edge returns True
|
||||
--- and if IsVertex for middle parameter of second range and
|
||||
--- second range returns True,
|
||||
--- otherwise returns False
|
||||
---
|
||||
|
||||
IsMiddlePointsEqual(myclass;
|
||||
E1: Edge from TopoDS;
|
||||
E2: Edge from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Gets boundary of parameters of E1 and E2.
|
||||
--- Computes 3d points on each corresponded to average parameters.
|
||||
--- Returns True if distance between computed points is less than
|
||||
--- sum of edge tolerance, otherwise returns False.
|
||||
---
|
||||
|
||||
IsVertex (myclass;
|
||||
aP : Pnt from gp;
|
||||
aTolPV: Real from Standard;
|
||||
aV: Vertex from TopoDS)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if the distance between point aP and
|
||||
--- vertex aV is less or equal to sum of aTolPV and
|
||||
--- vertex tolerance, otherwise returns False
|
||||
---
|
||||
|
||||
IntermediatePoint (myclass;
|
||||
aFirst: Real from Standard;
|
||||
aLast : Real from Standard)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns some value between aFirst and aLast
|
||||
---
|
||||
|
||||
SplitCurve (myclass;
|
||||
aC : Curve from IntTools;
|
||||
aS :out SequenceOfCurves from IntTools)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
--- Split aC by average parameter if aC is closed in 3D.
|
||||
--- Returns positive value if splitting has been done,
|
||||
--- otherwise returns zero.
|
||||
---
|
||||
|
||||
RejectLines(myclass;
|
||||
aSIn: SequenceOfCurves from IntTools;
|
||||
aSOut:out SequenceOfCurves from IntTools);
|
||||
---Purpose:
|
||||
--- Puts curves from aSIn to aSOut except those curves that
|
||||
--- are coincide with first curve from aSIn.
|
||||
---
|
||||
|
||||
IsDirsCoinside (myclass;
|
||||
D1:Dir from gp;
|
||||
D2:Dir from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if D1 and D2 coinside
|
||||
---
|
||||
|
||||
IsDirsCoinside (myclass;
|
||||
D1 :Dir from gp;
|
||||
D2 :Dir from gp;
|
||||
aTol:Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if D1 and D2 coinside with given tolerance
|
||||
---
|
||||
|
||||
IsClosed (myclass;
|
||||
aC : Curve from Geom)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
--- Returns True if aC is BoundedCurve from Geom and
|
||||
--- the distance between first point
|
||||
--- of the curve aC and last point
|
||||
--- is less than 1.e-12
|
||||
---
|
||||
|
||||
CurveTolerance(myclass;
|
||||
aC : Curve from Geom;
|
||||
aTolBase : Real from Standard)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
--- Returns adaptive tolerance for given aTolBase
|
||||
--- if aC is trimmed curve and basis curve is parabola,
|
||||
--- otherwise returns value of aTolBase
|
||||
---
|
||||
|
||||
end Tools;
|
574
src/IntTools/IntTools_Tools.cxx
Executable file
574
src/IntTools/IntTools_Tools.cxx
Executable file
@@ -0,0 +1,574 @@
|
||||
// File: IntTools_Tools.cxx
|
||||
// Created: Thu Nov 16 11:42:23 2000
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
//
|
||||
|
||||
#include <IntTools_Tools.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_BoundedCurve.hxx>
|
||||
#include <Geom_Geometry.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
#include <IntTools_Curve.hxx>
|
||||
#include <IntTools_SequenceOfCurves.hxx>
|
||||
|
||||
static
|
||||
void ParabolaTolerance(const Handle(Geom_Curve)& ,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
Standard_Real& ,
|
||||
Standard_Real& );
|
||||
|
||||
//=======================================================================
|
||||
//function : HasInternalEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::HasInternalEdge(const TopoDS_Wire& aW)
|
||||
{
|
||||
Standard_Boolean bFlag=Standard_True;
|
||||
|
||||
TopExp_Explorer anExp(aW, TopAbs_EDGE);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
|
||||
TopAbs_Orientation anOr=aE.Orientation();
|
||||
if (anOr==TopAbs_INTERNAL) {
|
||||
return bFlag;
|
||||
}
|
||||
}
|
||||
return !bFlag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsClosed (const Handle(Geom_Curve)& aC3D)
|
||||
{
|
||||
|
||||
Standard_Real aF, aL, aDist;
|
||||
gp_Pnt aP1, aP2;
|
||||
|
||||
Handle (Geom_BoundedCurve) aGBC=
|
||||
Handle (Geom_BoundedCurve)::DownCast(aC3D);
|
||||
if (aGBC.IsNull()) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
aF=aC3D->FirstParameter();
|
||||
aL=aC3D-> LastParameter();
|
||||
|
||||
aC3D->D0(aF, aP1);
|
||||
aC3D->D0(aL, aP2);
|
||||
|
||||
aDist=aP1.Distance(aP2);
|
||||
//return (aDist < 1.e-12);
|
||||
return (aDist < Precision::Confusion());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RejectLines
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Tools::RejectLines(const IntTools_SequenceOfCurves& aSIn,
|
||||
IntTools_SequenceOfCurves& aSOut)
|
||||
{
|
||||
Standard_Integer i, j, aNb;
|
||||
Standard_Boolean bFlag;
|
||||
Handle (Geom_Curve) aC3D;
|
||||
|
||||
gp_Dir aD1, aD2;
|
||||
|
||||
aSOut.Clear();
|
||||
|
||||
aNb=aSIn.Length();
|
||||
for (i=1; i<=aNb; i++) {
|
||||
const IntTools_Curve& IC=aSIn(i);
|
||||
aC3D=IC.Curve();
|
||||
//
|
||||
Handle (Geom_TrimmedCurve) aGTC=
|
||||
Handle (Geom_TrimmedCurve)::DownCast(aC3D);
|
||||
|
||||
if (!aGTC.IsNull()) {
|
||||
aC3D=aGTC->BasisCurve();
|
||||
IntTools_Curve* pIC=(IntTools_Curve*) &IC;
|
||||
pIC->SetCurve(aC3D);
|
||||
}
|
||||
//
|
||||
Handle (Geom_Line) aGLine=
|
||||
Handle (Geom_Line)::DownCast(aC3D);
|
||||
|
||||
if (aGLine.IsNull()) {
|
||||
aSOut.Clear();
|
||||
for (j=1; j<=aNb; j++) {
|
||||
aSOut.Append(aSIn(j));
|
||||
}
|
||||
return;
|
||||
}
|
||||
//
|
||||
gp_Lin aLin=aGLine->Lin();
|
||||
aD2=aLin.Direction();
|
||||
if (i==1) {
|
||||
aSOut.Append(IC);
|
||||
aD1=aD2;
|
||||
continue;
|
||||
}
|
||||
|
||||
bFlag=IntTools_Tools::IsDirsCoinside(aD1, aD2);
|
||||
if (!bFlag) {
|
||||
aSOut.Append(IC);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDirsCoinside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
gp_Pnt P1(D1.X(), D1.Y(), D1.Z());
|
||||
gp_Pnt P2(D2.X(), D2.Y(), D2.Z());
|
||||
Standard_Real dLim=0.0002, d;
|
||||
d=P1.Distance (P2);
|
||||
bFlag= (d<dLim || fabs (2.-d)<dLim);
|
||||
return bFlag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDirsCoinside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsDirsCoinside (const gp_Dir& D1,
|
||||
const gp_Dir& D2,
|
||||
const Standard_Real dLim)
|
||||
{
|
||||
Standard_Boolean bFlag;
|
||||
Standard_Real d;
|
||||
//
|
||||
gp_Pnt P1(D1.X(), D1.Y(), D1.Z());
|
||||
gp_Pnt P2(D2.X(), D2.Y(), D2.Z());
|
||||
d=P1.Distance (P2);
|
||||
bFlag= (d<dLim || fabs (2.-d)<dLim);
|
||||
return bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SplitCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Tools::SplitCurve(const IntTools_Curve& IC,
|
||||
IntTools_SequenceOfCurves& aCvs)
|
||||
{
|
||||
Handle (Geom_Curve) aC3D =IC.Curve();
|
||||
if(aC3D.IsNull())
|
||||
return 0;
|
||||
//
|
||||
Handle (Geom2d_Curve) aC2D1=IC.FirstCurve2d();
|
||||
Handle (Geom2d_Curve) aC2D2=IC.SecondCurve2d();
|
||||
Standard_Boolean bIsClosed;
|
||||
|
||||
bIsClosed=IntTools_Tools::IsClosed(aC3D);
|
||||
if (!bIsClosed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real aF, aL, aMid;
|
||||
|
||||
//
|
||||
aF=aC3D->FirstParameter();
|
||||
aL=aC3D->LastParameter();
|
||||
aMid=0.5*(aF+aL);
|
||||
//modified by NIZNHY-PKV Thu Feb 5 08:26:58 2009 f
|
||||
GeomAdaptor_Curve aGAC(aC3D);
|
||||
GeomAbs_CurveType aCT=aGAC.GetType();
|
||||
if (aCT==GeomAbs_BSplineCurve ||
|
||||
aCT==GeomAbs_BezierCurve) {
|
||||
//aMid=0.5*aMid;
|
||||
aMid=IntTools_Tools::IntermediatePoint(aF, aL);
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Feb 5 08:27:00 2009 t
|
||||
//
|
||||
Handle(Geom_Curve) aC3DNewF, aC3DNewL;
|
||||
aC3DNewF =new Geom_TrimmedCurve (aC3D, aF, aMid);
|
||||
aC3DNewL =new Geom_TrimmedCurve (aC3D, aMid, aL);
|
||||
|
||||
//
|
||||
Handle (Geom2d_Curve) aC2D1F, aC2D1L, aC2D2F, aC2D2L;
|
||||
//
|
||||
if(!aC2D1.IsNull()) {
|
||||
aC2D1F=new Geom2d_TrimmedCurve (aC2D1, aF, aMid);
|
||||
aC2D1L=new Geom2d_TrimmedCurve (aC2D1, aMid, aL);
|
||||
}
|
||||
|
||||
if(!aC2D2.IsNull()) {
|
||||
aC2D2F=new Geom2d_TrimmedCurve (aC2D2, aF, aMid);
|
||||
aC2D2L=new Geom2d_TrimmedCurve (aC2D2, aMid, aL);
|
||||
}
|
||||
//
|
||||
|
||||
IntTools_Curve aIC1(aC3DNewF, aC2D1F, aC2D2F);
|
||||
IntTools_Curve aIC2(aC3DNewL, aC2D1L, aC2D2L);
|
||||
//
|
||||
aCvs.Append(aIC1);
|
||||
//
|
||||
aCvs.Append(aIC2);
|
||||
//
|
||||
return 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntermediatePoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Tools::IntermediatePoint (const Standard_Real aFirst,
|
||||
const Standard_Real aLast)
|
||||
{
|
||||
//define parameter division number as 10*e^(-PI) = 0.43213918
|
||||
const Standard_Real PAR_T = 0.43213918;
|
||||
Standard_Real aParm;
|
||||
aParm=(1.-PAR_T)*aFirst + PAR_T*aLast;
|
||||
return aParm;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsVertex (const gp_Pnt& aP,
|
||||
const Standard_Real aTolPV,
|
||||
const TopoDS_Vertex& aV)
|
||||
{
|
||||
Standard_Real aTolV, aD, dTol;
|
||||
gp_Pnt aPv;
|
||||
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Jan 18 17:44:46 2007f
|
||||
//aTolV=aTolV+aTolPV;
|
||||
dTol=Precision::Confusion();
|
||||
aTolV=aTolV+aTolPV+dTol;
|
||||
//modified by NIZNHY-PKV Thu Jan 18 17:44:49 2007t
|
||||
//
|
||||
aPv=BRep_Tool::Pnt(aV);
|
||||
aD=aPv.Distance(aP);
|
||||
return (aD<=aTolV);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsVertex (const IntTools_CommonPrt& aCmnPrt)
|
||||
{
|
||||
Standard_Boolean anIsVertex;
|
||||
Standard_Real aParam;
|
||||
|
||||
const TopoDS_Edge& aE1=aCmnPrt.Edge1();
|
||||
const IntTools_Range& aR1=aCmnPrt.Range1();
|
||||
aParam=0.5*(aR1.First()+aR1.Last());
|
||||
anIsVertex=IntTools_Tools::IsVertex (aE1, aParam);
|
||||
|
||||
if (anIsVertex) {
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
const TopoDS_Edge& aE2=aCmnPrt.Edge2();
|
||||
const IntTools_SequenceOfRanges& aRs2=aCmnPrt.Ranges2();
|
||||
const IntTools_Range& aR2=aRs2(1);
|
||||
aParam=0.5*(aR2.First()+aR2.Last());
|
||||
anIsVertex=IntTools_Tools::IsVertex (aE2, aParam);
|
||||
if (anIsVertex) {
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsVertex (const TopoDS_Edge& aE,
|
||||
const TopoDS_Vertex& aV,
|
||||
const Standard_Real t)
|
||||
{
|
||||
Standard_Real aTolV, aTolV2, d2;
|
||||
gp_Pnt aPv, aPt;
|
||||
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
aBAC.D0(t, aPt);
|
||||
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
aTolV2=aTolV*aTolV;
|
||||
aPv=BRep_Tool::Pnt(aV);
|
||||
d2=aPv.SquareDistance (aPt);
|
||||
if (d2 < aTolV2) {
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsVertex (const TopoDS_Edge& aE,
|
||||
const Standard_Real t)
|
||||
{
|
||||
Standard_Real aTolV, aTolV2, d2;
|
||||
TopoDS_Vertex aV;
|
||||
gp_Pnt aPv, aPt;
|
||||
|
||||
BRepAdaptor_Curve aBAC(aE);
|
||||
aBAC.D0(t, aPt);
|
||||
|
||||
TopExp_Explorer anExp(aE, TopAbs_VERTEX);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
aV=TopoDS::Vertex (anExp.Current());
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
aTolV2=aTolV*aTolV;
|
||||
aTolV2=1.e-12;
|
||||
aPv=BRep_Tool::Pnt(aV);
|
||||
d2=aPv.SquareDistance (aPt);
|
||||
if (d2 < aTolV2) {
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeVV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools_Tools::ComputeVV(const TopoDS_Vertex& aV1,
|
||||
const TopoDS_Vertex& aV2)
|
||||
{
|
||||
Standard_Real aTolV1, aTolV2, aTolSum, d;
|
||||
gp_Pnt aP1, aP2;
|
||||
|
||||
aTolV1=BRep_Tool::Tolerance(aV1);
|
||||
aTolV2=BRep_Tool::Tolerance(aV2);
|
||||
aTolSum=aTolV1+aTolV2;
|
||||
|
||||
aP1=BRep_Tool::Pnt(aV1);
|
||||
aP2=BRep_Tool::Pnt(aV2);
|
||||
|
||||
d=aP1.Distance(aP2);
|
||||
if (d<aTolSum) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeFaceFromWireAndFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_Tools::MakeFaceFromWireAndFace(const TopoDS_Wire& aW,
|
||||
const TopoDS_Face& aF,
|
||||
TopoDS_Face& aFNew)
|
||||
{
|
||||
TopoDS_Face aFF;
|
||||
aFF=aF;
|
||||
aFF.Orientation(TopAbs_FORWARD);
|
||||
aFNew=TopoDS::Face (aFF.EmptyCopied());
|
||||
BRep_Builder BB;
|
||||
BB.Add(aFNew, aW);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClassifyPointByFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_State IntTools_Tools::ClassifyPointByFace(const TopoDS_Face& aF,
|
||||
const gp_Pnt2d& aP2d)
|
||||
{
|
||||
Standard_Real aFaceTolerance;
|
||||
TopAbs_State aState;
|
||||
|
||||
aFaceTolerance=BRep_Tool::Tolerance(aF);
|
||||
IntTools_FClass2d aClass2d(aF, aFaceTolerance);
|
||||
aState=aClass2d.Perform(aP2d);
|
||||
|
||||
return aState;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMiddlePointsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_Tools::IsMiddlePointsEqual(const TopoDS_Edge& aE1,
|
||||
const TopoDS_Edge& aE2)
|
||||
|
||||
{
|
||||
Standard_Real f1, l1, m1, f2, l2, m2, aTol1, aTol2, aSumTol;
|
||||
gp_Pnt aP1, aP2;
|
||||
|
||||
aTol1=BRep_Tool::Tolerance(aE1);
|
||||
Handle(Geom_Curve) C1=BRep_Tool::Curve(aE1, f1, l1);
|
||||
m1=0.5*(f1+l1);
|
||||
C1->D0(m1, aP1);
|
||||
|
||||
aTol2=BRep_Tool::Tolerance(aE2);
|
||||
Handle(Geom_Curve) C2=BRep_Tool::Curve(aE2, f2, l2);
|
||||
m2=0.5*(f2+l2);
|
||||
C2->D0(m2, aP2);
|
||||
|
||||
aSumTol=aTol1+aTol2;
|
||||
|
||||
if (aP1.Distance(aP2) < aSumTol) {
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurveTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntTools_Tools::CurveTolerance(const Handle(Geom_Curve)& aC3D,
|
||||
const Standard_Real aTolBase)
|
||||
{
|
||||
Standard_Real aTolReached, aTf, aTl, aTolMin, aTolMax;
|
||||
|
||||
aTolReached=aTolBase;
|
||||
//
|
||||
if (aC3D.IsNull()) {
|
||||
return aTolReached;
|
||||
}
|
||||
//
|
||||
Handle(Geom_TrimmedCurve) aCT3D=Handle(Geom_TrimmedCurve)::DownCast(aC3D);
|
||||
if (aCT3D.IsNull()) {
|
||||
return aTolReached;
|
||||
}
|
||||
//
|
||||
aTolMin=aTolBase;
|
||||
aTolMax=aTolBase;
|
||||
//
|
||||
aTf=aCT3D->FirstParameter();
|
||||
aTl=aCT3D->LastParameter();
|
||||
//
|
||||
GeomAdaptor_Curve aGAC(aCT3D);
|
||||
GeomAbs_CurveType aCType=aGAC.GetType();
|
||||
//
|
||||
if (aCType==GeomAbs_Parabola) {
|
||||
Handle(Geom_Curve) aC3DBase=aCT3D->BasisCurve();
|
||||
ParabolaTolerance(aC3DBase, aTf, aTl, aTolBase, aTolMin, aTolMax);
|
||||
aTolReached=aTolMax;
|
||||
}
|
||||
//
|
||||
return aTolReached;
|
||||
}
|
||||
|
||||
#include <Geom_Parabola.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
//=======================================================================
|
||||
//function : ParabolaTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ParabolaTolerance(const Handle(Geom_Curve)& aC3D,
|
||||
const Standard_Real aTf,
|
||||
const Standard_Real aTl,
|
||||
const Standard_Real aTol,
|
||||
Standard_Real& aTolMin,
|
||||
Standard_Real& aTolMax)
|
||||
{
|
||||
|
||||
aTolMin=aTol;
|
||||
aTolMax=aTol;
|
||||
|
||||
Handle(Geom_Parabola) aGP=Handle(Geom_Parabola)::DownCast(aC3D);
|
||||
if (aGP.IsNull()){
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aNbPoints;
|
||||
Standard_Real aFocal, aX1, aX2, aTol1, aTol2;
|
||||
gp_Pnt aPf, aPl;
|
||||
gp_Parab aParab=aGP->Parab();
|
||||
gp_Ax1 aXAxis=aParab.XAxis();
|
||||
Handle(Geom_Line) aGAxis=new Geom_Line(aXAxis);
|
||||
|
||||
aFocal=aGP->Focal();
|
||||
if (aFocal==0.) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// aTol1
|
||||
aTol1=aTol;
|
||||
aX1=0.;
|
||||
aGP->D0(aTf, aPf);
|
||||
GeomAPI_ProjectPointOnCurve aProj1(aPf, aGAxis);
|
||||
aNbPoints=aProj1.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aX1=aProj1.LowerDistanceParameter();
|
||||
}
|
||||
if (aX1>=0.) {
|
||||
aTol1=aTol*sqrt(0.5*aX1/aFocal);
|
||||
}
|
||||
if (aTol1==0.) {
|
||||
aTol1=aTol;
|
||||
}
|
||||
//
|
||||
// aTol2
|
||||
aTol2=aTol;
|
||||
aX2=0.;
|
||||
aGP->D0(aTl, aPl);
|
||||
GeomAPI_ProjectPointOnCurve aProj2(aPl, aGAxis);
|
||||
aNbPoints=aProj2.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aX2=aProj2.LowerDistanceParameter();
|
||||
}
|
||||
|
||||
if (aX2>=0.) {
|
||||
aTol2=aTol*sqrt(0.5*aX2/aFocal);
|
||||
}
|
||||
if (aTol2==0.) {
|
||||
aTol2=aTol;
|
||||
}
|
||||
//
|
||||
aTolMax=(aTol1>aTol2) ? aTol1 : aTol2;
|
||||
aTolMin=(aTol1<aTol2) ? aTol1 : aTol2;
|
||||
}
|
||||
|
106
src/IntTools/IntTools_TopolTool.cdl
Executable file
106
src/IntTools/IntTools_TopolTool.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: IntTools_TopolTool.cdl
|
||||
-- Created: Thu Apr 18 11:39:53 2002
|
||||
-- Author: Michael KLOKOV
|
||||
-- <mkk@kurox>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class TopolTool from IntTools inherits TopolTool from Adaptor3d
|
||||
|
||||
---Purpose: Class redefine methods of TopolTool from Adaptor3d
|
||||
--- concerning sample points
|
||||
---
|
||||
uses
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
HSurface from Adaptor3d,
|
||||
HArray1OfReal from TColStd
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is
|
||||
Create returns mutable TopolTool from IntTools;
|
||||
---Purpose:
|
||||
--- Empty constructor
|
||||
---
|
||||
|
||||
Create(theSurface: HSurface from Adaptor3d)
|
||||
returns mutable TopolTool from IntTools;
|
||||
---Purpose:
|
||||
--- Initializes me by surface
|
||||
---
|
||||
|
||||
Initialize(me: mutable)
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Redefined empty initializer
|
||||
---
|
||||
-- Warning:
|
||||
--- Raises the exception NotImplemented
|
||||
---
|
||||
|
||||
Initialize(me: mutable; theSurface: HSurface from Adaptor3d)
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Initializes me by surface
|
||||
---
|
||||
|
||||
--- sample points tools
|
||||
|
||||
ComputeSamplePoints(me: mutable)
|
||||
is redefined;
|
||||
---Purpose:
|
||||
---
|
||||
---
|
||||
|
||||
NbSamplesU(me: mutable)
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Computes the sample-points for the intersections algorithms
|
||||
---
|
||||
|
||||
NbSamplesV(me: mutable)
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Computes the sample-points for the intersections algorithms
|
||||
---
|
||||
|
||||
NbSamples(me: mutable)
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Computes the sample-points for the intersections algorithms
|
||||
---
|
||||
|
||||
SamplePoint(me: mutable; Index: Integer from Standard;
|
||||
P2d : out Pnt2d from gp;
|
||||
P3d : out Pnt from gp)
|
||||
is redefined;
|
||||
---Purpose:
|
||||
--- Returns a 2d point from surface myS
|
||||
--- and a corresponded 3d point
|
||||
--- for given index.
|
||||
--- The index should be from 1 to NbSamples()
|
||||
---
|
||||
|
||||
--modified by NIZNHY-IFV Sep 28 16:01:38 2005 f
|
||||
SamplePnts(me: mutable; theDefl: Real from Standard; theNUmin, theNVmin: Integer from Standard)
|
||||
---Purpose: compute the sample-points for the intersections algorithms
|
||||
-- by adaptive algorithm for BSpline surfaces. For other surfaces algorithm
|
||||
-- is the same as in method ComputeSamplePoints(), but only fill arrays of U
|
||||
-- and V sample parameters;
|
||||
-- theDefl is a requred deflection
|
||||
-- theNUmin, theNVmin are minimal nb points for U and V.
|
||||
is redefined;
|
||||
|
||||
fields
|
||||
--myS : HSurface from Adaptor3d; now inherits myS from Adaptor3d_TopolTool
|
||||
myNbSmplU : Integer from Standard;
|
||||
myNbSmplV : Integer from Standard;
|
||||
myU0 : Real from Standard;
|
||||
myV0 : Real from Standard;
|
||||
myDU : Real from Standard;
|
||||
myDV : Real from Standard;
|
||||
|
||||
end TopolTool from IntTools;
|
419
src/IntTools/IntTools_TopolTool.cxx
Executable file
419
src/IntTools/IntTools_TopolTool.cxx
Executable file
@@ -0,0 +1,419 @@
|
||||
#include <IntTools_TopolTool.ixx>
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
static void Analyse(const TColgp_Array2OfPnt& array2,
|
||||
Standard_Integer& theNbSamplesU,
|
||||
Standard_Integer& theNbSamplesV);
|
||||
|
||||
// =====================================================================================
|
||||
// function: Constructor
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
IntTools_TopolTool::IntTools_TopolTool()
|
||||
{
|
||||
myNbSmplU = 0;
|
||||
myNbSmplV = 0;
|
||||
myDU = 1.;
|
||||
myDV = 1.;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: Constructor
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
IntTools_TopolTool::IntTools_TopolTool(const Handle(Adaptor3d_HSurface)& theSurface)
|
||||
{
|
||||
Initialize(theSurface);
|
||||
myNbSmplU = 0;
|
||||
myNbSmplV = 0;
|
||||
myDU = 1.;
|
||||
myDV = 1.;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: Initialize
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
void IntTools_TopolTool::Initialize()
|
||||
{
|
||||
Standard_NotImplemented::Raise("IntTools_TopolTool::Initialize ()");
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: Initialize
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
void IntTools_TopolTool::Initialize(const Handle(Adaptor3d_HSurface)& theSurface)
|
||||
{
|
||||
Adaptor3d_TopolTool::Initialize(theSurface);
|
||||
//myS = theSurface;
|
||||
myNbSmplU = 0;
|
||||
myNbSmplV = 0;
|
||||
myDU = 1.;
|
||||
myDV = 1.;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: ComputeSamplePoints
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
void IntTools_TopolTool::ComputeSamplePoints()
|
||||
{
|
||||
Standard_Real uinf, usup, vinf, vsup;
|
||||
uinf = myS->FirstUParameter();
|
||||
usup = myS->LastUParameter();
|
||||
vinf = myS->FirstVParameter();
|
||||
vsup = myS->LastVParameter();
|
||||
const Standard_Integer aMaxNbSample = 50;
|
||||
|
||||
if (usup < uinf) { Standard_Real temp = uinf; uinf = usup; usup = temp; }
|
||||
if (vsup < vinf) { Standard_Real temp = vinf; vinf = vsup; vsup = temp; }
|
||||
Standard_Boolean isbiguinf, isbigusup, isbigvinf, isbigvsup;
|
||||
isbiguinf = Precision::IsNegativeInfinite(uinf);
|
||||
isbigusup = Precision::IsPositiveInfinite(usup);
|
||||
isbigvinf = Precision::IsNegativeInfinite(vinf);
|
||||
isbigvsup = Precision::IsPositiveInfinite(vsup);
|
||||
|
||||
if(isbiguinf && isbigusup) {uinf = -1.e5; usup = 1.e5;}
|
||||
else if(isbiguinf) {uinf = usup - 2.e5;}
|
||||
else if(isbigusup) {usup = uinf + 2.e5;}
|
||||
|
||||
if(isbigvinf && isbigvsup) {vinf = -1.e5; vsup = 1.e5;}
|
||||
else if(isbigvinf) {vinf = vsup - 2.e5;}
|
||||
else if(isbigvsup) {vsup = vinf + 2.e5;}
|
||||
myU0 = uinf;
|
||||
myV0 = vinf;
|
||||
|
||||
Standard_Integer nbsu,nbsv;
|
||||
GeomAbs_SurfaceType typS = myS->GetType();
|
||||
|
||||
switch(typS) {
|
||||
case GeomAbs_Plane: {
|
||||
nbsu = 10; nbsv = 10;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cylinder: {
|
||||
Standard_Real aRadius = myS->Cylinder().Radius();
|
||||
Standard_Real aMaxAngle = Standard_PI * 0.5;
|
||||
Standard_Real aDeflection = 1.e-02;
|
||||
|
||||
if(aRadius > aDeflection) {
|
||||
aMaxAngle = ACos(1. - aDeflection / aRadius) * 2.;
|
||||
}
|
||||
if(aMaxAngle > Precision::Angular()) {
|
||||
nbsu = Standard_Integer((usup-uinf) / aMaxAngle);
|
||||
}
|
||||
nbsv = (Standard_Integer)(vsup-vinf);
|
||||
nbsv /= 10;
|
||||
|
||||
if(nbsu < 2) nbsu = 2;
|
||||
if(nbsv < 2) nbsv = 2;
|
||||
|
||||
// if(nbsu < 10) nbsu = 10;
|
||||
// if(nbsv < 10) nbsv = 10;
|
||||
if(nbsu > aMaxNbSample) nbsu = aMaxNbSample;
|
||||
if(nbsv > aMaxNbSample) nbsv = aMaxNbSample;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cone: {
|
||||
gp_Cone aCone = myS->Cone();
|
||||
gp_Circ aCircle = ElSLib::ConeVIso(aCone.Position(), aCone.RefRadius(), aCone.SemiAngle(), vinf);
|
||||
Standard_Real aRadius = aCircle.Radius();
|
||||
aCircle = ElSLib::ConeVIso(aCone.Position(), aCone.RefRadius(), aCone.SemiAngle(), vsup);
|
||||
|
||||
if(aRadius < aCircle.Radius())
|
||||
aRadius = aCircle.Radius();
|
||||
Standard_Real aMaxAngle = Standard_PI * 0.5;
|
||||
Standard_Real aDeflection = 1.e-02;
|
||||
|
||||
if(aRadius > aDeflection) {
|
||||
aMaxAngle = ACos(1. - aDeflection / aRadius) * 2.;
|
||||
}
|
||||
|
||||
if(aMaxAngle > Precision::Angular()) {
|
||||
nbsu = Standard_Integer((usup - uinf) / aMaxAngle);
|
||||
}
|
||||
nbsv = (Standard_Integer)(vsup - vinf);
|
||||
nbsv /= 10;
|
||||
|
||||
// if(nbsu < 2) nbsu = 2;
|
||||
// if(nbsv < 2) nbsv = 2;
|
||||
|
||||
if(nbsu < 10) nbsu = 10;
|
||||
if(nbsv < 10) nbsv = 10;
|
||||
if(nbsu > aMaxNbSample) nbsu = aMaxNbSample;
|
||||
if(nbsv > aMaxNbSample) nbsv = aMaxNbSample;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
case GeomAbs_Torus: {
|
||||
gp_Circ aCircle;
|
||||
Standard_Real aRadius1, aRadius2;
|
||||
|
||||
if(typS == GeomAbs_Torus) {
|
||||
gp_Torus aTorus = myS->Torus();
|
||||
aCircle = ElSLib::TorusUIso(aTorus.Position(), aTorus.MajorRadius(), aTorus.MinorRadius(), uinf);
|
||||
aRadius2 = aCircle.Radius();
|
||||
aCircle = ElSLib::TorusUIso(aTorus.Position(), aTorus.MajorRadius(), aTorus.MinorRadius(), usup);
|
||||
aRadius2 = (aRadius2 < aCircle.Radius()) ? aCircle.Radius() : aRadius2;
|
||||
|
||||
aCircle = ElSLib::TorusVIso(aTorus.Position(), aTorus.MajorRadius(), aTorus.MinorRadius(), vinf);
|
||||
aRadius1 = aCircle.Radius();
|
||||
aCircle = ElSLib::TorusVIso(aTorus.Position(), aTorus.MajorRadius(), aTorus.MinorRadius(), vsup);
|
||||
aRadius1 = (aRadius1 < aCircle.Radius()) ? aCircle.Radius() : aRadius1;
|
||||
}
|
||||
else {
|
||||
gp_Sphere aSphere = myS->Sphere();
|
||||
aRadius1 = aSphere.Radius();
|
||||
aRadius2 = aSphere.Radius();
|
||||
}
|
||||
Standard_Real aMaxAngle = Standard_PI * 0.5;
|
||||
Standard_Real aDeflection = 1.e-02;
|
||||
|
||||
if(aRadius1 > aDeflection) {
|
||||
aMaxAngle = ACos(1. - aDeflection / aRadius1) * 2.;
|
||||
}
|
||||
|
||||
if(aMaxAngle > Precision::Angular()) {
|
||||
nbsu = Standard_Integer((usup - uinf) / aMaxAngle);
|
||||
}
|
||||
aMaxAngle = Standard_PI * 0.5;
|
||||
|
||||
if(aRadius2 > aDeflection) {
|
||||
aMaxAngle = ACos(1. - aDeflection / aRadius2) * 2.;
|
||||
}
|
||||
|
||||
if(aMaxAngle > Precision::Angular()) {
|
||||
nbsv = Standard_Integer((vsup - vinf) / aMaxAngle);
|
||||
}
|
||||
if(nbsu < 10) nbsu = 10;
|
||||
if(nbsv < 10) nbsv = 10;
|
||||
if(nbsu > aMaxNbSample) nbsu = aMaxNbSample;
|
||||
if(nbsv > aMaxNbSample) nbsv = aMaxNbSample;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_BezierSurface: {
|
||||
nbsv = 3 + myS->NbVPoles();
|
||||
nbsu = 3 + myS->NbUPoles();
|
||||
|
||||
if(nbsu > 10 || nbsv > 10) {
|
||||
TColgp_Array2OfPnt array2(1, myS->NbUPoles(), 1, myS->NbVPoles());
|
||||
myS->Bezier()->Poles(array2);
|
||||
Analyse(array2, nbsu, nbsv);
|
||||
}
|
||||
|
||||
if(nbsu < 10) nbsu = 10;
|
||||
if(nbsv < 10) nbsv = 10;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_BSplineSurface: {
|
||||
nbsv = myS->NbVKnots(); nbsv *= myS->VDegree(); if(nbsv < 4) nbsv=4;
|
||||
nbsu = myS->NbUKnots(); nbsu *= myS->UDegree(); if(nbsu < 4) nbsu=4;
|
||||
|
||||
if(nbsu > 10 || nbsv > 10) {
|
||||
TColgp_Array2OfPnt array2(1, myS->NbUPoles(), 1, myS->NbVPoles());
|
||||
myS->BSpline()->Poles(array2);
|
||||
Analyse(array2, nbsu, nbsv);
|
||||
}
|
||||
if(nbsu < 10) nbsu = 10;
|
||||
if(nbsv < 10) nbsv = 10;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_SurfaceOfExtrusion: {
|
||||
nbsu = 15;
|
||||
nbsv = (Standard_Integer)(vsup - vinf);
|
||||
nbsv /= 10;
|
||||
if(nbsv < 15) nbsv = 15;
|
||||
if(nbsv > aMaxNbSample) nbsv = aMaxNbSample;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_SurfaceOfRevolution: {
|
||||
nbsv = 15; nbsu = 15;
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
nbsu = 10; nbsv = 10;
|
||||
}
|
||||
break;
|
||||
}
|
||||
myNbSmplU = nbsu;
|
||||
myNbSmplV = nbsv;
|
||||
|
||||
myNbSamplesU = myNbSmplU;
|
||||
myNbSamplesV = myNbSmplV;
|
||||
|
||||
myDU = (usup - uinf)/(myNbSmplU + 1);
|
||||
myDV = (vsup - vinf)/(myNbSmplV + 1);
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: NbSamplesU
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
Standard_Integer IntTools_TopolTool::NbSamplesU()
|
||||
{
|
||||
if(myNbSmplU <= 0) {
|
||||
ComputeSamplePoints();
|
||||
}
|
||||
return myNbSmplU;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: NbSamplesV
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
Standard_Integer IntTools_TopolTool::NbSamplesV()
|
||||
{
|
||||
if(myNbSmplV <= 0) {
|
||||
ComputeSamplePoints();
|
||||
}
|
||||
return myNbSmplV;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: NbSamples
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
Standard_Integer IntTools_TopolTool::NbSamples()
|
||||
{
|
||||
if(myNbSmplU <= 0) {
|
||||
ComputeSamplePoints();
|
||||
}
|
||||
return(myNbSmplU * myNbSmplV);
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
// function: SamplePoint
|
||||
// purpose:
|
||||
// =====================================================================================
|
||||
void IntTools_TopolTool::SamplePoint(const Standard_Integer Index,
|
||||
gp_Pnt2d& P2d,
|
||||
gp_Pnt& P3d)
|
||||
{
|
||||
if (myUPars.IsNull())
|
||||
{
|
||||
if(myNbSmplU <= 0) {
|
||||
ComputeSamplePoints();
|
||||
}
|
||||
Standard_Integer iv = 1 + Index / myNbSmplU;
|
||||
Standard_Integer iu = 1 + Index - (iv - 1) * myNbSmplU;
|
||||
Standard_Real u = myU0 + iu * myDU;
|
||||
Standard_Real v = myV0 + iv * myDV;
|
||||
P2d.SetCoord(u, v);
|
||||
P3d = myS->Value(u, v);
|
||||
}
|
||||
else
|
||||
Adaptor3d_TopolTool::SamplePoint(Index, P2d, P3d);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : Analyse
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void Analyse(const TColgp_Array2OfPnt& array2,
|
||||
Standard_Integer& theNbSamplesU,
|
||||
Standard_Integer& theNbSamplesV)
|
||||
{
|
||||
gp_Vec Vi,Vip1;
|
||||
Standard_Integer sh,nbch,i,j;
|
||||
const Standard_Integer nbup = array2.UpperRow() - array2.LowerRow() + 1;
|
||||
const Standard_Integer nbvp = array2.UpperCol() - array2.LowerCol() + 1;
|
||||
|
||||
sh = 1;
|
||||
nbch = 0;
|
||||
if(nbvp>2) {
|
||||
|
||||
for(i = array2.LowerRow(); i <= array2.UpperRow(); i++) {
|
||||
const gp_Pnt& A=array2.Value(i,1);
|
||||
const gp_Pnt& B=array2.Value(i,2);
|
||||
const gp_Pnt& C=array2.Value(i,3);
|
||||
Vi.SetCoord(C.X()-B.X()-B.X()+A.X(),
|
||||
C.Y()-B.Y()-B.Y()+A.Y(),
|
||||
C.Z()-B.Z()-B.Z()+A.Z());
|
||||
Standard_Integer locnbch=0;
|
||||
|
||||
for(j = array2.LowerCol() + 2; j < array2.UpperCol();j++) { //-- essai
|
||||
const gp_Pnt& Ax=array2.Value(i,j-1);
|
||||
const gp_Pnt& Bx=array2.Value(i,j);
|
||||
const gp_Pnt& Cx=array2.Value(i,j+1);
|
||||
Vip1.SetCoord(Cx.X()-Bx.X()-Bx.X()+Ax.X(),
|
||||
Cx.Y()-Bx.Y()-Bx.Y()+Ax.Y(),
|
||||
Cx.Z()-Bx.Z()-Bx.Z()+Ax.Z());
|
||||
Standard_Real pd = Vi.Dot(Vip1);
|
||||
Vi=Vip1;
|
||||
if(pd>1.0e-7 || pd<-1.0e-7) {
|
||||
if(pd>0) { if(sh==-1) { sh=1; locnbch++; } }
|
||||
else { if(sh==1) { sh=-1; locnbch++; } }
|
||||
}
|
||||
}
|
||||
if(locnbch>nbch) {
|
||||
nbch=locnbch;
|
||||
}
|
||||
}
|
||||
}
|
||||
theNbSamplesV = nbch+5;
|
||||
|
||||
|
||||
nbch=0;
|
||||
if(nbup > 2) {
|
||||
for(j = array2.LowerCol(); j <= array2.UpperCol(); j++) {
|
||||
const gp_Pnt& A=array2.Value(array2.LowerRow(), j);
|
||||
const gp_Pnt& B=array2.Value(array2.LowerRow() + 1, j);
|
||||
const gp_Pnt& C=array2.Value(array2.LowerRow() + 2, j);
|
||||
Vi.SetCoord(C.X()-B.X()-B.X()+A.X(),
|
||||
C.Y()-B.Y()-B.Y()+A.Y(),
|
||||
C.Z()-B.Z()-B.Z()+A.Z());
|
||||
Standard_Integer locnbch=0;
|
||||
|
||||
for(i = array2.LowerRow() + 2; i < array2.UpperRow(); i++) { //-- essai
|
||||
const gp_Pnt& Ax=array2.Value(i-1,j);
|
||||
const gp_Pnt& Bx=array2.Value(i,j);
|
||||
const gp_Pnt& Cx=array2.Value(i+1,j);
|
||||
Vip1.SetCoord(Cx.X()-Bx.X()-Bx.X()+Ax.X(),
|
||||
Cx.Y()-Bx.Y()-Bx.Y()+Ax.Y(),
|
||||
Cx.Z()-Bx.Z()-Bx.Z()+Ax.Z());
|
||||
Standard_Real pd = Vi.Dot(Vip1);
|
||||
Vi=Vip1;
|
||||
if(pd>1.0e-7 || pd<-1.0e-7) {
|
||||
if(pd>0) { if(sh==-1) { sh=1; locnbch++; } }
|
||||
else { if(sh==1) { sh=-1; locnbch++; } }
|
||||
}
|
||||
}
|
||||
if(locnbch>nbch) nbch=locnbch;
|
||||
}
|
||||
}
|
||||
theNbSamplesU = nbch+5;
|
||||
}
|
||||
|
||||
//Modified IFV
|
||||
//=======================================================================
|
||||
//function : SamplePnts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntTools_TopolTool::SamplePnts(const Standard_Real theDefl,
|
||||
const Standard_Integer theNUmin,
|
||||
const Standard_Integer theNVmin)
|
||||
{
|
||||
Adaptor3d_TopolTool::SamplePnts(theDefl, theNUmin, theNVmin);
|
||||
|
||||
myNbSmplU = Adaptor3d_TopolTool::NbSamplesU();
|
||||
myNbSmplV = Adaptor3d_TopolTool::NbSamplesV();
|
||||
|
||||
myU0 = myUPars->Value(1);
|
||||
myV0 = myVPars->Value(1);
|
||||
|
||||
myDU = (myUPars->Value(myNbSmplU) - myU0)/(myNbSmplU-1);
|
||||
myDV = (myVPars->Value(myNbSmplV) - myU0)/(myNbSmplV-1);
|
||||
}
|
Reference in New Issue
Block a user