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:
194
src/Geom2dGcc/Geom2dGcc.cdl
Executable file
194
src/Geom2dGcc/Geom2dGcc.cdl
Executable file
@@ -0,0 +1,194 @@
|
||||
-- File: Geom2dGcc.cdl
|
||||
-- Created: Mon Jun 29 14:55:26 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
package Geom2dGcc
|
||||
|
||||
--- Purpose: The Geom2dGcc package describes qualified 2D
|
||||
-- curves used in the construction of constrained geometric
|
||||
-- objects by an algorithm provided by the Geom2dGcc package.
|
||||
-- A qualified 2D curve is a curve with a qualifier which
|
||||
-- specifies whether the solution of a construction
|
||||
-- algorithm using the qualified curve (as an argument):
|
||||
-- - encloses the curve, or
|
||||
-- - is enclosed by the curve, or
|
||||
-- - is built so that both the curve and this solution are external to one another, or
|
||||
-- - is undefined (all solutions apply).
|
||||
-- These package methods provide simpler functions to construct a qualified curve.
|
||||
-- Note: the interior of a curve is defined as the left-hand
|
||||
-- side of the curve in relation to its orientation.
|
||||
|
||||
|
||||
uses GccEnt,
|
||||
GccGeo,
|
||||
GccAna,
|
||||
GccIter,
|
||||
StdFail,
|
||||
Geom2dInt,
|
||||
Geom2d,
|
||||
TColStd,
|
||||
TopAbs,
|
||||
Standard,
|
||||
Geom2dAdaptor,
|
||||
Extrema,
|
||||
Adaptor3d,
|
||||
Adaptor2d,
|
||||
TColgp,
|
||||
gp
|
||||
|
||||
is
|
||||
|
||||
class CurveTool;
|
||||
|
||||
class QualifiedCurve;
|
||||
|
||||
class Circ2d3Tan;
|
||||
|
||||
class Circ2d2TanRad;
|
||||
|
||||
class Circ2d2TanOn;
|
||||
|
||||
class Circ2dTanOnRad;
|
||||
|
||||
class Circ2dTanCen;
|
||||
|
||||
class Lin2d2Tan;
|
||||
|
||||
class Lin2dTanObl;
|
||||
|
||||
class MyQCurve instantiates QualifiedCurv from GccEnt
|
||||
(Curve from Geom2dAdaptor);
|
||||
|
||||
class MyCurveTool instantiates CurvePGTool from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc ,
|
||||
OffsetCurve from Adaptor3d);
|
||||
|
||||
class MyCirc2d2TanOn instantiates Circ2d2TanOn from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt);
|
||||
|
||||
class MyCirc2d2TanRad instantiates Circ2d2TanRad from GccGeo
|
||||
(Curve from Geom2dAdaptor ,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt);
|
||||
|
||||
class MyCirc2dTanOnRad instantiates Circ2dTanOnRad from GccGeo
|
||||
(Curve from Geom2dAdaptor ,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt);
|
||||
|
||||
class MyC2d3Tan instantiates Circ2d3Tan from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc);
|
||||
|
||||
class MyCirc2dTanCen instantiates Circ2dTanCen from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
ExtPC2d from Extrema,
|
||||
MyQCurve from Geom2dGcc);
|
||||
|
||||
class MyC2d2TanOn instantiates Circ2d2TanOn from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc);
|
||||
|
||||
class MyL2dTanObl instantiates Lin2dTanObl from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc);
|
||||
|
||||
class MyL2d2Tan instantiates Lin2d2Tan from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
MyQCurve from Geom2dGcc);
|
||||
|
||||
Unqualified(Obj : Curve from Geom2dAdaptor) returns QualifiedCurve;
|
||||
---Purpose: Constructs such a qualified curve that the relative
|
||||
-- position of the solution computed by a construction
|
||||
-- algorithm using the qualified curve to the circle or line is
|
||||
-- not qualified, i.e. all solutions apply.
|
||||
-- Warning
|
||||
-- Obj is an adapted curve, i.e. an object which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The adapted curve is created in the following way:
|
||||
-- Handle(Geom2d_Curve) mycurve = ...
|
||||
-- ;
|
||||
-- Geom2dAdaptor_Curve Obj ( mycurve )
|
||||
-- ;
|
||||
-- The qualified curve is then constructed with this object:
|
||||
-- Geom2dGcc_QualifiedCurve
|
||||
-- myQCurve = Geom2dGcc::Unqualified(Obj);
|
||||
|
||||
Enclosing(Obj : Curve from Geom2dAdaptor) returns QualifiedCurve;
|
||||
---Purpose: Constructs such a qualified curve that the solution
|
||||
-- computed by a construction algorithm using the qualified
|
||||
-- curve encloses the curve.
|
||||
-- Warning
|
||||
-- Obj is an adapted curve, i.e. an object which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The adapted curve is created in the following way:
|
||||
-- Handle(Geom2d_Curve) mycurve = ...
|
||||
-- ;
|
||||
-- Geom2dAdaptor_Curve Obj ( mycurve )
|
||||
-- ;
|
||||
-- The qualified curve is then constructed with this object:
|
||||
-- Geom2dGcc_QualifiedCurve
|
||||
-- myQCurve = Geom2dGcc::Enclosing(Obj);
|
||||
|
||||
Enclosed(Obj : Curve from Geom2dAdaptor) returns QualifiedCurve;
|
||||
---Purpose: Constructs such a qualified curve that the solution
|
||||
-- computed by a construction algorithm using the qualified
|
||||
-- curve is enclosed by the curve.
|
||||
-- Warning
|
||||
-- Obj is an adapted curve, i.e. an object which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The adapted curve is created in the following way:
|
||||
-- Handle(Geom2d_Curve) mycurve = ...
|
||||
-- ;
|
||||
-- Geom2dAdaptor_Curve Obj ( mycurve )
|
||||
-- ;
|
||||
-- The qualified curve is then constructed with this object:
|
||||
-- Geom2dGcc_QualifiedCurve
|
||||
-- myQCurve = Geom2dGcc::Enclosed(Obj);
|
||||
|
||||
Outside(Obj : Curve from Geom2dAdaptor) returns QualifiedCurve;
|
||||
---Purpose: Constructs such a qualified curve that the solution
|
||||
-- computed by a construction algorithm using the qualified
|
||||
-- curve and the curve are external to one another.
|
||||
-- Warning
|
||||
-- Obj is an adapted curve, i.e. an object which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The adapted curve is created in the following way:
|
||||
-- Handle(Geom2d_Curve) mycurve = ...
|
||||
-- ;
|
||||
-- Geom2dAdaptor_Curve Obj ( mycurve )
|
||||
-- ;
|
||||
-- The qualified curve is then constructed with this object:
|
||||
-- Geom2dGcc_QualifiedCurve
|
||||
-- myQCurve = Geom2dGcc::Outside(Obj);
|
||||
|
||||
end Geom2dGcc;
|
29
src/Geom2dGcc/Geom2dGcc.cxx
Executable file
29
src/Geom2dGcc/Geom2dGcc.cxx
Executable file
@@ -0,0 +1,29 @@
|
||||
// File Geom2dGcc.cxx, REG 13/08/91
|
||||
|
||||
//=========================================================================
|
||||
// Methodes de package permettant de qualifier les objets. +
|
||||
// +
|
||||
//=========================================================================
|
||||
|
||||
#include <Geom2dGcc.ixx>
|
||||
|
||||
Geom2dGcc_QualifiedCurve
|
||||
Geom2dGcc::Unqualified(const Geom2dAdaptor_Curve& Curve) {
|
||||
return Geom2dGcc_QualifiedCurve(Curve,GccEnt_unqualified);
|
||||
}
|
||||
|
||||
Geom2dGcc_QualifiedCurve
|
||||
Geom2dGcc::Enclosing(const Geom2dAdaptor_Curve& Curve) {
|
||||
return Geom2dGcc_QualifiedCurve(Curve,GccEnt_enclosing);
|
||||
}
|
||||
|
||||
Geom2dGcc_QualifiedCurve
|
||||
Geom2dGcc::Enclosed(const Geom2dAdaptor_Curve& Curve) {
|
||||
return Geom2dGcc_QualifiedCurve(Curve,GccEnt_enclosed);
|
||||
}
|
||||
|
||||
Geom2dGcc_QualifiedCurve
|
||||
Geom2dGcc::Outside(const Geom2dAdaptor_Curve& Curve) {
|
||||
return Geom2dGcc_QualifiedCurve(Curve,GccEnt_outside);
|
||||
}
|
||||
|
281
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cdl
Executable file
281
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cdl
Executable file
@@ -0,0 +1,281 @@
|
||||
-- File: Circ2d2TanOn.cdl
|
||||
-- Created: Tue Oct 20 16:23:45 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Circ2d2TanOn from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d circles TANgent to 2 entities and
|
||||
-- having the center ON a curve.
|
||||
-- The order of the tangency argument is always
|
||||
-- QualifiedCirc, QualifiedLin, QualifiedCurv, Pnt2d.
|
||||
-- the arguments are :
|
||||
-- - The two tangency arguments.
|
||||
-- - The center line.
|
||||
-- - The parameter for each tangency argument which
|
||||
-- is a curve.
|
||||
-- - The tolerance.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Curve from Geom2dAdaptor,
|
||||
QualifiedCurve from Geom2dGcc,
|
||||
Integer from Standard,
|
||||
Boolean from Standard,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Pnt2d from gp,
|
||||
Point from Geom2d,
|
||||
Circ2d from gp,
|
||||
Circ2d2TanOn from GccAna,
|
||||
MyCirc2d2TanOn from Geom2dGcc,
|
||||
MyC2d2TanOn from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises NotDone from StdFail,
|
||||
BadQualifier from GccEnt,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
OnCurve : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
Param2 : Real from Standard ;
|
||||
ParamOn : Real from Standard )
|
||||
returns Circ2d2TanOn from Geom2dGcc ;
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two curves and
|
||||
-- having the center ON a 2d curve.
|
||||
-- Param1 is the initial guess on the first curve QualifiedCurv.
|
||||
-- Param1 is the initial guess on the second curve QualifiedCurv.
|
||||
-- ParamOn is the initial guess on the center curve OnCurv.
|
||||
-- Tolerance is used for the limit cases.
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Point : Point from Geom2d ;
|
||||
OnCurve : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
ParamOn : Real from Standard )
|
||||
returns Circ2d2TanOn from Geom2dGcc ;
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to one curve and one point and
|
||||
-- having the center ON a 2d curve.
|
||||
-- Param1 is the initial guess on the first curve QualifiedCurv.
|
||||
-- ParamOn is the initial guess on the center curve OnCurv.
|
||||
-- Tolerance is used for the limit cases.
|
||||
|
||||
Create(Point1 : Point from Geom2d ;
|
||||
Point2 : Point from Geom2d ;
|
||||
OnCurve : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2d2TanOn from Geom2dGcc ;
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two points and
|
||||
-- having the center ON a 2d curve.
|
||||
-- Tolerance is used for the limit cases.
|
||||
|
||||
-- -- ....................................................................
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : Circ2d2TanOn from GccAna)
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2d2TanOn from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail
|
||||
-- (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has
|
||||
-- reached its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: This method returns the number of solutions.
|
||||
-- NotDone is raised if the algorithm failed.
|
||||
|
||||
ThisSolution(me ; Index : Integer) returns Circ2d
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be carefull: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to theses outside the context
|
||||
-- of the algorithm-object.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than or equal
|
||||
-- to zero or greater than the number of solutions
|
||||
-- computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt ;
|
||||
Qualif2 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It returns the informations about the qualifiers of
|
||||
-- the tangency
|
||||
-- arguments concerning the solution number Index.
|
||||
-- It returns the real qualifiers (the qualifiers given to the
|
||||
-- constructor method in case of enclosed, enclosing and outside
|
||||
-- and the qualifiers computedin case of unqualified).
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the second argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
|
||||
CenterOn3 (me ;
|
||||
Index : Integer from Standard;
|
||||
ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns the center PntSol of the solution of index Index
|
||||
-- computed by this algorithm.
|
||||
-- ParArg is the parameter of the point PntSol on the third argument.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
--- Purpose: Returns true if the solution of index Index and,
|
||||
-- respectively, the first or second argument of this
|
||||
-- algorithm are the same (i.e. there are 2 identical circles).
|
||||
-- If Rarg is the radius of the first or second argument,
|
||||
-- Rsol is the radius of the solution and dist is the
|
||||
-- distance between the two centers, we consider the two
|
||||
-- circles to be identical if |Rarg - Rsol| and dist
|
||||
-- are less than or equal to the tolerance criterion given at
|
||||
-- the time of construction of this algorithm.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
IsTheSame2(me ;
|
||||
Index : Integer ) returns Boolean
|
||||
raises NotDone
|
||||
is static;
|
||||
--- Purpose: Returns true if the solution of index Index and,
|
||||
-- respectively, the first or second argument of this
|
||||
-- algorithm are the same (i.e. there are 2 identical circles).
|
||||
-- If Rarg is the radius of the first or second argument,
|
||||
-- Rsol is the radius of the solution and dist is the
|
||||
-- distance between the two centers, we consider the two
|
||||
-- circles to be identical if |Rarg - Rsol| and dist
|
||||
-- are less than or equal to the tolerance criterion given at
|
||||
-- the time of construction of this algorithm.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: Returns True if the algorithm succeeded.
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
-- TheSolution.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: Returns the number of solutions.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the first argument.
|
||||
|
||||
qualifier2 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the second argument.
|
||||
|
||||
TheSame1 : Array1OfInteger from TColStd;
|
||||
---Purpose: Returns 1 if the solution and the first argument are the same (2 circles).
|
||||
-- if R1 is the radius of the first argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R1+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
TheSame2 : Array1OfInteger from TColStd;
|
||||
---Purpose: 1 if the solution and the second argument are the same (2 circles).
|
||||
-- if R2 is the radius of the second argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R2+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the first argument.
|
||||
|
||||
pnttg2sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the second argument.
|
||||
|
||||
pntcen : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The center point of the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of pnttg1sol on the solution.
|
||||
-- pnttg1sol is the tangency point between the solution and the first argument.
|
||||
|
||||
par2sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of pnttg2sol on the solution.
|
||||
-- pnttg2sol is the tangency point between the solution and the second argument.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of pnttg1sol on the first argument.
|
||||
-- pnttg1sol is the tangency point between the solution and the first argument.
|
||||
|
||||
pararg2 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of pnttg2sol on the second argument.
|
||||
-- pnttg2sol is the tangency point between the solution and the second argument.
|
||||
|
||||
parcen3 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the center point of the solution on the third argument.
|
||||
|
||||
Invert : Boolean from Standard;
|
||||
|
||||
-- CircAna : Circ2d2TanOn from GccAna;
|
||||
-- CircGeo : MyCirc2d2TanOn from Geom2dGcc;
|
||||
-- CircIter : MyC2d2TanOn from Geom2dGcc;
|
||||
-- TypeAna : Boolean;
|
||||
|
||||
end Circ2d2TanOn;
|
719
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cxx
Executable file
719
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cxx
Executable file
@@ -0,0 +1,719 @@
|
||||
// File: Geom2dGcc_Circ2d2TanOn.cxx
|
||||
// Created: Wed Oct 21 14:49:42 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
|
||||
#include <Geom2dGcc_Circ2d2TanOn.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_MyCirc2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_MyC2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <GccEnt_QualifiedLin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Geom2dGcc_Circ2d2TanOn::
|
||||
Geom2dGcc_Circ2d2TanOn (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2 ,
|
||||
const Geom2dAdaptor_Curve& OnCurve ,
|
||||
const Standard_Real Tolerance ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real Param2 ,
|
||||
const Standard_Real ParamOn ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
qualifier2(1,8),
|
||||
TheSame1(1,8) ,
|
||||
TheSame2(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
pnttg2sol(1,8),
|
||||
pntcen(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
par2sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pararg2(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
GeomAbs_CurveType Type3 = OnCurve.GetType();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
Handle(Geom2d_Curve) Con = OnCurve.Curve();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
|
||||
(Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) {
|
||||
if (Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1 =
|
||||
GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier()),
|
||||
CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier()),
|
||||
LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1 =
|
||||
GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier()),
|
||||
Ql1,CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
Invert = Standard_True;
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier()),
|
||||
Ql1,LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
Invert = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Ql1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Ql1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1 =
|
||||
GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2 =
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc1,Qc2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2 =
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc1,Ql2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1 =
|
||||
GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2 =
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc2,Ql1,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
Invert = Standard_True;
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2 =
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Ql1,Ql2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccIter. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
if ((Type3 == GeomAbs_Circle || Type3 == GeomAbs_Line)) {
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Qc2,CCon->Circ2d(),
|
||||
Param1,Param2,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Qc2,LLon->Lin2d(),
|
||||
Param1,Param2,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
}
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Qc2,OnCurve,
|
||||
Param1,Param2,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d2TanOn::
|
||||
Geom2dGcc_Circ2d2TanOn (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Handle(Geom2d_Point)& Point ,
|
||||
const Geom2dAdaptor_Curve& OnCurve ,
|
||||
const Standard_Real Tolerance ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real ParamOn ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
qualifier2(1,8),
|
||||
TheSame1(1,8) ,
|
||||
TheSame2(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
pnttg2sol(1,8),
|
||||
pntcen(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
par2sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pararg2(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type3 = OnCurve.GetType();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) Con = OnCurve.Curve();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) {
|
||||
if (Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle) {
|
||||
gp_Pnt2d pnt(Point->Pnt2d());
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,pnt,CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else if (Type3 == GeomAbs_Line) {
|
||||
Handle(Geom2d_Line) CCon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Qc1,pnt,CCon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LLL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Ql1,pnt,CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else if (Type3 == GeomAbs_Line) {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(Ql1,pnt,LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc1,Point->Pnt2d(),OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LLL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Ql1,Point->Pnt2d(),OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccIter. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
if ((Type3 == GeomAbs_Circle || Type3 == GeomAbs_Line)) {
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Point->Pnt2d(),CCon->Circ2d(),
|
||||
Param1,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Point->Pnt2d(),LLon->Lin2d(),
|
||||
Param1,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyC2d2TanOn Circ(Qc1,Point->Pnt2d(),OnCurve,
|
||||
Param1,ParamOn,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d2TanOn::
|
||||
Geom2dGcc_Circ2d2TanOn (const Handle(Geom2d_Point)& Point1 ,
|
||||
const Handle(Geom2d_Point)& Point2 ,
|
||||
const Geom2dAdaptor_Curve& OnCurve ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
qualifier2(1,8),
|
||||
TheSame1(1,8) ,
|
||||
TheSame2(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
pnttg2sol(1,8),
|
||||
pntcen(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
par2sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pararg2(1,8) ,
|
||||
parcen3(1,8)
|
||||
|
||||
{
|
||||
GeomAbs_CurveType Type3 = OnCurve.GetType();
|
||||
Handle(Geom2d_Curve) Con = OnCurve.Curve();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle) {
|
||||
gp_Pnt2d pnt1(Point1->Pnt2d());
|
||||
gp_Pnt2d pnt2(Point2->Pnt2d());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(pnt1,pnt2,CCon->Circ2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
GccAna_Circ2d2TanOn CircAna(pnt1,pnt2,LLon->Lin2d(),Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Point1->Pnt2d(),Point2->Pnt2d(),
|
||||
OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::Results(const GccAna_Circ2d2TanOn& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
if (Circ.IsTheSame2(j)) { TheSame2(j) = 1; }
|
||||
else {TheSame2(j) = 0; }
|
||||
Circ.WhichQualifier(j,qualifier1(j),qualifier2(j));
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
Circ.CenterOn3(j,parcen3(j),pntcen(j));
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::Results(const Geom2dGcc_MyCirc2d2TanOn& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
if (Circ.IsTheSame2(j)) { TheSame2(j) = 1; }
|
||||
else {TheSame2(j) = 0; }
|
||||
Circ.WhichQualifier(j,qualifier1(j),qualifier2(j));
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
Circ.CenterOn3(j,parcen3(j),pntcen(j));
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanOn::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2d2TanOn::
|
||||
NbSolutions () const
|
||||
{
|
||||
return NbrSol;
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2d2TanOn::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::
|
||||
WhichQualifier (const Standard_Integer Index ,
|
||||
GccEnt_Position& Qualif1 ,
|
||||
GccEnt_Position& Qualif2) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (Invert) {
|
||||
Qualif1 = qualifier2(Index);
|
||||
Qualif2 = qualifier1(Index);
|
||||
}
|
||||
else {
|
||||
Qualif1 = qualifier1(Index);
|
||||
Qualif2 = qualifier2(Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (Invert) {
|
||||
if (TheSame2(Index) == 0) {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::
|
||||
Tangency2 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (!Invert) {
|
||||
if (TheSame2(Index) == 0) {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::
|
||||
CenterOn3 (const Standard_Integer Index,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParArg = parcen3(Index);
|
||||
PntSol = pntcen(Index);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanOn::
|
||||
IsTheSame1 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (Invert) {
|
||||
if (TheSame2(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanOn::
|
||||
IsTheSame2 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (!Invert) {
|
||||
if (TheSame2(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
277
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRad.cdl
Executable file
277
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRad.cdl
Executable file
@@ -0,0 +1,277 @@
|
||||
-- File: C2d2TanRad.cdl
|
||||
-- Created: Tue Oct 20 16:23:30 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Circ2d2TanRad from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d circles tangent to one curve and a
|
||||
-- point/line/circle/curv and with a given radius.
|
||||
-- For each construction methods arguments are:
|
||||
-- - Two Qualified elements for tangency constrains.
|
||||
-- (for example EnclosedCirc if we want the
|
||||
-- solution inside the argument EnclosedCirc).
|
||||
-- - Two Reals. One (Radius) for the radius and the
|
||||
-- other (Tolerance) for the tolerance.
|
||||
-- Tolerance is only used for the limit cases.
|
||||
-- For example :
|
||||
-- We want to create a circle inside a circle C1 and
|
||||
-- inside a curve Cu2 with a radius Radius and a
|
||||
-- tolerance Tolerance.
|
||||
-- If we did not used Tolerance it is impossible to
|
||||
-- find a solution in the the following case : Cu2 is
|
||||
-- inside C1 and there is no intersection point
|
||||
-- between the two elements.
|
||||
-- with Tolerance we will give a solution if the
|
||||
-- lowest distance between C1 and Cu2 is lower than or
|
||||
-- equal Tolerance.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses QualifiedCurve from Geom2dGcc,
|
||||
Integer from Standard,
|
||||
Boolean from Standard,
|
||||
Pnt2d from gp,
|
||||
Point from Geom2d,
|
||||
Circ2d from gp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Circ2d2TanRad from GccAna,
|
||||
MyCirc2d2TanRad from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail,
|
||||
NegativeValue from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
Radius : Real from Standard ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2d2TanRad from Geom2dGcc
|
||||
raises BadQualifier, NegativeValue;
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Point : Point from Geom2d ;
|
||||
Radius : Real from Standard ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2d2TanRad from Geom2dGcc
|
||||
raises BadQualifier, NegativeValue;
|
||||
|
||||
Create(Point1 : Point from Geom2d ;
|
||||
Point2 : Point from Geom2d ;
|
||||
Radius : Real from Standard ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2d2TanRad from Geom2dGcc
|
||||
raises NegativeValue;
|
||||
|
||||
---Purpose: These constructors create one or more 2D circles of radius Radius either
|
||||
-- - tangential to the 2 curves Qualified1 and Qualified2, or
|
||||
-- - tangential to the curve Qualified1 and passing through the point Point, or
|
||||
-- - passing through two points Point1 and Point2.
|
||||
-- Tolerance is a tolerance criterion used by the algorithm
|
||||
-- to find a solution when, mathematically, the problem
|
||||
-- posed does not have a solution, but where there is
|
||||
-- numeric uncertainty attached to the arguments.
|
||||
-- For example, take two circles C1 and C2, such that C2
|
||||
-- is inside C1, and almost tangential to C1. There is, in
|
||||
-- fact, no point of intersection between C1 and C2. You
|
||||
-- now want to find a circle of radius R (smaller than the
|
||||
-- radius of C2), which is tangential to C1 and C2, and
|
||||
-- inside these two circles: a pure mathematical resolution
|
||||
-- will not find a solution. This is where the tolerance
|
||||
-- criterion is used: the algorithm considers that C1 and
|
||||
-- C2 are tangential if the shortest distance between these
|
||||
-- two circles is less than or equal to Tolerance. Thus, a
|
||||
-- solution is found by the algorithm.
|
||||
-- Exceptions
|
||||
-- GccEnt_BadQualifier if a qualifier is inconsistent with
|
||||
-- the argument it qualifies (for example, enclosing for a line).
|
||||
-- Standard_NegativeValue if Radius is negative.
|
||||
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : Circ2d2TanRad from GccAna)
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2d2TanRad from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: This method returns True if the algorithm succeeded.
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has reached its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: This method returns the number of solutions.
|
||||
-- NotDone is raised if the algorithm failed.
|
||||
-- Exceptions
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be carefull: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to theses outside the context of the algorithm-object.
|
||||
-- Warning
|
||||
-- This indexing simply provides a means of consulting the
|
||||
-- solutions. The index values are not associated with
|
||||
-- these solutions outside the context of the algorithm object.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt ;
|
||||
Qualif2 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the qualifiers Qualif1 and Qualif2 of the
|
||||
-- tangency arguments for the solution of index Index
|
||||
-- computed by this algorithm.
|
||||
-- The returned qualifiers are:
|
||||
-- - those specified at the start of construction when the
|
||||
-- solutions are defined as enclosed, enclosing or
|
||||
-- outside with respect to the arguments, or
|
||||
-- - those computed during construction (i.e. enclosed,
|
||||
-- enclosing or outside) when the solutions are defined
|
||||
-- as unqualified with respect to the arguments, or
|
||||
-- - GccEnt_noqualifier if the tangency argument is a point, or
|
||||
-- - GccEnt_unqualified in certain limit cases where it
|
||||
-- is impossible to qualify the solution as enclosed, enclosing or outside.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result number Index and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
-- OutOfRange is raised if Index is greater than the number of solutions.
|
||||
-- notDone is raised if the construction algorithm did not succeed.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result number Index and the second argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
-- OutOfRange is raised if Index is greater than the number of solutions.
|
||||
-- notDone is raised if the construction algorithm did not succeed.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns true if the solution of index Index and,
|
||||
-- respectively, the first or second argument of this
|
||||
-- algorithm are the same (i.e. there are 2 identical circles).
|
||||
-- If Rarg is the radius of the first or second argument,
|
||||
-- Rsol is the radius of the solution and dist is the
|
||||
-- distance between the two centers, we consider the two
|
||||
-- circles to be identical if |Rarg - Rsol| and dist
|
||||
-- are less than or equal to the tolerance criterion given at
|
||||
-- the time of construction of this algorithm.
|
||||
-- OutOfRange is raised if Index is greater than the number of solutions.
|
||||
-- notDone is raised if the construction algorithm did not succeed.
|
||||
|
||||
IsTheSame2(me ;
|
||||
Index : Integer from Standard ) returns Boolean from Standard
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns true if the solution of index Index and,
|
||||
-- respectively, the first or second argument of this
|
||||
-- algorithm are the same (i.e. there are 2 identical circles).
|
||||
-- If Rarg is the radius of the first or second argument,
|
||||
-- Rsol is the radius of the solution and dist is the
|
||||
-- distance between the two centers, we consider the two
|
||||
-- circles to be identical if |Rarg - Rsol| and dist
|
||||
-- are less than or equal to the tolerance criterion given at
|
||||
-- the time of construction of this algorithm.
|
||||
-- OutOfRange is raised if Index is greater than the number of solutions.
|
||||
-- notDone is raised if the construction algorithm did not succeed.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: Returns True if the algorithm succeeded.
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
---Purpose: TheSolution.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: Returns the number of solutions.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the first argument.
|
||||
|
||||
qualifier2 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the second argument.
|
||||
|
||||
TheSame1 : Array1OfInteger from TColStd;
|
||||
---Purpose: Returns 1 if the solution and the first argument are the same (2 circles).
|
||||
-- if R1 is the radius of the first argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R1+dist-Rsol is less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
TheSame2 : Array1OfInteger from TColStd;
|
||||
---Purpose: 1 if the solution and the second argument are the same (2 circles).
|
||||
-- if R2 is the radius of the second argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R2+dist-Rsol is less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the first argument on the solution.
|
||||
|
||||
pnttg2sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the second argument on the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the first argument on the solution.
|
||||
|
||||
par2sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the second argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the first argument on the first argument.
|
||||
|
||||
pararg2 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the second argument on the second argument.
|
||||
|
||||
Invert : Boolean from Standard;
|
||||
|
||||
-- CircAna : Circ2d2TanRad from GccAna;
|
||||
-- CircGeo : MyrCirc2d2TanRad from Geom2dGcc;
|
||||
-- TypeAna : Boolean;
|
||||
|
||||
end Circ2d2TanRad;
|
||||
|
500
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRad.cxx
Executable file
500
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRad.cxx
Executable file
@@ -0,0 +1,500 @@
|
||||
// File: Geom2dGcc_Circ2d2TanRad.cxx
|
||||
// Created: Wed Oct 21 14:49:57 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Circ2d2TanRad.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2d2TanRad.hxx>
|
||||
#include <Geom2dGcc_MyCirc2d2TanRad.hxx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <GccEnt_QualifiedLin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_NegativeValue.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
|
||||
// circulaire tangent a deux cercles et de rayon donne
|
||||
//====================================================
|
||||
//========================================================================
|
||||
// On initialise WellDone a false. +
|
||||
// On recupere le cercle C1 et le cercle C2. +
|
||||
// On sort en erreur dans les cas ou la construction est impossible. +
|
||||
// On distingue les cas limites pour les triater separement. +
|
||||
// On fait la parallele a C1 dans le bon sens. +
|
||||
// On fait la parallele a C2 dans le bon sens. +
|
||||
// On intersecte les paralleles ==> point de centre de la solution. +
|
||||
// On cree la solution qu on ajoute aux solutions deja trouvees. +
|
||||
// On remplit les champs. +
|
||||
//========================================================================
|
||||
|
||||
Geom2dGcc_Circ2d2TanRad::
|
||||
Geom2dGcc_Circ2d2TanRad (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2 ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,16) ,
|
||||
qualifier1(1,16),
|
||||
qualifier2(1,16),
|
||||
TheSame1(1,16) ,
|
||||
TheSame2(1,16) ,
|
||||
pnttg1sol(1,16),
|
||||
pnttg2sol(1,16),
|
||||
par1sol(1,16) ,
|
||||
par2sol(1,16) ,
|
||||
pararg1(1,16) ,
|
||||
pararg2(1,16)
|
||||
{
|
||||
if (Radius < 0.) { Standard_NegativeValue::Raise(); }
|
||||
else {
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
|
||||
(Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1 = GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccAna_Circ2d2TanRad CircAna(Qc1,
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier()),
|
||||
Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
if (!Qualified2.IsEnclosing()) {
|
||||
GccAna_Circ2d2TanRad CircAna(Qc1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
WellDone = Standard_False;
|
||||
GccEnt_BadQualifier::Raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
if (Qualified1.IsEnclosing()) {
|
||||
WellDone = Standard_False;
|
||||
GccEnt_BadQualifier::Raise();
|
||||
}
|
||||
else {
|
||||
GccEnt_QualifiedLin Ql1 = GccEnt_QualifiedLin(l1,
|
||||
Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
Invert = Standard_True;
|
||||
GccAna_Circ2d2TanRad CircAna(GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier()),
|
||||
Ql1,Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
if (!Qualified2.IsEnclosing()) {
|
||||
GccAna_Circ2d2TanRad CircAna(Ql1,
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier()),
|
||||
Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
WellDone = Standard_False;
|
||||
GccEnt_BadQualifier::Raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
else {
|
||||
if (Type1 == GeomAbs_Line) {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
if (Qualified1.IsEnclosing()) {
|
||||
WellDone = Standard_False;
|
||||
GccEnt_BadQualifier::Raise();
|
||||
}
|
||||
else {
|
||||
GccEnt_QualifiedLin Ql1 = GccEnt_QualifiedLin(l1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
else if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1 = GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
else if (Type2 == GeomAbs_Line) {
|
||||
Invert = Standard_True;
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
if (Qualified2.IsEnclosing()) {
|
||||
WellDone = Standard_False;
|
||||
GccEnt_BadQualifier::Raise();
|
||||
}
|
||||
else {
|
||||
GccEnt_QualifiedLin Ql2 = GccEnt_QualifiedLin(l2,
|
||||
Qualified2.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql2,Qc1,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
else if (Type2 == GeomAbs_Circle) {
|
||||
Invert = Standard_True;
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2 = GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc2,Qc1,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d2TanRad::
|
||||
Geom2dGcc_Circ2d2TanRad (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Handle(Geom2d_Point)& Point ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
qualifier2(1,8),
|
||||
TheSame1(1,8) ,
|
||||
TheSame2(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
pnttg2sol(1,8),
|
||||
par1sol(1,8) ,
|
||||
par2sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pararg2(1,8)
|
||||
{
|
||||
if (Radius < 0.) { Standard_NegativeValue::Raise(); }
|
||||
else {
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
GccAna_Circ2d2TanRad CircAna(Qc1,Point->Pnt2d(),Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LLL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
|
||||
GccAna_Circ2d2TanRad CircAna(Ql1,Point->Pnt2d(),Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Point->Pnt2d(),Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircGeo.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d2TanRad::
|
||||
Geom2dGcc_Circ2d2TanRad (const Handle(Geom2d_Point)& Point1 ,
|
||||
const Handle(Geom2d_Point)& Point2 ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
qualifier2(1,2),
|
||||
TheSame1(1,2) ,
|
||||
TheSame2(1,2) ,
|
||||
pnttg1sol(1,2),
|
||||
pnttg2sol(1,2),
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2)
|
||||
{
|
||||
if (Radius < 0.) { Standard_NegativeValue::Raise(); }
|
||||
else {
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
Invert = Standard_False;
|
||||
NbrSol = 0;
|
||||
GccAna_Circ2d2TanRad CircAna(Point1->Pnt2d(),Point2->Pnt2d(),
|
||||
Radius,Tolerance);
|
||||
WellDone = CircAna.IsDone();
|
||||
NbrSol = CircAna.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
CircAna.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(CircAna);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::Results(const GccAna_Circ2d2TanRad& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
if (Circ.IsTheSame2(j)) { TheSame2(j) = 1; }
|
||||
else {TheSame2(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::Results(const Geom2dGcc_MyCirc2d2TanRad& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
if (Circ.IsTheSame2(j)) { TheSame2(j) = 1; }
|
||||
else {TheSame2(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanRad::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2d2TanRad::
|
||||
NbSolutions () const
|
||||
{
|
||||
return NbrSol;
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2d2TanRad::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::
|
||||
WhichQualifier (const Standard_Integer Index ,
|
||||
GccEnt_Position& Qualif1 ,
|
||||
GccEnt_Position& Qualif2) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (Invert) {
|
||||
Qualif1 = qualifier2(Index);
|
||||
Qualif2 = qualifier1(Index);
|
||||
}
|
||||
else {
|
||||
Qualif1 = qualifier1(Index);
|
||||
Qualif2 = qualifier2(Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (Invert) {
|
||||
if (TheSame2(Index) == 0) {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::
|
||||
Tangency2 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (!Invert) {
|
||||
if (TheSame2(Index) == 0) {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanRad::
|
||||
IsTheSame1 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (Invert) {
|
||||
if (TheSame2(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d2TanRad::
|
||||
IsTheSame2 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (!Invert) {
|
||||
if (TheSame2(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
else {
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
else { return Standard_True; }
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
314
src/Geom2dGcc/Geom2dGcc_Circ2d3Tan.cdl
Executable file
314
src/Geom2dGcc/Geom2dGcc_Circ2d3Tan.cdl
Executable file
@@ -0,0 +1,314 @@
|
||||
-- File: Circ2d3Tan.cdl
|
||||
-- Created: Tue Oct 20 16:23:14 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Circ2d3Tan from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d circles tangent to 3 points/lines/circles/
|
||||
-- curves with one curve or more.
|
||||
-- The arguments of all construction methods are :
|
||||
-- - The three qualifiied elements for the
|
||||
-- tangency constrains (QualifiedCirc, QualifiedLine,
|
||||
-- Qualifiedcurv, Points).
|
||||
-- - A parameter for each QualifiedCurv.
|
||||
-- Describes functions for building a 2D circle:
|
||||
-- - tangential to 3 curves, or
|
||||
-- - tangential to 2 curves and passing through a point, or
|
||||
-- - tangential to a curve and passing through 2 points, or
|
||||
-- - passing through 3 points.
|
||||
-- A Circ2d3Tan object provides a framework for:
|
||||
-- - defining the construction of 2D circles(s),
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result(s).
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses QualifiedCurve from Geom2dGcc,
|
||||
Integer from Standard,
|
||||
Circ2d from gp,
|
||||
Pnt2d from gp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Boolean from Standard,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Circ2d3Tan from GccAna,
|
||||
Point from Geom2d,
|
||||
MyC2d3Tan from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified3 : QualifiedCurve from Geom2dGcc ;
|
||||
Tolerance : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
Param2 : Real from Standard ;
|
||||
Param3 : Real from Standard )
|
||||
returns Circ2d3Tan from Geom2dGcc;
|
||||
---Purpose: Constructs one or more 2D circles
|
||||
-- tangential to three curves Qualified1, Qualified2 and
|
||||
-- Qualified3, where Param1, Param2 and Param3 are
|
||||
-- used, respectively, as the initial values of the
|
||||
-- parameters on Qualified1, Qualified2 and Qualified3
|
||||
-- of the tangency point between these arguments and
|
||||
-- the solution sought, if the algorithm chooses an
|
||||
-- iterative method to find the solution (i.e. if either
|
||||
-- Qualified1, Qualified2 or Qualified3 is more complex
|
||||
-- than a line or a circle).
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
Point : Point from Geom2d ;
|
||||
Tolerance : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
Param2 : Real from Standard )
|
||||
returns Circ2d3Tan from Geom2dGcc;
|
||||
---Purpose: Constructs one or more 2D circles
|
||||
-- tangential to two curves Qualified1 and Qualified2
|
||||
-- and passing through the point Point, where Param1
|
||||
-- and Param2 are used, respectively, as the initial
|
||||
-- values of the parameters on Qualified1 and
|
||||
-- Qualified2 of the tangency point between this
|
||||
-- argument and the solution sought, if the algorithm
|
||||
-- chooses an iterative method to find the solution (i.e. if
|
||||
-- either Qualified1 or Qualified2 is more complex than
|
||||
-- a line or a circle).
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Point1 : Point from Geom2d ;
|
||||
Point2 : Point from Geom2d ;
|
||||
Tolerance : Real from Standard ;
|
||||
Param1 : Real from Standard )
|
||||
returns Circ2d3Tan from Geom2dGcc;
|
||||
---Purpose: Constructs one or more 2D circles tangential to the curve Qualified1 and passing
|
||||
-- through two points Point1 and Point2, where Param1
|
||||
-- is used as the initial value of the parameter on
|
||||
-- Qualified1 of the tangency point between this
|
||||
-- argument and the solution sought, if the algorithm
|
||||
-- chooses an iterative method to find the solution (i.e. if
|
||||
-- Qualified1 is more complex than a line or a circle)
|
||||
|
||||
|
||||
Create(Point1 : Point from Geom2d ;
|
||||
Point2 : Point from Geom2d ;
|
||||
Point3 : Point from Geom2d ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2d3Tan from Geom2dGcc;
|
||||
---Purpose: Constructs one or more 2D circles passing through three points Point1, Point2 and Point3.
|
||||
-- Tolerance is a tolerance criterion used by the algorithm
|
||||
-- to find a solution when, mathematically, the problem
|
||||
-- posed does not have a solution, but where there is
|
||||
-- numeric uncertainty attached to the arguments.
|
||||
-- For example, take:
|
||||
-- - two circles C1 and C2, such that C2 is inside C1,
|
||||
-- and almost tangential to C1; there is in fact no point
|
||||
-- of intersection between C1 and C2; and
|
||||
-- - a circle C3 outside C1.
|
||||
-- You now want to find a circle which is tangential to C1,
|
||||
-- C2 and C3: a pure mathematical resolution will not find
|
||||
-- a solution. This is where the tolerance criterion is used:
|
||||
-- the algorithm considers that C1 and C2 are tangential if
|
||||
-- the shortest distance between these two circles is less
|
||||
-- than or equal to Tolerance. Thus, the algorithm finds a solution.
|
||||
-- Warning
|
||||
-- An iterative algorithm is used if Qualified1, Qualified2 or
|
||||
-- Qualified3 is more complex than a line or a circle. In
|
||||
-- such cases, the algorithm constructs only one solution.
|
||||
-- Exceptions
|
||||
-- GccEnt_BadQualifier if a qualifier is inconsistent with
|
||||
-- the argument it qualifies (for example, enclosing for a line).
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : Circ2d3Tan from GccAna ;
|
||||
Rank1 : Integer from Standard;
|
||||
Rank2 : Integer from Standard;
|
||||
Rank3 : Integer from Standard)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has reached its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: This method returns the number of solutions.
|
||||
-- NotDone is raised if the algorithm failed.
|
||||
|
||||
ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be carefull: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to theses outside the context
|
||||
-- of the algorithm-object.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt ;
|
||||
Qualif2 : out Position from GccEnt ;
|
||||
Qualif3 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It returns the informations about the qualifiers of the tangency
|
||||
-- arguments concerning the solution number Index.
|
||||
-- It returns the real qualifiers (the qualifiers given to the
|
||||
-- constructor method in case of enclosed, enclosing and outside
|
||||
-- and the qualifiers computedin case of unqualified).
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the second argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
|
||||
Tangency3(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the third argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns True if the solution is equal to the first argument.
|
||||
|
||||
IsTheSame2(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns True if the solution is equal to the second argument.
|
||||
|
||||
IsTheSame3(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns True if the solution is equal to the third argument.
|
||||
-- If Rarg is the radius of the first, second or third
|
||||
-- argument, Rsol is the radius of the solution and dist
|
||||
-- is the distance between the two centers, we consider
|
||||
-- the two circles to be identical if |Rarg - Rsol| and
|
||||
-- dist are less than or equal to the tolerance criterion
|
||||
-- given at the time of construction of this algorithm.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
fields
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
---Purpose: The solution.
|
||||
|
||||
NbrSol : Real from Standard;
|
||||
---Purpose: number of solutions.
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: True if the algorithm succeeded.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the first argument.
|
||||
|
||||
qualifier2 : Array1OfPosition from GccEnt ;
|
||||
---Purpose: The qualifiers of the second argument.
|
||||
|
||||
qualifier3 : Array1OfPosition from GccEnt;
|
||||
---Purpose: The qualifiers of the third argument.
|
||||
|
||||
TheSame1 : Array1OfInteger from TColStd;
|
||||
---Purpose: 1 if the solution and the first argument are the same (2 circles).
|
||||
-- if R1 is the radius of the first argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R1+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
TheSame2 : Array1OfInteger from TColStd;
|
||||
---Purpose: 1 if the solution and the second argument are the same (2 circles).
|
||||
-- if R2 is the radius of the second argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R2+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
TheSame3 : Array1OfInteger from TColStd;
|
||||
---Purpose: 1 if the solution and the third argument are the same (2 circles).
|
||||
-- if R3 is the radius of the third argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R3+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the first argument.
|
||||
|
||||
pnttg2sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the second argument.
|
||||
|
||||
pnttg3sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the third argument.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the
|
||||
-- first argument on the solution.
|
||||
|
||||
par2sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the
|
||||
-- second argument on the solution.
|
||||
|
||||
par3sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the
|
||||
-- third argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the first
|
||||
-- argument on the first argument.
|
||||
|
||||
pararg2 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the second
|
||||
-- argument on the second argument.
|
||||
|
||||
pararg3 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution and the third
|
||||
-- argument on the second argument.
|
||||
|
||||
|
||||
-- CircAna : Circ2d2TanOn from GccAna;
|
||||
-- CircIter : Circ2d2TanOn from GccIter;
|
||||
-- TypeAna : Boolean;
|
||||
|
||||
end Circ2d3Tan;
|
636
src/Geom2dGcc/Geom2dGcc_Circ2d3Tan.cxx
Executable file
636
src/Geom2dGcc/Geom2dGcc_Circ2d3Tan.cxx
Executable file
@@ -0,0 +1,636 @@
|
||||
// File: Geom2dGcc_Circ2d3Tan.cxx
|
||||
// Created: Wed Oct 21 14:50:19 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Circ2d3Tan.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <Geom2dGcc_MyC2d3Tan.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <GccEnt_QualifiedLin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Geom2dGcc_Circ2d3Tan::
|
||||
Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2 ,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified3 ,
|
||||
const Standard_Real Tolerance ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real Param2 ,
|
||||
const Standard_Real Param3 ):
|
||||
cirsol(1,16) ,
|
||||
qualifier1(1,16),
|
||||
qualifier2(1,16),
|
||||
qualifier3(1,16),
|
||||
TheSame1(1,16) ,
|
||||
TheSame2(1,16) ,
|
||||
TheSame3(1,16) ,
|
||||
pnttg1sol(1,16),
|
||||
pnttg2sol(1,16),
|
||||
pnttg3sol(1,16),
|
||||
par1sol(1,16) ,
|
||||
par2sol(1,16) ,
|
||||
par3sol(1,16) ,
|
||||
pararg1(1,16) ,
|
||||
pararg2(1,16) ,
|
||||
pararg3(1,16)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
Geom2dAdaptor_Curve C3 = Qualified3.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
Handle(Geom2d_Curve) CC3 = C3.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
GeomAbs_CurveType Type3 = C3.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
|
||||
(Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle) &&
|
||||
(Type3 == GeomAbs_Line || Type3 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
|
||||
gp_Circ2d c3(CCC3->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Qc2,Qc3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),
|
||||
qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
|
||||
gp_Lin2d l3(LL3->Lin2d());
|
||||
GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Qc2,Ql3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),
|
||||
qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
|
||||
gp_Circ2d c3(CCC3->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc3(c3,Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Qc3,Ql2,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),
|
||||
qualifier3(i),qualifier2(i));
|
||||
}
|
||||
Results(Circ,1,3,2);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
|
||||
gp_Lin2d l3(LL3->Lin2d());
|
||||
GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Ql2,Ql3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),
|
||||
qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1=GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
|
||||
gp_Circ2d c3(CCC3->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc2,Qc3,Ql1,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier3(i),
|
||||
qualifier1(i),qualifier2(i));
|
||||
}
|
||||
Results(Circ,3,1,2);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
|
||||
gp_Lin2d l3(LL3->Lin2d());
|
||||
GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc2,Ql1,Ql3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier2(i),
|
||||
qualifier1(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,2,1,3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2=GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
|
||||
if (Type3 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC3 = Handle(Geom2d_Circle)::DownCast(CC3);
|
||||
gp_Circ2d c3(CCC3->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc3=GccEnt_QualifiedCirc(c3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc3,Ql2,Ql1,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier3(i),
|
||||
qualifier2(i),qualifier1(i));
|
||||
}
|
||||
Results(Circ,3,2,1);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL3 = Handle(Geom2d_Line)::DownCast(CC3);
|
||||
gp_Lin2d l3(LL3->Lin2d());
|
||||
GccEnt_QualifiedLin Ql3=GccEnt_QualifiedLin(l3,
|
||||
Qualified3.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Ql1,Ql2,Ql3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),
|
||||
qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc3(C3,Qualified3.Qualifier());
|
||||
Geom2dGcc_MyC2d3Tan Circ(Qc1,Qc2,Qc3,Param1,Param2,Param3,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
if (WellDone) {
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
|
||||
else {TheSame3(1) = 0; }
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d3Tan::
|
||||
Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2 ,
|
||||
const Handle(Geom2d_Point)& Point ,
|
||||
const Standard_Real Tolerance ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real Param2 ):
|
||||
cirsol(1,16) ,
|
||||
qualifier1(1,16),
|
||||
qualifier2(1,16),
|
||||
qualifier3(1,16),
|
||||
TheSame1(1,16) ,
|
||||
TheSame2(1,16) ,
|
||||
TheSame3(1,16) ,
|
||||
pnttg1sol(1,16),
|
||||
pnttg2sol(1,16),
|
||||
pnttg3sol(1,16),
|
||||
par1sol(1,16) ,
|
||||
par2sol(1,16) ,
|
||||
par3sol(1,16) ,
|
||||
pararg1(1,16) ,
|
||||
pararg2(1,16) ,
|
||||
pararg3(1,16)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
|
||||
(Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Qc2,Point->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Ql2,Point->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2(c2,Qualified2.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc2,Ql1,Point->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier2(i),qualifier1(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,2,1,3);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL2 = Handle(Geom2d_Line)::DownCast(CC2);
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2(l2,Qualified2.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Ql1,Ql2,Point->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyC2d3Tan Circ(Qc1,Qc2,Point->Pnt2d(),Param1,Param2,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
if (WellDone) {
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
|
||||
else {TheSame3(1) = 0; }
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d3Tan::
|
||||
Geom2dGcc_Circ2d3Tan (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Handle(Geom2d_Point)& Point1 ,
|
||||
const Handle(Geom2d_Point)& Point2 ,
|
||||
const Standard_Real Tolerance ,
|
||||
const Standard_Real Param1 ):
|
||||
cirsol(1,16) ,
|
||||
qualifier1(1,16),
|
||||
qualifier2(1,16),
|
||||
qualifier3(1,16),
|
||||
TheSame1(1,16) ,
|
||||
TheSame2(1,16) ,
|
||||
TheSame3(1,16) ,
|
||||
pnttg1sol(1,16),
|
||||
pnttg2sol(1,16),
|
||||
pnttg3sol(1,16),
|
||||
par1sol(1,16) ,
|
||||
par2sol(1,16) ,
|
||||
par3sol(1,16) ,
|
||||
pararg1(1,16) ,
|
||||
pararg2(1,16) ,
|
||||
pararg3(1,16)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1(l1,Qualified1.Qualifier());
|
||||
GccAna_Circ2d3Tan Circ(Ql1,Point1->Pnt2d(),Point2->Pnt2d(),Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyC2d3Tan Circ(Qc1,Point1->Pnt2d(),Point2->Pnt2d(),
|
||||
Param1,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = 1;
|
||||
if (WellDone) {
|
||||
cirsol(1) = Circ.ThisSolution();
|
||||
if (Circ.IsTheSame1()) { TheSame1(1) = 1; }
|
||||
else {TheSame1(1) = 0; }
|
||||
if (Circ.IsTheSame2()) { TheSame2(1) = 1; }
|
||||
else {TheSame2(1) = 0; }
|
||||
if (Circ.IsTheSame3()) { TheSame3(1) = 1; }
|
||||
else {TheSame3(1) = 0; }
|
||||
Circ.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Circ.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
Circ.Tangency3(par3sol(1),pararg3(1),pnttg3sol(1));
|
||||
Circ.WhichQualifier(qualifier1(1),qualifier2(1),qualifier3(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2d3Tan::
|
||||
Geom2dGcc_Circ2d3Tan (const Handle(Geom2d_Point)& Point1 ,
|
||||
const Handle(Geom2d_Point)& Point2 ,
|
||||
const Handle(Geom2d_Point)& Point3 ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
qualifier2(1,2),
|
||||
qualifier3(1,2),
|
||||
TheSame1(1,2) ,
|
||||
TheSame2(1,2) ,
|
||||
TheSame3(1,2) ,
|
||||
pnttg1sol(1,2),
|
||||
pnttg2sol(1,2),
|
||||
pnttg3sol(1,2),
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
par3sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2) ,
|
||||
pararg3(1,2)
|
||||
{
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
GccAna_Circ2d3Tan Circ(Point1->Pnt2d(),Point2->Pnt2d(),Point3->Pnt2d(),
|
||||
Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
Circ.WhichQualifier(i,qualifier1(i),qualifier2(i),qualifier3(i));
|
||||
}
|
||||
Results(Circ,1,2,3);
|
||||
}
|
||||
|
||||
|
||||
void Geom2dGcc_Circ2d3Tan::Results(const GccAna_Circ2d3Tan& Circ ,
|
||||
const Standard_Integer Rank1,
|
||||
const Standard_Integer Rank2,
|
||||
const Standard_Integer Rank3)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
Standard_Integer i1 = 0, i2 = 0, i3 = 0;
|
||||
if (Circ.IsTheSame1(j)) { i1 = 1; }
|
||||
if (Circ.IsTheSame2(j)) { i2 = 1; }
|
||||
if (Circ.IsTheSame3(j)) { i3 = 1; }
|
||||
if (Rank1 == 1) {
|
||||
TheSame1(j) = i1;
|
||||
if ( i1 == 0)
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
}
|
||||
else if (Rank1 == 2) {
|
||||
TheSame1(j) = i2;
|
||||
if ( i2 == 0)
|
||||
Circ.Tangency2(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
}
|
||||
else if (Rank1 == 3) {
|
||||
TheSame1(j) = i3;
|
||||
if ( i3 == 0)
|
||||
Circ.Tangency3(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
}
|
||||
if (Rank2 == 1) {
|
||||
TheSame2(j) = i1;
|
||||
if ( i1 == 0)
|
||||
Circ.Tangency1(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
}
|
||||
else if (Rank2 == 2) {
|
||||
TheSame2(j) = i2;
|
||||
if ( i2 == 0)
|
||||
Circ.Tangency2(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
}
|
||||
else if (Rank2 == 3) {
|
||||
TheSame2(j) = i3;
|
||||
if ( i3 == 0)
|
||||
Circ.Tangency3(j,par2sol(j),pararg2(j),pnttg2sol(j));
|
||||
}
|
||||
if (Rank3 == 1) {
|
||||
TheSame3(j) = i1;
|
||||
if ( i1 == 0)
|
||||
Circ.Tangency1(j,par3sol(j),pararg3(j),pnttg3sol(j));
|
||||
}
|
||||
else if (Rank3 == 2) {
|
||||
TheSame3(j) = i2;
|
||||
if ( i2 == 0)
|
||||
Circ.Tangency2(j,par3sol(j),pararg3(j),pnttg3sol(j));
|
||||
}
|
||||
else if (Rank3 == 3) {
|
||||
TheSame3(j) = i3;
|
||||
if ( i3 == 0)
|
||||
Circ.Tangency3(j,par3sol(j),pararg3(j),pnttg3sol(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d3Tan::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2d3Tan::
|
||||
NbSolutions () const
|
||||
{
|
||||
return (Standard_Integer ) NbrSol;
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2d3Tan::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d3Tan::
|
||||
WhichQualifier (const Standard_Integer Index ,
|
||||
GccEnt_Position& Qualif1 ,
|
||||
GccEnt_Position& Qualif2 ,
|
||||
GccEnt_Position& Qualif3) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
Qualif1 = qualifier1(Index);
|
||||
Qualif2 = qualifier2(Index);
|
||||
Qualif3 = qualifier3(Index);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d3Tan::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d3Tan::
|
||||
Tangency2 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (TheSame2(Index) == 0) {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d3Tan::
|
||||
Tangency3 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (TheSame3(Index) == 0) {
|
||||
ParSol = par3sol(Index);
|
||||
ParArg = pararg3(Index);
|
||||
PntSol = pnttg3sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d3Tan::IsTheSame1 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d3Tan::
|
||||
IsTheSame2 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (TheSame2(Index) == 0) { return Standard_False; }
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2d3Tan::
|
||||
IsTheSame3 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (TheSame3(Index) == 0) { return Standard_False; }
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
188
src/Geom2dGcc/Geom2dGcc_Circ2dTanCen.cdl
Executable file
188
src/Geom2dGcc/Geom2dGcc_Circ2dTanCen.cdl
Executable file
@@ -0,0 +1,188 @@
|
||||
-- File: Circ2dTanCen.cdl
|
||||
-- Created: Tue Oct 20 16:24:19 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Circ2dTanCen from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d circles tangent to a curve and
|
||||
-- centered on a point.
|
||||
-- The arguments of all construction methods are :
|
||||
-- - The qualified element for the tangency constrains
|
||||
-- (QualifiedCurv).
|
||||
-- -The center point Pcenter.
|
||||
-- - A real Tolerance.
|
||||
-- Tolerance is only used in the limits cases.
|
||||
-- For example :
|
||||
-- We want to create a circle tangent to an EnclosedCurv C1
|
||||
-- with a tolerance Tolerance.
|
||||
-- If we did not used Tolerance it is impossible to
|
||||
-- find a solution in the the following case : Pcenter is
|
||||
-- outside C1.
|
||||
-- With Tolerance we will give a solution if the distance
|
||||
-- between C1 and Pcenter is lower than or equal Tolerance/2.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses QualifiedCurve from Geom2dGcc,
|
||||
Pnt2d from gp,
|
||||
Point from Geom2d,
|
||||
Circ2d from gp,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Boolean from Standard,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create( Qualified1 : QualifiedCurve from Geom2dGcc;
|
||||
Pcenter : Point from Geom2d ;
|
||||
Tolerance : Real from Standard ) returns Circ2dTanCen
|
||||
raises BadQualifier;
|
||||
---Purpose: Constructs one or more 2D circles tangential to the
|
||||
-- curve Qualified1 and centered on the point Pcenter.
|
||||
-- Tolerance is a tolerance criterion used by the algorithm
|
||||
-- to find a solution when, mathematically, the problem
|
||||
-- posed does not have a solution, but where there is
|
||||
-- numeric uncertainty attached to the arguments.
|
||||
-- Tolerance is only used in these algorithms in very
|
||||
-- specific cases where the center of the solution is very
|
||||
-- close to the circle to which it is tangential, and where the
|
||||
-- solution is thus a very small circle.
|
||||
-- Exceptions
|
||||
-- GccEnt_BadQualifier if a qualifier is inconsistent with
|
||||
-- the argument it qualifies (for example, enclosing for a line).
|
||||
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail
|
||||
-- (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has reached
|
||||
-- its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns the number of circles, representing solutions
|
||||
-- computed by this algorithm.
|
||||
-- Exceptions
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns a circle, representing the solution of index
|
||||
-- Index computed by this algorithm.
|
||||
-- Warning
|
||||
-- This indexing simply provides a means of consulting the
|
||||
-- solutions. The index values are not associated with
|
||||
-- these solutions outside the context of the algorithm object.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the qualifier Qualif1 of the tangency argument
|
||||
-- for the solution of index Index computed by this algorithm.
|
||||
-- The returned qualifier is:
|
||||
-- - that specified at the start of construction when the
|
||||
-- solutions are defined as enclosed, enclosing or
|
||||
-- outside with respect to the argument, or
|
||||
-- - that computed during construction (i.e. enclosed,
|
||||
-- enclosing or outside) when the solutions are defined
|
||||
-- as unqualified with respect to the argument.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result number Index and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns true if the solution of index Index and the first
|
||||
-- argument of this algorithm are the same (i.e. there are 2
|
||||
-- identical circles).
|
||||
-- If Rarg is the radius of the first argument, Rsol is the
|
||||
-- radius of the solution and dist is the distance between
|
||||
-- the two centers, we consider the two circles to be
|
||||
-- identical if |Rarg - Rsol| and dist are less than
|
||||
-- or equal to the tolerance criterion given at the time of
|
||||
-- construction of this algorithm.
|
||||
-- NotDone is raised if the construction algorithm didn't succeed.
|
||||
-- OutOfRange is raised if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
-- True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
-- Number of solutions.
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the first argument.
|
||||
|
||||
TheSame1 : Array1OfInteger from TColStd;
|
||||
-- 1 if the solution and the first argument are the same (2 circles).
|
||||
-- if R1 is the radius of the first argument and Rsol the radius
|
||||
-- of the solution and dist the distance between the two centers,
|
||||
-- we concider the two circles are identical if R1+dist-Rsol is
|
||||
-- less than Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the first argument on
|
||||
-- the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the
|
||||
-- first argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the first
|
||||
-- argument on the first argument.
|
||||
|
||||
|
||||
-- CircAna : Circ2d2TanRad from GccAna;
|
||||
-- CircGeo : Circ2d2TanRad from GccGeo;
|
||||
-- TypeAna : Boolean;
|
||||
|
||||
end Circ2dTanCen;
|
||||
|
||||
|
||||
|
141
src/Geom2dGcc/Geom2dGcc_Circ2dTanCen.cxx
Executable file
141
src/Geom2dGcc/Geom2dGcc_Circ2dTanCen.cxx
Executable file
@@ -0,0 +1,141 @@
|
||||
// File: Geom2dGcc_Circ2dTanCen.cxx
|
||||
// Created: Mon Oct 26 10:59:57 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Circ2dTanCen.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2dTanCen.hxx>
|
||||
#include <Geom2dGcc_MyCirc2dTanCen.hxx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <GccEnt_QualifiedLin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Geom2dGcc_Circ2dTanCen::
|
||||
Geom2dGcc_Circ2dTanCen (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Handle(Geom2d_Point&) PCenter ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
TheSame1(1,2) ,
|
||||
pnttg1sol(1,2),
|
||||
par1sol(1,2) ,
|
||||
pararg1(1,2)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
gp_Pnt2d pcenter(PCenter->Pnt2d());
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1(c1,Qualified1.Qualifier());
|
||||
GccAna_Circ2dTanCen Circ(Qc1,pcenter,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
Circ.WhichQualifier(j,qualifier1(j));
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccAna_Circ2dTanCen Circ(l1,pcenter);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
Circ.WhichQualifier(j,qualifier1(j));
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanCen Circ(Qc1,pcenter,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
TheSame1(j) = 0;
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.WhichQualifier(j,qualifier1(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanCen::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2dTanCen::
|
||||
NbSolutions () const
|
||||
{
|
||||
return NbrSol;
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2dTanCen::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanCen::
|
||||
WhichQualifier(const Standard_Integer Index,
|
||||
GccEnt_Position& Qualif1) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else { Qualif1 = qualifier1(Index); }
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanCen::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanCen::
|
||||
IsTheSame1 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
return Standard_True;
|
||||
}
|
||||
|
246
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRad.cdl
Executable file
246
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRad.cdl
Executable file
@@ -0,0 +1,246 @@
|
||||
-- File: Circ2dTanOnRad.cdl
|
||||
-- Created: Tue Oct 20 16:24:03 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Circ2dTanOnRad from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create a 2d circle tangent to a 2d entity,
|
||||
-- centered on a 2d entity and with a given radius.
|
||||
-- More than one argument must be a curve.
|
||||
-- The arguments of all construction methods are :
|
||||
-- - The qualified element for the tangency constrains
|
||||
-- (QualifiedCirc, QualifiedLin, QualifiedCurvPoints).
|
||||
-- - The Center element (circle, line, curve).
|
||||
-- - A real Tolerance.
|
||||
-- Tolerance is only used in the limits cases.
|
||||
-- For example :
|
||||
-- We want to create a circle tangent to an OutsideCurv Cu1
|
||||
-- centered on a line OnLine with a radius Radius and with
|
||||
-- a tolerance Tolerance.
|
||||
-- If we did not used Tolerance it is impossible to
|
||||
-- find a solution in the the following case : OnLine is
|
||||
-- outside Cu1. There is no intersection point between Cu1
|
||||
-- and OnLine. The distance between the line and the
|
||||
-- circle is greater than Radius.
|
||||
-- With Tolerance we will give a solution if the
|
||||
-- distance between Cu1 and OnLine is lower than or
|
||||
-- equal Tolerance.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Lin2d from gp,
|
||||
Circ2d from gp,
|
||||
Pnt2d from gp,
|
||||
Point from Geom2d,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Curve from Geom2dAdaptor,
|
||||
QualifiedCurve from Geom2dGcc,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Circ2dTanOnRad from GccAna,
|
||||
MyCirc2dTanOnRad from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises NegativeValue from Standard,
|
||||
OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
OnCurv : Curve from Geom2dAdaptor;
|
||||
Radius : Real from Standard ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2dTanOnRad from Geom2dGcc
|
||||
raises NegativeValue,BadQualifier;
|
||||
---Purpose: Constructs one or more 2D circles of radius Radius,
|
||||
-- centered on the 2D curve OnCurv and:
|
||||
-- - tangential to the curve Qualified1
|
||||
|
||||
Create(Point1 : Point from Geom2d ;
|
||||
OnCurv : Curve from Geom2dAdaptor;
|
||||
Radius : Real from Standard ;
|
||||
Tolerance : Real from Standard )
|
||||
returns Circ2dTanOnRad from Geom2dGcc
|
||||
raises NegativeValue;
|
||||
---Purpose: Constructs one or more 2D circles of radius Radius,
|
||||
-- centered on the 2D curve OnCurv and:
|
||||
-- passing through the point Point1.
|
||||
-- OnCurv is an adapted curve, i.e. an object which is an
|
||||
-- interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by the construction algorithm.
|
||||
-- Similarly, the qualified curve Qualified1 is created from
|
||||
-- an adapted curve.
|
||||
-- Adapted curves are created in the following way:
|
||||
-- Handle(Geom2d_Curve) myCurveOn = ... ;
|
||||
-- Geom2dAdaptor_Curve OnCurv ( myCurveOn ) ;
|
||||
-- The algorithm is then constructed with this object:
|
||||
-- Handle(Geom2d_Curve) myCurve1 = ...
|
||||
-- ;
|
||||
-- Geom2dAdaptor_Curve Adapted1 ( myCurve1 ) ;
|
||||
-- Geom2dGcc_QualifiedCurve
|
||||
-- Qualified1 = Geom2dGcc::Outside(Adapted1);
|
||||
-- Standard_Real Radius = ... , Tolerance = ... ;
|
||||
-- Geom2dGcc_Circ2dTanOnRad
|
||||
-- myAlgo ( Qualified1 , OnCurv , Radius , Tolerance ) ;
|
||||
-- if ( myAlgo.IsDone() )
|
||||
-- { Standard_Integer Nbr = myAlgo.NbSolutions() ;
|
||||
-- gp_Circ2d Circ ;
|
||||
-- for ( Standard_Integer i = 1 ;
|
||||
-- i <= nbr ; i++ )
|
||||
-- { Circ = myAlgo.ThisSolution (i) ;
|
||||
-- ...
|
||||
-- }
|
||||
-- }
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : Circ2dTanOnRad from GccAna)
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2dTanOnRad from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail
|
||||
-- (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm which has reached
|
||||
-- its numeric limits.
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns the number of circles, representing solutions
|
||||
-- computed by this algorithm.
|
||||
-- Exceptions: StdFail_NotDone if the construction fails.
|
||||
|
||||
ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be carefull: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to theses outside the context
|
||||
-- of the algorithm-object.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
--- Purpose: Returns the qualifier Qualif1 of the tangency argument
|
||||
-- for the solution of index Index computed by this algorithm.
|
||||
-- The returned qualifier is:
|
||||
-- - that specified at the start of construction when the
|
||||
-- solutions are defined as enclosed, enclosing or
|
||||
-- outside with respect to the arguments, or
|
||||
-- - that computed during construction (i.e. enclosed,
|
||||
-- enclosing or outside) when the solutions are defined
|
||||
-- as unqualified with respect to the arguments, or
|
||||
-- - GccEnt_noqualifier if the tangency argument is a point.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result number Index and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point on the argument curv.
|
||||
-- PntSol is the tangency point on the solution curv.
|
||||
-- PntArg is the tangency point on the argument curv.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
CenterOn3 (me ;
|
||||
Index : Integer from Standard;
|
||||
ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the center PntSol on the second argument (i.e.
|
||||
-- line or circle) of the solution of index Index computed by
|
||||
-- this algorithm.
|
||||
-- ParArg is the intrinsic parameter of the point on the argument curv.
|
||||
-- PntSol is the center point of the solution curv.
|
||||
-- PntArg is the projection of PntSol on the argument curv.
|
||||
-- Exceptions:
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns true if the solution of index Index and the first
|
||||
-- argument of this algorithm are the same (i.e. there are 2
|
||||
-- identical circles).
|
||||
-- If Rarg is the radius of the first argument, Rsol is the
|
||||
-- radius of the solution and dist is the distance between
|
||||
-- the two centers, we consider the two circles to be
|
||||
-- identical if |Rarg - Rsol| and dist are less than
|
||||
-- or equal to the tolerance criterion given at the time of
|
||||
-- construction of this algorithm.
|
||||
-- OutOfRange is raised if Index is greater than the number of solutions.
|
||||
-- notDone is raised if the construction algorithm did not succeed.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
-- True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
-- The number of possible solutions. We have to decide about the
|
||||
-- status of the multiple solutions...
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
---Purpose : The solutions.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the first argument.
|
||||
|
||||
TheSame1 : Array1OfInteger from TColStd;
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the first argument on
|
||||
-- the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the
|
||||
-- first argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the first
|
||||
-- argument on the first argument.
|
||||
|
||||
pntcen3 : Array1OfPnt2d from TColgp;
|
||||
-- The center point of the solution on the first argument.
|
||||
|
||||
parcen3 : Array1OfReal from TColStd;
|
||||
-- The parameter of the center point of the solution on the second
|
||||
-- argument.
|
||||
|
||||
end Circ2dTanOnRad;
|
||||
|
||||
|
280
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRad.cxx
Executable file
280
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRad.cxx
Executable file
@@ -0,0 +1,280 @@
|
||||
// File: Geom2dGcc_Circ2dTanOnRad.cxx
|
||||
// Created: Wed Oct 21 14:51:18 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Circ2dTanOnRad.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2dTanOnRad.hxx>
|
||||
#include <Geom2dGcc_MyCirc2dTanOnRad.hxx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <GccEnt_QualifiedLin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_NegativeValue.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRad::
|
||||
Geom2dGcc_Circ2dTanOnRad (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const Geom2dAdaptor_Curve& OnCurve ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
if (Radius < 0.) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = OnCurve.GetType();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) Con = OnCurve.Curve();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if ((Type1 == GeomAbs_Line || Type1 == GeomAbs_Circle) &&
|
||||
(Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle)) {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
gp_Circ2d con(CCon->Circ2d());
|
||||
GccAna_Circ2dTanOnRad Circ(Qc1,con,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
gp_Lin2d lon(LLon->Lin2d());
|
||||
GccAna_Circ2dTanOnRad Circ(Qc1,lon,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1=GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
gp_Circ2d con(CCon->Circ2d());
|
||||
GccAna_Circ2dTanOnRad Circ(Ql1,con,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
gp_Lin2d lon(LLon->Lin2d());
|
||||
GccAna_Circ2dTanOnRad Circ(Ql1,lon,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
}
|
||||
else if (Type1 == GeomAbs_Line) {
|
||||
Handle(Geom2d_Line) LL1 = Handle(Geom2d_Line)::DownCast(CC1);
|
||||
gp_Lin2d l1(LL1->Lin2d());
|
||||
GccEnt_QualifiedLin Ql1=GccEnt_QualifiedLin(l1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(Ql1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRad::
|
||||
Geom2dGcc_Circ2dTanOnRad (const Handle(Geom2d_Point&) Point1 ,
|
||||
const Geom2dAdaptor_Curve& OnCurve ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8),
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8),
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
if (Radius < 0.) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
gp_Pnt2d point1(Point1->Pnt2d());
|
||||
GeomAbs_CurveType Type2 = OnCurve.GetType();
|
||||
Handle(Geom2d_Curve) Con = OnCurve.Curve();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if (Type2 == GeomAbs_Line || Type2 == GeomAbs_Circle) {
|
||||
if (Type2 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCon = Handle(Geom2d_Circle)::DownCast(Con);
|
||||
gp_Circ2d con(CCon->Circ2d());
|
||||
GccAna_Circ2dTanOnRad Circ(point1,con,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
else {
|
||||
Handle(Geom2d_Line) LLon = Handle(Geom2d_Line)::DownCast(Con);
|
||||
gp_Lin2d lon(LLon->Lin2d());
|
||||
GccAna_Circ2dTanOnRad Circ(point1,lon,Radius,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
Results(Circ);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccGeo. +
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(point1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::Results(const GccAna_Circ2dTanOnRad& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.CenterOn3(j,parcen3(j),pntcen3(j));
|
||||
Circ.WhichQualifier(j,qualifier1(j));
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::Results(const Geom2dGcc_MyCirc2dTanOnRad& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
if (Circ.IsTheSame1(j)) { TheSame1(j) = 1; }
|
||||
else {TheSame1(j) = 0; }
|
||||
Circ.Tangency1(j,par1sol(j),pararg1(j),pnttg1sol(j));
|
||||
Circ.CenterOn3(j,parcen3(j),pntcen3(j));
|
||||
Circ.WhichQualifier(j,qualifier1(j));
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanOnRad::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2dTanOnRad::
|
||||
NbSolutions () const
|
||||
{
|
||||
return NbrSol;
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2dTanOnRad::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::
|
||||
WhichQualifier (const Standard_Integer Index,
|
||||
GccEnt_Position& Qualif1) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else { Qualif1 = qualifier1(Index); }
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
if (TheSame1(Index) == 0) {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
else { StdFail_NotDone::Raise(); }
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::
|
||||
CenterOn3 (const Standard_Integer Index,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParArg = parcen3(Index);
|
||||
PntSol = pntcen3(Index);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanOnRad::
|
||||
IsTheSame1 (const Standard_Integer Index) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
if (TheSame1(Index) == 0) { return Standard_False; }
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
45
src/Geom2dGcc/Geom2dGcc_CurveTool.cdl
Executable file
45
src/Geom2dGcc/Geom2dGcc_CurveTool.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: CurveTool.cdl
|
||||
-- Created: Thu Jun 4 16:21:49 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class CurveTool from Geom2dGcc
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Curve from Geom2dAdaptor,
|
||||
Pnt2d from gp,
|
||||
Vec2d from gp
|
||||
|
||||
is
|
||||
|
||||
FirstParameter(myclass; C: Curve from Geom2dAdaptor)
|
||||
returns Real;
|
||||
|
||||
LastParameter(myclass; C: Curve from Geom2dAdaptor)
|
||||
returns Real;
|
||||
|
||||
EpsX (myclass ;
|
||||
C : Curve from Geom2dAdaptor;
|
||||
Tol : Real from Standard )
|
||||
returns Real;
|
||||
|
||||
NbSamples(myclass ;
|
||||
C : Curve from Geom2dAdaptor)
|
||||
returns Integer;
|
||||
|
||||
Value (myclass; C: Curve from Geom2dAdaptor; X: Real)
|
||||
returns Pnt2d from gp;
|
||||
|
||||
D1 (myclass; C: Curve from Geom2dAdaptor; U: Real ;
|
||||
P: out Pnt2d; T: out Vec2d);
|
||||
|
||||
D2 (myclass; C: Curve from Geom2dAdaptor; U: Real ;
|
||||
P: out Pnt2d; T,N: out Vec2d);
|
||||
|
||||
D3 (myclass; C: Curve from Geom2dAdaptor; U: Real ;
|
||||
P: out Pnt2d; T,N,dN: out Vec2d);
|
||||
|
||||
end CurveTool;
|
||||
|
67
src/Geom2dGcc/Geom2dGcc_CurveTool.cxx
Executable file
67
src/Geom2dGcc/Geom2dGcc_CurveTool.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
#include <Geom2dGcc_CurveTool.ixx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
//Template a respecter
|
||||
|
||||
|
||||
Standard_Real Geom2dGcc_CurveTool::
|
||||
EpsX (const Geom2dAdaptor_Curve& C ,
|
||||
const Standard_Real Tol) {
|
||||
return C.Resolution(Tol);
|
||||
}
|
||||
|
||||
Standard_Integer Geom2dGcc_CurveTool::
|
||||
NbSamples (const Geom2dAdaptor_Curve& /*C*/) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
gp_Pnt2d Geom2dGcc_CurveTool::Value (const Geom2dAdaptor_Curve& C,
|
||||
const Standard_Real U) {
|
||||
return C.Value(U);
|
||||
}
|
||||
|
||||
Standard_Real
|
||||
Geom2dGcc_CurveTool::FirstParameter (const Geom2dAdaptor_Curve& C) {
|
||||
return C.FirstParameter();
|
||||
}
|
||||
|
||||
Standard_Real
|
||||
Geom2dGcc_CurveTool::LastParameter (const Geom2dAdaptor_Curve& C) {
|
||||
return C.LastParameter();
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveTool::D1 (const Geom2dAdaptor_Curve& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T) {
|
||||
|
||||
C.D1(U,P,T);
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveTool::D2 (const Geom2dAdaptor_Curve& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T,
|
||||
gp_Vec2d& N) {
|
||||
|
||||
C.D2(U,P,T,N);
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveTool::D3 (const Geom2dAdaptor_Curve& C ,
|
||||
const Standard_Real U ,
|
||||
gp_Pnt2d& P ,
|
||||
gp_Vec2d& T ,
|
||||
gp_Vec2d& N ,
|
||||
gp_Vec2d& dN) {
|
||||
|
||||
C.D3(U,P,T,N,dN);
|
||||
}
|
||||
|
||||
|
||||
|
229
src/Geom2dGcc/Geom2dGcc_Lin2d2Tan.cdl
Executable file
229
src/Geom2dGcc/Geom2dGcc_Lin2d2Tan.cdl
Executable file
@@ -0,0 +1,229 @@
|
||||
-- File: Lin2d2Tan.cdl
|
||||
-- Created: Tue Oct 20 16:27:16 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Lin2d2Tan from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d lines tangent to 2 other elements which
|
||||
-- can be circles, curves or points.
|
||||
-- More than one argument must be a curve.
|
||||
-- Describes functions for building a 2D line:
|
||||
-- - tangential to 2 curves, or
|
||||
-- - tangential to a curve and passing through a point.
|
||||
-- A Lin2d2Tan object provides a framework for:
|
||||
-- - defining the construction of 2D line(s),
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result(s).
|
||||
--
|
||||
-- Note: Some constructors may check the type of the qualified argument
|
||||
-- and raise BadQualifier Error in case of incorrect couple (qualifier, curv).
|
||||
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Lin2d from gp,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
QualifiedCurve from Geom2dGcc,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfLin2d from TColgp,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
MyL2d2Tan from Geom2dGcc,
|
||||
Curve from Geom2dAdaptor
|
||||
|
||||
raises NotDone from StdFail,
|
||||
BadQualifier from GccEnt,
|
||||
OutOfRange from Standard
|
||||
|
||||
|
||||
is
|
||||
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 11:40:57 2002 Begin
|
||||
|
||||
-- Add constructors without initial parameters Param1 and Param2 which
|
||||
-- calculate all solutions.
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
Tolang : Real from Standard )
|
||||
returns Lin2d2Tan from Geom2dGcc
|
||||
raises BadQualifier from GccEnt;
|
||||
---Purpose: This class implements the algorithms used to create 2d
|
||||
-- line tangent to two curves.
|
||||
-- Tolang is used to determine the tolerance for the tangency points.
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
ThePoint : Pnt2d from gp ;
|
||||
Tolang : Real from Standard )
|
||||
returns Lin2d2Tan from Geom2dGcc
|
||||
---Purpose: This class implements the algorithms used to create 2d
|
||||
-- lines passing thrue a point and tangent to a curve.
|
||||
-- Tolang is used to determine the tolerance for the tangency points.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 11:40:57 2002 End
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
Qualified2 : QualifiedCurve from Geom2dGcc ;
|
||||
Tolang : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
Param2 : Real from Standard )
|
||||
returns Lin2d2Tan from Geom2dGcc
|
||||
raises BadQualifier from GccEnt;
|
||||
---Purpose: This class implements the algorithms used to create 2d
|
||||
-- line tangent to two curves.
|
||||
-- Tolang is used to determine the tolerance for the tangency points.
|
||||
-- Param1 is used for the initial guess on the first curve.
|
||||
-- Param2 is used for the initial guess on the second curve.
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
ThePoint : Pnt2d from gp ;
|
||||
Tolang : Real from Standard ;
|
||||
Param1 : Real from Standard )
|
||||
returns Lin2d2Tan from Geom2dGcc
|
||||
---Purpose: This class implements the algorithms used to create 2d
|
||||
-- lines passing thrue a point and tangent to a curve.
|
||||
-- Tolang is used to determine the tolerance for the tangency points.
|
||||
-- Param2 is used for the initial guess on the curve.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
IsDone (me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail
|
||||
-- (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has
|
||||
-- reached its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
---Purpose: Returns the number of lines, representing solutions computed by this algorithm.
|
||||
-- Exceptions StdFail_NotDone if the construction fails.R
|
||||
|
||||
ThisSolution(me ;
|
||||
Index : Integer from Standard) returns Lin2d from gp
|
||||
raises OutOfRange,NotDone
|
||||
is static;
|
||||
---Purpose: Returns a line, representing the solution of index Index computed by this algorithm.
|
||||
-- Warning
|
||||
-- This indexing simply provides a means of consulting the
|
||||
-- solutions. The index values are not associated with
|
||||
-- these solutions outside the context of the algorithm object.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt ;
|
||||
Qualif2 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: Returns the qualifiers Qualif1 and Qualif2 of the
|
||||
-- tangency arguments for the solution of index Index
|
||||
-- computed by this algorithm.
|
||||
-- The returned qualifiers are:
|
||||
-- - those specified at the start of construction when the
|
||||
-- solutions are defined as enclosing or outside with
|
||||
-- respect to the arguments, or
|
||||
-- - those computed during construction (i.e. enclosing or
|
||||
-- outside) when the solutions are defined as unqualified
|
||||
-- with respect to the arguments, or
|
||||
-- - GccEnt_noqualifier if the tangency argument is a point.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange,NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on
|
||||
-- the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange,NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 12:04:52 2002 Begin
|
||||
Add(me: in out; theIndex: Integer from Standard;
|
||||
theLin : MyL2d2Tan from Geom2dGcc;
|
||||
theTol : Real from Standard;
|
||||
theC1 : Curve from Geom2dAdaptor;
|
||||
theC2 : Curve from Geom2dAdaptor)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 12:04:52 2002 End
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
-- True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: Number of solutions.
|
||||
|
||||
linsol : Array1OfLin2d from TColgp;
|
||||
---Purpose : The solutions.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the first argument.
|
||||
|
||||
qualifier2 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the second argument.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the first argument on
|
||||
-- the solution.
|
||||
|
||||
pnttg2sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the second argument on
|
||||
-- the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the
|
||||
-- first argument on the solution.
|
||||
|
||||
par2sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the
|
||||
-- second argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the first
|
||||
-- argument on the first argument.
|
||||
|
||||
pararg2 : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the second
|
||||
-- argument on the second argument.
|
||||
|
||||
end Lin2d2Tan;
|
397
src/Geom2dGcc/Geom2dGcc_Lin2d2Tan.cxx
Executable file
397
src/Geom2dGcc/Geom2dGcc_Lin2d2Tan.cxx
Executable file
@@ -0,0 +1,397 @@
|
||||
// File: Geom2dGcc_Lin2d2Tan.cxx
|
||||
// Created: Wed Oct 21 14:52:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Lin2d2Tan.ixx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccAna_Lin2d2Tan.hxx>
|
||||
#include <Geom2dGcc_MyL2d2Tan.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_NegativeValue.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Geom2dGcc_CurveTool.hxx>
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Oct 16 11:44:41 2002 Begin
|
||||
Geom2dGcc_Lin2d2Tan::
|
||||
Geom2dGcc_Lin2d2Tan (const Geom2dGcc_QualifiedCurve& Qualified1,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2,
|
||||
const Standard_Real Tolang ):
|
||||
linsol(1,4) ,
|
||||
qualifier1(1,4),
|
||||
qualifier2(1,4),
|
||||
pnttg1sol(1,4) ,
|
||||
pnttg2sol(1,4) ,
|
||||
par1sol(1,4) ,
|
||||
par2sol(1,4) ,
|
||||
pararg1(1,4) ,
|
||||
pararg2(1,4)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle && Type2 == GeomAbs_Circle ) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
GccAna_Lin2d2Tan Lin(Qc1,Qc2,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:50:48 2001 Begin
|
||||
if (WellDone) {
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:50:49 2001 End
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Tangency2(i,par2sol(i),pararg2(i),pnttg2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Standard_Real a1FPar = Geom2dGcc_CurveTool::FirstParameter(C1);
|
||||
Standard_Real a1LPar = Geom2dGcc_CurveTool::LastParameter(C1);
|
||||
Standard_Integer aNbSamples1 = Geom2dGcc_CurveTool::NbSamples(C1);
|
||||
Standard_Real aStep1 = (a1LPar - a1FPar)/aNbSamples1;
|
||||
Standard_Real Param1 = a1FPar;
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Standard_Real a2FPar = Geom2dGcc_CurveTool::FirstParameter(C2);
|
||||
Standard_Real a2LPar = Geom2dGcc_CurveTool::LastParameter(C2);
|
||||
Standard_Integer aNbSamples2 = Geom2dGcc_CurveTool::NbSamples(C2);
|
||||
Standard_Real aStep2 = (a2LPar - a2FPar)/aNbSamples2;
|
||||
Standard_Real Param2 = a2FPar;
|
||||
Standard_Integer i;
|
||||
Standard_Integer j;
|
||||
|
||||
for (i = 0; i <= aNbSamples1 && NbrSol < 4; i++) {
|
||||
Param2 = a2FPar;
|
||||
|
||||
for (j = 0; j <= aNbSamples2 && NbrSol < 4; j++) {
|
||||
Geom2dGcc_MyL2d2Tan Lin(Qc1,Qc2,Param1,Param2,Tolang);
|
||||
|
||||
if (Lin.IsDone()) {
|
||||
if (Add(NbrSol + 1, Lin, Tolang, C1, C2))
|
||||
NbrSol++;
|
||||
}
|
||||
Param2 += aStep2;
|
||||
}
|
||||
Param1 += aStep1;
|
||||
}
|
||||
|
||||
WellDone = (NbrSol > 0);
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Lin2d2Tan::
|
||||
Geom2dGcc_Lin2d2Tan (const Geom2dGcc_QualifiedCurve& Qualified1,
|
||||
const gp_Pnt2d& ThePoint ,
|
||||
const Standard_Real Tolang ):
|
||||
linsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
qualifier2(1,2),
|
||||
pnttg1sol(1,2) ,
|
||||
pnttg2sol(1,2) ,
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccAna_Lin2d2Tan Lin(Qc1,ThePoint,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
|
||||
if (WellDone) {
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Tangency2(i,par2sol(i),pararg2(i),pnttg2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Standard_Real aFirstPar = Geom2dGcc_CurveTool::FirstParameter(C1);
|
||||
Standard_Real aLastPar = Geom2dGcc_CurveTool::LastParameter(C1);
|
||||
Standard_Integer aNbSamples = Geom2dGcc_CurveTool::NbSamples(C1);
|
||||
Standard_Real aStep = (aLastPar - aFirstPar)/aNbSamples;
|
||||
Standard_Real Param1 = aFirstPar;
|
||||
Standard_Integer i;
|
||||
|
||||
for (i = 0; i <= aNbSamples && NbrSol < 2; i++) {
|
||||
Geom2dGcc_MyL2d2Tan Lin(Qc1,ThePoint,Param1,Tolang);
|
||||
|
||||
if (Lin.IsDone()) {
|
||||
if (Add(NbrSol + 1, Lin, Tolang, C1, Geom2dAdaptor_Curve()))
|
||||
NbrSol++;
|
||||
}
|
||||
|
||||
Param1 += aStep;
|
||||
}
|
||||
|
||||
WellDone = (NbrSol > 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Oct 16 11:44:41 2002 End
|
||||
|
||||
Geom2dGcc_Lin2d2Tan::
|
||||
Geom2dGcc_Lin2d2Tan (const Geom2dGcc_QualifiedCurve& Qualified1,
|
||||
const Geom2dGcc_QualifiedCurve& Qualified2,
|
||||
const Standard_Real Tolang ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real Param2 ):
|
||||
linsol(1,4) ,
|
||||
qualifier1(1,4),
|
||||
qualifier2(1,4),
|
||||
pnttg1sol(1,4) ,
|
||||
pnttg2sol(1,4) ,
|
||||
par1sol(1,4) ,
|
||||
par2sol(1,4) ,
|
||||
pararg1(1,4) ,
|
||||
pararg2(1,4)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Geom2dAdaptor_Curve C2 = Qualified2.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
Handle(Geom2d_Curve) CC2 = C2.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
GeomAbs_CurveType Type2 = C2.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle && Type2 == GeomAbs_Circle ) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
Handle(Geom2d_Circle) CCC2 = Handle(Geom2d_Circle)::DownCast(CC2);
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccEnt_QualifiedCirc Qc2=GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
GccAna_Lin2d2Tan Lin(Qc1,Qc2,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:50:48 2001 Begin
|
||||
if (WellDone) {
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:50:49 2001 End
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Tangency2(i,par2sol(i),pararg2(i),pnttg2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyQCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyL2d2Tan Lin(Qc1,Qc2,Param1,Param2,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:51:59 2001 Begin
|
||||
if (WellDone) {
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:52:00 2001 End
|
||||
NbrSol = 1;
|
||||
linsol(1) = Lin.ThisSolution();
|
||||
Lin.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Lin.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
Lin.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Lin2d2Tan::
|
||||
Geom2dGcc_Lin2d2Tan (const Geom2dGcc_QualifiedCurve& Qualified1,
|
||||
const gp_Pnt2d& ThePoint ,
|
||||
const Standard_Real Tolang ,
|
||||
const Standard_Real Param1 ):
|
||||
linsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
qualifier2(1,2),
|
||||
pnttg1sol(1,2) ,
|
||||
pnttg2sol(1,2) ,
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccAna_Lin2d2Tan Lin(Qc1,ThePoint,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:52:32 2001 Begin
|
||||
if (WellDone) {
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:52:34 2001 End
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Tangency2(i,par2sol(i),pararg2(i),pnttg2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i),qualifier2(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyL2d2Tan Lin(Qc1,ThePoint,Param1,Tolang);
|
||||
WellDone = Lin.IsDone();
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:53:01 2001 Begin
|
||||
if (WellDone) {
|
||||
// Modified by Sergey KHROMOV - Thu Apr 5 17:53:02 2001 End
|
||||
NbrSol = 1;
|
||||
linsol(1) = Lin.ThisSolution();
|
||||
Lin.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Lin.Tangency2(par2sol(1),pararg2(1),pnttg2sol(1));
|
||||
Lin.WhichQualifier(qualifier1(1),qualifier2(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Lin2d2Tan::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Lin2d2Tan::
|
||||
NbSolutions () const { return NbrSol; }
|
||||
|
||||
gp_Lin2d Geom2dGcc_Lin2d2Tan::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (Index > NbrSol || Index <= 0) { Standard_OutOfRange::Raise(); }
|
||||
return linsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2d2Tan::
|
||||
WhichQualifier (const Standard_Integer Index ,
|
||||
GccEnt_Position& Qualif1,
|
||||
GccEnt_Position& Qualif2) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
Qualif1 = qualifier1(Index);
|
||||
Qualif2 = qualifier2(Index);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2d2Tan::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2d2Tan::
|
||||
Tangency2 (const Standard_Integer Index ,
|
||||
Standard_Real& ParSol ,
|
||||
Standard_Real& ParArg ,
|
||||
gp_Pnt2d& PntSol ) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pnttg2sol(Index);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Lin2d2Tan::Add(const Standard_Integer theIndex,
|
||||
const Geom2dGcc_MyL2d2Tan &theLin,
|
||||
const Standard_Real theTol,
|
||||
const Geom2dAdaptor_Curve &theC1,
|
||||
const Geom2dAdaptor_Curve &theC2)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Real aPar1sol;
|
||||
Standard_Real aPar2sol;
|
||||
Standard_Real aPar1arg;
|
||||
Standard_Real aPar2arg;
|
||||
gp_Pnt2d aPnt1Sol;
|
||||
gp_Pnt2d aPnt2Sol;
|
||||
gp_Lin2d aLin = theLin.ThisSolution();
|
||||
|
||||
theLin.Tangency1(aPar1sol, aPar1arg, aPnt1Sol);
|
||||
theLin.Tangency2(aPar2sol, aPar2arg, aPnt2Sol);
|
||||
|
||||
for(i = 1; i < theIndex; i++) {
|
||||
if (Abs(aPar1arg - pararg1(i)) <= theTol &&
|
||||
Abs(aPar2arg - pararg2(i)) <= theTol)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Dir2d aLinDir = aLin.Direction();
|
||||
gp_Vec2d aVTan;
|
||||
gp_Pnt2d aPoint;
|
||||
|
||||
Geom2dGcc_CurveTool::D1(theC1, aPar1arg, aPoint, aVTan);
|
||||
|
||||
if (Abs(aLinDir.Crossed(gp_Dir2d(aVTan))) > theTol)
|
||||
return Standard_False;
|
||||
|
||||
if (!theC2.Curve().IsNull()) {
|
||||
Geom2dGcc_CurveTool::D1(theC2, aPar2arg, aPoint, aVTan);
|
||||
|
||||
if (Abs(aLinDir.Crossed(gp_Dir2d(aVTan))) > theTol)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
linsol(theIndex) = aLin;
|
||||
par1sol(theIndex) = aPar1sol;
|
||||
pararg1(theIndex) = aPar1arg;
|
||||
pnttg1sol(theIndex) = aPnt1Sol;
|
||||
par2sol(theIndex) = aPar2sol;
|
||||
pararg2(theIndex) = aPar2arg;
|
||||
pnttg2sol(theIndex) = aPnt2Sol;
|
||||
|
||||
theLin.WhichQualifier(qualifier1(theIndex),qualifier2(theIndex));
|
||||
|
||||
return Standard_True;
|
||||
}
|
215
src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cdl
Executable file
215
src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cdl
Executable file
@@ -0,0 +1,215 @@
|
||||
-- File: Lin2dTanObl.cdl
|
||||
-- Created: Tue Oct 20 16:24:34 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Lin2dTanObl from Geom2dGcc
|
||||
|
||||
---Purpose: This class implements the algorithms used to
|
||||
-- create 2d line tangent to a curve QualifiedCurv and
|
||||
-- doing an angle Angle with a line TheLin.
|
||||
-- The angle must be in Radian.
|
||||
-- Describes functions for building a 2D line making a given
|
||||
-- angle with a line and tangential to a curve.
|
||||
-- A Lin2dTanObl object provides a framework for:
|
||||
-- - defining the construction of 2D line(s),
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result(s).
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Lin2d from gp,
|
||||
Pnt2d from gp,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfLin2d from TColgp,
|
||||
QualifiedCurve from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
Curve from Geom2dAdaptor,
|
||||
MyL2dTanObl from Geom2dGcc
|
||||
|
||||
raises BadQualifier from GccEnt,
|
||||
NotDone from StdFail,
|
||||
IsParallel from GccIter,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 11:40:57 2002 Begin
|
||||
|
||||
-- Add constructor without initial parameter Param1 which
|
||||
-- calculate all solutions.
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
TheLin : Lin2d from gp ;
|
||||
TolAng : Real from Standard ;
|
||||
Angle : Real from Standard )
|
||||
returns Lin2dTanObl from Geom2dGcc
|
||||
raises BadQualifier from GccEnt;
|
||||
---Purpose: This class implements the algorithm used to
|
||||
-- create 2d line tangent to a curve and doing an
|
||||
-- angle Angle with the line TheLin.
|
||||
-- Angle must be in Radian.
|
||||
-- Tolang is the angular tolerance.
|
||||
|
||||
-- Modified by Sergey KHROMOV - Thu Oct 17 10:34:00 2002 End
|
||||
|
||||
Create (Qualified1 : QualifiedCurve from Geom2dGcc ;
|
||||
TheLin : Lin2d from gp ;
|
||||
TolAng : Real from Standard ;
|
||||
Param1 : Real from Standard ;
|
||||
Angle : Real from Standard )
|
||||
returns Lin2dTanObl from Geom2dGcc
|
||||
raises BadQualifier from GccEnt;
|
||||
---Purpose: This class implements the algorithm used to
|
||||
-- create 2d line tangent to a curve and doing an
|
||||
-- angle Angle with the line TheLin.
|
||||
-- Angle must be in Radian.
|
||||
-- Param2 is the initial guess on the curve QualifiedCurv.
|
||||
-- Tolang is the angular tolerance.
|
||||
-- Warning
|
||||
-- An iterative algorithm is used if Qualified1 is more
|
||||
-- complex than a line or a circle. In such cases, the
|
||||
-- algorithm constructs only one solution.
|
||||
-- Exceptions
|
||||
-- GccEnt_BadQualifier if a qualifier is inconsistent with
|
||||
-- the argument it qualifies (for example, enclosed for a circle).
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the construction algorithm does not fail
|
||||
-- (even if it finds no solution).
|
||||
-- Note: IsDone protects against a failure arising from a
|
||||
-- more internal intersection algorithm, which has reached its numeric limits.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
---Purpose: Returns the number of lines, representing solutions computed by this algorithm.
|
||||
-- Exceptions
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
ThisSolution(me ;
|
||||
Index : Integer from Standard) returns Lin2d from gp
|
||||
raises OutOfRange,NotDone
|
||||
is static;
|
||||
---Purpose: Returns a line, representing the solution of index Index
|
||||
-- computed by this algorithm.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
|
||||
---Purpose: Returns the qualifier Qualif1 of the tangency argument
|
||||
-- for the solution of index Index computed by this algorithm.
|
||||
-- The returned qualifier is:
|
||||
-- - that specified at the start of construction when the
|
||||
-- solutions are defined as enclosing or outside with
|
||||
-- respect to the argument, or
|
||||
-- - that computed during construction (i.e. enclosing or
|
||||
-- outside) when the solutions are defined as unqualified
|
||||
-- with respect to the argument, or
|
||||
-- - GccEnt_noqualifier if the tangency argument is a point.
|
||||
-- Exceptions
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises OutOfRange,NotDone
|
||||
is static;
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result and the first argument.
|
||||
-- ParSol is the intrinsic parameter of the point PntSol on
|
||||
-- the solution curv.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on
|
||||
-- the argument curv.
|
||||
|
||||
Intersection2 (me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
raises NotDone from StdFail, IsParallel from GccIter, OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Returns the point of intersection PntSol between the
|
||||
-- solution of index Index and the second argument (the line) of this algorithm.
|
||||
-- ParSol is the parameter of the point PntSol on the
|
||||
-- solution. ParArg is the parameter of the point PntSol on the second argument (the line).
|
||||
-- Exceptions
|
||||
-- StdFail_NotDone if the construction fails.
|
||||
-- GccIter_IsParallel if the solution and the second
|
||||
-- argument (the line) are parallel.
|
||||
-- Standard_OutOfRange if Index is less than zero or
|
||||
-- greater than the number of solutions computed by this algorithm.
|
||||
|
||||
IsParallel2(me) returns Boolean from Standard
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
---Purpose: Returns true if the line and the solution are parallel. This
|
||||
-- is the case when the angle given at the time of
|
||||
-- construction is equal to 0 or Pi.
|
||||
-- Exceptions StdFail_NotDone if the construction fails.
|
||||
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 12:04:52 2002 Begin
|
||||
Add(me: in out; theIndex: Integer from Standard;
|
||||
theLin : MyL2dTanObl from Geom2dGcc;
|
||||
theTol : Real from Standard;
|
||||
theC1 : Curve from Geom2dAdaptor)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
-- Modified by Sergey KHROMOV - Wed Oct 16 12:04:52 2002 End
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
-- True if the algorithm succeeded.
|
||||
|
||||
Paral2 : Boolean from Standard;
|
||||
-- True if the solution is parallel to the second argument (Angle = 0).
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: number of solutions.
|
||||
|
||||
linsol : Array1OfLin2d from TColgp;
|
||||
---Purpose : The solution.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the first argument.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the first argument on
|
||||
-- the solution.
|
||||
|
||||
pntint2sol : Array1OfPnt2d from TColgp;
|
||||
-- The tangency point between the solution and the second argument on
|
||||
-- the solution.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the
|
||||
-- first argument on the solution.
|
||||
|
||||
par2sol : Array1OfReal from TColStd;
|
||||
-- The parameter of the intersection point between the solution and the
|
||||
-- second argument on the solution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
-- The parameter of the tangency point between the solution and the first
|
||||
-- argument on the first argument.
|
||||
|
||||
pararg2 : Array1OfReal from TColStd;
|
||||
-- The parameter of the intersection point between the solution and
|
||||
-- the second argument on the second argument.
|
||||
|
||||
end Lin2dTanObl;
|
226
src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx
Executable file
226
src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx
Executable file
@@ -0,0 +1,226 @@
|
||||
// File: Geom2dGcc_Lin2dTanObl.cxx
|
||||
// Created: Wed Oct 21 14:53:14 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@phobox>
|
||||
|
||||
#include <Geom2dGcc_Lin2dTanObl.ixx>
|
||||
#include <Geom2dGcc_MyQCurve.hxx>
|
||||
#include <GccAna_Lin2dTanObl.hxx>
|
||||
#include <Geom2dGcc_MyL2dTanObl.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <GccEnt_QualifiedCirc.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_NegativeValue.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Geom2dGcc_CurveTool.hxx>
|
||||
|
||||
Geom2dGcc_Lin2dTanObl::
|
||||
Geom2dGcc_Lin2dTanObl (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const gp_Lin2d& TheLine ,
|
||||
const Standard_Real TolAng ,
|
||||
const Standard_Real Angle ):
|
||||
linsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
pnttg1sol(1,2) ,
|
||||
pntint2sol(1,2),
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle ) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccAna_Lin2dTanObl Lin(Qc1,TheLine,Angle);
|
||||
if((WellDone = Lin.IsDone())) {
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Intersection2(i,par2sol(i),pararg2(i),pntint2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Standard_Real aFirstPar = Geom2dGcc_CurveTool::FirstParameter(C1);
|
||||
Standard_Real aLastPar = Geom2dGcc_CurveTool::LastParameter(C1);
|
||||
Standard_Integer aNbSamples = Geom2dGcc_CurveTool::NbSamples(C1);
|
||||
Standard_Real aStep = (aLastPar - aFirstPar)/aNbSamples;
|
||||
Standard_Real Param1 = aFirstPar;
|
||||
Standard_Integer i;
|
||||
|
||||
for (i = 0; i <= aNbSamples && NbrSol < 2; i++) {
|
||||
Geom2dGcc_MyL2dTanObl Lin(Qc1,TheLine,Param1,TolAng,Angle);
|
||||
|
||||
if (Lin.IsDone()) {
|
||||
if (Add(NbrSol + 1, Lin, TolAng, C1))
|
||||
NbrSol++;
|
||||
}
|
||||
|
||||
Param1 += aStep;
|
||||
}
|
||||
|
||||
WellDone = (NbrSol > 0);
|
||||
}
|
||||
}
|
||||
|
||||
Geom2dGcc_Lin2dTanObl::
|
||||
Geom2dGcc_Lin2dTanObl (const Geom2dGcc_QualifiedCurve& Qualified1 ,
|
||||
const gp_Lin2d& TheLine ,
|
||||
const Standard_Real TolAng ,
|
||||
const Standard_Real Param1 ,
|
||||
const Standard_Real Angle ):
|
||||
linsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
pnttg1sol(1,2) ,
|
||||
pntint2sol(1,2),
|
||||
par1sol(1,2) ,
|
||||
par2sol(1,2) ,
|
||||
pararg1(1,2) ,
|
||||
pararg2(1,2)
|
||||
{
|
||||
Geom2dAdaptor_Curve C1 = Qualified1.Qualified();
|
||||
Handle(Geom2d_Curve) CC1 = C1.Curve();
|
||||
GeomAbs_CurveType Type1 = C1.GetType();
|
||||
|
||||
//=============================================================================
|
||||
// Appel a GccAna. +
|
||||
//=============================================================================
|
||||
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (Type1 == GeomAbs_Circle ) {
|
||||
Handle(Geom2d_Circle) CCC1 = Handle(Geom2d_Circle)::DownCast(CC1);
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier());
|
||||
GccAna_Lin2dTanObl Lin(Qc1,TheLine,Angle);
|
||||
if((WellDone = Lin.IsDone())) {
|
||||
NbrSol = Lin.NbSolutions();
|
||||
for (Standard_Integer i = 1 ; i <= NbrSol ; i++) {
|
||||
linsol(i) = Lin.ThisSolution(i);
|
||||
Lin.Tangency1(i,par1sol(i),pararg1(i),pnttg1sol(i));
|
||||
Lin.Intersection2(i,par2sol(i),pararg2(i),pntint2sol(i));
|
||||
Lin.WhichQualifier(i,qualifier1(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyL2dTanObl Lin(Qc1,TheLine,TolAng,Param1,Angle);
|
||||
if((WellDone = Lin.IsDone())) {
|
||||
linsol(1) = Lin.ThisSolution();
|
||||
Lin.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1));
|
||||
Lin.Intersection2(par2sol(1),pararg2(1),pntint2sol(1));
|
||||
Lin.WhichQualifier(qualifier1(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Lin2dTanObl::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Lin2dTanObl::
|
||||
NbSolutions () const { return NbrSol; }
|
||||
|
||||
gp_Lin2d Geom2dGcc_Lin2dTanObl::
|
||||
ThisSolution (const Standard_Integer Index) const {
|
||||
|
||||
if (Index > NbrSol || Index <= 0) { Standard_OutOfRange::Raise(); }
|
||||
return linsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2dTanObl::
|
||||
WhichQualifier (const Standard_Integer Index,
|
||||
GccEnt_Position& Qualif1) const
|
||||
{
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else { Qualif1 = qualifier1(Index); }
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2dTanObl::
|
||||
Tangency1 (const Standard_Integer Index,
|
||||
Standard_Real& ParSol,
|
||||
Standard_Real& ParArg,
|
||||
gp_Pnt2d& PntSol) const {
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
PntSol = pnttg1sol(Index);
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Lin2dTanObl::
|
||||
Intersection2 (const Standard_Integer Index ,
|
||||
Standard_Real& ParSol ,
|
||||
Standard_Real& ParArg ,
|
||||
gp_Pnt2d& PntSol ) const {
|
||||
if (!WellDone) { StdFail_NotDone::Raise(); }
|
||||
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
|
||||
else {
|
||||
ParSol = par2sol(Index);
|
||||
ParArg = pararg2(Index);
|
||||
PntSol = pntint2sol(Index);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Lin2dTanObl::Add
|
||||
(const Standard_Integer theIndex,
|
||||
const Geom2dGcc_MyL2dTanObl &theLin,
|
||||
const Standard_Real theTol,
|
||||
const Geom2dAdaptor_Curve &theC1)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Real aPar1sol;
|
||||
Standard_Real aPar2sol;
|
||||
Standard_Real aPar1arg;
|
||||
Standard_Real aPar2arg;
|
||||
gp_Pnt2d aPnt1Sol;
|
||||
gp_Pnt2d aPnt2Sol;
|
||||
gp_Lin2d aLin = theLin.ThisSolution();
|
||||
|
||||
theLin.Tangency1(aPar1sol, aPar1arg, aPnt1Sol);
|
||||
theLin.Intersection2(aPar2sol, aPar2arg, aPnt2Sol);
|
||||
|
||||
for(i = 1; i < theIndex; i++) {
|
||||
if (Abs(aPar1arg - pararg1(i)) <= theTol &&
|
||||
Abs(aPar2arg - pararg2(i)) <= theTol)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Dir2d aLinDir = aLin.Direction();
|
||||
gp_Vec2d aVTan;
|
||||
gp_Pnt2d aPoint;
|
||||
|
||||
Geom2dGcc_CurveTool::D1(theC1, aPar1arg, aPoint, aVTan);
|
||||
|
||||
if (Abs(aLinDir.Crossed(gp_Dir2d(aVTan))) > theTol)
|
||||
return Standard_False;
|
||||
|
||||
linsol(theIndex) = aLin;
|
||||
par1sol(theIndex) = aPar1sol;
|
||||
pararg1(theIndex) = aPar1arg;
|
||||
pnttg1sol(theIndex) = aPnt1Sol;
|
||||
par2sol(theIndex) = aPar2sol;
|
||||
pararg2(theIndex) = aPar2arg;
|
||||
pntint2sol(theIndex) = aPnt2Sol;
|
||||
|
||||
theLin.WhichQualifier(qualifier1(theIndex));
|
||||
|
||||
return Standard_True;
|
||||
}
|
106
src/Geom2dGcc/Geom2dGcc_QualifiedCurve.cdl
Executable file
106
src/Geom2dGcc/Geom2dGcc_QualifiedCurve.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: QualifiedCurve.cdl
|
||||
-- Created: Mon Apr 15 15:34:24 1991
|
||||
-- Author: Philippe DAUTRY
|
||||
-- <fid@phobox>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
class QualifiedCurve from Geom2dGcc
|
||||
|
||||
---Purpose: Describes functions for building a qualified 2D curve.
|
||||
-- A qualified 2D curve is a curve with a qualifier which
|
||||
-- specifies whether the solution of a construction
|
||||
-- algorithm using the qualified curve (as an argument):
|
||||
-- - encloses the curve, or
|
||||
-- - is enclosed by the curve, or
|
||||
-- - is built so that both the curve and it are external to one another, or
|
||||
-- - is undefined (all solutions apply).
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Position from GccEnt,
|
||||
Curve from Geom2dAdaptor
|
||||
|
||||
-- raises
|
||||
|
||||
is
|
||||
|
||||
Create(Curve : Curve from Geom2dAdaptor;
|
||||
Qualifier : Position from GccEnt )
|
||||
returns QualifiedCurve from Geom2dGcc;
|
||||
---Purpose: Constructs a qualified curve by assigning the qualifier
|
||||
-- Qualifier to the curve Curve. Qualifier may be:
|
||||
-- - GccEnt_enclosing if the solution of a construction
|
||||
-- algorithm using the qualified curve encloses the curve, or
|
||||
-- - GccEnt_enclosed if the solution is enclosed by the curve, or
|
||||
-- - GccEnt_outside if both the solution and the curve
|
||||
-- are external to one another, or
|
||||
-- - GccEnt_unqualified if all solutions apply.
|
||||
-- Note: The interior of a curve is defined as the left-hand
|
||||
-- side of the curve in relation to its orientation.
|
||||
-- Warning
|
||||
-- Curve is an adapted curve, i.e. an object which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The adapted curve is created in the following way:
|
||||
-- Handle(Geom2d_Curve) mycurve = ... ;
|
||||
-- Geom2dAdaptor_Curve Curve ( mycurve ) ;
|
||||
-- The qualified curve is then constructed with this object:
|
||||
-- GccEnt_Position myQualif = GccEnt_outside ;
|
||||
-- Geom2dGcc_QualifiedCurve myQCurve ( Curve, myQualif );
|
||||
-- is private;
|
||||
|
||||
Qualified(me) returns Curve from Geom2dAdaptor
|
||||
is static;
|
||||
---Purpose: Returns a 2D curve to which the qualifier is assigned.
|
||||
-- Warning
|
||||
-- The returned curve is an adapted curve, i.e. an object
|
||||
-- which is an interface between:
|
||||
-- - the services provided by a 2D curve from the package Geom2d,
|
||||
-- - and those required on the curve by a computation algorithm.
|
||||
-- The Geom2d curve on which the adapted curve is
|
||||
-- based can be obtained in the following way:
|
||||
-- myQualifiedCurve = ... ;
|
||||
-- Geom2dAdaptor_Curve myAdaptedCurve = myQualifiedCurve.Qualified();
|
||||
-- Handle(Geom2d_Curve) = myAdaptedCurve.Curve();
|
||||
|
||||
Qualifier(me) returns Position from GccEnt
|
||||
is static;
|
||||
---Purpose: Returns
|
||||
-- - the qualifier of this qualified curve if it is enclosing,
|
||||
-- enclosed or outside, or
|
||||
-- - GccEnt_noqualifier if it is unqualified.
|
||||
|
||||
IsUnqualified(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if the solution is unqualified and false in the other cases.
|
||||
|
||||
IsEnclosing(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: It returns true if the solution is Enclosing the Curv and false in
|
||||
-- the other cases.
|
||||
|
||||
IsEnclosed(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: It returns true if the solution is Enclosed in the Curv and false in
|
||||
-- the other cases.
|
||||
|
||||
IsOutside(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: It returns true if the solution is Outside the Curv and false in
|
||||
-- the other cases.
|
||||
|
||||
fields
|
||||
|
||||
TheQualifier : Position from GccEnt;
|
||||
TheQualified : Curve from Geom2dAdaptor;
|
||||
|
||||
-- friends
|
||||
|
||||
-- Unqualified(Obj : Curve3) from Geom2dGcc,
|
||||
-- Enclosing (Obj : Curve3) from Geom2dGcc,
|
||||
-- Enclosed (Obj : Curve3) from Geom2dGcc,
|
||||
-- Outside (Obj : Curve3) from Geom2dGcc
|
||||
|
||||
end QualifiedCurve;
|
||||
|
||||
|
42
src/Geom2dGcc/Geom2dGcc_QualifiedCurve.cxx
Executable file
42
src/Geom2dGcc/Geom2dGcc_QualifiedCurve.cxx
Executable file
@@ -0,0 +1,42 @@
|
||||
//File Geom2dGcc_QualifiedCurve.cxx, REG 19/08/91
|
||||
|
||||
#include <Geom2dGcc_QualifiedCurve.ixx>
|
||||
|
||||
Geom2dGcc_QualifiedCurve::
|
||||
Geom2dGcc_QualifiedCurve (const Geom2dAdaptor_Curve& Curve ,
|
||||
const GccEnt_Position Qualifier) {
|
||||
TheQualified = Curve;
|
||||
TheQualifier = Qualifier;
|
||||
}
|
||||
|
||||
Geom2dAdaptor_Curve Geom2dGcc_QualifiedCurve::
|
||||
Qualified () const { return TheQualified; }
|
||||
|
||||
GccEnt_Position Geom2dGcc_QualifiedCurve::
|
||||
Qualifier () const { return TheQualifier; }
|
||||
|
||||
Standard_Boolean Geom2dGcc_QualifiedCurve::
|
||||
IsUnqualified () const {
|
||||
if (TheQualifier == GccEnt_unqualified ) { return Standard_True; }
|
||||
else { return Standard_False; }
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_QualifiedCurve::
|
||||
IsEnclosing () const {
|
||||
if (TheQualifier == GccEnt_enclosing) { return Standard_True; }
|
||||
else { return Standard_False; }
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_QualifiedCurve::
|
||||
IsEnclosed () const {
|
||||
if (TheQualifier == GccEnt_enclosed) { return Standard_True; }
|
||||
else { return Standard_False; }
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_QualifiedCurve::
|
||||
IsOutside () const {
|
||||
if (TheQualifier == GccEnt_outside) { return Standard_True; }
|
||||
else { return Standard_False; }
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user