1
0
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:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

8
src/IntCurve/FILES Executable file
View File

@@ -0,0 +1,8 @@
IntCurve_IntConicConic_Tool.cxx
IntCurve_IntConicConic_1.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_IntConicConic_Tool.cxx
IntCurve_ToolPolygon.gxx
IntCurve_IntConicConic_1.hxx
IntCurve_IntConicConic_Tool.hxx

110
src/IntCurve/IntCurve.cdl Executable file
View File

@@ -0,0 +1,110 @@
-- File: IntCurve.cdl
-- Created: Wed Mar 4 13:52:01 1992
-- Author: Laurent BUCHARD
-- <lbr@phobox>
---Copyright: Matra Datavision 1992
package IntCurve
---Purpose: This package provides algorithmes to intersect 2D curves,
-- with domains.
--
-- class IntConicConic : Algorithm used to intersect 2 conics
-- from gp with domains.
--
-- class IntConicCurveGen : Generic algorithm used to intersect
-- a conic from gp, and a parametrised
-- curve.
-- The parametrised Curve can
-- not be a Composite curve and
-- can not be a conic.
--
-- class IntCurveCurveGen : Generic algorithm used to intersect 2
-- curves. The resources on a curve are
-- discribed in the class CurveTool.
--
-- class UserIntConicCurveGen: Generic algorithm used to
-- intersect a Conic from gp
-- and a parametrised curve.
-- This curve can be either a
-- composite curve or a conic.
--
---Level: Advanced
--
-- The Classes <PConicTool,
-- IConicTool,
-- PConic,
-- ProjectOnPConicTool,
-- IntConicCurveGen,
-- ProjPCurGen,
-- UserIntConicCurveGen,
-- IntPolyPolyGen,
-- ToolPolygon,
-- Polygon2dGen,
-- DistBetweenPCurvesGen> are Internal
--
-- The Classe <IntCurveCurveGen> is Advanced
--
--
uses Standard , math, gp, TColgp, GeomAbs,
IntImpParGen, IntRes2d, Extrema,
StdFail, Bnd, Intf, TColStd
is
class IntConicConic;
---Purpose: Intersection between 2 conics from gp.
generic class DistBetweenPCurvesGen;
generic class Polygon2dGen;
generic class ToolPolygon;
generic class IntPolyPolyGen,ThePolygon2d,
ThePolygon2dTool,
InterferencePoly2d,
TheDistBetweenPCurves,
ExactIntersectionPoint;
generic class UserIntConicCurveGen;
generic class ProjPCurGen,TheCurveLocator,TheLocateExtPC;
generic class IntConicCurveGen,TheIntersector;
---Purpose: Intersection between a conic from gp and a bounded parametric curve.
generic class IntCurveCurveGen,TheProjPCur,
TheIntConicCurve,
IntConicCurve,
TheIntPCurvePCurve;
---Purpose: Intersection between 2 2d curves.
private class ProjectOnPConicTool;
class PConic;
class IConicTool;
private class PConicTool;
private class IntImpConicParConic
instantiates Intersector from IntImpParGen
(IConicTool from IntCurve,
PConic from IntCurve,
PConicTool from IntCurve,
ProjectOnPConicTool from IntCurve);
end IntCurve;

View File

@@ -0,0 +1,101 @@
-- File: DistBetweenPCurvesGen.cdl
-- Created: Wed Oct 21 16:37:20 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
generic class DistBetweenPCurvesGen from IntCurve (
TheCurve as any;
TheCurveTool as any) -- as CurveTool from IntCurve(TheCurve)
inherits FunctionSetWithDerivatives from math
---Purpose: provides a set of 2 function of 2 variables.
-- f1(u,v) = X1(u) - X2(v)
-- f2(u,v) = Y1(u) - Y2(v)
-- where (X1(u),Y1(u)) = ParamCurve1.Value(u)
-- and (X2(v),Y2(v)) = ParamCurve2.Value(v)
--
-- The Jacobian Matrix is :
--
-- | df1 df1 | | T1x(u) - T2x(v) |
-- | --- --- | = | |
-- | du dv | | T1y(u) - T2y(v) |
-- | |
-- | |
-- | df2 df2 |
-- | --- --- |
-- | du dv |
--
-- where T1(u) = (T1x(u),T1y(u)) is the tangent vector at
-- the curve1 at the parameter u.
-- and
-- T2(u) = (T2x(u),T2y(u)) is the tangent vector at
-- the curve2 at the parameter u.
---Level: Internal
uses Vector from math,
Matrix from math
is
Create(curve1: TheCurve;
curve2: TheCurve)
returns DistBetweenPCurvesGen;
NbVariables(me)
---Purpose: returns 2.
returns Integer from Standard
is static;
NbEquations(me)
---Purpose: returns 2.
returns Integer from Standard
is static;
Value(me: in out; X: Vector; F: out Vector)
---Purpose: computes the values <F> of the Functions for the
-- variable <X>.
-- returns True if the computation was done successfully,
-- False otherwise.
returns Boolean
is static;
Derivatives(me: in out; X: Vector; D: out Matrix)
---Purpose: returns the values <D> of the derivatives for the
-- variable <X>.
-- returns True if the computation was done successfully,
-- False otherwise.
returns Boolean
is static;
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
---Purpose: returns the values <F> of the functions and the derivatives
-- <D> for the variable <X>.
-- returns True if the computation was done successfully,
-- False otherwise.
returns Boolean
is static;
fields
thecurve1 : Address from Standard; --- TheCurve;
thecurve2 : Address from Standard; --- TheCurve;
end DistBetweenPCurvesGen;

View File

@@ -0,0 +1,91 @@
// File: IntCurve_DistBetweenPCurvesGen.gxx
// Created: Wed Oct 21 17:39:03 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#ifndef DEB
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#define THECURVE1 (*((TheCurve *)thecurve1))
#define THECURVE2 (*((TheCurve *)thecurve2))
//======================================================================
IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen( const TheCurve& C1
,const TheCurve& C2) {
thecurve1 = (Standard_Address) (&C1);
thecurve2 = (Standard_Address )(&C2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const {
return(2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const {
return(2);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value
(const math_Vector& X
,math_Vector& F)
{
gp_Pnt2d P1,P2;
TheCurveTool::D0(THECURVE1,X(1),P1);
TheCurveTool::D0(THECURVE2,X(2),P2);
F(1) = P1.X() - P2.X();
F(2) = P1.Y() - P2.Y();
return(Standard_True);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives
(const math_Vector& X
,math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P;
TheCurveTool::D1(THECURVE1,X(1),P,T);
D.Value(1,1) = T.X();
D.Value(2,1) = T.Y();
TheCurveTool::D1(THECURVE2,X(2),P,T);
D.Value(1,2) = -(T.X());
D.Value(2,2) = -(T.Y());
return(Standard_True);
}
//======================================================================
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values
(const math_Vector& X
,math_Vector& F
,math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P1,P2;
TheCurveTool::D1(THECURVE1,X(1),P1,T);
D.Value(1,1) = T.X();
D.Value(2,1) = T.Y();
TheCurveTool::D1(THECURVE2,X(2),P2,T);
D.Value(1,2) = -(T.X());
D.Value(2,2) = -(T.Y());
F.Value(1) = P1.X() - P2.X();
F.Value(2) = P1.Y() - P2.Y();
return(Standard_True);
}
//======================================================================

View File

@@ -0,0 +1,213 @@
// File: IntCurve_ExactIntersectionPoint.gxx
// Created: Wed Dec 15 16:18:55 1999
// Author: Atelier CAS2000
// <cas@cageox.paris1.matra-dtv.fr>
#include <math_Vector.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_NewtonFunctionSetRoot.hxx>
#include <gp_Vec2d.hxx>
//======================================================================
//===
//======================================================================
IntCurve_ExactIntersectionPoint::IntCurve_ExactIntersectionPoint(const TheCurve& C1,const TheCurve& C2,const Standard_Real Tol)
: done(Standard_False),
nbroots(0),
myTol(Tol*Tol),
FctDist(C1,C2),
ToleranceVector(1,2),
BInfVector(1,2),
BSupVector(1,2),
StartingPoint(1,2),
Root(1,2),
anErrorOccurred(Standard_False)
{
ToleranceVector.Value(1) = TheCurveTool::EpsX(C1);
ToleranceVector.Value(2) = TheCurveTool::EpsX(C2);
}
//----------------------------------------------------------------------
void IntCurve_ExactIntersectionPoint::Perform( const IntCurve_ThePolygon2d& Poly1
,const IntCurve_ThePolygon2d& Poly2
,Standard_Integer& NumSegOn1
,Standard_Integer& NumSegOn2
,Standard_Real& ParamOnSeg1
,Standard_Real& ParamOnSeg2) {
//----------------------------------------------------------------------
//-- On prend comme bornes de recherches :
//--
//-- Segment : i-1 i i+1 i+2
//--
//-- |---------|-----X-------|---------|----------|
//-- Inf Sup
//--
if(NumSegOn1 >= Poly1.NbSegments() && ParamOnSeg1==0.0) {
NumSegOn1--; ParamOnSeg1 = 1.0;
}
if(NumSegOn2 >= Poly2.NbSegments() && ParamOnSeg2==0.0) {
NumSegOn2--; ParamOnSeg2 = 1.0;
}
if(NumSegOn1 <=0) {
NumSegOn1=1; ParamOnSeg1 = 0.0;
}
if(NumSegOn2 <=0) {
NumSegOn2=1; ParamOnSeg2 = 0.0;
}
StartingPoint.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1,ParamOnSeg1);
if(NumSegOn1<=2) BInfVector.Value(1)= Poly1.InfParameter();
else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-1,(Standard_Real)0.0);
if(NumSegOn1 >= (Poly1.NbSegments() -2)) BSupVector.Value(1)= Poly1.SupParameter();
else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+2,(Standard_Real)0.0);
StartingPoint.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2,ParamOnSeg2);
if(NumSegOn2<=2) BInfVector.Value(2)= Poly2.InfParameter();
else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-1,(Standard_Real)0.0);
if(NumSegOn2 >= (Poly2.NbSegments() -2)) BSupVector.Value(2)= Poly2.SupParameter();
else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+2,(Standard_Real)0.0);
IntCurve_ExactIntersectionPoint::MathPerform();
if(nbroots == 0) {
// Standard_Real DeflectionOn1 = Poly1.DeflectionOverEstimation();
Poly1.DeflectionOverEstimation();
// Standard_Real DeflectionOn2 = Poly2.DeflectionOverEstimation();
Poly2.DeflectionOverEstimation();
// if(DeflectionOn2 > Poly1.BeginOfSeg(NumSegOn1).Distance(Poly1.EndOfSeg(NumSegOn1))) {
{
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
Standard_Integer diff=1;
Standard_Real AnBinfVector = BInfVector.Value(1);
Standard_Real AnBsupVector = BSupVector.Value(1);
//---------------- On elargit les bornes par la gauche --------------------
do {
diff++;
if((NumSegOn1-diff)<=1) {
BInfVector.Value(1)= Poly1.InfParameter();
diff=0;
}
else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-diff,(Standard_Real)0.0);
IntCurve_ExactIntersectionPoint::MathPerform();
//-- le 18 nov 97
if(diff>3) diff+=NumSegOn1/2;
}
while( nbroots==0 && diff!=0);
//---------------- On elargit les bornes par la droite --------------------
if(nbroots==0) {
BInfVector.Value(1) = AnBinfVector;
diff=1;
do {
diff++;
if((NumSegOn1+diff) >= (Poly1.NbSegments() -1)) {
BSupVector.Value(1)= Poly1.SupParameter();
diff=0;
}
else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+1+diff,(Standard_Real)0.0);
IntCurve_ExactIntersectionPoint::MathPerform();
//-- le 18 nov 97
if(diff>3) diff+=1+(Poly1.NbSegments()-NumSegOn1)/2;
}
while( nbroots==0 && diff!=0);
}
BSupVector.Value(1) = AnBsupVector;
}
if(nbroots==0) {
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
Standard_Integer diff=1;
Standard_Real AnBinfVector = BInfVector.Value(2);
Standard_Real AnBsupVector = BSupVector.Value(2);
//---------------- On elargit les bornes par la gauche --------------------
do {
diff++;
if((NumSegOn2-diff)<=1) {
BInfVector.Value(2)= Poly2.InfParameter();
diff=0;
}
else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-diff,(Standard_Real)0.0);
IntCurve_ExactIntersectionPoint::MathPerform();
//-- le 18 nov 97
if(diff>3) diff+=NumSegOn2/2;
}
while( nbroots==0 && diff!=0);
//---------------- On elargit les bornes par la droite --------------------
if(nbroots==0) {
BInfVector.Value(2) = AnBinfVector;
diff=1;
do {
diff++;
if((NumSegOn2+diff) >= (Poly2.NbSegments() -1)) {
BSupVector.Value(2)= Poly2.SupParameter();
diff=0;
}
else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+1+diff,(Standard_Real)0.0);
IntCurve_ExactIntersectionPoint::MathPerform();
//-- le 18 nov 97
if(diff>3) diff+=1+(Poly2.NbSegments()-NumSegOn2)/2;
}
while( nbroots==0 && diff!=0);
}
BSupVector.Value(2) = AnBsupVector;
}
}
}
//----------------------------------------------------------------------
void IntCurve_ExactIntersectionPoint::Perform( const Standard_Real Uo
,const Standard_Real Vo
,const Standard_Real UInf
,const Standard_Real VInf
,const Standard_Real USup
,const Standard_Real VSup) {
done = Standard_True;
BInfVector.Value(1) = UInf;
BInfVector.Value(2) = VInf;
BSupVector.Value(1) = USup;
BSupVector.Value(2) = VSup;
StartingPoint.Value(1) = Uo;
StartingPoint.Value(2) = Vo;
IntCurve_ExactIntersectionPoint::MathPerform();
}
//----------------------------------------------------------------------
Standard_Integer IntCurve_ExactIntersectionPoint::NbRoots() const { return(nbroots); }
//----------------------------------------------------------------------
void IntCurve_ExactIntersectionPoint::Roots(Standard_Real& U,Standard_Real& V) {
U=Root.Value(1);
V=Root.Value(2);
}
//----------------------------------------------------------------------
void IntCurve_ExactIntersectionPoint::MathPerform(void) {
math_FunctionSetRoot Fct( FctDist
,StartingPoint
,ToleranceVector
,BInfVector
,BSupVector
,50);
if(Fct.IsDone()) {
Fct.Root(Root); nbroots = 1;
math_Vector XY(1,2);
FctDist.Value(Root,XY);
Standard_Real dist2 = ((XY(1)*XY(1)+XY(2)*XY(2)));
if(dist2 > myTol) nbroots = 0;
}
else {
anErrorOccurred = Standard_True;
nbroots = 0;
}
}
//======================================================================
Standard_Boolean IntCurve_ExactIntersectionPoint::AnErrorOccurred() const
{
return anErrorOccurred;
}

View File

@@ -0,0 +1,100 @@
-- File: IConicTool.cdl
-- Created: Thu Mar 26 14:24:05 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1992
class IConicTool from IntCurve
---Purpose: Implementation of the ImpTool from IntImpParGen
-- for conics of gp.
---Level: Internal
uses
Pnt2d from gp,
Vec2d from gp,
Ax22d from gp,
Lin2d from gp,
Elips2d from gp,
Circ2d from gp,
Parab2d from gp,
Hypr2d from gp,
Trsf2d from gp,
CurveType from GeomAbs
is
Create returns IConicTool from IntCurve;
Create(IT: IConicTool from IntCurve) returns IConicTool from IntCurve;
Create(E: Elips2d from gp) returns IConicTool from IntCurve;
Create(L: Lin2d from gp) returns IConicTool from IntCurve;
Create(C: Circ2d from gp) returns IConicTool from IntCurve;
Create(P: Parab2d from gp) returns IConicTool from IntCurve;
Create(H: Hypr2d from gp) returns IConicTool from IntCurve;
Value (me; X: Real from Standard)
returns Pnt2d from gp
is static;
D1 (me; U: Real from Standard ; P: out Pnt2d; T: out Vec2d)
is static;
D2 (me; U: Real from Standard ; P: out Pnt2d; T,N: out Vec2d)
is static;
Distance(me; P: Pnt2d)
---Purpose: Computes the value of the signed distance between
-- the point P and the implicit curve.
returns Real from Standard
is static;
GradDistance(me; P: Pnt2d)
---Purpose: Computes the Gradient of the Signed Distance
-- between a point and the implicit curve, at the
-- point P.
returns Vec2d from gp
is static;
FindParameter(me; P: Pnt2d)
---Purpose: Returns the parameter U of the point on the
-- implicit curve corresponding to the point P. The
-- correspondance between P and the point P(U) on the
-- implicit curve must be coherent with the way of
-- determination of the signed distance.
returns Real from Standard
is static;
fields
prm1 : Real from Standard;
prm2 : Real from Standard;
prm3 : Real from Standard;
Axis : Ax22d from gp;
type : CurveType from GeomAbs;
Abs_To_Object : Trsf2d from gp;
end IConicTool;

View File

@@ -0,0 +1,322 @@
#include <IntCurve_IConicTool.ixx>
#include <ElCLib.hxx>
#include <gp.hxx>
#define Object_To_Abs Abs_To_Object.Inverted()
//======================================================================
#define Elips_a prm1
#define Elips_b prm2
#define Elips_c prm3
#define Elips_aa (Elips_a*Elips_a)
#define Elips_bb (Elips_b*Elips_b)
#define Elips_x0 (Axis.Location().X())
#define Elips_y0 (Axis.Location().Y())
//======================================================================
#define Hypr_a prm1
#define Hypr_b prm2
#define Hypr_aa (Hypr_a * Hypr_a)
#define Hypr_bb (Hypr_b * Hypr_b)
//======================================================================
#define Line_a prm1
#define Line_b prm2
#define Line_c prm3
//======================================================================
#define Circle_r prm1
#define Circle_x0 prm2
#define Circle_y0 prm3
//======================================================================
#define Parab_f prm1
#define Parab_2p prm2
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(void) {
//###### PLACER LE TYPE NON DEFINI ######
}
IntCurve_IConicTool::IntCurve_IConicTool(const IntCurve_IConicTool& ITool) {
prm1=ITool.prm1;
prm2=ITool.prm2;
prm3=ITool.prm3;
Axis=ITool.Axis;
Abs_To_Object=ITool.Abs_To_Object;
type=ITool.type;
}
//======================================================================
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(const gp_Lin2d& Line) {
Line.Coefficients(Line_a,Line_b,Line_c);
Axis = gp_Ax22d(Line.Position(),Standard_True);
type = GeomAbs_Line;
}
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(const gp_Elips2d& Elips) {
Elips_a = Elips.MajorRadius();
Elips_b = Elips.MinorRadius();
Elips_c = sqrt(Elips_a*Elips_a-Elips_b*Elips_b);
Axis = Elips.Axis();
Abs_To_Object.SetTransformation(gp::OX2d(),Axis.XAxis());
type = GeomAbs_Ellipse;
}
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(const gp_Circ2d& C) {
Circle_r=C.Radius();
Axis=C.Axis();
Circle_x0=Axis.Location().X();
Circle_y0=Axis.Location().Y();
Abs_To_Object.SetTransformation(gp::OX2d(),Axis.XAxis());
type = GeomAbs_Circle;
}
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(const gp_Parab2d& P) {
Parab_f=P.Focal();
Parab_2p=4.0*Parab_f;
Axis=P.Axis();
Abs_To_Object.SetTransformation(gp::OX2d(),Axis.XAxis());
type = GeomAbs_Parabola;
}
//======================================================================
IntCurve_IConicTool::IntCurve_IConicTool(const gp_Hypr2d& H) {
Hypr_a = H.MajorRadius();
Hypr_b = H.MinorRadius();
Axis = H.Axis();
Abs_To_Object.SetTransformation(gp::OX2d(),Axis.XAxis());
type = GeomAbs_Hyperbola;
}
//----------------------------------------------------------------------
gp_Pnt2d IntCurve_IConicTool::Value(const Standard_Real X) const {
switch(type) {
case GeomAbs_Line: return(ElCLib::LineValue(X,Axis.XAxis()));
case GeomAbs_Ellipse: return(ElCLib::EllipseValue(X,Axis,Elips_a,Elips_b));
case GeomAbs_Circle: return(ElCLib::CircleValue(X,Axis,Circle_r));
case GeomAbs_Parabola: return(ElCLib::ParabolaValue(X,Axis,Parab_f));
case GeomAbs_Hyperbola: return(ElCLib::HyperbolaValue(X,Axis,Hypr_a,Hypr_b));
default: { cout<<"### Erreur sur le type de la courbe ###";
return(gp_Pnt2d(0.0,0.0)); }
}
}
//----------------------------------------------------------------------
void IntCurve_IConicTool::D1(const Standard_Real X,
gp_Pnt2d& Pt,
gp_Vec2d& Tan) const {
switch(type) {
case GeomAbs_Line: ElCLib::LineD1(X,Axis.XAxis(),Pt,Tan); break;
case GeomAbs_Ellipse: ElCLib::EllipseD1(X,Axis,Elips_a,Elips_b,Pt,Tan); break;
case GeomAbs_Circle: ElCLib::CircleD1(X,Axis,Circle_r,Pt,Tan); break;
case GeomAbs_Parabola: ElCLib::ParabolaD1(X,Axis,Parab_f,Pt,Tan); break;
case GeomAbs_Hyperbola: ElCLib::HyperbolaD1(X,Axis,Hypr_a,Hypr_b,Pt,Tan); break;
default: { cout<<"### Erreur sur le type de la courbe ###"; }
}
}
//----------------------------------------------------------------------
void IntCurve_IConicTool::D2(const Standard_Real X,
gp_Pnt2d& Pt,
gp_Vec2d& Tan,
gp_Vec2d& Norm) const {
switch(type) {
case GeomAbs_Line: ElCLib::LineD1(X,Axis.XAxis(),Pt,Tan); Norm.SetCoord(0.0,0.0); break;
case GeomAbs_Ellipse: ElCLib::EllipseD2(X,Axis,Elips_a,Elips_b,Pt,Tan,Norm); break;
case GeomAbs_Circle: ElCLib::CircleD2(X,Axis,Circle_r,Pt,Tan,Norm); break;
case GeomAbs_Parabola: ElCLib::ParabolaD2(X,Axis,Parab_f,Pt,Tan,Norm); break;
case GeomAbs_Hyperbola: ElCLib::HyperbolaD2(X,Axis,Hypr_a,Hypr_b,Pt,Tan,Norm); break;
default: { cout<<"### Erreur sur le type de la courbe ###"; }
}
}
//----------------------------------------------------------------------
#define AN_ELIPS 0
//----------------------------------------------------------------------
Standard_Real IntCurve_IConicTool::Distance(const gp_Pnt2d& ThePoint) const {
switch(type) {
case GeomAbs_Line:
{
return(Line_a*ThePoint.X()+Line_b*ThePoint.Y()+Line_c);
}
case GeomAbs_Ellipse:
{
#if AN_ELIPS
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
Standard_Real x=P.X();
Standard_Real y2=P.Y() * P.Y();
return(sqrt(y2+(x+Elips_c)*(x+Elips_c))
+sqrt(y2+(x-Elips_c)*(x-Elips_c))-Elips_a-Elips_a);
#else
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
Standard_Real x=P.X();
Standard_Real y=P.Y()*(Elips_a/Elips_b);
Standard_Real d=sqrt(x*x+y*y)-Elips_a;
return(d);
#endif
}
case GeomAbs_Circle:
{
Standard_Real Dx=Circle_x0-ThePoint.X();
Standard_Real Dy=Circle_y0-ThePoint.Y();
return(sqrt(Dx*Dx+Dy*Dy)-Circle_r);
}
case GeomAbs_Parabola:
{ //-- Distance(X,Y) = Y**2 - 2 P X
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
return(P.Y()*P.Y()-Parab_2p*P.X());
}
case GeomAbs_Hyperbola:
{ //-- Distance(X,Y) = (X/a)**2 - (Y/b)**2 -1
//-- pour x>0
//-- -(Y/b)**2 - 1 sinon ??
//-- avec un gradient avec x -> Abs(x)
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
if(P.X()>0.0)
return((P.X()*P.X())/Hypr_aa
-(P.Y()*P.Y())/Hypr_bb -1.0);
else
return((-P.X()*P.X())/Hypr_aa
-(P.Y()*P.Y())/Hypr_bb -1.0);
}
default: { cout<<"### Erreur sur le type de la courbe ###";
return(0.0); }
}
}
gp_Vec2d IntCurve_IConicTool::GradDistance(const gp_Pnt2d& ThePoint) const {
switch(type) {
case GeomAbs_Line: return(gp_Vec2d(Line_a,Line_b));
case GeomAbs_Circle: {
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
Standard_Real Gradx=0.0;
Standard_Real Grady=0.0;
Standard_Real x=P.X();
Standard_Real y=P.Y();
Standard_Real temp1=sqrt(y*y+x*x);
if(temp1) {
Gradx=x/temp1;
Grady=y/temp1;
}
gp_Vec2d Gradient(Gradx,Grady);
Gradient.Transform(Object_To_Abs);
return(Gradient);
}
case GeomAbs_Ellipse: {
#if AN_ELIPS
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
Standard_Real Gradx=0.0;
Standard_Real Grady=0.0;
Standard_Real x=P.X();
Standard_Real y=P.Y();
Standard_Real xmc=x-Elips_c;
Standard_Real xpc=x+Elips_c;
Standard_Real temp1=sqrt(y*y+xmc*xmc);
Standard_Real temp2=sqrt(y*y+xpc*xpc);
if(temp2) {
Gradx=xpc/temp2;
Grady=y/temp2;
}
if(temp1) {
Gradx+=xmc/temp1;
Grady+=y/temp1;
}
gp_Vec2d Gradient(Gradx,Grady);
Gradient.Transform(Object_To_Abs);
return(Gradient);
#else
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
Standard_Real Gradx=0.0;
Standard_Real Grady=0.0;
Standard_Real x=P.X();
Standard_Real y=P.Y()*(Elips_a/Elips_b);
Standard_Real temp1=sqrt(y*y+x*x);
if(temp1) {
Gradx=x/temp1;
Grady=(y*(Elips_a/Elips_b))/temp1;
}
gp_Vec2d Gradient(Gradx,Grady);
Gradient.Transform(Object_To_Abs);
return(Gradient);
#endif
}
case GeomAbs_Parabola: { //-- Distance(X,Y) = Y**2 - 2 P X
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
gp_Vec2d Gradient(-Parab_2p,P.Y()+P.Y());
Gradient.Transform(Object_To_Abs);
return(Gradient);
}
case GeomAbs_Hyperbola: { //-- Distance(X,Y) = (X/a)**2 - (Y/b)**2 -1
gp_Pnt2d P=ThePoint;
P.Transform(Abs_To_Object);
//--### la Branche a X negatif doit ramener vers les X positifs
gp_Vec2d Gradient(2.0*Abs(P.X())/Hypr_aa,-2.0*P.Y()/Hypr_bb);
Gradient.Transform(Object_To_Abs);
return(Gradient);
}
default: { cout<<"### Erreur sur le type de la courbe ###";
return(gp_Vec2d(0.0,0.0)); }
}
}
Standard_Real IntCurve_IConicTool::FindParameter(const gp_Pnt2d& P) const {
Standard_Real Param=0;
switch(type) {
case GeomAbs_Line:
Param=ElCLib::LineParameter(Axis.XAxis(),P);
break;
case GeomAbs_Circle:
Param=ElCLib::CircleParameter(Axis,P);
if(Param<0.0) { Param+=PI+PI; }
break;
case GeomAbs_Ellipse: {
Param=ElCLib::EllipseParameter(Axis
,Elips_a
,Elips_b
,P);
if (Param < 0.0) { Param+=PI+PI; }
break;
}
case GeomAbs_Parabola: {
Param=ElCLib::ParabolaParameter(Axis,P);
break;
}
case GeomAbs_Hyperbola: {
Param=ElCLib::HyperbolaParameter(Axis
,Hypr_a
,Hypr_b
,P);
break;
}
#ifndef DEB
default:
break;
#endif
}
return(Param);
}

View File

@@ -0,0 +1,390 @@
-- File: IntConicConic.cdl
-- Created: Mon Apr 27 17:02:19 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1992
class IntConicConic from IntCurve
---Purpose: Provides methods to intersect two conics.
-- The exception ConstructionError is raised in constructors
-- or in Perform methods when a domain (Domain from IntRes2d)
-- is not correct, i-e when a Circle (Circ2d from gp) or
-- an Ellipse (i-e Elips2d from gp) do not have a closed
-- domain (use the SetEquivalentParameters method for a domain
-- on a circle or an ellipse).
inherits Intersection from IntRes2d
uses Lin2d from gp,
Elips2d from gp,
Circ2d from gp,
Parab2d from gp,
Hypr2d from gp,
PConic from IntCurve,
IConicTool from IntCurve,
Domain from IntRes2d,
IntImpConicParConic from IntCurve
raises ConstructionError from Standard
is
Create
---Purpose: Empty Constructor
returns IntConicConic from IntCurve;
---C++:inline
Create(L1: Lin2d from gp; D1: Domain from IntRes2d;
L2: Lin2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 lines from gp.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out;L1: Lin2d from gp; D1: Domain from IntRes2d;
L2: Lin2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 lines from gp.
is static;
Create(L: Lin2d from gp; DL: Domain from IntRes2d;
C: Circ2d from gp; DC: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and a circle.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;L: Lin2d from gp; DL: Domain from IntRes2d;
C: Circ2d from gp; DC: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a circle.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
raises ConstructionError from Standard
is static;
Create(L: Lin2d from gp; DL: Domain from IntRes2d;
E: Elips2d from gp; DE: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and an ellipse.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;L: Lin2d from gp; DL: Domain from IntRes2d;
E: Elips2d from gp; DE: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and an ellipse.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
raises ConstructionError from Standard
is static;
Create(L: Lin2d from gp; DL: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and a parabola from gp.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out; L: Lin2d from gp; DL: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and a parabola from gp.
is static;
Create(L: Lin2d from gp; DL: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and an hyperbola.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out;L: Lin2d from gp; DL: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a line and an hyperbola.
is static;
Create(C1: Circ2d from gp; D1: Domain from IntRes2d;
C2: Circ2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 circles from gp.
-- The exception ConstructionError is raised if the method
-- IsClosed of one of the domain returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;C1: Circ2d from gp; D1: Domain from IntRes2d;
C2: Circ2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 circles from gp.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of one of the circle returns False.
raises ConstructionError from Standard
is static;
Create(C: Circ2d from gp; DC: Domain from IntRes2d;
E: Elips2d from gp; DE: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and an ellipse.
-- The exception ConstructionError is raised if the method
-- IsClosed of one the domain returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out; C: Circ2d from gp; DC: Domain from IntRes2d;
E: Elips2d from gp; DE: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and an ellipse.
-- The exception ConstructionError is raised if the method
-- IsClosed of one the domain returns False.
raises ConstructionError from Standard
is static;
Create(C: Circ2d from gp; DC: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and a parabola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out; C: Circ2d from gp; DC: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and a parabola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
raises ConstructionError from Standard
is static;
Create(C: Circ2d from gp; DC: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and an hyperbola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;C: Circ2d from gp; DC: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a circle and an hyperbola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the circle returns False.
raises ConstructionError from Standard
is static;
Create(E1: Elips2d from gp; D1: Domain from IntRes2d;
E2: Elips2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 ellipses.
-- The exception ConstructionError is raised if the method
-- IsClosed of one of the domain returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;E1: Elips2d from gp; D1: Domain from IntRes2d;
E2: Elips2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 ellipses.
-- The exception ConstructionError is raised if the method
-- IsClosed of one of the domain returns False.
raises ConstructionError from Standard
is static;
Create(E: Elips2d from gp; DE: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between an ellipse and a parabola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out; E: Elips2d from gp; DE: Domain from IntRes2d;
P: Parab2d from gp; DP: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between an ellipse and a parabola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
raises ConstructionError from Standard
is static;
Create(E: Elips2d from gp; DE: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between an ellipse and an hyperbola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
returns IntConicConic from IntCurve
raises ConstructionError from Standard;
---C++:inline
Perform(me: in out;E: Elips2d from gp; DE: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between an ellipse and an hyperbola.
-- The exception ConstructionError is raised if the method
-- IsClosed of the domain of the ellipse returns False.
raises ConstructionError from Standard
is static;
Create(P1: Parab2d from gp; D1: Domain from IntRes2d;
P2: Parab2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 parabolas.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out;P1: Parab2d from gp; D1: Domain from IntRes2d;
P2: Parab2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 parabolas.
is static;
Create(P: Parab2d from gp; DP: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a parabola and an hyperbola.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out;P: Parab2d from gp; DP: Domain from IntRes2d;
H: Hypr2d from gp; DH: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between a parabola and an hyperbola.
is static;
Create(H1: Hypr2d from gp; D1: Domain from IntRes2d;
H2: Hypr2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 hyperbolas.
returns IntConicConic from IntCurve;
---C++:inline
Perform(me: in out;H1: Hypr2d from gp; D1: Domain from IntRes2d;
H2: Hypr2d from gp; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard )
---Purpose: Intersection between 2 hyperbolas.
is static;
fields
Inter : IntImpConicParConic from IntCurve;
end IntConicConic;

View File

@@ -0,0 +1,974 @@
// File: IntCurve_IntConicConic.cxx
// Created: Mon Apr 27 18:35:13 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
// Modified: OFV Thu Nov 6 17:03:52 2003
#include <IntCurve_IntConicConic.ixx>
#include <IntCurve_IntConicConic_1.hxx>
#include <IntCurve_IConicTool.hxx>
#include <IntCurve_PConic.hxx>
#include <IntRes2d_Domain.hxx>
#include <gp.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <IntAna2d_AnaIntersection.hxx>
#include <IntAna2d_IntPoint.hxx>
#include <IntAna2d_Conic.hxx>
#include <ElCLib.hxx>
//=======================================================================
// Perform() for
// Line - Parabola
// Line - Elipse
// Line - Hyperbola
// Circle - Parabola
// Circle - Elipse
// Circle - Hyperbola
// Parabola - Parabola
// Elipse - Parabola
// Parabola - Hyperbola
// Elipse - Elipse
// Elipse - Hyperbola
// Hyperbola - Hyperbola
//=======================================================================
static const Standard_Real PARAM_MAX_ON_PARABOLA = 100000000.0;
static const Standard_Real PARAM_MAX_ON_HYPERBOLA = 10000.0;
static const Standard_Real TOL_EXACT_INTER = 1.e-7;
static inline Standard_Boolean BOUNDED_DOMAIN(const IntRes2d_Domain& domain)
{
return (domain.HasFirstPoint() && domain.HasLastPoint());
}
static Standard_Boolean SET_BOUNDED_DOMAIN(const IntRes2d_Domain domain,
Standard_Real& binf,
Standard_Real& tolinf,
gp_Pnt2d& Pntinf,
Standard_Real& bsup,
Standard_Real& tolsup,
gp_Pnt2d& Pntsup)
{
if(domain.HasFirstPoint()) {
if(binf<domain.FirstParameter()) {
Pntinf = domain.FirstPoint();
binf = domain.FirstParameter();
tolinf = domain.FirstTolerance();
}
}
if(domain.HasLastPoint()) {
if(bsup>domain.FirstParameter()) {
Pntsup = domain.LastPoint();
bsup = domain.LastParameter();
tolsup = domain.LastTolerance();
}
}
Standard_Boolean result = (bsup <= binf) ? Standard_False : Standard_True;
// if(bsup<=binf) return(Standard_False);
// return(Standard_True);
return result;
}
void SetBinfBsupFromIntAna2d(const IntAna2d_AnaIntersection& theIntAna2d,
Standard_Real& binf,
gp_Pnt2d& pntinf,
Standard_Real& bsup,gp_Pnt2d& pntsup,
const gp_Hypr2d& H,
const Standard_Real maxtol,
const Standard_Real LIMITE);
void SetBinfBsupFromIntAna2d(const IntAna2d_AnaIntersection &theIntAna2d,
Standard_Real& binf,gp_Pnt2d& pntinf,
Standard_Real& bsup,gp_Pnt2d& pntsup,
const gp_Parab2d& PR,
const Standard_Real maxtol,
const Standard_Real LIMITE);
//=======================================================================
//function : Perform
//purpose : Line - Parabola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Lin2d& L,
const IntRes2d_Domain& DL,
const gp_Parab2d& P,
const IntRes2d_Domain& DP,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(L);
IntCurve_PConic PCurve(P);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
Standard_Real binf = Precision::Infinite();
Standard_Real bsup = -Precision::Infinite();
Standard_Real maxtol = (Tol > TolConf) ? Tol : TolConf;
if( maxtol< 1.e-7 ) maxtol = 1.e-7;
Standard_Boolean wasSet = Standard_False;
gp_Pnt2d Pntinf,Pntsup;
IntAna2d_AnaIntersection theIntAna2d;
maxtol*=100.0;
// if(maxtol<0.000001) maxtol = 0.000001;
gp_Vec2d Offset(maxtol*L.Direction().Y(),maxtol*L.Direction().X());
gp_Lin2d Lp(L.Translated(Offset));
theIntAna2d.Perform(P,Lp);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
Offset.Reverse();
gp_Lin2d Lm(L.Translated(Offset));
theIntAna2d.Perform(P,Lm);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DP)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DP,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DPModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DL,PCurve,DPModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DP.FirstParameter()) {
binf = DP.FirstParameter();
Pntinf = DP.FirstPoint();
ft = DP.FirstTolerance();
if(bsup < DP.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DP.LastParameter()) {
bsup = DP.LastParameter();
Pntsup = DP.LastPoint();
lt = DP.LastTolerance();
if(binf>DP.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DPModif(Pntinf,binf,ft,Pntsup,bsup,lt);
// Inter.Perform(ITool,DL,PCurve,DPModif,TolConf,Tol);
Inter.Perform(ITool,DL,PCurve,DPModif,TOL_EXACT_INTER,TOL_EXACT_INTER);
this->SetValues(Inter);
wasSet = Standard_True;
if( this->IsDone() && this->NbPoints() == 0 ) {
this->ResetFields();
Inter.Perform(ITool,DL,PCurve,DPModif,TolConf,Tol);
wasSet = Standard_False;
}
}
if( !wasSet ) this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Line - Elipse
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Lin2d& L,
const IntRes2d_Domain& DL,
const gp_Elips2d& E,
const IntRes2d_Domain& DE,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(L);
IntCurve_PConic PCurve(E);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
if(! DE.IsClosed()) {
IntRes2d_Domain D(DE);
D.SetEquivalentParameters(DE.FirstParameter(),DE.FirstParameter()+PI+PI);
Inter.Perform(ITool,DL,PCurve,D,TolConf,Tol);
}
else {
Inter.Perform(ITool,DL,PCurve,DE,TolConf,Tol);
}
this->SetValues(Inter);
}
//=======================================================================
//function : Perform
//purpose : Line - Hyperbola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Lin2d& L,
const IntRes2d_Domain& DL,
const gp_Hypr2d& H,
const IntRes2d_Domain& DH,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(L);
IntCurve_PConic PCurve(H);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
if(Tol > TolConf) maxtol = Tol; else maxtol = TolConf;
maxtol*=100.0;
if(maxtol<0.000001) maxtol = 0.000001;
gp_Vec2d Offset(maxtol*H.XAxis().Direction().X(),
maxtol*H.XAxis().Direction().Y());
gp_Hypr2d Hp(H.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Hp,L);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
Offset.Reverse();
gp_Hypr2d Hm(H.Translated(Offset));
theIntAna2d.Perform(Hm,L);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DH)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DH,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DHModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DL,PCurve,DHModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DH.FirstParameter()) {
binf = DH.FirstParameter();
Pntinf = DH.FirstPoint();
ft = DH.FirstTolerance();
if(bsup < DH.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DH.LastParameter()) {
bsup = DH.LastParameter();
Pntsup = DH.LastPoint();
lt = DH.LastTolerance();
if(binf>DH.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DHModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,DL,PCurve,DHModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Circle - Parabola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Circ2d& C,
const IntRes2d_Domain& DC,
const gp_Parab2d& P,
const IntRes2d_Domain& DP,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(C);
IntCurve_PConic PCurve(P);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
IntRes2d_Domain D(DC);
if(! DC.IsClosed()) {
D.SetEquivalentParameters(DC.FirstParameter(),DC.FirstParameter()+PI+PI);
}
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
maxtol = C.Radius() / 10.0;
gp_Circ2d Cp(C);
Cp.SetRadius(C.Radius()+maxtol);
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(P,Cp);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
if(C.Radius() > maxtol) {
Cp.SetRadius(C.Radius() - maxtol);
theIntAna2d.Perform(P,Cp);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
}
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DP)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DP,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DPModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,D,PCurve,DPModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DP.FirstParameter()) {
binf = DP.FirstParameter();
Pntinf = DP.FirstPoint();
ft = DP.FirstTolerance();
if(bsup < DP.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DP.LastParameter()) {
bsup = DP.LastParameter();
Pntsup = DP.LastPoint();
lt = DP.LastTolerance();
if(binf>DP.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DPModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,D,PCurve,DPModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Circle - Elipse
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Circ2d& C,
const IntRes2d_Domain& DC,
const gp_Elips2d& E,
const IntRes2d_Domain& DE,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(C);
IntCurve_PConic PCurve(E);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
if(! DC.IsClosed()) {
IntRes2d_Domain D1(DC);
D1.SetEquivalentParameters(DC.FirstParameter(),DC.FirstParameter()+PI+PI);
if(! DE.IsClosed()) {
IntRes2d_Domain D2(DE);
D2.SetEquivalentParameters(DE.FirstParameter(),DE.FirstParameter()+PI+PI);
Inter.Perform(ITool,D1,PCurve,D2,TolConf,Tol);
}
else {
Inter.Perform(ITool,D1,PCurve,DE,TolConf,Tol);
}
}
else {
if(! DE.IsClosed()) {
IntRes2d_Domain D2(DE);
D2.SetEquivalentParameters(DE.FirstParameter(),DE.FirstParameter()+PI+PI);
Inter.Perform(ITool,DC,PCurve,D2,TolConf,Tol);
}
else {
Inter.Perform(ITool,DC,PCurve,DE,TolConf,Tol);
}
}
this->SetValues(Inter);
}
//=======================================================================
//function : Perform
//purpose : Circle - Hyperbola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Circ2d& C,
const IntRes2d_Domain& DC,
const gp_Hypr2d& H,
const IntRes2d_Domain& DH,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(C);
IntCurve_PConic PCurve(H);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
IntRes2d_Domain D(DC);
if(! DC.IsClosed()) {
D.SetEquivalentParameters(DC.FirstParameter(),DC.FirstParameter()+PI+PI);
}
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
maxtol = C.Radius() / 10.0;
gp_Vec2d Offset(maxtol*H.XAxis().Direction().X(),
maxtol*H.XAxis().Direction().Y());
gp_Hypr2d Hp(H.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Hp,C);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
Offset.Reverse();
gp_Hypr2d Hm(H.Translated(Offset));
theIntAna2d.Perform(Hm,C);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DH)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DH,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DHModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,D,PCurve,DHModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DH.FirstParameter()) {
binf = DH.FirstParameter();
Pntinf = DH.FirstPoint();
ft = DH.FirstTolerance();
if(bsup < DH.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DH.LastParameter()) {
bsup = DH.LastParameter();
Pntsup = DH.LastPoint();
lt = DH.LastTolerance();
if(binf>DH.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DHModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,D,PCurve,DHModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Parabola - Parabola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Parab2d& P1,
const IntRes2d_Domain& DP1,
const gp_Parab2d& P2,
const IntRes2d_Domain& DP2,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(P1);
IntCurve_PConic PCurve(P2);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
if(Tol > TolConf) maxtol = Tol; else maxtol = TolConf;
maxtol*=100.0;
if(maxtol<0.000001) maxtol = 0.000001;
gp_Vec2d Offset(maxtol*P2.MirrorAxis().Direction().X(),
maxtol*P2.MirrorAxis().Direction().Y());
gp_Parab2d Pp(P2.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Pp,P1);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P2,maxtol,PARAM_MAX_ON_PARABOLA);
Offset.Reverse();
gp_Parab2d Pm(P2.Translated(Offset));
theIntAna2d.Perform(Pm,P1);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P2,maxtol,PARAM_MAX_ON_PARABOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DP2)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DP2,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DPModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DP1,PCurve,DPModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DP2.FirstParameter()) {
binf = DP2.FirstParameter();
Pntinf = DP2.FirstPoint();
ft = DP2.FirstTolerance();
if(bsup < DP2.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DP2.LastParameter()) {
bsup = DP2.LastParameter();
Pntsup = DP2.LastPoint();
lt = DP2.LastTolerance();
if(binf>DP2.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DPModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,DP1,PCurve,DPModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Elipse - Parabola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Elips2d& E,
const IntRes2d_Domain& DE,
const gp_Parab2d& P,
const IntRes2d_Domain& DP,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(E);
IntCurve_PConic PCurve(P);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
IntRes2d_Domain D(DE);
if(! DE.IsClosed()) {
D.SetEquivalentParameters(DE.FirstParameter(),DE.FirstParameter()+PI+PI);
}
//-- cout<<" Parab Elips "<<endl;
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
if(Tol > TolConf) maxtol = Tol; else maxtol = TolConf;
maxtol = E.MinorRadius() / 10.0;
gp_Elips2d Ep(E);
Ep.SetMajorRadius(E.MajorRadius()+maxtol);
Ep.SetMinorRadius(E.MinorRadius()+maxtol);
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(P,Ep);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
if(E.MinorRadius() > maxtol) {
Ep.SetMinorRadius(E.MinorRadius() - maxtol);
Ep.SetMajorRadius(E.MajorRadius() - maxtol);
theIntAna2d.Perform(P,Ep);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,P,maxtol,PARAM_MAX_ON_PARABOLA);
}
//-- cout<<" binf,bsup "<<binf<<" "<<bsup<<endl;
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DP)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DP,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DPModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,D,PCurve,DPModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DP.FirstParameter()) {
binf = DP.FirstParameter();
Pntinf = DP.FirstPoint();
ft = DP.FirstTolerance();
if(bsup < DP.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DP.LastParameter()) {
bsup = DP.LastParameter();
Pntsup = DP.LastPoint();
lt = DP.LastTolerance();
if(binf>DP.LastParameter()) {
done=Standard_True; return;
}
}
//-- cout<<"BOUNDED binf,bsup "<<binf<<" "<<bsup<<endl;
//-- cout<<"Domain "<<DP.FirstParameter()<<" "<<DP.LastParameter()<<endl;
IntRes2d_Domain DPModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,D,PCurve,DPModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Parabola - Hyperbola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Parab2d& P,
const IntRes2d_Domain& DP,
const gp_Hypr2d& H,
const IntRes2d_Domain& DH,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(P);
IntCurve_PConic PCurve(H);
Inter.SetReversedParameters(ReversedParameters());
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
if(Tol > TolConf) maxtol = Tol; else maxtol = TolConf;
maxtol*=100.0;
if(maxtol<0.000001) maxtol = 0.000001;
gp_Vec2d Offset(maxtol*H.XAxis().Direction().X(),
maxtol*H.XAxis().Direction().Y());
gp_Hypr2d Hp(H.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Hp,P);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
Offset.Reverse();
gp_Hypr2d Hm(H.Translated(Offset));
theIntAna2d.Perform(Hm,P);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DH)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DH,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DHModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DP,PCurve,DHModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DH.FirstParameter()) {
binf = DH.FirstParameter();
Pntinf = DH.FirstPoint();
ft = DH.FirstTolerance();
if(bsup < DH.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DH.LastParameter()) {
bsup = DH.LastParameter();
Pntsup = DH.LastPoint();
lt = DH.LastTolerance();
if(binf>DH.LastParameter()) {
done=Standard_True; return;
}
}
IntRes2d_Domain DHModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,DP,PCurve,DHModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Elipse - Elipse
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Elips2d& E1,
const IntRes2d_Domain& DE1,
const gp_Elips2d& E2,
const IntRes2d_Domain& DE2,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(E1);
IntCurve_PConic PCurve(E2);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
if(! DE1.IsClosed()) {
IntRes2d_Domain D1(DE1);
D1.SetEquivalentParameters(DE1.FirstParameter(),DE1.FirstParameter()+PI+PI);
if(! DE2.IsClosed()) {
IntRes2d_Domain D2(DE2);
D2.SetEquivalentParameters(DE2.FirstParameter(),DE2.FirstParameter()+PI+PI);
Inter.Perform(ITool,D1,PCurve,D2,TolConf,Tol);
}
else {
Inter.Perform(ITool,D1,PCurve,DE2,TolConf,Tol);
}
}
else {
if(! DE2.IsClosed()) {
IntRes2d_Domain D2(DE2);
D2.SetEquivalentParameters(DE2.FirstParameter(),DE2.FirstParameter()+PI+PI);
Inter.Perform(ITool,DE1,PCurve,D2,TolConf,Tol);
}
else {
Inter.Perform(ITool,DE1,PCurve,DE2,TolConf,Tol);
}
}
this->SetValues(Inter);
}
//=======================================================================
//function : Perform
//purpose : Elipse - Hyperbola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Elips2d& E,
const IntRes2d_Domain& DE,
const gp_Hypr2d& H,
const IntRes2d_Domain& DH,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(E);
IntCurve_PConic PCurve(H);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
IntRes2d_Domain DEModif(DE);
if(! DE.IsClosed()) {
DEModif.SetEquivalentParameters(DE.FirstParameter(),DE.FirstParameter()+PI+PI);
}
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
maxtol = E.MinorRadius() / 10.0;
gp_Vec2d Offset(maxtol*H.XAxis().Direction().X(),
maxtol*H.XAxis().Direction().Y());
gp_Hypr2d Hp(H.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Hp,E);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
Offset.Reverse();
gp_Hypr2d Hm(H.Translated(Offset));
theIntAna2d.Perform(Hm,E);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H,maxtol,PARAM_MAX_ON_HYPERBOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DH)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DH,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DHModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DEModif,PCurve,DHModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DH.FirstParameter()) {
binf = DH.FirstParameter();
Pntinf = DH.FirstPoint();
ft = DH.FirstTolerance();
if(bsup < DH.FirstParameter()) {
done=Standard_True; return;
}
}
if(bsup> DH.LastParameter()) {
bsup = DH.LastParameter();
Pntsup = DH.LastPoint();
lt = DH.LastTolerance();
if(binf>DH.LastParameter()) {
done=Standard_True; return;
}
}
if(binf>=bsup) {
done = Standard_True; return;
}
IntRes2d_Domain DHModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,DEModif,PCurve,DHModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//=======================================================================
//function : Perform
//purpose : Hyperbola - Hyperbola
//=======================================================================
void IntCurve_IntConicConic::Perform(const gp_Hypr2d& H1,
const IntRes2d_Domain& DH1,
const gp_Hypr2d& H2,
const IntRes2d_Domain& DH2,
const Standard_Real TolConf,
const Standard_Real Tol)
{
this->ResetFields();
IntCurve_IConicTool ITool(H1);
IntCurve_PConic PCurve(H2);
PCurve.SetAccuracy(20);
Inter.SetReversedParameters(ReversedParameters());
Standard_Real binf = Precision::Infinite(),bsup = -Precision::Infinite(),maxtol;
gp_Pnt2d Pntinf,Pntsup;
if(Tol > TolConf) maxtol = Tol; else maxtol = TolConf;
maxtol*=100.0;
if(maxtol<0.000001) maxtol = 0.000001;
gp_Vec2d Offset(maxtol*H2.XAxis().Direction().X(),
maxtol*H2.XAxis().Direction().Y());
gp_Hypr2d Hp(H2.Translated(Offset));
IntAna2d_AnaIntersection theIntAna2d;
theIntAna2d.Perform(Hp,H1);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H2,maxtol,PARAM_MAX_ON_HYPERBOLA);
Offset.Reverse();
gp_Hypr2d Hm(H2.Translated(Offset));
theIntAna2d.Perform(Hm,H1);
SetBinfBsupFromIntAna2d(theIntAna2d,binf,Pntinf,bsup,Pntsup,H2,maxtol,PARAM_MAX_ON_HYPERBOLA);
if(binf<=bsup) {
if(!BOUNDED_DOMAIN(DH2)) {
Standard_Real tolinf = 0.0;
Standard_Real tolsup = 0.0;
if(SET_BOUNDED_DOMAIN(DH2,binf,tolinf,Pntinf,bsup,tolsup,Pntsup)) {
IntRes2d_Domain DHModif(Pntinf,binf,tolinf,Pntsup,bsup,tolsup);
Inter.Perform(ITool,DH1,PCurve,DHModif,TolConf,Tol);
}
else {
done = Standard_True; return;
}
}
else {
Standard_Real ft=0.0,lt=0.0;
if(binf< DH2.FirstParameter()) {
binf = DH2.FirstParameter();
Pntinf = DH2.FirstPoint();
ft = DH2.FirstTolerance();
}
if(bsup> DH2.LastParameter()) {
bsup = DH2.LastParameter();
Pntsup = DH2.LastPoint();
lt = DH2.LastTolerance();
}
//-- lbr le 22 sept 97
//-- binf=-5.6 bsup=-5.3 DH2=(5.6,5.7) -> binf=+5.6 bsup=-5.3
if(binf>=bsup) {
done = Standard_True; return;
}
IntRes2d_Domain DHModif(Pntinf,binf,ft,Pntsup,bsup,lt);
Inter.Perform(ITool,DH1,PCurve,DHModif,TolConf,Tol);
}
this->SetValues(Inter);
}
else {
done = Standard_True;
}
}
//----------------------------------------------------------------------
void SetBinfBsupFromIntAna2d(const IntAna2d_AnaIntersection &theIntAna2d,
Standard_Real& binf,gp_Pnt2d& Pntinf,
Standard_Real& bsup,gp_Pnt2d& Pntsup,
const gp_Parab2d& PR,
const Standard_Real maxtol,
const Standard_Real LIMITE) {
if(theIntAna2d.IsDone()) {
if(!theIntAna2d.IsEmpty()) {
for(Standard_Integer p=1; p<=theIntAna2d.NbPoints(); p++) {
Standard_Real param = theIntAna2d.Point(p).ParamOnFirst();
if(Abs(param) < LIMITE) {
gp_Vec2d V;
gp_Pnt2d P;
ElCLib::D1(param,PR,P,V);
Standard_Real NormeD1 = V.Magnitude();
Standard_Real dparam = 100.0*maxtol/NormeD1;
if(dparam<1e-3) dparam = 1e-3;
param-=dparam;
if(param < binf) {
binf = param;
Pntinf=ElCLib::Value(param,PR);
}
param+=dparam+dparam;
if(param > bsup) {
bsup = param;
Pntsup=ElCLib::Value(param,PR);
}
}
}
}
}
}
void SetBinfBsupFromIntAna2d(const IntAna2d_AnaIntersection &theIntAna2d,
Standard_Real& binf,gp_Pnt2d& Pntinf,
Standard_Real& bsup,gp_Pnt2d& Pntsup,
const gp_Hypr2d& H,
const Standard_Real maxtol,
const Standard_Real LIMITE) {
if(theIntAna2d.IsDone()) {
if(!theIntAna2d.IsEmpty()) {
for(Standard_Integer p=1; p<=theIntAna2d.NbPoints(); p++) {
Standard_Real param = theIntAna2d.Point(p).ParamOnFirst();
if(Abs(param) < LIMITE) {
gp_Vec2d V;
gp_Pnt2d P;
ElCLib::D1(param,H,P,V);
Standard_Real NormeD1 = V.Magnitude();
Standard_Real dparam = 100.0*maxtol/NormeD1;
if(dparam<1e-3) dparam = 1e-3;
param-=dparam;
if(param < binf) {
binf = param;
Pntinf=ElCLib::Value(param,H);
}
param+=dparam+dparam;
if(param > bsup) {
bsup = param;
Pntsup=ElCLib::Value(param,H);
}
}
}
}
}
}

View File

@@ -0,0 +1,128 @@
// File: IntCurve_IntConicConic.lxx
// Created: Wed Feb 19 10:25:13 1997
// Author: Laurent BUCHARD
// <lbr@cracbox.paris1.matra-dtv.fr>
#define CONSTRUCTOR IntCurve_IntConicConic::IntCurve_IntConicConic
#define PERFORM void IntCurve_IntConicConic::Perform
inline CONSTRUCTOR() { }
//---------------------------------------------------------------------- L P
inline CONSTRUCTOR(const gp_Lin2d& L,const IntRes2d_Domain& DL
,const gp_Parab2d& P,const IntRes2d_Domain& DP
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(L,DL,P,DP,TolConf,Tol);
}
//---------------------------------------------------------------------- L E
inline CONSTRUCTOR(const gp_Lin2d& L,const IntRes2d_Domain& DL
,const gp_Elips2d& E,const IntRes2d_Domain& DE
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(L,DL,E,DE,TolConf,Tol);
}
//---------------------------------------------------------------------- L H
inline CONSTRUCTOR(const gp_Lin2d& L,const IntRes2d_Domain& DL
,const gp_Hypr2d& H,const IntRes2d_Domain& DH
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(L,DL,H,DH,TolConf,Tol);
}
//---------------------------------------------------------------------- C P
inline CONSTRUCTOR(const gp_Circ2d& C,const IntRes2d_Domain& DC
,const gp_Parab2d& P,const IntRes2d_Domain& DP
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(C,DC,P,DP,TolConf,Tol);
}
//---------------------------------------------------------------------- C E
inline CONSTRUCTOR(const gp_Circ2d& C,const IntRes2d_Domain& DC
,const gp_Elips2d& E,const IntRes2d_Domain& DE
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(C,DC,E,DE,TolConf,Tol);
}
//---------------------------------------------------------------------- C H
inline CONSTRUCTOR(const gp_Circ2d& C,const IntRes2d_Domain& DC
,const gp_Hypr2d& H,const IntRes2d_Domain& DH
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(C,DC,H,DH,TolConf,Tol);
}
//---------------------------------------------------------------------- P P
inline CONSTRUCTOR(const gp_Parab2d& P1,const IntRes2d_Domain& D1
,const gp_Parab2d& P2,const IntRes2d_Domain& D2
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(P1,D1,P2,D2,TolConf,Tol);
}
//---------------------------------------------------------------------- E P
inline CONSTRUCTOR(const gp_Elips2d& E,const IntRes2d_Domain& DE
,const gp_Parab2d& P,const IntRes2d_Domain& DP
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(E,DE,P,DP,TolConf,Tol);
}
//---------------------------------------------------------------------- P H
inline CONSTRUCTOR(const gp_Parab2d& P,const IntRes2d_Domain& DP
,const gp_Hypr2d& H,const IntRes2d_Domain& DH
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(P,DP,H,DH,TolConf,Tol);
}
//---------------------------------------------------------------------- E E
inline CONSTRUCTOR(const gp_Elips2d& E1,const IntRes2d_Domain& D1
,const gp_Elips2d& E2,const IntRes2d_Domain& D2
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(E1,D1,E2,D2,TolConf,Tol);
}
//---------------------------------------------------------------------- E H
inline CONSTRUCTOR(const gp_Elips2d& E,const IntRes2d_Domain& DE
,const gp_Hypr2d& H,const IntRes2d_Domain& DH
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(E,DE,H,DH,TolConf,Tol);
}
//---------------------------------------------------------------------- H H
inline CONSTRUCTOR(const gp_Hypr2d& H1,const IntRes2d_Domain& DH1
,const gp_Hypr2d& H2,const IntRes2d_Domain& DH2
,const Standard_Real TolConf,const Standard_Real Tol) {
Perform(H1,DH1,H2,DH2,TolConf,Tol);
}
//---------------------------------------------------------------------- L L
inline CONSTRUCTOR(const gp_Lin2d& L1
,const IntRes2d_Domain& D1
,const gp_Lin2d& L2
,const IntRes2d_Domain& D2
,const Standard_Real TolConf
,const Standard_Real Tol) {
Perform(L1,D1,L2,D2,TolConf,Tol);
}
//---------------------------------------------------------------------- L C
inline CONSTRUCTOR(const gp_Lin2d& L1
,const IntRes2d_Domain& D1
,const gp_Circ2d& C2
,const IntRes2d_Domain& D2
,const Standard_Real TolConf
,const Standard_Real Tol) {
Perform(L1,D1,C2,D2,TolConf,Tol);
}
//---------------------------------------------------------------------- C C
inline CONSTRUCTOR(const gp_Circ2d& C1
,const IntRes2d_Domain& D1
,const gp_Circ2d& C2
,const IntRes2d_Domain& D2
,const Standard_Real TolConf
,const Standard_Real Tol) {
SetReversedParameters(Standard_False);
Perform(C1,D1,C2,D2,TolConf,Tol);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
// File: IntCurve_IntConicConic_1.hxx
// Created: Wed May 6 16:13:16 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#ifndef IntCurve_IntConicConic_1_HeaderFile
#define IntCurve_IntConicConic_1_HeaderFile
#include <IntCurve_IntConicConic_Tool.hxx>
//======================================================================
//=== I n t e r s e c t i o n C e r c l e C e r c l e =====
//======================================================================
//----------------------------------------------------------------------
void CircleCircleGeometricIntersection(const gp_Circ2d& C1
,const gp_Circ2d& C2
,const Standard_Real Tol
,PeriodicInterval& C1_Res1
,PeriodicInterval& C1_Res2
,Standard_Integer& nbsol);
//----------------------------------------------------------------------
void CircleCircleDomainIntersection(const gp_Circ2d& C1
,const gp_Circ2d& C2
,const Standard_Real Tol
,PeriodicInterval& Res1
,PeriodicInterval& C1_Res2
,Standard_Integer& nbsol);
//----------------------------------------------------------------------
void ProjectOnC2AndIntersectWithC2Domain(const gp_Circ2d& Circle1
,const gp_Circ2d& Circle2
,PeriodicInterval& C1DomainAndRes
,PeriodicInterval& C2Domain
,PeriodicInterval* SolutionC1
,PeriodicInterval* SolutionC2
,Standard_Integer &NbSolTotal
,const Standard_Boolean IdentCircles);
//======================================================================
//=== I n t e r s e c t i o n L i g n e C e r c l e =====
//======================================================================
void LineCircleGeometricIntersection(const gp_Lin2d& Line
,const gp_Circ2d& Circle
,const Standard_Real Tol
,PeriodicInterval& C1Int
,PeriodicInterval& C2Int
,Standard_Integer& nbsol);
void ProjectOnLAndIntersectWithLDomain(const gp_Circ2d& Circle
,const gp_Lin2d& Line
,PeriodicInterval& CDomainAndRes
,Interval& LDomain
,PeriodicInterval* CircleSolution
,Interval* LineSolution
,Standard_Integer &NbSolTotal);
//======================================================================
//=== I n t e r s e c t i o n L i g n e L i g n e =====
//======================================================================
void DomainIntersection(const IntRes2d_Domain& Domain
,const Standard_Real U1inf
,const Standard_Real U1sup
,Standard_Real& Res1inf
,Standard_Real& Res1sup);
void LineLineGeometricIntersection(const gp_Lin2d& L1
,const gp_Lin2d& L2
,const Standard_Real Tol
,Standard_Real& U1
,Standard_Real& U2
,Standard_Real& SinDemiAngle
,Standard_Integer& nbsol);
#endif

View File

@@ -0,0 +1,192 @@
// File: IntCurve_IntConicConic_Tool.cxx
// Created: Wed May 6 16:09:07 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <IntCurve_IntConicConic_Tool.hxx>
#include <gp.hxx>
#define TOLERANCE_ANGULAIRE 0.00000001
//======================================================================
//=== R e s s o u r c e s G e n e r a l e s ===
//======================================================================
void Determine_Transition_LC(const IntRes2d_Position Pos1,
gp_Vec2d& Tan1,
const gp_Vec2d& Norm1,
IntRes2d_Transition& T1,
const IntRes2d_Position Pos2,
gp_Vec2d& Tan2,
const gp_Vec2d& Norm2,
IntRes2d_Transition& T2,
const Standard_Real ) {
Standard_Real sgn=Tan1.Crossed(Tan2);
Standard_Real norm=Tan1.Magnitude()*Tan2.Magnitude();
if (Abs(sgn)<=TOLERANCE_ANGULAIRE*norm) { // Transition TOUCH #########
Standard_Boolean opos=(Tan1.Dot(Tan2))<0;
gp_Vec2d Norm;
// Modified by Sergey KHROMOV - Thu Nov 2 17:57:15 2000 Begin
Tan1.Normalize();
// Modified by Sergey KHROMOV - Thu Nov 2 17:57:16 2000 End
Norm.SetCoord(-Tan1.Y(),Tan1.X());
Standard_Real Val1=Norm.Dot(Norm1);
Standard_Real Val2=Norm.Dot(Norm2);
if (Abs(Val1-Val2) <= gp::Resolution()) {
T1.SetValue(Standard_True,Pos1,IntRes2d_Unknown,opos);
T2.SetValue(Standard_True,Pos2,IntRes2d_Unknown,opos);
}
else if (Val2 > Val1) {
T2.SetValue(Standard_True,Pos2,IntRes2d_Inside,opos);
if (opos) { T1.SetValue(Standard_True,Pos1,IntRes2d_Inside,opos); }
else { T1.SetValue(Standard_True,Pos1,IntRes2d_Outside,opos); }
}
else { // Val1 > Val2
T2.SetValue(Standard_True,Pos2,IntRes2d_Outside,opos);
if (opos) { T1.SetValue(Standard_True,Pos1,IntRes2d_Outside,opos); }
else { T1.SetValue(Standard_True,Pos1,IntRes2d_Inside,opos); }
}
}
else if (sgn<0) {
T1.SetValue(Standard_False,Pos1,IntRes2d_In);
T2.SetValue(Standard_False,Pos2,IntRes2d_Out);
}
else {
T1.SetValue(Standard_False,Pos1,IntRes2d_Out);
T2.SetValue(Standard_False,Pos2,IntRes2d_In);
}
}
//----------------------------------------------------------------------
Standard_Real NormalizeOnCircleDomain(const Standard_Real _Param
,const IntRes2d_Domain& TheDomain) {
Standard_Real Param=_Param;
while(Param<TheDomain.FirstParameter()) {
Param+=PIpPI;
}
while(Param>TheDomain.LastParameter()) {
Param-=PIpPI;
}
return(Param);
}
//----------------------------------------------------------------------
PeriodicInterval PeriodicInterval::FirstIntersection(PeriodicInterval& PInter)
{
Standard_Real a,b;
if(PInter.isnull || isnull) {
PeriodicInterval PourSGI; return(PourSGI);
}
else {
if(Length() >= PIpPI)
return(PeriodicInterval(PInter.Binf,PInter.Bsup));
if(PInter.Length()>=PIpPI)
return(PeriodicInterval(Binf,Bsup));
if(PInter.Bsup<=Binf) {
while(PInter.Binf <= Binf && PInter.Bsup <= Binf) {
PInter.Binf+=PIpPI; PInter.Bsup+=PIpPI;
}
}
if(PInter.Binf >= Bsup) {
while(PInter.Binf >=Bsup && PInter.Bsup >= Bsup) {
PInter.Binf-=PIpPI; PInter.Bsup-=PIpPI;
}
}
if((PInter.Bsup < Binf) || (PInter.Binf > Bsup)) {
PeriodicInterval PourSGI; return(PourSGI);
}
}
a=(PInter.Binf > Binf)? PInter.Binf : Binf;
b=(PInter.Bsup < Bsup)? PInter.Bsup : Bsup;
return(PeriodicInterval(a,b));
}
//----------------------------------------------------------------------
PeriodicInterval PeriodicInterval::SecondIntersection(PeriodicInterval& PInter)
{
Standard_Real a,b;
if(PInter.isnull
|| isnull
|| this->Length()>=PIpPI
|| PInter.Length()>=PIpPI) {
PeriodicInterval PourSGI; return(PourSGI);
}
Standard_Real PInter_inf=PInter.Binf+PIpPI;
Standard_Real PInter_sup=PInter.Bsup+PIpPI;
if(PInter_inf > Bsup) {
PInter_inf=PInter.Binf-PIpPI;
PInter_sup=PInter.Bsup-PIpPI;
}
if((PInter_sup < Binf) || (PInter_inf > Bsup)) {
PeriodicInterval PourSGI; return(PourSGI);
}
else {
a=(PInter_inf > Binf)? PInter_inf : Binf;
b=(PInter_sup < Bsup)? PInter_sup : Bsup;
}
return(PeriodicInterval(a,b));
}
//----------------------------------------------------------------------
Interval::Interval() { IsNull=Standard_True; }
Interval::Interval(const Standard_Real a,const Standard_Real b) {
HasFirstBound=HasLastBound=Standard_True;
if(a<b) { Binf=a; Bsup=b; }
else { Binf=b; Bsup=a; }
IsNull=Standard_False;
}
Interval::Interval(const IntRes2d_Domain& Domain) {
IsNull=Standard_False;
if(Domain.HasFirstPoint()) {
HasFirstBound=Standard_True;
Binf=Domain.FirstParameter()-Domain.FirstTolerance();
}
else
HasFirstBound=Standard_False;
if(Domain.HasLastPoint()) {
HasLastBound=Standard_True;
Bsup=Domain.LastParameter()+Domain.LastTolerance();
}
else HasLastBound=Standard_False;
}
Interval::Interval( const Standard_Real a,const Standard_Boolean hf
,const Standard_Real b,const Standard_Boolean hl) {
Binf=a; Bsup=b;
IsNull=Standard_False;
HasFirstBound=hf;
HasLastBound=hl;
}
Standard_Real Interval::Length() { return((IsNull)? -1.0 :Abs(Bsup-Binf)); }
Interval Interval::IntersectionWithBounded(const Interval& Inter) {
if(IsNull || Inter.IsNull) { Interval PourSGI; return(PourSGI); }
if(!(HasFirstBound || HasLastBound))
return(Interval(Inter.Binf,Inter.Bsup));
Standard_Real a,b;
if(HasFirstBound) {
if(Inter.Bsup < Binf) { Interval PourSGI; return(PourSGI); }
a=(Inter.Binf < Binf)? Binf : Inter.Binf;
}
else { a=Inter.Binf; }
if(HasLastBound) {
if(Inter.Binf > Bsup) { Interval PourSGI; return(PourSGI); }
b=(Inter.Bsup > Bsup)? Bsup : Inter.Bsup;
}
else { b=Inter.Bsup; }
return(Interval(a,b));
}

View File

@@ -0,0 +1,128 @@
// File: IntCurve_IntConicConic_Tool.hxx
// Created: Wed May 6 16:02:53 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#ifndef IntCurve_IntConicConic_Tool_HeaderFile
#define IntCurve_IntConicConic_Tool_HeaderFile
#include <IntCurve_IntImpConicParConic.hxx>
#include <IntCurve_IConicTool.hxx>
#include <IntCurve_PConic.hxx>
// #include <IntCurve_IConicPConicTool.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_Transition.hxx>
#include <IntRes2d_Position.hxx>
#include <gp_Vec2d.hxx>
#include <gp.hxx>
static Standard_Real PIpPI = Standard_PI+Standard_PI;
//======================================================================
//========== P R O T O T Y P E S ============
//======================================================================
void Determine_Transition_LC(const IntRes2d_Position,
gp_Vec2d&,
const gp_Vec2d&,
IntRes2d_Transition&,
const IntRes2d_Position,
gp_Vec2d&,
const gp_Vec2d&,
IntRes2d_Transition&,
const Standard_Real);
//======================================================================
Standard_Real NormalizeOnCircleDomain(const Standard_Real Param,const IntRes2d_Domain& Domain);
//=====================================================================
//==== C l a s s e I n t e r v a l !! Specifique !! ========
//=====================================================================
class Interval {
public:
Standard_Real Binf;
Standard_Real Bsup;
Standard_Boolean HasFirstBound;
Standard_Boolean HasLastBound;
Standard_Boolean IsNull;
Interval();
Interval(const Standard_Real a,const Standard_Real b);
Interval(const IntRes2d_Domain& Domain);
Interval( const Standard_Real a,const Standard_Boolean hf
,const Standard_Real b,const Standard_Boolean hl);
Standard_Real Length();
Interval IntersectionWithBounded(const Interval& Inter);
};
//======================================================================
//== C L A S S E P E R I O D I C I N T E R V A L (Specifique)
//======================================================================
class PeriodicInterval {
public:
Standard_Real Binf;
Standard_Real Bsup;
Standard_Boolean isnull;
void SetNull() { isnull=Standard_True; }
Standard_Boolean IsNull() { return(isnull); }
void Complement() { if(!isnull) {
Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI;
if(Binf>PIpPI) {
Binf-=PIpPI;
Bsup-=PIpPI;
}
}
}
Standard_Real Length() { return((isnull)? -100.0: Abs(Bsup-Binf)); }
PeriodicInterval(const IntRes2d_Domain& Domain) {
isnull=Standard_False;
if(Domain.HasFirstPoint())
Binf=Domain.FirstParameter();
else
Binf=-1.0;
if(Domain.HasLastPoint())
Bsup=Domain.LastParameter();
else
Bsup=20.0;
}
PeriodicInterval() { isnull=Standard_True; Binf=Bsup=0.0; }
PeriodicInterval(const Standard_Real a,const Standard_Real b)
{
isnull=Standard_False;
Binf=a;
Bsup=b;
if((b-a) < PIpPI)
this->Normalize();
}
void SetValues(const Standard_Real a,const Standard_Real b)
{
isnull=Standard_False;
Binf=a;
Bsup=b;
if((b-a) < PIpPI)
this->Normalize();
}
void Normalize() {
if(!isnull) {
while(Binf>PIpPI) Binf-=PIpPI;
while(Binf<0.0) Binf+=PIpPI;
while(Bsup<Binf) Bsup+=PIpPI;
while(Bsup>=(Binf+PIpPI)) Bsup-=PIpPI;
}
}
PeriodicInterval FirstIntersection(PeriodicInterval& I1);
PeriodicInterval SecondIntersection(PeriodicInterval& I2);
};
#endif

View File

@@ -0,0 +1,174 @@
-- File: IntConicCurveGen.cdl
-- Created: Thu May 21 14:14:00 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun1>
---Copyright: Matra Datavision 1992
generic class IntConicCurveGen from IntCurve (
TheImpTool as any; -- as ImpTool from IntImpParGen
ThePCurve as any;
ThePCurveTool as any; -- as ParTool from IntImpParGen(ThePCurve)
TheProjPCur as any) -- as ProjPCurGen(TheCurve,TheCurveTool)
inherits Intersection from IntRes2d
---Purpose: Generic algorithm to intersect a conic from gp and
-- a parametric curve. This class uses the class
-- IConicTool from IntCurve, and Domain from
-- IntCurve. The template class for the PCurveTool
-- is given in the package IntImpParGen (ParTool).
-- The methods used to know the result of the
-- intersection are inherited from the class
-- Intersection from IntRes2d.
--
-- This algorithm is called from the IntCurveCurveGen
-- class.
---Level: Internal
uses IConicTool from IntCurve,
Lin2d from gp,
Circ2d from gp,
Elips2d from gp,
Parab2d from gp,
Hypr2d from gp,
Domain from IntRes2d
class TheIntersector instantiates Intersector from IntImpParGen(
TheImpTool,
ThePCurve,
ThePCurveTool,
TheProjPCur);
is
Create
---Purpose: Empty constructor.
returns IntConicCurveGen from IntCurve;
---C++:inline
Create (L: Lin2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
returns IntConicCurveGen from IntCurve;
---C++:inline
Create (C: Circ2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
returns IntConicCurveGen from IntCurve;
Create (E: Elips2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between an ellipse and a parametric curve.
returns IntConicCurveGen from IntCurve;
Create (Prb: Parab2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a parabola and a parametric curve.
returns IntConicCurveGen from IntCurve;
Create (H: Hypr2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between the main branch of an hyperbola
-- and a parametric curve.
returns IntConicCurveGen from IntCurve;
Perform (me: in out;
L: Lin2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
---C++:inline
is static;
Perform (me: in out;
C: Circ2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
---C++:inline
is static;
Perform (me: in out;
E: Elips2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---C++: inline
---Purpose: Intersection between an ellipse and a parametric curve.
is static;
Perform (me: in out;
Prb: Parab2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---C++: inline
---Purpose: Intersection between a parabola and a parametric curve.
is static;
Perform (me: in out;
H: Hypr2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between the main branch of an hyperbola
-- and a parametric curve.
---C++: inline
is static;
Perform (me: in out;
ICurve: IConicTool from IntCurve; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---C++:inline
---Purpose: Intersection between a conic fom gp
-- and a parametric curve.
is static private;
end IntConicCurveGen;

View File

@@ -0,0 +1,67 @@
// File: IntCurve_IntConicCurveGen.gxx
// Created: Wed Jun 3 14:02:17 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include IntCurve_TheIntersector_hxx
#include <IntRes2d_Domain.hxx>
#include <IntCurve_IConicTool.hxx>
//--------------------------------------------------------------------------------
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Circ2d& C,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
if(!D1.IsClosed()) {
IntRes2d_Domain D(D1);
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+PI+PI);
Perform(IntCurve_IConicTool(C),D,PCurve,D2,TolConf,Tol);
//-- Standard_ConstructionError::Raise("Domaine incorrect");
}
else {
Perform(IntCurve_IConicTool(C),D1,PCurve,D2,TolConf,Tol);
}
}
//--------------------------------------------------------------------------------
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Elips2d& E,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
if(!D1.IsClosed()) {
IntRes2d_Domain D(D1);
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+PI+PI);
Perform(IntCurve_IConicTool(E),D,PCurve,D2,TolConf,Tol);
//-- Standard_ConstructionError::Raise("Domaine incorrect");
}
else {
Perform(IntCurve_IConicTool(E),D1,PCurve,D2,TolConf,Tol);
}
}
//--------------------------------------------------------------------------------
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Parab2d& Prb,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(Prb),D1,PCurve,D2,TolConf,Tol);
}
//--------------------------------------------------------------------------------
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Hypr2d& H,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(H),D1,PCurve,D2,TolConf,Tol);
}
//--------------------------------------------------------------------------------

View File

@@ -0,0 +1,110 @@
// File: IntCurve_IntConicCurveGen.gxx
// Created: Wed Jun 3 14:02:17 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include IntCurve_TheIntersector_hxx
#include <IntRes2d_Domain.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Parab2d.hxx>
#include <IntCurve_IConicTool.hxx>
//--------------------------------------------------------------------------------
inline IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen ()
{ }
//--------------------------------------------------------------------------------
inline IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Lin2d& L,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(L),D1,PCurve,D2,TolConf,Tol);
}
inline void IntCurve_IntConicCurveGen::Perform (const gp_Lin2d& L,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(L),D1,PCurve,D2,TolConf,Tol);
}
//--------------------------------------------------------------------------------
inline void IntCurve_IntConicCurveGen::Perform (const gp_Circ2d& C,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
if(!D1.IsClosed()) {
IntRes2d_Domain D(D1);
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+PI+PI);
Perform(IntCurve_IConicTool(C),D,PCurve,D2,TolConf,Tol);
//-- Standard_ConstructionError::Raise("Domaine incorrect");
}
else {
Perform(IntCurve_IConicTool(C),D1,PCurve,D2,TolConf,Tol);
}
}
//--------------------------------------------------------------------------------
inline void IntCurve_IntConicCurveGen::Perform (const gp_Elips2d& E,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
if(!D1.IsClosed()) {
IntRes2d_Domain D(D1);
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+PI+PI);
Perform(IntCurve_IConicTool(E),D,PCurve,D2,TolConf,Tol);
}
else {
Perform(IntCurve_IConicTool(E),D1,PCurve,D2,TolConf,Tol);
}
}
//--------------------------------------------------------------------------------
inline void IntCurve_IntConicCurveGen::Perform (const gp_Parab2d& Prb,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(Prb),D1,PCurve,D2,TolConf,Tol);
}
//--------------------------------------------------------------------------------
inline void IntCurve_IntConicCurveGen::Perform (const gp_Hypr2d& H,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(IntCurve_IConicTool(H),D1,PCurve,D2,TolConf,Tol);
}
//--------------------------------------------------------------------------------
inline void IntCurve_IntConicCurveGen::Perform (const IntCurve_IConicTool& ICurve,
const IntRes2d_Domain& D1,
const ThePCurve& PCurve,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
IntCurve_TheIntersector myintersection;
myintersection.SetReversedParameters(ReversedParameters());
myintersection.Perform(ICurve,D1,PCurve,D2,TolConf,Tol);
this->SetValues(myintersection);
}
//================================================================================

View File

@@ -0,0 +1,233 @@
-- File: IntCurveCurveGen.cdl
-- Created: Fri May 22 14:20:59 1992
-- Author: Jacques GOUSSARD
-- <jag@sdsun1>
---Copyright: Matra Datavision 1992
generic class IntCurveCurveGen from IntCurve (
TheCurve as any;
TheCurveTool as any) -- as CurveTool from IntCurve(TheCurve)
---Purpose: Provides the algorithm to intersect two 2D-curves.
-- The curves may be parametric curves or Conic (see
-- the template class CurveTool).
--
-- Note: The exception ConstructionError is raised in
-- constructors or in Perform methods when a domain
-- (Domain from IntRes2d) is not correct, i-e when
-- the method TheType returns GeomAbs_Circle or
-- GeomAbs_Ellipsei and the corresponding domain is
-- not closed (use the SetEquivalentParameters for a
-- domain on a circle or an ellipse) or when the
-- method TheType returns GeomAbs_Other and the
-- domain of the curve is not bounded
-- (HasFirstPoint() && HasLastPoint() return True).
---Level: Advanced
inherits Intersection from IntRes2d
uses Domain from IntRes2d,
IntConicConic from IntCurve,
IConicTool from IntCurve,
Array1OfReal from TColStd
raises ConstructionError from Standard
class TheProjPCur instantiates ProjPCurGen from IntCurve(
TheCurve,
TheCurveTool);
class TheIntConicCurve instantiates IntConicCurveGen from IntCurve
(IConicTool from IntCurve,
TheCurve,
TheCurveTool,
TheProjPCur);
class IntConicCurve instantiates UserIntConicCurveGen from IntCurve
(IConicTool from IntCurve,
TheCurve,
TheCurveTool,
TheIntConicCurve);
class TheIntPCurvePCurve instantiates IntPolyPolyGen from IntCurve
(TheCurve,
TheCurveTool,
TheProjPCur);
is
Create
---Purpose: Empty constructor.
returns IntCurveCurveGen from IntCurve;
---C++: inline
Create (C: TheCurve; TolConf,Tol: Real from Standard)
---Purpose: Self Intersection of a curve
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C: TheCurve; D: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Self Intersection of a curve with a domain.
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C1: TheCurve; C2: TheCurve;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C1: TheCurve; D1: Domain from IntRes2d;
C2: TheCurve;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C1: TheCurve;
C2: TheCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C1: TheCurve; D1: Domain from IntRes2d;
C2: TheCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
---C++: inline
returns IntCurveCurveGen from IntCurve
raises ConstructionError from Standard;
Perform (me: in out;
C1: TheCurve; D1: Domain from IntRes2d;
C2: TheCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static;
Perform (me: in out;
C1: TheCurve;
C2: TheCurve;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
---C++: inline
raises ConstructionError from Standard
is static;
Perform (me: in out;
C1: TheCurve; D1: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static;
Perform (me: in out;
C1: TheCurve;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static;
Perform (me: in out;
C1: TheCurve; D1: Domain from IntRes2d;
C2: TheCurve;
TolConf,Tol: Real from Standard)
---C++: inline
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static;
Perform (me: in out;
C1: TheCurve;
C2: TheCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---C++: inline
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static;
ComputeDomain(me; C1: TheCurve; TolDomain: Real from Standard)
---Purpose: Create a domain from a curve
returns Domain from IntRes2d
is static;
InternalPerform(me: in out;
C1: TheCurve; D1: Domain from IntRes2d;
C2: TheCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite: Boolean from Standard)
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static private;
InternalCompositePerform(me: in out;
C1: TheCurve; D1: Domain from IntRes2d;
N1,NB1: Integer from Standard;
Tab1: Array1OfReal from TColStd;
C2: TheCurve; D2: Domain from IntRes2d;
N2,NB2: Integer from Standard;
Tab2: Array1OfReal from TColStd;
TolConf,Tol: Real from Standard;
Composite: Boolean from Standard)
---Purpose: Intersection between 2 curves.
raises ConstructionError from Standard
is static private;
fields
param1inf : Real from Standard;
param1sup : Real from Standard;
param2inf : Real from Standard;
param2sup : Real from Standard;
intconiconi : IntConicConic from IntCurve;
intconicurv : TheIntConicCurve;
intcurvcurv : TheIntPCurvePCurve;
end IntCurveCurveGen;

View File

@@ -0,0 +1,978 @@
// File: IntCurve_IntCurveCurveGen.gxx
// Created: Mon Oct 12 17:17:30 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <GeomAbs_CurveType.hxx>
#include <IntCurve_IntConicConic.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Parab2d.hxx>
#include <gp_Hypr2d.hxx>
#include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx>
void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C,
const Standard_Real TolConf,
const Standard_Real Tol) {
IntRes2d_Domain D1;
Standard_Real TolDomain = Tol;
if(Tol<TolConf) TolDomain = TolConf;
GeomAbs_CurveType typ = TheCurveTool::TheType(C);
switch(typ) {
case GeomAbs_Ellipse:
case GeomAbs_Circle:
case GeomAbs_Parabola:
case GeomAbs_Hyperbola:
case GeomAbs_Line:
ResetFields();
done = Standard_True;
return;
default:
{
Standard_Real paraminf = TheCurveTool::FirstParameter(C);
Standard_Real paramsup = TheCurveTool::LastParameter(C);
if(paraminf>-Precision::Infinite()) {
if(paramsup<Precision::Infinite()) {
//-- paraminf-----------paramsup
D1.SetValues(TheCurveTool::Value(C,paraminf),
paraminf,
TolDomain,
TheCurveTool::Value(C,paramsup),
paramsup,
TolDomain);
}
else {
//-- paraminf------------...
D1.SetValues(TheCurveTool::Value(C,paraminf),
paraminf,
TolDomain,
Standard_True);
}
}
else {
if(paramsup<Precision::Infinite()) {
//-- ...-----------------paramsup
D1.SetValues(TheCurveTool::Value(C,paramsup),
paramsup,
TolDomain,
Standard_False);
}
}
this->ResetFields();
intcurvcurv.SetReversedParameters(Standard_False);
intcurvcurv.Perform(C,D1,TolConf,Tol);
this->SetValues(intcurvcurv);
done = Standard_True;
}
}
}
void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C,
const IntRes2d_Domain& D,
const Standard_Real TolConf,
const Standard_Real Tol) {
GeomAbs_CurveType typ = TheCurveTool::TheType(C);
switch(typ) {
case GeomAbs_Ellipse:
case GeomAbs_Circle:
case GeomAbs_Parabola:
case GeomAbs_Hyperbola:
case GeomAbs_Line:
ResetFields();
done = Standard_True;
return;
default:
{
this->ResetFields();
intcurvcurv.SetReversedParameters(Standard_False);
intcurvcurv.Perform(C,D,TolConf,Tol);
this->SetValues(intcurvcurv);
done = Standard_True;
}
}
}
//----------------------------------------------------------------------
IntRes2d_Domain IntCurve_IntCurveCurveGen::ComputeDomain(const TheCurve& C1,
const Standard_Real TolDomain) const {
IntRes2d_Domain D1;
GeomAbs_CurveType typ = TheCurveTool::TheType(C1);
switch(typ) {
case GeomAbs_Ellipse:
case GeomAbs_Circle: {
//---------------------------------------------------------------
//-- if the curve is a trimmed curve, first and last parameters
//-- will be the parameters used to buid the domain
//--
Standard_Real firstparameter = TheCurveTool::FirstParameter(C1);
Standard_Real lastparameter = TheCurveTool::LastParameter(C1);
gp_Pnt2d P1(TheCurveTool::Value(C1,firstparameter));
gp_Pnt2d P2(TheCurveTool::Value(C1,lastparameter));
D1.SetValues(P1,firstparameter ,TolDomain,
P2,lastparameter ,TolDomain);
D1.SetEquivalentParameters(firstparameter,firstparameter+PI+PI);
break;
}
default: {
Standard_Real paraminf = TheCurveTool::FirstParameter(C1);
Standard_Real paramsup = TheCurveTool::LastParameter(C1);
if(paraminf>-Precision::Infinite()) {
if(paramsup<Precision::Infinite()) {
//-- paraminf-----------paramsup
D1.SetValues(TheCurveTool::Value(C1,paraminf),
paraminf,
TolDomain,
TheCurveTool::Value(C1,paramsup),
paramsup,
TolDomain);
}
else {
//-- paraminf------------...
D1.SetValues(TheCurveTool::Value(C1,paraminf),
paraminf,
TolDomain,
Standard_True);
}
}
else {
if(paramsup<Precision::Infinite()) {
//-- ...-----------------paramsup
D1.SetValues(TheCurveTool::Value(C1,paramsup),
paramsup,
TolDomain,
Standard_False);
}
}
break;
}
}
return(D1);
}
//----------------------------------------------------------------------
//-- Perform : Si Une des courbes est Composite Alors decompose les appels
//----------------------------------------------------------------------
void IntCurve_IntCurveCurveGen::Perform (const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer nbi1 = TheCurveTool::NbIntervals(C1);
if(nbi1 > 1) {
param1inf = TheCurveTool::FirstParameter(C1);
param1sup = TheCurveTool::LastParameter(C1);
}
else {
param1inf = (D1.HasFirstPoint())? (D1.FirstParameter()) : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? (D1.LastParameter()) : Precision::Infinite();
}
Standard_Integer nbi2 = TheCurveTool::NbIntervals(C2);
if(nbi2 > 1) {
param2inf = TheCurveTool::FirstParameter(C2);
param2sup = TheCurveTool::LastParameter(C2);
}
else {
param2inf = (D2.HasFirstPoint())? (D2.FirstParameter()) : -Precision::Infinite();
param2sup = (D2.HasLastPoint()) ? (D2.LastParameter()) : Precision::Infinite();
}
if(nbi1>1 || nbi2>1) {
TColStd_Array1OfReal Tab1(1,nbi1+1);
TColStd_Array1OfReal Tab2(1,nbi2+1);
TheCurveTool::Intervals(C1,Tab1);
TheCurveTool::Intervals(C2,Tab2);
InternalCompositePerform(C1,D1,1,nbi1,Tab1,
C2,D2,1,nbi2,Tab2,
TolConf,Tol,Standard_True);
return;
}
else {
InternalPerform(C1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//----------------------------------------------------------------------
//-- InternalPerform
//-- Suppose des Courbes Lin...Other
//-- Si Composite == True
//-- Les Resultats sont Ajoutes
//-- Sinon
//-- Les Resultats sont Copies
//----------------------------------------------------------------------
void IntCurve_IntCurveCurveGen::InternalPerform (const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ1 = TheCurveTool::TheType(C1);
GeomAbs_CurveType typ2 = TheCurveTool::TheType(C2);
switch (typ1) {
case GeomAbs_Line:
{
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Line(C1),D1,
TheCurveTool::Line(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Line(C1),D1,
TheCurveTool::Circle(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Line(C1),D1,
TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Line(C1),D1,
TheCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Line(C1),D1,
TheCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(TheCurveTool::Line(C1),D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
break;
case GeomAbs_Circle:
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Line(C2),D2,
TheCurveTool::Circle(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Circle(C1),D1,
TheCurveTool::Circle(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Circle(C1),D1,
TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Circle(C1),D1,
TheCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Circle(C1),D1,
TheCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(TheCurveTool::Circle(C1),D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
break;
case GeomAbs_Ellipse:
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Line(C2),D2,
TheCurveTool::Ellipse(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Circle(C2),D2,
TheCurveTool::Ellipse(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
TheCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
TheCurveTool::Hyperbola(C2),D2,
TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(TheCurveTool::Ellipse(C1),D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
break;
case GeomAbs_Parabola:
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Line(C2),D2,
TheCurveTool::Parabola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Circle(C2),D2,
TheCurveTool::Parabola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Ellipse(C2),D2,
TheCurveTool::Parabola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Parabola(C1),D1,
TheCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Parabola(C1),D1,
TheCurveTool::Hyperbola(C2),D2,
TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(TheCurveTool::Parabola(C1),D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
break;
case GeomAbs_Hyperbola:
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Line(C2),D2,
TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Circle(C2),D2,
TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Ellipse(C2),D2,
TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(TheCurveTool::Parabola(C2),D2,
TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(TheCurveTool::Hyperbola(C1),D1,
TheCurveTool::Hyperbola(C2),D2,
TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(TheCurveTool::Hyperbola(C1),D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
switch (typ2) {
case GeomAbs_Line:
{
intconicurv.SetReversedParameters(Standard_True);
intconicurv.Perform(TheCurveTool::Line(C2),D2, C1,D1,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
case GeomAbs_Circle:
{
intconicurv.SetReversedParameters(Standard_True);
intconicurv.Perform(TheCurveTool::Circle(C2),D2, C1,D1,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
case GeomAbs_Ellipse:
{
intconicurv.SetReversedParameters(Standard_True);
intconicurv.Perform(TheCurveTool::Ellipse(C2),D2, C1,D1,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
case GeomAbs_Parabola:
{
intconicurv.SetReversedParameters(Standard_True);
intconicurv.Perform(TheCurveTool::Parabola(C2),D2,C1,D1,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
case GeomAbs_Hyperbola:
{
intconicurv.SetReversedParameters(Standard_True);
intconicurv.Perform(TheCurveTool::Hyperbola(C2),D2,C1,D1,
TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intcurvcurv.SetReversedParameters(Standard_False);
intcurvcurv.Perform(C1,D1, C2,D2,TolConf,Tol);
if(Composite) { this->Append(intcurvcurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intcurvcurv); }
done = Standard_True;
}
break;
}
break;
}
}
}
//-- C1 ou C2 sont des courbes composites
//--
void
IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1,
const IntRes2d_Domain& D1,
const Standard_Integer XXXNumInterC1,
const Standard_Integer NbInterC1,
const TColStd_Array1OfReal& Tab1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Integer XXXNumInterC2,
const Standard_Integer NbInterC2,
const TColStd_Array1OfReal& Tab2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean RecursOnC2) {
Standard_Integer NumInterC2=XXXNumInterC2;
Standard_Integer NumInterC1=XXXNumInterC1;
// Standard_Boolean Arret=Standard_False;
if(NumInterC2<=NbInterC2) {
if(RecursOnC2) {
for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
NumInterC1=i;
InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
C1,D1,NumInterC1,NbInterC1,Tab1,
TolConf,Tol,
Standard_False);
}
if(NumInterC2<NbInterC2) {
NumInterC2++;
NumInterC1=1;
InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
C2,D2,NumInterC2,NbInterC2,Tab2,
TolConf,Tol,
Standard_True);
}
}
else {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ I n t e r s e c t i o n ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ de C2[NumInterC2] ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ et C1[NumInterC1] ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~ (pour respecter l ordre) ~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IntRes2d_Domain DomainC1NumInter;
IntRes2d_Domain DomainC2NumInter;
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C1
//----------------------------------------------------------------------
Standard_Boolean DomainIsOK = Standard_True;
Standard_Real ParamInf,ParamSup;
if(NbInterC1>1) {
TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D1.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D1.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
ParamInf,
D1.FirstTolerance(),
TheCurveTool::Value(C1,ParamSup),
ParamSup,
D1.LastTolerance());
}
else {
DomainIsOK = Standard_False;
}
}
else {
DomainC1NumInter = D1;
}
//----------------------------------------------------------------------
//-- Creation du domaine associe a la portion de C2
//----------------------------------------------------------------------
if(NbInterC2 > 1) {
TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
//--------------------------------------------------------------
//-- Verification : Domaine Inclu dans Intervalle de Definition
//--------------------------------------------------------------
Standard_Real u;
u = D2.FirstParameter();
if(ParamInf < u) { ParamInf = u; }
u = D2.LastParameter();
if(ParamSup > u) { ParamSup = u; }
if((ParamSup - ParamInf) > 1e-10) {
DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
TheCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
}
else {
DomainIsOK = Standard_False;
}
}
else {
DomainC2NumInter = D2;
}
if(DomainIsOK) {
InternalPerform(C2,DomainC2NumInter,
C1,DomainC1NumInter,
TolConf,Tol,
Standard_True);
}
}
}
}
//----------------------------------------------------------------------
//-- InterComposite ( C1 , Num1 , C2 , Num2 , Recursion_sur_C2 )
//--
//-- Boolean Arret = False
//--
//-- Si C2.Type() == Composite Max2 = C2.GetIntervals() Sinon Max2=2
//--
//-- Si C1.Type() == Composite Max1 = C1.GetIntervals() Sinon Max1=2
//--
//-- Si Num2 > Max2 RETURN;
//--
//-- Sinon
//--
//-- Si Recursion_sur_C2 == True
//--
//-- for i = Num1 --> Max1
//--
//-- Num1 = i
//--
//-- InterComposite(C2,Num2,C1,Num1,False);
//--
//-- Si Num2 < Max2
//--
//-- Num2++
//--
//-- Num1 = 1
//--
//-- InterComposite(C1,Num1,C2,Num2,True);
//--
//-- Sinon
//--
//-- *** INTERSECTION ENTRE C2[num2] et C1[Num1] ***
//--
//-- Fin
//--
//--
//-- (( Appel avec C1 , 1 , C2 , 1 , True))
//--
//-- Exemple : C1 = ABCD C2= 12
//--
//-- donne : A,1 B,1 C,1 D,1 A,2 B,2 C,2 D,2
//----------------------------------------------------------------------

View File

@@ -0,0 +1,122 @@
// File: IntCurve_IntCurveCurveGen.lxx
// Created: Tue Jul 25 10:46:26 1995
// Author: Modelistation
// <model@mastox>
#include<Precision.hxx>
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen () :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen(const TheCurve& C,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C,TolConf,Tol);
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen(const TheCurve& C,
const IntRes2d_Domain& D,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C,D,TolConf,Tol);
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen(const TheCurve& C1,
const TheCurve& C2,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C1,C2,TolConf,Tol);
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen (const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C1,D1,C2,TolConf,Tol);
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen (const TheCurve& C1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C1,C2,D2,TolConf,Tol);
}
//----------------------------------------------------------------------
inline IntCurve_IntCurveCurveGen::IntCurve_IntCurveCurveGen (const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) :
param1inf(-Precision::Infinite()),
param1sup(Precision::Infinite()),
param2inf(-Precision::Infinite()),
param2sup(Precision::Infinite())
{
Perform(C1,D1,C2,D2,TolConf,Tol);
}
//---------------------------------------------------------------------
inline void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C1,
const TheCurve& C2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Standard_Real TolDomain = Tol;
if(TolConf>TolDomain) { TolDomain = TolConf; }
Perform(C1,ComputeDomain(C1,TolDomain),C2,ComputeDomain(C2,TolDomain),TolConf,Tol);
}
//----------------------------------------------------------------------
inline void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Standard_Real TolDomain = Tol;
if(TolConf>TolDomain) { TolDomain = TolConf; }
Perform(C1,D1,C2,ComputeDomain(C2,TolDomain),TolConf,Tol);
}
//----------------------------------------------------------------------
inline void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Standard_Real TolDomain = Tol;
if(TolConf>TolDomain) { TolDomain = TolConf; }
Perform(C1,ComputeDomain(C1,TolDomain),C2,D2,TolConf,Tol);
}

View File

@@ -0,0 +1,156 @@
-- File: IntPolyPolyGen.cdl
-- Created: Mon Oct 19 12:03:29 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
generic class IntPolyPolyGen from IntCurve (
TheCurve as any;
TheCurveTool as any; -- as CurveTool from IntCurve (TheCurve)
TheProjPCur as any) -- as ProjPCurGen from IntCurve
inherits Intersection from IntRes2d
---Level: Internal
uses Domain from IntRes2d
class ThePolygon2d instantiates Polygon2dGen from IntCurve
(TheCurve,
TheCurveTool);
class ThePolygon2dTool instantiates ToolPolygon from IntCurve
(Pnt2d from gp,
ThePolygon2d,
Box2d from Bnd);
class InterferencePoly2d instantiates InterferencePolygon2d from Intf
(ThePolygon2d,
ThePolygon2dTool,
ThePolygon2d,
ThePolygon2dTool);
class TheDistBetweenPCurves instantiates DistBetweenPCurvesGen
(TheCurve,
TheCurveTool);
class ExactIntersectionPoint
uses Vector from math ,
ThePolygon2d from IntCurve
is
Create ( C1 : TheCurve;
C2 : TheCurve;
Tol : Real from Standard )
returns ExactIntersectionPoint from IntCurve ;
Perform ( me: in out ;
Poly1 : ThePolygon2d from IntCurve ;
Poly2 : ThePolygon2d from IntCurve ;
NumSegOn1 : out Integer from Standard ;
NumSegOn2 : out Integer from Standard ;
ParamOnSeg1 : out Real from Standard ;
ParamOnSeg2 : out Real from Standard );
Perform ( me: in out ;
Uo : Real from Standard ;
Vo : Real from Standard ;
UInf : Real from Standard ;
VInf : Real from Standard ;
USup : Real from Standard ;
VSup : Real from Standard );
NbRoots ( me )
returns Integer from Standard ;
Roots ( me : in out ;
U : out Real from Standard ;
V : out Real from Standard ) ;
MathPerform ( me : in out ) is private ;
AnErrorOccurred ( me )
returns Boolean from Standard ;
fields
done : Boolean from Standard ;
nbroots : Integer from Standard ;
myTol : Real from Standard ;
FctDist : TheDistBetweenPCurves from IntCurve ;
ToleranceVector : Vector from math ;
BInfVector : Vector from math ;
BSupVector : Vector from math ;
StartingPoint : Vector from math ;
Root : Vector from math ;
anErrorOccurred : Boolean from Standard ;
end ExactIntersectionPoint from IntCurve;
is
Create
returns IntPolyPolyGen from IntCurve;
Perform(me: in out;
Curve1 : TheCurve;
Domain1: Domain from IntRes2d;
Curve2 : TheCurve;
Domain2: Domain from IntRes2d;
TolConf: Real from Standard;
Tol : Real from Standard)
is static;
Perform(me: in out;
Curve1 : TheCurve;
Domain1: Domain from IntRes2d;
TolConf: Real from Standard;
Tol : Real from Standard)
is static;
Perform(me: in out;
Curve1 : TheCurve;
Domain1: Domain from IntRes2d;
Curve2 : TheCurve;
Domain2: Domain from IntRes2d;
TolConf: Real from Standard;
Tol : Real from Standard;
NbIter : Integer from Standard;
DeltaU : Real from Standard;
DeltaV : Real from Standard)
is static protected;
Perform(me: in out;
Curve1 : TheCurve;
Domain1: Domain from IntRes2d;
TolConf: Real from Standard;
Tol : Real from Standard;
NbIter : Integer from Standard;
DeltaU : Real from Standard;
DeltaV : Real from Standard)
is static protected;
fields
DomainOnCurve1 : Domain from IntRes2d;
DomainOnCurve2 : Domain from IntRes2d;
end IntPolyPolyGen;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
-- File: PConic.cdl
-- Created: Wed Mar 4 14:28:50 1992
-- Author: Laurent BUCHARD
-- <lbr@phobox>
---Copyright: Matra Datavision 1992
class PConic from IntCurve
---Purpose: This class represents a conic from gp as a
-- parametric curve ( in order to be used by the
-- class PConicTool from IntCurve).
---Level: Internal
uses Elips2d from gp,
Lin2d from gp,
Circ2d from gp,
Parab2d from gp,
Hypr2d from gp,
Ax22d from gp,
CurveType from GeomAbs
is
Create(PC: PConic from IntCurve) returns PConic from IntCurve;
Create(E: Elips2d from gp) returns PConic from IntCurve;
Create(C: Circ2d from gp) returns PConic from IntCurve;
Create(P: Parab2d from gp) returns PConic from IntCurve;
Create(H: Hypr2d from gp) returns PConic from IntCurve;
Create(L: Lin2d from gp) returns PConic from IntCurve;
SetEpsX(me: in out; EpsDist: Real from Standard) is static;
---Purpose: EpsX is a internal tolerance used in math
-- algorithms, usually about 1e-10
-- (See FunctionAllRoots for more details)
SetAccuracy(me: in out; Nb: Integer from Standard) is static;
---Purpose: Accuracy is the number of samples used to
-- approximate the parametric curve on its domain.
Accuracy(me)
---C++: inline
returns Integer from Standard is static;
EpsX(me)
---C++: inline
returns Real from Standard is static;
TypeCurve(me)
---Purpose: The Conics are manipulated as objects which only
-- depend on three parameters : Axis and two Real from Standards.
-- Type Curve is used to select the correct Conic.
---C++: inline
returns CurveType from GeomAbs
is static;
Axis2(me)
---C++: inline
---C++: return const &
returns Ax22d from gp
is static;
Param1(me)
---C++: inline
returns Real from Standard is static;
Param2(me)
---C++: inline
returns Real from Standard is static;
fields
axe : Ax22d from gp;
prm1 : Real from Standard;
prm2 : Real from Standard;
TheEpsX : Real from Standard;
TheAccuracy : Integer from Standard;
type : CurveType from GeomAbs;
end PConic;

View File

@@ -0,0 +1,57 @@
// File: IntCurve_PConic.cxx
// Created: Mon Mar 30 17:35:40 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <IntCurve_PConic.ixx>
IntCurve_PConic::IntCurve_PConic(const IntCurve_PConic& PC) :
axe(PC.axe) , prm1(PC.prm1) ,
prm2(PC.prm2) , TheEpsX(PC.TheEpsX) , TheAccuracy(PC.TheAccuracy) ,
type(PC.type) {
}
IntCurve_PConic::IntCurve_PConic(const gp_Elips2d& E) :
axe(E.Axis()) ,
prm1(E.MajorRadius()) , prm2(E.MinorRadius()) ,
TheEpsX(0.00000001) , TheAccuracy(20) , type(GeomAbs_Ellipse) {
}
IntCurve_PConic::IntCurve_PConic(const gp_Hypr2d& H) :
axe(H.Axis()) ,
prm1(H.MajorRadius()) , prm2(H.MinorRadius()) ,
TheEpsX(0.00000001) , TheAccuracy(50) , type(GeomAbs_Hyperbola) {
}
IntCurve_PConic::IntCurve_PConic(const gp_Circ2d& C) :
axe(C.Axis()) ,
prm1(C.Radius()) , TheEpsX(0.00000001) , TheAccuracy(20) ,
type(GeomAbs_Circle) {
}
IntCurve_PConic::IntCurve_PConic(const gp_Parab2d& P) :
axe(P.Axis()) ,
prm1(P.Focal()) , TheEpsX(0.00000001) , TheAccuracy(20) ,
type(GeomAbs_Parabola) {
}
IntCurve_PConic::IntCurve_PConic(const gp_Lin2d& L) :
axe(gp_Ax22d(L.Position())) , TheEpsX(0.00000001) ,
TheAccuracy(20) , type(GeomAbs_Line) {
}
void IntCurve_PConic::SetEpsX(const Standard_Real epsx) {
TheEpsX = epsx;
}
void IntCurve_PConic::SetAccuracy(const Standard_Integer n) {
TheAccuracy = n;
}

View File

@@ -0,0 +1,34 @@
// File: IntImpPar_PConic.lxx
// Created: Tue Mar 31 09:43:07 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
inline Standard_Real IntCurve_PConic::EpsX(void) const {
return(TheEpsX);
}
inline Standard_Real IntCurve_PConic::Param1(void) const {
return(prm1);
}
inline Standard_Real IntCurve_PConic::Param2(void) const {
return(prm2);
}
inline const gp_Ax22d& IntCurve_PConic::Axis2(void) const {
return(axe);
}
inline GeomAbs_CurveType IntCurve_PConic::TypeCurve(void) const {
return(type);
}
inline Standard_Integer IntCurve_PConic::Accuracy(void) const {
return(TheAccuracy);
}

View File

@@ -0,0 +1,67 @@
-- File: PConicTool.cdl
-- Created: Thu Mar 26 16:22:34 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1992
private class PConicTool from IntCurve
---Purpose: Implementation of the ParTool from IntImpParGen
-- for conics of gp, using the class PConic from IntCurve.
---Level: Internal
uses Pnt2d from gp,
Vec2d from gp,
Lin2d from gp,
XY from gp,
PConic from IntCurve
is
EpsX (myclass; C: PConic)
--Purpose: Tolerance used by mathematical algorithms
-- usually about 1e-10
returns Real from Standard;
NbSamples(myclass; C: PConic)
--Purpose: returns the number of samples on the parametric curve
returns Integer from Standard;
NbSamples(myclass; C: PConic; U0,U1: Real from Standard)
--Purpose: returns the number of samples on the parametric curve
returns Integer from Standard;
Value (myclass; C: PConic from IntCurve; X: Real from Standard)
--Purpose: Returns the geometric point which lies at the
-- parameter x on the parametric curve.
returns Pnt2d from gp;
D1 (myclass; C: PConic from IntCurve; U: Real from Standard ;
P: out Pnt2d; T: out Vec2d);
--Purpose: Computes the Value, First and Second Derivative at
-- the parameter U on the curve.
D2 (myclass; C: PConic from IntCurve; U: Real from Standard ;
P: out Pnt2d; T,N: out Vec2d);
--Purpose: Computes the Value, First and Second Derivative at
-- the parameter U on the curve.
end PConicTool;

View File

@@ -0,0 +1,130 @@
// File: IntCurve_PConicTool.cxx
// Created: Mon Mar 30 17:35:40 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <IntCurve_PConicTool.ixx>
#include <ElCLib.hxx>
//----------------------------------------------------------------------
gp_Pnt2d IntCurve_PConicTool::Value(const IntCurve_PConic& PConic,
const Standard_Real X) {
switch(PConic.TypeCurve()) {
case GeomAbs_Line:
return(ElCLib::LineValue(X,PConic.Axis2().XAxis()));
case GeomAbs_Circle:
return(ElCLib::CircleValue(X,PConic.Axis2(),PConic.Param1()));
case GeomAbs_Ellipse:
return(ElCLib::EllipseValue(X,PConic.Axis2(),
PConic.Param1(),
PConic.Param2()));
case GeomAbs_Parabola:
return(ElCLib::ParabolaValue(X,PConic.Axis2(),PConic.Param1()));
default: //-- case GeomAbs_Hyperbola:
return(ElCLib::HyperbolaValue(X,PConic.Axis2(),PConic.Param1(),
PConic.Param2()));
}
}
//----------------------------------------------------------------------
void IntCurve_PConicTool::D1(const IntCurve_PConic& PConic,
const Standard_Real U,
gp_Pnt2d& Pt,
gp_Vec2d& Tan) {
switch(PConic.TypeCurve()) {
case GeomAbs_Line:
ElCLib::LineD1(U,PConic.Axis2().XAxis(),Pt,Tan);
break;
case GeomAbs_Circle:
ElCLib::CircleD1(U,PConic.Axis2(),PConic.Param1(),Pt,Tan);
break;
case GeomAbs_Ellipse:
ElCLib::EllipseD1(U,PConic.Axis2(),PConic.Param1(),
PConic.Param2(),Pt,Tan);
break;
case GeomAbs_Parabola:
ElCLib::ParabolaD1(U,PConic.Axis2(),PConic.Param1(),Pt,Tan);
break;
case GeomAbs_Hyperbola:
ElCLib::HyperbolaD1(U,PConic.Axis2(),PConic.Param1(),
PConic.Param2(),Pt,Tan);
break;
#ifndef DEB
default:
break;
#endif
}
}
//----------------------------------------------------------------------
void IntCurve_PConicTool::D2(const IntCurve_PConic& PConic,
const Standard_Real U,
gp_Pnt2d& Pt,
gp_Vec2d& Tan,
gp_Vec2d& Norm) {
switch(PConic.TypeCurve()) {
case GeomAbs_Line:
Tan.SetCoord(0.0,0.0);
ElCLib::LineD1(U,PConic.Axis2().XAxis(),Pt,Tan);
break;
case GeomAbs_Circle:
ElCLib::CircleD2(U,PConic.Axis2(),PConic.Param1(),Pt,Tan,Norm);
break;
case GeomAbs_Ellipse:
ElCLib::EllipseD2(U,PConic.Axis2(),PConic.Param1(),PConic.Param2(),
Pt,Tan,Norm);
break;
case GeomAbs_Parabola:
ElCLib::ParabolaD2(U,PConic.Axis2(),PConic.Param1(),Pt,Tan,Norm);
break;
case GeomAbs_Hyperbola:
ElCLib::HyperbolaD2(U,PConic.Axis2(),PConic.Param1(),
PConic.Param2(),Pt,Tan,Norm);
break;
#ifndef DEB
default:
break;
#endif
}
}
Standard_Real IntCurve_PConicTool::EpsX(const IntCurve_PConic& PConic) {
return(PConic.EpsX());
}
Standard_Integer IntCurve_PConicTool::NbSamples(const IntCurve_PConic& PConic) {
return(PConic.Accuracy());
}
//Standard_Integer IntCurve_PConicTool::NbSamples(const IntCurve_PConic& PConic,const Standard_Real U0,const Standard_Real U1) {
Standard_Integer IntCurve_PConicTool::NbSamples(const IntCurve_PConic& PConic,const Standard_Real ,const Standard_Real ) {
return(PConic.Accuracy());
}

View File

@@ -0,0 +1,186 @@
-- File: Polygon2dGen.cdl
-- Created: Mon Oct 19 11:51:16 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
generic class Polygon2dGen from IntCurve (
TheCurve as any;
TheCurveTool as any) -- as CurveTool from IntCurve(TheCurve)
---Purpose: Describe a polyline as a topology to compute the
-- interference beetween two polylines 2 dimension.
---Level: Internal
uses Pnt2d from gp,
Box2d from Bnd,
Array1OfPnt2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Domain from IntRes2d
raises OutOfRange from Standard
is
Create (Curve : TheCurve;
NbPnt : Integer from Standard;
Domain : Domain from IntRes2d;
Tol : Real from Standard)
---Purpose: Compute a polygon on the domain of the curve.
returns Polygon2dGen from IntCurve;
Create (Curve : TheCurve;
NbPnt : Integer from Standard;
Domain : Domain from IntRes2d;
Tol : Real from Standard;
OtherBox : Box2d from Bnd)
---Purpose: Compute a polygon on the domain of the
-- curve. parameters of the begin and
-- end of the curve (and its polygon) are
-- adjusted to lie in the OtherBox.
returns Polygon2dGen from IntCurve;
ComputeWithBox(me : in out;
Curve : TheCurve;
OtherBox : Box2d from Bnd)
---Purpose: The current polygon is modified if most
-- of the points of the polygon are are
-- outside the box <OtherBox>. In this
-- situation, bounds are computed to build
-- a polygon inside or near the OtherBox.
is static;
Bounding (me)
returns Box2d from Bnd
is static;
---C++: return const &
---C++: inline
---Purpose: Give the bounding box of the polygon.
DeflectionOverEstimation(me)
returns Real from Standard
---C++: inline
is static;
SetDeflectionOverEstimation(me: in out; x:Real from Standard)
---C++: inline
is static;
Closed (me : in out; clos : Boolean from Standard)
---C++: inline
is static;
Closed (me)
returns Boolean from Standard
---C++: inline
is static;
NbSegments (me)
returns Integer
---C++: inline
is static;
---Purpose: Give the number of Segments in the polyline.
BeginOfSeg (me;
Index : in Integer)
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
---Purpose: Give the point of range Index in the Polygon.
---C++: inline
---C++: return const &
EndOfSeg (me;
Index : in Integer)
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
---Purpose: Give the point of range Index in the Polygon.
---C++: inline
---C++: return const &
-- Implementation :
InfParameter(me)
---Purpose: Returns the parameter (On the curve)
-- of the first point of the Polygon
returns Real from Standard
---C++: inline
is static;
SupParameter(me)
---Purpose: Returns the parameter (On the curve)
-- of the last point of the Polygon
returns Real from Standard
---C++: inline
is static;
AutoIntersectionIsPossible(me)
returns Boolean from Standard
is static;
ApproxParamOnCurve(me;
Index : in Integer from Standard;
ParamOnLine : in Real from Standard)
returns Real from Standard
raises OutOfRange from Standard
is static;
---Purpose: Give an approximation of the parameter on the curve
-- according to the discretization of the Curve.
CalculRegion (me;
x : Real from Standard ;
y : Real from Standard ;
x1 : Real from Standard ;
x2 : Real from Standard ;
y1 : Real from Standard ;
y2 : Real from Standard )
returns Integer from Standard ;
---C++: inline
Dump (me)
is static;
fields TheBnd : Box2d from Bnd;
TheDeflection : Real from Standard;
NbPntIn : Integer from Standard;
TheMaxNbPoints: Integer from Standard;
ThePnts : Array1OfPnt2d from TColgp;
TheParams : Array1OfReal from TColStd;
TheIndex : Array1OfInteger from TColStd;
ClosedPolygon : Boolean from Standard;
--- To compute an approximate parameter on the Curve
--
Binf : Real from Standard;
Bsup : Real from Standard;
end Polygon2dGen;

View File

@@ -0,0 +1,445 @@
// File: IntCurve_Polygon2dGen.gxx
// Created: Mon Oct 12 17:17:30 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#define TEST 0
#include <Standard_ConstructionError.hxx>
#include <Bnd_Box2d.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Dir2d.hxx>
#define MAJORATION_DEFLECTION 1.5
//======================================================================
//== On echantillonne sur le Domain de la Curve NbPts Points
//== a parametres constants.
//==
//== On estime la fleche maximum en prenant la distance maxi entre la
//== droite Curve.Value(X(i))-->Curve.Value(X(i+1))
//== et le point Curve.Value(X(i+1/2))
//======================================================================
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:43 2003 Begin
IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
const Standard_Integer tNbPts,
const IntRes2d_Domain& D,
const Standard_Real Tol):
// const Standard_Real ):
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:45 2003 End
ThePnts(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheParams(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheIndex(1,(tNbPts<3)? 6 : (tNbPts+tNbPts))
{
Standard_Integer NbPts = (tNbPts<3)? 3 : tNbPts;
TheMaxNbPoints = NbPts+NbPts;
NbPntIn = NbPts;
//-----------------------------------------------------
//--- Initialisation du Brise a d_Parametre constant
//---
Binf = D.FirstParameter();
Bsup = D.LastParameter();
//-----------------------------------------------------
//-- IntRes2d Raise si HasFirst retourne False
//-- et Acces a First Parameter
//--
Standard_Real u=Binf;
Standard_Real u1=Bsup;
Standard_Real du=(u1-u)/(Standard_Real)(NbPts-1);
// Standard_Integer ip1,i=1;
Standard_Integer i=1;
do {
gp_Pnt2d P=TheCurveTool::Value(C,u);
TheBnd.Add(P);
TheIndex.SetValue(i,i);
ThePnts.SetValue(i,P);
TheParams.SetValue(i,u);
u+=du;
i++;
}
while(i<=NbPts);
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//---
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 Begin
// TheDeflection = 0.000000001;
TheDeflection = Min(0.000000001, Tol/100.);
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 End
i=1;
u=D.FirstParameter();
u+=du * 0.5;
do {
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
const gp_Pnt2d& P1 = ThePnts.Value(i);
const gp_Pnt2d& P2 = ThePnts.Value(i+1);
u+=du;
i++;
Standard_Real dx,dy,t=0;
dx=P1.X()-P2.X(); if(dx<0) dx=-dx;
dy=P1.Y()-P2.Y(); if(dy<0) dy=-dy;
if(dx+dy>1e-12) {
gp_Lin2d L(P1,gp_Dir2d(gp_Vec2d(P1,P2)));
t = L.Distance(Pm);
if(t>TheDeflection) {
TheDeflection = t;
}
}
}
while(i<NbPts);
TheBnd.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
ClosedPolygon = Standard_False;
}
//======================================================================
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:26 2003 Begin
IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
const Standard_Integer tNbPts,
const IntRes2d_Domain& D,
const Standard_Real Tol,
const Bnd_Box2d& BoxOtherPolygon):
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:28 2003 End
ThePnts(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheParams(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheIndex(1,(tNbPts<3)? 6 : (tNbPts+tNbPts))
{
Standard_Integer NbPts = (tNbPts<3)? 3 : tNbPts;
TheMaxNbPoints = NbPts+NbPts;
NbPntIn = NbPts;
//-----------------------------------------------------
//--- Initialisation du Brise a d_Parametre constant
//---
Binf = D.FirstParameter();
Bsup = D.LastParameter();
//-----------------------------------------------------
Standard_Real u=Binf;
Standard_Real u1=Bsup;
Standard_Real du=(u1-u)/(Standard_Real)(NbPts-1);
Standard_Integer i=1;
do {
gp_Pnt2d P=TheCurveTool::Value(C,u);
TheBnd.Add(P);
ThePnts.SetValue(i,P);
TheParams.SetValue(i,u);
TheIndex.SetValue(i,i);
u+=du;
i++;
}
while(i<=NbPts);
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//---
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:55 2003 Begin
// TheDeflection = 0.0000001;
TheDeflection = Min(0.0000001, Tol/100.);
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:56 2003 End
i=1;
u=D.FirstParameter();
u+=du * 0.5;
do {
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
const gp_Pnt2d& P1 = ThePnts.Value(i);
const gp_Pnt2d& P2 = ThePnts.Value(i+1);
Standard_Real dx,dy;
dx=P1.X()-P2.X(); if(dx<0) dx=-dx;
dy=P1.Y()-P2.Y(); if(dy<0) dy=-dy;
if(dx+dy>1e-12) {
gp_Lin2d L(P1,gp_Dir2d(gp_Vec2d(P1,P2)));
Standard_Real t = L.Distance(Pm);
if(t>TheDeflection) {
TheDeflection = t;
}
}
u+=du;
i++;
}
while(i<NbPts);
TheBnd.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
ClosedPolygon = Standard_False;
//-------------------------------------------------------
//-- On supprime les points alignes
//-- (Permet de diminuer le nombre total de points)
//-- (Dans le cas ou la courbe est "droite" )
Standard_Real DeflectionMaj = TheDeflection;
for(i=2;i<NbPntIn && NbPntIn>3;i++) {
Standard_Integer indexim1 = TheIndex.Value(i-1);
Standard_Integer indexi = TheIndex.Value(i);
Standard_Integer indexip1 = TheIndex.Value(i+1);
const gp_Pnt2d& Pim1 = ThePnts.Value(indexim1);
const gp_Pnt2d& Pi = ThePnts.Value(indexi);
const gp_Pnt2d& Pip1 = ThePnts.Value(indexip1);
Standard_Real dx,dy;
dx=Pim1.X()-Pip1.X(); if(dx<0) dx=-dx;
dy=Pim1.Y()-Pip1.Y(); if(dy<0) dy=-dy;
Standard_Real t=0;
if(dx+dy>1e-12) {
gp_Lin2d L(Pim1,gp_Dir2d(gp_Vec2d(Pim1,Pip1)));
t = L.Distance(Pi);
}
if(t<=DeflectionMaj) {
//-- On supprime le point i
for(Standard_Integer j = i; j<NbPntIn; j++) {
TheIndex.SetValue(j,TheIndex.Value(j+1));
}
NbPntIn--;
i--;
}
}
ComputeWithBox(C,BoxOtherPolygon);
}
//======================================================================
void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
const Bnd_Box2d& BoxOtherPolygon) {
if(TheBnd.IsOut(BoxOtherPolygon)) {
NbPntIn=2;
TheBnd.SetVoid();
}
else {
Standard_Real bx0,bx1,by0,by1;
BoxOtherPolygon.Get(bx0,by0,bx1,by1);
bx0-=TheDeflection;
by0-=TheDeflection;
bx1+=TheDeflection;
by1+=TheDeflection;
Standard_Integer MaxIndexUsed = 1;
Standard_Integer i,nbp;
Standard_Integer Rprec,Ri;
Standard_Real x,y;
nbp = 0;
x = ThePnts.Value(TheIndex.Value(1)).X();
y = ThePnts.Value(TheIndex.Value(1)).Y();
Rprec = CalculRegion(x,y,bx0,bx1,by0,by1);
for(i = 2; i<=NbPntIn; i++) {
const gp_Pnt2d& P2d = ThePnts.Value(TheIndex.Value(i));
Ri = CalculRegion(P2d.X(),P2d.Y(),bx0,bx1,by0,by1);
if((Ri & Rprec)==0) {
if(nbp) {
if(TheIndex.Value(nbp) != TheIndex.Value(i-1)) {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
}
else {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i));
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
Rprec = Ri;
}
else {
if((Ri & Rprec)==0) {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i));
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
Rprec = Ri;
}
}
Rprec = Ri;
}
if(nbp==1) {
NbPntIn=2;
TheBnd.SetVoid();
}
else {
TheBnd.SetVoid();
if(nbp) {
TheBnd.Add(ThePnts.Value(TheIndex.Value(1)));
}
Standard_Real RatioDeflection;
Standard_Integer nbpassagedeflection = 0;
// Standard_Integer PointHasBeenAdded = 0;
do {
nbpassagedeflection++;
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:28 2003 Begin
// Standard_Real NewDeflection = 0.0000001;
Standard_Real NewDeflection = TheDeflection;
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:29 2003 End
for(i=2; i<=nbp; i++) {
Standard_Integer Ii = TheIndex.Value(i);
Standard_Integer Iim1= TheIndex.Value(i-1);
const gp_Pnt2d& Pi = ThePnts.Value(Ii);
const gp_Pnt2d& Pim1 = ThePnts.Value(Iim1);
TheBnd.Add(Pi);
Standard_Integer Regi = CalculRegion(Pi.X(),Pi.Y(),bx0,bx1,by0,by1);
Standard_Integer Regim1 = CalculRegion(Pim1.X(),Pim1.Y(),bx0,bx1,by0,by1);
if((Regi & Regim1) == 0) {
Standard_Real u = 0.5*( TheParams.Value(Ii)
+TheParams.Value(Iim1));
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
Standard_Real dx,dy,t=0;
dx=Pim1.X()-Pi.X(); if(dx<0) dx=-dx;
dy=Pim1.Y()-Pi.Y(); if(dy<0) dy=-dy;
if(dx+dy>1e-12) {
gp_Lin2d L(Pim1,gp_Dir2d(gp_Vec2d(Pim1,Pi)));
t = L.Distance(Pm);
if((MaxIndexUsed<(TheMaxNbPoints-1)) && (t>(TheDeflection * 0.5))) {
const gp_Pnt2d& P1=Pim1;
nbp++;
for(Standard_Integer j=nbp; j>=i+1; j--) {
TheIndex.SetValue(j,TheIndex.Value(j-1));
}
MaxIndexUsed++;
TheIndex.SetValue(i,MaxIndexUsed);
ThePnts.SetValue(MaxIndexUsed,Pm);
TheParams.SetValue(MaxIndexUsed,u);
Standard_Real u1m = 0.5*(u+TheParams.Value(TheIndex.Value(i-1)));
Standard_Real um2 = 0.5*(u+TheParams.Value(TheIndex.Value(i+1)));
gp_Pnt2d P1m = TheCurveTool::Value(C,u1m);
#ifdef DEB
gp_Pnt2d Pm2 = TheCurveTool::Value(C,um2);
#else
TheCurveTool::Value(C,um2);
#endif
gp_Lin2d L1m(P1,gp_Dir2d(gp_Vec2d(P1,Pm)));
#ifdef DEB
gp_Lin2d Lm2(Pm,gp_Dir2d(gp_Vec2d(Pm,ThePnts.Value(TheIndex.Value(i+1)))));
#else
ThePnts.Value(TheIndex.Value(i+1));
#endif
t = L1m.Distance(P1m);
i--;
}
}
else {
if(t>NewDeflection) {
NewDeflection = t;
}
}
}
}
if(NewDeflection)
RatioDeflection = TheDeflection / NewDeflection;
else RatioDeflection = 10.0;
TheDeflection = NewDeflection;
NbPntIn = nbp;
}
while((RatioDeflection<3.0)
&& (nbpassagedeflection < 3)
&& (MaxIndexUsed<(TheMaxNbPoints-2)));
}
TheDeflection*=MAJORATION_DEFLECTION;
TheBnd.Enlarge(TheDeflection);
}
ClosedPolygon = Standard_False;
Dump();
}
Standard_Boolean IntCurve_Polygon2dGen::AutoIntersectionIsPossible() const {
gp_Vec2d VRef(ThePnts.Value(TheIndex.Value(1)),
ThePnts.Value(TheIndex.Value(2)));
for(Standard_Integer i=3; i<=NbPntIn; i++) {
gp_Vec2d V(ThePnts.Value(TheIndex.Value(i-1)),
ThePnts.Value(TheIndex.Value(i)));
if(V.Dot(VRef)<0.0) {
return(Standard_True);
}
}
return(Standard_False);
}
//======================================================================
Standard_Real IntCurve_Polygon2dGen::ApproxParamOnCurve( const Standard_Integer Aindex
,const Standard_Real TheParamOnLine)
const
{
Standard_Integer Indexp1,Index = Aindex;
Standard_Real ParamOnLine = TheParamOnLine;
if (Index > NbPntIn) {
cout << "OutOfRange Polygon2d::ApproxParamOnCurve " <<endl;
}
if((Index == NbPntIn) && (ParamOnLine == 0.0)) {
Index--; ParamOnLine=1.0;
}
if(Index==0) {
Index=1;
ParamOnLine = 0.0;
}
Indexp1 = TheIndex.Value(Index+1);
Index = TheIndex.Value(Index);
Standard_Real du = TheParams.Value(Indexp1)-TheParams.Value(Index);
Standard_Real u = TheParams.Value(Index) + ParamOnLine * du;
return(u);
}
//======================================================================
#if TEST
extern Standard_Boolean DebugPolygon2d;
extern void DrawSegmentBlanc(const gp_Pnt2d& _P1,const gp_Pnt2d& _P2);
extern void DrawSegment(const gp_Pnt2d& _P1,const gp_Pnt2d& _P2);
void IntCurve_Polygon2dGen::Dump(void) const {
if(!DebugPolygon2d) return;
Standard_Real bx0,bx1,by0,by1;
if(TheBnd.IsVoid()) return;
TheBnd.Get(bx0,by0,bx1,by1);
DrawSegment(gp_Pnt2d(bx0,by0),gp_Pnt2d(bx1,by0));
DrawSegment(gp_Pnt2d(bx1,by0),gp_Pnt2d(bx1,by1));
DrawSegment(gp_Pnt2d(bx1,by1),gp_Pnt2d(bx0,by1));
DrawSegment(gp_Pnt2d(bx0,by1),gp_Pnt2d(bx0,by0));
Standard_Integer i;
if(NbPntIn<=1) return;
for(i=2;i<=NbPntIn; i++) {
DrawSegmentBlanc(ThePnts.Value(TheIndex.Value(i-1)),ThePnts.Value(TheIndex.Value(i)));
}
}
#else
void IntCurve_Polygon2dGen::Dump(void) const {
static int debug = 0;
if(debug) {
Standard_Real bx0,bx1,by0,by1;
cout<<"\n ----- Dump de IntCurve_Polygon2dGen -----"<<endl;
if(TheBnd.IsVoid()) {
cout<<" Polygone Vide "<<endl;
return;
}
TheBnd.Get(bx0,by0,bx1,by1);
cout<<" bx0:"<<bx0 <<endl;
cout<<" by0:"<<by0<<endl;
cout<<" bx1:"<<bx1<<endl;
cout<<" by1:"<<by1<<endl;
Standard_Integer i;
for(i=1;i<=NbPntIn; i++) {
const gp_Pnt2d& P = ThePnts(TheIndex(i));
cout<<" ("<<i<<") u:"<<TheParams.Value(TheIndex(i))<<" X:"<<P.X()<<" Y:"<<P.Y()<<endl;
}
}
}
#endif
//======================================================================
//======================================================================

View File

@@ -0,0 +1,68 @@
// File: IntCurve_Polygon2dGen.lxx
// Created: Thu 3 Jun 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
#include <Standard_OutOfRange.hxx>
//======================================================================
inline const Bnd_Box2d& IntCurve_Polygon2dGen::Bounding(void) const {
return(TheBnd);
}
//======================================================================
inline Standard_Real IntCurve_Polygon2dGen::DeflectionOverEstimation() const {
return(TheDeflection);
}//======================================================================
inline void IntCurve_Polygon2dGen::SetDeflectionOverEstimation
(const Standard_Real x) {
TheDeflection = x;
TheBnd.Enlarge(TheDeflection);
}
//======================================================================
inline void IntCurve_Polygon2dGen::Closed(const Standard_Boolean flag) {
ClosedPolygon = flag;
}
//======================================================================
inline Standard_Boolean IntCurve_Polygon2dGen::Closed(void) const {
return(Standard_False); //-- Voir si le cas Closed est traitable
}
//======================================================================
inline Standard_Integer IntCurve_Polygon2dGen::NbSegments(void) const {
return((ClosedPolygon)? NbPntIn : NbPntIn-1);
}
//======================================================================
inline const gp_Pnt2d& IntCurve_Polygon2dGen::EndOfSeg(const Standard_Integer Index) const {
Standard_Integer ind = Index;
if (Index >= NbPntIn) {
if (!ClosedPolygon)
Standard_OutOfRange::Raise("OutOfRange Polygon2d::EndOfSeg !");
ind = 0;
}
return ThePnts(TheIndex(ind+1));
}
//======================================================================
inline const gp_Pnt2d& IntCurve_Polygon2dGen::BeginOfSeg(const Standard_Integer Index) const {
return ThePnts(TheIndex(Index));
}
//======================================================================
inline Standard_Real IntCurve_Polygon2dGen::InfParameter() const {
return(TheParams.Value(TheIndex(1)));
}
//======================================================================
inline Standard_Real IntCurve_Polygon2dGen::SupParameter() const {
return(TheParams.Value(TheIndex(NbPntIn)));
}
//======================================================================
//======================================================================
inline Standard_Integer IntCurve_Polygon2dGen::CalculRegion(const Standard_Real x,
const Standard_Real y,
const Standard_Real x1,
const Standard_Real x2,
const Standard_Real y1,
const Standard_Real y2) const {
Standard_Integer r;
if(x<x1) { r=1; } else { if(x>x2) { r=2; } else { r=0; } }
if(y<y1) { r|=4; } else { if(y>y2) { r|=8; } }
return(r);
}

View File

@@ -0,0 +1,87 @@
-- File: ProjPCurGen.cdl
-- Created: Tue Oct 13 18:27:03 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
generic class ProjPCurGen from IntCurve (
TheCurve as any;
TheCurveTool as any) -- as CurveTool from IntCurve(TheCurve)
---Purpose: this class provide a tool which computes the parameter
-- of a point near a parametric curve.
---Level: Internal
uses Pnt2d from gp,
Vec2d from gp,
POnCurv2d from Extrema
class TheCurveLocator instantiates CurveLocator from Extrema (
TheCurve,
TheCurveTool,
TheCurve,
TheCurveTool,
POnCurv2d from Extrema,
Pnt2d from gp);
class TheLocateExtPC instantiates GenLocateExtPC from Extrema (
TheCurve,
TheCurveTool,
POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp);
is
FindParameter(myclass; C: TheCurve;
Pnt: Pnt2d from gp;
Tol: Real from Standard)
--- Purpose: Returns the parameter V of the point on the
-- parametric curve corresponding to the Point Pnt.
-- The Correspondance between Pnt and the point P(V)
-- on the parametric curve must be coherent with the
-- way of determination of the signed distance
-- between a point and the implicit curve.
-- Tol is the tolerance on the distance between a point
-- and the parametrised curve.
-- In that case, no bounds are given. The research of
-- the rigth parameter has to be made on the natural
-- parametric domain of the curve.
returns Real from Standard;
FindParameter(myclass; C: TheCurve;
Pnt: Pnt2d from gp;
LowParameter,HighParameter,Tol: Real from Standard)
--- Purpose: Returns the parameter V of the point on the
-- parametric curve corresponding to the Point Pnt.
-- The Correspondance between Pnt and the point P(V)
-- on the parametric curve must be coherent with the
-- way of determination of the signed distance
-- between a point and the implicit curve.
-- Tol is the tolerance on the distance between a point
-- and the parametrised curve.
-- LowParameter and HighParameter give the
-- boundaries of the interval in wich the parameter
-- certainly lies. These parameters are given to
-- implement a more efficient algoritm. So, it is not
-- necessary to check that the returned value verifies
-- LowParameter <= Value <= HighParameter.
returns Real from Standard;
end ProjPCurGen;

View File

@@ -0,0 +1,59 @@
// File: IntCurve_ProjPCurGen.gxx
// Created: Tue Oct 13 18:50:18 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <Extrema_POnCurv2d.hxx>
Standard_Real IntCurve_ProjPCurGen::FindParameter
(const TheCurve& C,
const gp_Pnt2d& P,
const Standard_Real LowParameter,
const Standard_Real HighParameter,
const Standard_Real)
{
Standard_Real theparam,defaultparam;
Standard_Integer NbPts = TheCurveTool::NbSamples(C);
Standard_Real theEpsX = TheCurveTool::EpsX(C);
Extrema_POnCurv2d POnC;
IntCurve_TheCurveLocator::Locate(P,C,NbPts,LowParameter,HighParameter,POnC);
defaultparam = POnC.Parameter();
IntCurve_TheLocateExtPC Loc(P,C,defaultparam,theEpsX);
if(Loc.IsDone() == Standard_False) {
//-- cout<<"\n Erreur dans LocateExtPC "<<endl;
theparam = defaultparam;
}
else {
if(Loc.IsMin() == Standard_False) {
//-- cout<<"\n Erreur dans LocateExtPC (Maximum trouve) "<<endl;
theparam = defaultparam;
}
else {
theparam = Loc.Point().Parameter();
}
}
return theparam;
}
Standard_Real IntCurve_ProjPCurGen::FindParameter
(const TheCurve& C,
const gp_Pnt2d& P,
const Standard_Real Tol)
{
Standard_Real theParam;
theParam = FindParameter( C
,P
,TheCurveTool::FirstParameter(C)
,TheCurveTool::LastParameter(C)
,Tol);
return theParam;
}

View File

@@ -0,0 +1,56 @@
-- File: ProjectOnPConicTool.cdl
-- Created: Tue Oct 13 18:36:43 1992
-- Author: Laurent BUCHARD
-- <lbr@sdsun2>
---Copyright: Matra Datavision 1992
private class ProjectOnPConicTool from IntCurve
---Purpose: This class provides a tool which computes the parameter
-- of a point near a parametric conic.
uses Pnt2d from gp,
PConic from IntCurve
is
FindParameter(myclass; C: PConic from IntCurve;
Pnt: Pnt2d from gp;
Tol: Real from Standard)
--- Purpose: Returns the parameter V of the point on the
-- parametric curve corresponding to the Point Pnt. The
-- Correspondance between Pnt and the point P(V) on the
-- parametric curve must be coherent with the way of
-- determination of the signed distance between a point and
-- the implicit curve. Tol is the tolerance on the distance
-- between a point and the parametrised curve. In that case,
-- no bounds are given. The research of the rigth parameter
-- has to be made on the natural parametric domain of the
-- curve.
returns Real from Standard;
FindParameter(myclass; C: PConic from IntCurve;
Pnt: Pnt2d from gp;
LowParameter,HighParameter,Tol: Real from Standard)
--- Purpose: Returns the parameter V of the point on the
-- parametric curve corresponding to the Point Pnt. The
-- Correspondance between Pnt and the point P(V) on the
-- parametric curve must be coherent with the way of
-- determination of the signed distance between a point and
-- the implicit curve. Tol is the tolerance on the distance
-- between a point and the parametrised curve. LowParameter
-- and HighParameter give the boundaries of the interval in
-- wich the parameter certainly lies. These parameters are
-- given to implement a more efficient algoritm. So, it is
-- not necessary to check that the returned value verifies
-- LowParameter <= Value <= HighParameter.
returns Real from Standard;
end ProjectOnPConicTool;

View File

@@ -0,0 +1,116 @@
// File: IntCurve_ProjectOnPConicTool.cxx
// Created: Tue Oct 13 18:45:14 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <ElCLib.hxx>
#include <IntCurve_ProjectOnPConicTool.ixx>
Standard_Real IntCurve_ProjectOnPConicTool::FindParameter
(const IntCurve_PConic& ThePConic,
const gp_Pnt2d& P,
const Standard_Real LowParameter,
const Standard_Real HighParameter,
const Standard_Real) {
Standard_Real ParamSup,ParamInf,Param=0;
if(LowParameter>HighParameter) {
ParamSup=LowParameter;
ParamInf=HighParameter;
}
else {
ParamInf=LowParameter;
ParamSup=HighParameter;
}
switch(ThePConic.TypeCurve()) {
case GeomAbs_Line:
Param=ElCLib::LineParameter(ThePConic.Axis2().XAxis(),P);
break;
case GeomAbs_Circle:
Param=ElCLib::CircleParameter(ThePConic.Axis2(),P);
if(Param<0.0) { Param+=PI+PI; }
break;
case GeomAbs_Ellipse: {
Param=ElCLib::EllipseParameter(ThePConic.Axis2()
,ThePConic.Param1()
,ThePConic.Param2()
,P);
if (Param < 0.0) { Param+=PI+PI; }
break;
}
case GeomAbs_Parabola: {
Param=ElCLib::ParabolaParameter(ThePConic.Axis2(),P);
break;
}
case GeomAbs_Hyperbola: {
Param=ElCLib::HyperbolaParameter(ThePConic.Axis2()
,ThePConic.Param1()
,ThePConic.Param2(),P);
break;
}
#ifndef DEB
default:
break;
#endif
}
if(ParamInf!=ParamSup) {
if(Param<ParamInf) return(ParamInf);
if(Param>ParamSup) return(ParamSup);
}
return(Param);
}
Standard_Real IntCurve_ProjectOnPConicTool::FindParameter
(const IntCurve_PConic& ThePConic,
const gp_Pnt2d& P,
const Standard_Real) {
//cout<<"\n\n---- Dans ProjectOnPConicTool::FindParameter Point : "<<P.X()<<","<<P.Y();
Standard_Real Param=0;
switch(ThePConic.TypeCurve()) {
case GeomAbs_Line:
Param=ElCLib::LineParameter(ThePConic.Axis2().XAxis(),P);
break;
case GeomAbs_Circle:
Param=ElCLib::CircleParameter(ThePConic.Axis2(),P);
if(Param<0.0) { Param+=PI+PI; }
break;
case GeomAbs_Ellipse: {
Param=ElCLib::EllipseParameter(ThePConic.Axis2()
,ThePConic.Param1()
,ThePConic.Param2()
,P);
if (Param < 0.0) { Param+=PI+PI; }
break;
}
case GeomAbs_Parabola: {
Param=ElCLib::ParabolaParameter(ThePConic.Axis2(),P);
break;
}
case GeomAbs_Hyperbola: {
Param=ElCLib::HyperbolaParameter(ThePConic.Axis2()
,ThePConic.Param1()
,ThePConic.Param2(),P);
break;
}
#ifndef DEB
default:
break;
#endif
}
return(Param);
}

View File

@@ -0,0 +1,58 @@
-- File: ToolPolygon.cdl
-- Created: Fri Aug 2 08:18:37 1991
-- Author: Didier PIFFAULT
-- <dpf@sdsun2>
---Copyright: Matra Datavision 1991
generic class ToolPolygon from IntCurve (Point as any;
Polygon as any;
BoundingBox as any)
---Purpose: Describe a polyline as a topology to compute the
-- interference beetween two polylines.
---Level: Internal
raises OutOfRange from Standard
is Bounding (myclass; thePolygon : Polygon)
returns BoundingBox;
---Purpose: Give the bounding box of the polygon.
---C++: inline
---C++: return const &
DeflectionOverEstimation
(myclass; thePolygon : Polygon)
---C++: inline
returns Real from Standard;
Closed (myclass; thePolygon : Polygon)
---C++: inline
returns Boolean from Standard;
NbSegments (myclass; thePolygon : Polygon)
---C++: inline
returns Integer;
---Purpose: Give the number of Segments in the polyline.
BeginOfSeg (myclass; thePolygon : Polygon;
Index : in Integer)
---C++: inline
returns Point
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
EndOfSeg (myclass; thePolygon : Polygon;
Index : in Integer)
---C++: inline
returns Point
raises OutOfRange from Standard;
---C++: return const &
---Purpose: Give the point of range Index in the Polygon.
end ToolPolygon;

View File

@@ -0,0 +1,5 @@
// File: IntCurve_ToolPolygon.gxx
// Created: Tue Jun 4 16:14:49 1996
// Author: Laurent BUCHARD
// <lbr@sherlox.paris1.matra-dtv.fr>

View File

@@ -0,0 +1,49 @@
// File: IntCurve_ToolPolygon.gxx
// Created: Thu Jun 3 14:52:18 1993
// Author: Laurent BUCHARD
// <lbr@nonox>
#include Polygon_hxx
//=================================================================
inline const BoundingBox& IntCurve_ToolPolygon::Bounding
(const Polygon& thePolygon)
{
return thePolygon.Bounding();
}
//=================================================================
inline Standard_Real IntCurve_ToolPolygon::DeflectionOverEstimation
(const Polygon& thePolygon)
{
return thePolygon.DeflectionOverEstimation();
}
//=================================================================
inline Standard_Boolean IntCurve_ToolPolygon::Closed
(const Polygon& thePolygon)
{
return thePolygon.Closed();
}
//=================================================================
inline Standard_Integer IntCurve_ToolPolygon::NbSegments
(const Polygon& thePolygon)
{
return thePolygon.NbSegments();
}
//=================================================================
inline const Point& IntCurve_ToolPolygon::BeginOfSeg
(const Polygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.BeginOfSeg(Index);
}
//=================================================================
inline const Point& IntCurve_ToolPolygon::EndOfSeg
(const Polygon& thePolygon,
const Standard_Integer Index)
{
return thePolygon.EndOfSeg(Index);
}
//=================================================================

View File

@@ -0,0 +1,249 @@
-- File: UserIntConicCurveGen.cdl
-- Created: Tue Nov 24 12:33:33 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1992
generic class UserIntConicCurveGen from IntCurve (
TheImpTool as any; -- as ImpTool from IntImpParGen
ThePCurve as any;
ThePCurveTool as any; -- as CurveTool from IntCurve(ThePCurve)
TheIntConicCurve as any) -- as IntConicCurveGen from IntCurve (
-- TheImpTool as ImpTool from IntImpParGen
-- ThePCurve as any;
-- ThePCurveTool as ParTool from IntImpParGen(ThePCurve)
inherits Intersection from IntRes2d
---Purpose: Generic algorithm to intersect a conic from gp and
-- a parametric curve. This class uses the class
-- IConicTool from IntCurve, and Domain from
-- IntCurve.
--
-- The template class for the PCurveTool is given in
-- the package IntCurve (CurveTool).
--
-- The methods used to know the result of the
-- intersection are inherited from the class
-- Intersection from IntRes2d.
--
-- Note: The exception ConstructionError is raised in
-- constructors or in Perform methods when a domain
-- (Domain from IntRes2d) is not correct, i-e when a
-- Circle (Circ2d from gp) or an Ellipse (i-e Elips2d
-- from gp) do not have a closed domain (use the
-- SetEquivalentParameters for a domain on a circle
-- or an ellipse) or the domain of the ThePCurve is
-- not bounded (HasFirstPoint() && HasLastPoint()
-- return True.)
---Level: Internal
uses IConicTool from IntCurve,
Lin2d from gp,
Circ2d from gp,
Elips2d from gp,
Parab2d from gp,
Hypr2d from gp,
Domain from IntRes2d,
IntConicConic from IntCurve
raises ConstructionError from Standard
is
Create
---Purpose: Empty constructor.
returns UserIntConicCurveGen from IntCurve;
Create (L: Lin2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
returns UserIntConicCurveGen from IntCurve
raises ConstructionError from Standard;
Create (C: Circ2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
returns UserIntConicCurveGen from IntCurve
raises ConstructionError from Standard;
Create (E: Elips2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between an ellipse and a parametric curve.
returns UserIntConicCurveGen from IntCurve
raises ConstructionError from Standard;
Create (Prb: Parab2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a parabola and a parametric curve.
returns UserIntConicCurveGen from IntCurve
raises ConstructionError from Standard;
Create (H: Hypr2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between the main branch of an hyperbola
-- and a parametric curve.
returns UserIntConicCurveGen from IntCurve
raises ConstructionError from Standard;
Perform (me: in out;
L: Lin2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
raises ConstructionError from Standard
is static;
Perform (me: in out;
C: Circ2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a line and a parametric curve.
raises ConstructionError from Standard
is static;
Perform (me: in out;
E: Elips2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between an ellipse and a parametric curve.
raises ConstructionError from Standard
is static;
Perform (me: in out;
Prb: Parab2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between a parabola and a parametric curve.
raises ConstructionError from Standard
is static;
Perform (me: in out;
H: Hypr2d from gp; D1: Domain from IntRes2d;
PCurve: ThePCurve; D2: Domain from IntRes2d;
TolConf,Tol: Real from Standard)
---Purpose: Intersection between the main branch of an hyperbola
-- and a parametric curve.
raises ConstructionError from Standard
is static;
-------------------------------- p r i v a t e f u n c t i o n s
InternalPerform (me : in out;
Lin1 : Lin2d from gp;
D1 : Domain from IntRes2d;
PCurve : ThePCurve;
D2 : Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite : Boolean from Standard)
is static private;
InternalPerform (me : in out;
Circ1 : Circ2d from gp;
D1 : Domain from IntRes2d;
PCurve : ThePCurve;
D2 : Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite : Boolean from Standard)
is static private;
InternalPerform (me : in out;
Eli1 : Elips2d from gp;
D1 : Domain from IntRes2d;
PCurve : ThePCurve;
D2 : Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite : Boolean from Standard)
is static private;
InternalPerform (me : in out;
Prb1 : Parab2d from gp;
D1 : Domain from IntRes2d;
PCurve : ThePCurve;
D2 : Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite : Boolean from Standard)
is static private;
InternalPerform (me : in out;
Hpr1 : Hypr2d from gp;
D1 : Domain from IntRes2d;
PCurve : ThePCurve;
D2 : Domain from IntRes2d;
TolConf,Tol: Real from Standard;
Composite : Boolean from Standard)
is static private;
fields
param1inf : Real from Standard;
param1sup : Real from Standard;
param2inf : Real from Standard;
param2sup : Real from Standard;
intconiconi : IntConicConic from IntCurve;
intconicurv : TheIntConicCurve;
end UserIntConicCurveGen;

View File

@@ -0,0 +1,777 @@
// File: IntCurve_UserIntConicCurveGen.gxx
// Created: Tue Nov 24 14:18:49 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <IntCurve_IntConicConic.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Parab2d.hxx>
#include <gp_Hypr2d.hxx>
#include <Precision.hxx>
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen () {
done = Standard_False;
}
//-------------------------------------------------------------------------------------
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Lin2d& Lin1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(Lin1,D1,C2,D2,TolConf,Tol);
}
//-------------------------------------------------------------------------------------
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Circ2d& Circ1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(Circ1,D1,C2,D2,TolConf,Tol);
}
//-------------------------------------------------------------------------------------
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Parab2d& Parab1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(Parab1,D1,C2,D2,TolConf,Tol);
}
//-------------------------------------------------------------------------------------
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Elips2d& Elips1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(Elips1,D1,C2,D2,TolConf,Tol);
}
//-------------------------------------------------------------------------------------
IntCurve_UserIntConicCurveGen::IntCurve_UserIntConicCurveGen (const gp_Hypr2d& Hyper1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
Perform(Hyper1,D1,C2,D2,TolConf,Tol);
}
//-------------------------------------------------------------------------------------
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::Perform (const gp_Lin2d& Lin1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
if(NbInterC2 > 1) {
Standard_Real ParamInf,ParamSup;
Standard_Real D2FirstParam = D2.FirstParameter();
Standard_Real D2LastParam = D2.LastParameter();
Standard_Boolean Ok = Standard_True;
param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? D1.LastParameter() : Precision::Infinite();
param2inf = ThePCurveTool::FirstParameter(C2);
param2sup = ThePCurveTool::LastParameter(C2);
IntRes2d_Domain DomainC2NumInter;
TColStd_Array1OfReal Tab2(1,NbInterC2+1);
ThePCurveTool::Intervals(C2,Tab2);
for(Standard_Integer NumInterC2=1; Ok && (NumInterC2 <= NbInterC2);NumInterC2++) {
ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False;
else {
if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
if(ParamSup > D2LastParam) ParamSup = D2LastParam;
if((ParamSup - ParamInf) > RealEpsilon()) {
DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
ThePCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
InternalPerform(Lin1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
}
}
}
}
else {
InternalPerform(Lin1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//--------------------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::Perform (const gp_Circ2d& Circ1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
if(NbInterC2 > 1) {
Standard_Real ParamInf,ParamSup;
Standard_Real D2FirstParam = D2.FirstParameter();
Standard_Real D2LastParam = D2.LastParameter();
Standard_Boolean Ok = Standard_True;
param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? D1.LastParameter() : Precision::Infinite();
param2inf = ThePCurveTool::FirstParameter(C2);
param2sup = ThePCurveTool::LastParameter(C2);
IntRes2d_Domain DomainC2NumInter;
TColStd_Array1OfReal Tab2(1,NbInterC2+1);
ThePCurveTool::Intervals(C2,Tab2);
for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) {
ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False;
else {
if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
if(ParamSup > D2LastParam) ParamSup = D2LastParam;
if((ParamSup - ParamInf) > RealEpsilon()) {
DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
ThePCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
InternalPerform(Circ1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
}
}
}
}
else {
InternalPerform(Circ1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//--------------------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::Perform (const gp_Parab2d& Parab1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
if(NbInterC2 > 1) {
Standard_Real ParamInf,ParamSup;
Standard_Real D2FirstParam = D2.FirstParameter();
Standard_Real D2LastParam = D2.LastParameter();
Standard_Boolean Ok = Standard_True;
param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? D1.LastParameter() : Precision::Infinite();
param2inf = ThePCurveTool::FirstParameter(C2);
param2sup = ThePCurveTool::LastParameter(C2);
IntRes2d_Domain DomainC2NumInter;
TColStd_Array1OfReal Tab2(1,NbInterC2+1);
ThePCurveTool::Intervals(C2,Tab2);
for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) {
ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False;
else {
if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
if(ParamSup > D2LastParam) ParamSup = D2LastParam;
if((ParamSup - ParamInf) > RealEpsilon()) {
DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
ThePCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
InternalPerform(Parab1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
}
}
}
}
else {
InternalPerform(Parab1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//--------------------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::Perform (const gp_Elips2d& Elips1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
if(NbInterC2 > 1) {
Standard_Real ParamInf,ParamSup;
Standard_Real D2FirstParam = D2.FirstParameter();
Standard_Real D2LastParam = D2.LastParameter();
Standard_Boolean Ok = Standard_True;
param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? D1.LastParameter() : Precision::Infinite();
param2inf = ThePCurveTool::FirstParameter(C2);
param2sup = ThePCurveTool::LastParameter(C2);
IntRes2d_Domain DomainC2NumInter;
TColStd_Array1OfReal Tab2(1,NbInterC2+1);
ThePCurveTool::Intervals(C2,Tab2);
for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) {
ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False;
else {
if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
if(ParamSup > D2LastParam) ParamSup = D2LastParam;
if((ParamSup - ParamInf) > RealEpsilon()) {
DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
ThePCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
InternalPerform(Elips1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
}
}
}
}
else {
InternalPerform(Elips1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//--------------------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::Perform (const gp_Hypr2d& Hyper1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol) {
this->ResetFields();
Standard_Integer NbInterC2 = ThePCurveTool::NbIntervals(C2);
if(NbInterC2 > 1) {
Standard_Real ParamInf,ParamSup;
Standard_Real D2FirstParam = D2.FirstParameter();
Standard_Real D2LastParam = D2.LastParameter();
Standard_Boolean Ok = Standard_True;
param1inf = (D1.HasFirstPoint()) ? D1.FirstParameter() : -Precision::Infinite();
param1sup = (D1.HasLastPoint()) ? D1.LastParameter() : Precision::Infinite();
param2inf = ThePCurveTool::FirstParameter(C2);
param2sup = ThePCurveTool::LastParameter(C2);
IntRes2d_Domain DomainC2NumInter;
TColStd_Array1OfReal Tab2(1,NbInterC2+1);
ThePCurveTool::Intervals(C2,Tab2);
for(Standard_Integer NumInterC2=1; Ok && (NumInterC2<=NbInterC2);NumInterC2++) {
ThePCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
if((ParamInf > D2LastParam)||(ParamSup < D2FirstParam)) Ok=Standard_False;
else {
if(ParamInf < D2FirstParam) ParamInf = D2FirstParam;
if(ParamSup > D2LastParam) ParamSup = D2LastParam;
if((ParamSup - ParamInf) > RealEpsilon()) {
DomainC2NumInter.SetValues(ThePCurveTool::Value(C2,ParamInf),
ParamInf,
D2.FirstTolerance(),
ThePCurveTool::Value(C2,ParamSup),
ParamSup,
D2.LastTolerance());
InternalPerform(Hyper1,D1,C2,DomainC2NumInter,TolConf,Tol,Standard_True);
}
}
}
}
else {
InternalPerform(Hyper1,D1,C2,D2,TolConf,Tol,Standard_False);
}
}
//----------------------------------------------------------------------
//-- InternalPerform
//-- Suppose des Courbes Lin...Hypr
//-- Si Composite == True
//-- Les Resultats sont Ajoutes
//-- Sinon
//-- Les Resultats sont Copies
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Lin2d& Lin1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ2 = ThePCurveTool::TheType(C2);
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Lin1,D1,ThePCurveTool::Line(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Lin1,D1,ThePCurveTool::Circle(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Lin1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Lin1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Lin1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(Lin1,D1,C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
}
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Circ2d& Circ1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ2 = ThePCurveTool::TheType(C2);
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Line(C2),D2,Circ1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Circ1,D1,ThePCurveTool::Circle(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Circ1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Circ1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Circ1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(Circ1,D1,C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
}
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Elips2d& Elips1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ2 = ThePCurveTool::TheType(C2);
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Line(C2),D2,Elips1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Elips1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Elips1,D1,ThePCurveTool::Ellipse(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Elips1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Elips1,D1,ThePCurveTool::Hyperbola(C2),D2,
TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(Elips1,D1,C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
}
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Parab2d& Parab1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ2 = ThePCurveTool::TheType(C2);
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Line(C2),D2,Parab1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Parab1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Ellipse(C2),D2,Parab1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Parab1,D1,ThePCurveTool::Parabola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Parab1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(Parab1,D1,C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
}
//----------------------------------------------------------------------
void IntCurve_UserIntConicCurveGen::InternalPerform (const gp_Hypr2d& Hyper1,
const IntRes2d_Domain& D1,
const ThePCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Boolean Composite) {
GeomAbs_CurveType typ2 = ThePCurveTool::TheType(C2);
switch (typ2) {
case GeomAbs_Line:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Line(C2),D2,Hyper1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Circle:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Circle(C2),D2,Hyper1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Ellipse:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Ellipse(C2),D2,Hyper1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Parabola:
{
intconiconi.SetReversedParameters(Standard_True);
intconiconi.Perform(ThePCurveTool::Parabola(C2),D2,Hyper1,D1,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_Hyperbola:
{
intconiconi.SetReversedParameters(Standard_False);
intconiconi.Perform(Hyper1,D1,ThePCurveTool::Hyperbola(C2),D2,TolConf,Tol);
if(Composite) { this->Append(intconiconi,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconiconi); }
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
{
intconicurv.SetReversedParameters(Standard_False);
intconicurv.Perform(Hyper1,D1,
C2,D2,TolConf,Tol);
if(Composite) { this->Append(intconicurv,
param1inf,
param1sup,
param2inf,
param2sup); }
else { this->SetValues(intconicurv); }
}
break;
}
}
//--------------------------------------------------------------------------------