mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0024773: Convertation of the generic classes to the non-generic. Part 7
1) Generic classes: "GccGeo_Circ2dTanOn", "GccGeo_Circ2d2TanRad", "GccGeo_Circ2d2TanCen", "GccGeo_Circ2d2TanOnRad", "GccGeo_CurvePGTool" from "GccGeo" package converted to the non-generic classes and moved to the "Geom2dGcc" package. Names of this classes were changed to: "Geom2dGcc_Circ2dTanOnGeo", "Geom2dGcc_Circ2d2TanRadGeo", "Geom2dGcc_Circ2d2TanCenGeo", "Geom2dGcc_Circ2d2TanOnRadGeo", "Geom2dGcc_CurveToolGeo". Also "GccGeo_PanGenCurve" unused generic class was deleted. And "GccGeo" package was deleted.
This commit is contained in:
@@ -32,12 +32,12 @@ package Geom2dGcc
|
||||
|
||||
|
||||
uses GccEnt,
|
||||
GccGeo,
|
||||
GccAna,
|
||||
GccIter,
|
||||
StdFail,
|
||||
Geom2dInt,
|
||||
Geom2d,
|
||||
GeomAbs,
|
||||
TColStd,
|
||||
Standard,
|
||||
Geom2dAdaptor,
|
||||
@@ -69,62 +69,32 @@ class Lin2dTanObl;
|
||||
|
||||
class QCurve;
|
||||
|
||||
class MyCurveTool instantiates CurvePGTool from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d);
|
||||
class CurveToolGeo;
|
||||
|
||||
class MyCirc2d2TanOn instantiates Circ2d2TanOn from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt);
|
||||
class Circ2d2TanOnGeo;
|
||||
|
||||
class MyCirc2d2TanRad instantiates Circ2d2TanRad from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt);
|
||||
class Circ2d2TanRadGeo;
|
||||
|
||||
class MyCirc2dTanOnRad instantiates Circ2dTanOnRad from GccGeo
|
||||
(Curve from Geom2dAdaptor ,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
MyCurveTool from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt);
|
||||
class Circ2dTanCenGeo;
|
||||
|
||||
class Circ2dTanOnRadGeo;
|
||||
|
||||
class MyC2d3Tan instantiates Circ2d3Tan from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
class MyCirc2dTanCen instantiates Circ2dTanCen from GccGeo
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
ExtPC2d from Extrema,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
class MyC2d2TanOn instantiates Circ2d2TanOn from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
class MyL2dTanObl instantiates Lin2dTanObl from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
class MyL2d2Tan instantiates Lin2d2Tan from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
||||
class MyL2d2Tan instantiates Lin2d2Tan from GccIter
|
||||
(Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc);
|
||||
|
@@ -42,7 +42,7 @@ uses Curve from Geom2dAdaptor,
|
||||
Point from Geom2d,
|
||||
Circ2d from gp,
|
||||
Circ2d2TanOn from GccAna,
|
||||
MyCirc2d2TanOn from Geom2dGcc,
|
||||
Circ2d2TanOnGeo from Geom2dGcc,
|
||||
MyC2d2TanOn from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
@@ -100,7 +100,7 @@ Results(me : in out ;
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2d2TanOn from Geom2dGcc)
|
||||
Circ : Circ2d2TanOnGeo from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean
|
||||
@@ -284,7 +284,7 @@ fields
|
||||
Invert : Boolean from Standard;
|
||||
|
||||
-- CircAna : Circ2d2TanOn from GccAna;
|
||||
-- CircGeo : MyCirc2d2TanOn from Geom2dGcc;
|
||||
-- CircGeo : Circ2d2TanOnGeo from Geom2dGcc;
|
||||
-- CircIter : MyC2d2TanOn from Geom2dGcc;
|
||||
-- TypeAna : Boolean;
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <Geom2dGcc_Circ2d2TanOn.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_MyCirc2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_Circ2d2TanOnGeo.hxx>
|
||||
#include <Geom2dGcc_MyC2d2TanOn.hxx>
|
||||
#include <Geom2dGcc_QCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
@@ -210,7 +210,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2 =
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc1,Qc2,OnCurve,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Qc1,Qc2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -223,7 +223,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2 =
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc1,Ql2,OnCurve,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Qc1,Ql2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -242,7 +242,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
gp_Circ2d c2(CCC2->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc2 =
|
||||
GccEnt_QualifiedCirc(c2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Qc2,Ql1,OnCurve,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Qc2,Ql1,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -256,7 +256,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
gp_Lin2d l2(LL2->Lin2d());
|
||||
GccEnt_QualifiedLin Ql2 =
|
||||
GccEnt_QualifiedLin(l2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Ql1,Ql2,OnCurve,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Ql1,Ql2,OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -417,7 +417,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
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);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Qc1,Point->Pnt2d(),OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -429,7 +429,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
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);
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Ql1,Point->Pnt2d(),OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -550,7 +550,7 @@ Geom2dGcc_Circ2d2TanOn::
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyCirc2d2TanOn CircGeo(Point1->Pnt2d(),Point2->Pnt2d(),
|
||||
Geom2dGcc_Circ2d2TanOnGeo CircGeo(Point1->Pnt2d(),Point2->Pnt2d(),
|
||||
OnCurve,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
@@ -576,7 +576,7 @@ void Geom2dGcc_Circ2d2TanOn::Results(const GccAna_Circ2d2TanOn& Circ)
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanOn::Results(const Geom2dGcc_MyCirc2d2TanOn& Circ)
|
||||
void Geom2dGcc_Circ2d2TanOn::Results(const Geom2dGcc_Circ2d2TanOnGeo& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
|
293
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cdl
Normal file
293
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cdl
Normal file
@@ -0,0 +1,293 @@
|
||||
-- Created on: 1991-03-29
|
||||
-- Created by: Remi GILET
|
||||
-- Copyright (c) 1991-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Circ2d2TanOnGeo 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 (lines, circles or points).
|
||||
-- - The center line (a curve).
|
||||
-- - The parameter for each tangency argument which
|
||||
-- is a curve.
|
||||
-- - The tolerance.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Lin2d from gp,
|
||||
Circ2d from gp,
|
||||
QualifiedCirc from GccEnt,
|
||||
QualifiedLin from GccEnt,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
CurveToolGeo from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt
|
||||
|
||||
raises NotDone from StdFail,
|
||||
BadQualifier from GccEnt,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCirc from GccEnt ;
|
||||
Qualified2 : QualifiedCirc from GccEnt ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two 2d circles and
|
||||
-- having the center ON a curve.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
Create(Qualified1 : QualifiedCirc from GccEnt ;
|
||||
Qualified2 : QualifiedLin from GccEnt ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a 2d circle and a 2d line
|
||||
-- having the center ON a curve.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
Create(Qualified1 : QualifiedCirc from GccEnt ;
|
||||
Point2 : Pnt2d from gp ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a 2d circle and a point
|
||||
-- having the center ON a curve.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
Create(Qualified1 : QualifiedLin from GccEnt ;
|
||||
Qualified2 : QualifiedLin from GccEnt ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two 2d lines
|
||||
-- having the center ON a curve.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
Create(Qualified1 : QualifiedLin from GccEnt ;
|
||||
Qualified2 : Pnt2d from gp ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a 2d line and a point
|
||||
-- having the center ON a 2d line.
|
||||
raises BadQualifier from GccEnt;
|
||||
|
||||
Create(Point1 : Pnt2d from gp ;
|
||||
Point2 : Pnt2d from gp ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanOnGeo ;
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two points
|
||||
-- having the center ON a 2d line.
|
||||
|
||||
-- ....................................................................
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: This method returns True if the construction
|
||||
-- algorithm succeeded.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
---Purpose: This method returns the number of solutions.
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
|
||||
ThisSolution(me ; Index : Integer) returns Circ2d from gp
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be careful: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to those outside the
|
||||
-- context of the algorithm-object.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
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).
|
||||
|
||||
Tangency1(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
---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.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
---Purpose: Returns informations about the tangency point between the
|
||||
-- result number Index and the second 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.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
CenterOn3 (me ;
|
||||
Index : Integer from Standard;
|
||||
ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
---Purpose: Returns informations about the center (on the curv)
|
||||
-- of the result.
|
||||
-- ParArg is the intrinsic parameter of the point on
|
||||
-- the argument curv.
|
||||
-- PntSol is the center point of the solution curv.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
---Purpose: Returns True if the solution number Index is equal to
|
||||
-- the first argument and False in the other cases.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
IsTheSame2(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
---Purpose: Returns True if the solution number Index is equal to
|
||||
-- the second argument and False in the other cases.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: Number of solutions.
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
---Purpose: The 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: 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 consider 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 consider 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.
|
||||
|
||||
pntcen : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The center point of the solution on 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.
|
||||
|
||||
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.
|
||||
|
||||
parcen3 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the center point of the solution on the
|
||||
-- second argument.
|
||||
|
||||
end Circ2d2TanOnGeo;
|
1074
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx
Normal file
1074
src/Geom2dGcc/Geom2dGcc_Circ2d2TanOnGeo.cxx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@ uses QualifiedCurve from Geom2dGcc,
|
||||
Array1OfInteger from TColStd,
|
||||
Array1OfReal from TColStd,
|
||||
Circ2d2TanRad from GccAna,
|
||||
MyCirc2d2TanRad from Geom2dGcc,
|
||||
Circ2d2TanRadGeo from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
@@ -113,7 +113,7 @@ Results(me : in out ;
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2d2TanRad from Geom2dGcc)
|
||||
Circ : Circ2d2TanRadGeo from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <Geom2dGcc_Circ2d2TanRad.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2d2TanRad.hxx>
|
||||
#include <Geom2dGcc_MyCirc2d2TanRad.hxx>
|
||||
#include <Geom2dGcc_Circ2d2TanRadGeo.hxx>
|
||||
#include <Geom2dGcc_QCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
@@ -178,7 +178,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
GccEnt_QualifiedLin Ql1 = GccEnt_QualifiedLin(l1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql1,Qc2,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Ql1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -193,7 +193,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
GccEnt_QualifiedCirc Qc1 = GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -213,7 +213,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
GccEnt_QualifiedLin Ql2 = GccEnt_QualifiedLin(l2,
|
||||
Qualified2.Qualifier());
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Ql2,Qc1,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Ql2,Qc1,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -229,7 +229,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
GccEnt_QualifiedCirc Qc2 = GccEnt_QualifiedCirc(c2,
|
||||
Qualified2.Qualifier());
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc2,Qc1,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Qc2,Qc1,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -240,7 +240,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
else {
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_QCurve Qc2(C2,Qualified2.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Qc1,Qc2,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -312,7 +312,7 @@ Geom2dGcc_Circ2d2TanRad::
|
||||
//=============================================================================
|
||||
else {
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2d2TanRad CircGeo(Qc1,Point->Pnt2d(),Radius,Tolerance);
|
||||
Geom2dGcc_Circ2d2TanRadGeo CircGeo(Qc1,Point->Pnt2d(),Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
for(Standard_Integer i=1; i<=NbrSol; i++) {
|
||||
@@ -373,7 +373,7 @@ void Geom2dGcc_Circ2d2TanRad::Results(const GccAna_Circ2d2TanRad& Circ)
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2d2TanRad::Results(const Geom2dGcc_MyCirc2d2TanRad& Circ)
|
||||
void Geom2dGcc_Circ2d2TanRad::Results(const Geom2dGcc_Circ2d2TanRadGeo& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
|
261
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cdl
Normal file
261
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cdl
Normal file
@@ -0,0 +1,261 @@
|
||||
-- Created on: 1991-03-29
|
||||
-- Created by: Remi GILET
|
||||
-- Copyright (c) 1991-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Circ2d2TanRadGeo 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 following case : Cu2 is
|
||||
-- inside C1 and there is no intersection point
|
||||
-- between the two elements.
|
||||
-- With Tolerance we will get a solution if the
|
||||
-- lowest distance between C1 and Cu2 is lower than or
|
||||
-- equal Tolerance.
|
||||
|
||||
-- inherits Entity from Standard
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Circ2d from gp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
QualifiedCirc from GccEnt,
|
||||
QualifiedLin from GccEnt,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
CurveToolGeo from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail,
|
||||
NegativeValue from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Qualified1 : QualifiedCirc from GccEnt;
|
||||
Qualified2 : QCurve from Geom2dGcc;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanRadGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a 2d circle and a curve
|
||||
-- with a radius of Radius.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: It raises NegativeValue if Radius is lower than zero.
|
||||
|
||||
Create(Qualified1 : QualifiedLin from GccEnt;
|
||||
Qualified2 : QCurve from Geom2dGcc;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanRadGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a 2d line and a curve
|
||||
-- with a radius of Radius.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: It raises NegativeValue if Radius is lower than zero.
|
||||
|
||||
Create(Qualified1 : QCurve from Geom2dGcc;
|
||||
Qualified2 : QCurve from Geom2dGcc;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanRadGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to two curves with
|
||||
-- a radius of Radius.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: It raises NegativeValue if Radius is lower than zero.
|
||||
|
||||
Create(Qualified1 : QCurve from Geom2dGcc;
|
||||
Point2 : Pnt2d from gp ;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2d2TanRadGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles TANgent to a curve and a point
|
||||
-- with a radius of Radius.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: It raises NegativeValue if Radius is lower than zero.
|
||||
|
||||
-- -- ....................................................................
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: This method returns True if the algorithm succeeded.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
---Purpose: This method returns the number of solutions.
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the algorithm failed.
|
||||
|
||||
ThisSolution(me ;
|
||||
Index : Integer from Standard) returns Circ2d from gp
|
||||
---Purpose: Returns the solution number Index.
|
||||
-- Be careful: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to those outside the context
|
||||
-- of the algorithm-object.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises OutOfRange exception if Index is greater
|
||||
-- than the number of solutions.
|
||||
-- It raises NotDone if the construction algorithm did not
|
||||
-- succeed.
|
||||
|
||||
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 information 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 )
|
||||
---Purpose: Returns information 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.
|
||||
-- ParArg is the intrinsic parameter of the point PntSol on the first
|
||||
-- argument.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises OutOfRange if Index is greater than the number
|
||||
-- of solutions.
|
||||
-- It raises NotDone if the construction algorithm did not
|
||||
-- succeed.
|
||||
|
||||
Tangency2(me ;
|
||||
Index : Integer from Standard;
|
||||
ParSol,ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
---Purpose: Returns information 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.
|
||||
-- ParArg is the intrinsic parameter of the point PntArg on
|
||||
-- the second argument.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises OutOfRange if Index is greater than the number
|
||||
-- of solutions.
|
||||
-- It raises NotDone if the construction algorithm did not
|
||||
-- succeed.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
---Purpose: Returns True if the solution number Index is equal to
|
||||
-- the first argument.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises OutOfRange if Index is greater than the number
|
||||
-- of solutions.
|
||||
-- It raises NotDone if the construction algorithm did not
|
||||
-- succeed.
|
||||
|
||||
IsTheSame2(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
---Purpose: Returns True if the solution number Index is equal to
|
||||
-- the second argument.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises OutOfRange if Index is greater than the number
|
||||
-- of solutions.
|
||||
-- It raises NotDone if the construction algorithm did not
|
||||
-- succeed.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: The number of possible solutions. We have to decide about
|
||||
-- the status of the multiple solutions...
|
||||
|
||||
cirsol : Array1OfCirc2d from TColgp;
|
||||
-- The solutions.
|
||||
|
||||
qualifier1 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the first argument.
|
||||
|
||||
qualifier2 : Array1OfPosition from GccEnt;
|
||||
-- The qualifiers of the second 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 consider 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 consider 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.
|
||||
|
||||
end Circ2d2TanRadGeo;
|
1025
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx
Normal file
1025
src/Geom2dGcc/Geom2dGcc_Circ2d2TanRadGeo.cxx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@
|
||||
#include <Geom2dGcc_Circ2dTanCen.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2dTanCen.hxx>
|
||||
#include <Geom2dGcc_MyCirc2dTanCen.hxx>
|
||||
#include <Geom2dGcc_Circ2dTanCenGeo.hxx>
|
||||
#include <Geom2dGcc_QCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
@@ -85,7 +85,7 @@ Geom2dGcc_Circ2dTanCen::
|
||||
|
||||
else {
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanCen Circ(Qc1,pcenter,Tolerance);
|
||||
Geom2dGcc_Circ2dTanCenGeo Circ(Qc1,pcenter,Tolerance);
|
||||
WellDone = Circ.IsDone();
|
||||
NbrSol = Circ.NbSolutions();
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
|
150
src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cdl
Normal file
150
src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cdl
Normal file
@@ -0,0 +1,150 @@
|
||||
-- Created on: 1991-03-28
|
||||
-- Created by: Remi GILET
|
||||
-- Copyright (c) 1991-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Circ2dTanCenGeo 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 use Tolerance it is impossible to
|
||||
-- find a solution in 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 Pnt2d from gp,
|
||||
Circ2d from gp,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
ExtPC2d from Extrema,
|
||||
QCurve from Geom2dGcc
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create( Qualified1 : QCurve from Geom2dGcc;
|
||||
Pcenter : Pnt2d from gp;
|
||||
Tolerance : Real from Standard) returns Circ2dTanCenGeo
|
||||
---Purpose: This method implements the algorithms used to
|
||||
-- create 2d circles tangent to a circle and
|
||||
-- centered on a point.
|
||||
raises BadQualifier;
|
||||
|
||||
-- -- ....................................................................
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: This method returns True if the construction
|
||||
-- algorithm succeeded.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
---Purpose: Returns the number of solutions and raises NotDone
|
||||
-- exception if the algorithm didn't succeed.
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
|
||||
ThisSolution(me ;
|
||||
Index : Integer from Standard) returns Circ2d from gp
|
||||
---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.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions or less than zero.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
-- 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 )
|
||||
---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 PntArg
|
||||
-- on the argument curv.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions or less than zero.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
end Circ2dTanCenGeo;
|
164
src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx
Normal file
164
src/Geom2dGcc/Geom2dGcc_Circ2dTanCenGeo.cxx
Normal file
@@ -0,0 +1,164 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Geom2dGcc_Circ2dTanCenGeo.ixx>
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Extrema_POnCurv2d.hxx>
|
||||
|
||||
#include <Geom2dGcc_CurveTool.hxx>
|
||||
#include <Extrema_ExtPC2d.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un cercle tangent a une courbe centre en un point. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanCenGeo::
|
||||
Geom2dGcc_Circ2dTanCenGeo (const Geom2dGcc_QCurve& Qualified1,
|
||||
const gp_Pnt2d& Pcenter ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//========================================================================
|
||||
// Initialisation des champs. +
|
||||
//========================================================================
|
||||
|
||||
cirsol(1,2) ,
|
||||
qualifier1(1,2),
|
||||
pnttg1sol(1,2) ,
|
||||
par1sol(1,2) ,
|
||||
pararg1(1,2)
|
||||
{
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
TColgp_Array1OfPnt2d pTan(1,2);
|
||||
TColStd_Array1OfInteger Index(1,2);
|
||||
TColStd_Array1OfReal theDist2(1,2);
|
||||
TColStd_Array1OfReal theParam(1,2);
|
||||
theDist2(1) = RealLast();
|
||||
theDist2(2) = 0.;
|
||||
Standard_Integer i = 1;
|
||||
Standard_Integer nbsol = 0;
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thePar;
|
||||
Geom2dAdaptor_Curve curve = Qualified1.Qualified();
|
||||
Extrema_ExtPC2d distmin(Pcenter,curve,Geom2dGcc_CurveTool::NbSamples(curve),
|
||||
Geom2dGcc_CurveTool::EpsX(curve,Tol),Tol);
|
||||
if (!distmin.IsDone() ) { Standard_Failure::Raise(); }
|
||||
Standard_Integer nbext = distmin.NbExt();
|
||||
if(nbext==0) { Standard_Failure::Raise(); }
|
||||
while (i<=nbext) {
|
||||
thePar = distmin.Point(i).Parameter();
|
||||
if (distmin.SquareDistance(i)<theDist2(1) &&
|
||||
thePar>=Geom2dGcc_CurveTool::FirstParameter(curve) &&
|
||||
thePar <= Geom2dGcc_CurveTool::LastParameter(curve)) {
|
||||
theDist2(1) = distmin.SquareDistance(i);
|
||||
theParam(1) = thePar;
|
||||
pTan(1) = distmin.Point(i).Value();
|
||||
}
|
||||
if (distmin.SquareDistance(i)>theDist2(2) &&
|
||||
thePar>=Geom2dGcc_CurveTool::FirstParameter(curve) &&
|
||||
thePar <= Geom2dGcc_CurveTool::LastParameter(curve)) {
|
||||
theDist2(2) = distmin.SquareDistance(i);
|
||||
theParam(2) = thePar;
|
||||
pTan(2) = distmin.Point(i).Value();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (Index(1) == Index(2)) { nbsol = 1; }
|
||||
else { nbsol = 2; }
|
||||
for (i = 1 ; i <= nbsol; i++) {
|
||||
gp_Pnt2d point1;
|
||||
gp_Vec2d Tan1;
|
||||
Geom2dGcc_CurveTool::D1(curve,theParam(i),point1,Tan1);
|
||||
Standard_Real normetan1 = Tan1.Magnitude();
|
||||
gp_Vec2d Vec1(point1,Pcenter);
|
||||
Standard_Real normevec1 = Vec1.Magnitude();
|
||||
Standard_Real dot1;
|
||||
if (normevec1 >= gp::Resolution() && normetan1 >= gp::Resolution()) {
|
||||
dot1 = Vec1.Dot(Tan1)/(normevec1*normetan1);
|
||||
}
|
||||
else { dot1 = 0.; }
|
||||
Tol = 1.e-12;
|
||||
if (dot1 <= Tol) {
|
||||
Standard_Real Angle1 = Vec1.Angle(Tan1);
|
||||
if (Qualified1.IsUnqualified()||
|
||||
(Qualified1.IsEnclosing()&&Angle1<=0.)||
|
||||
(Qualified1.IsOutside() && Angle1 >= 0.) ||
|
||||
(Qualified1.IsEnclosed() && Angle1 <= 0.)) {
|
||||
NbrSol++;
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Pcenter,dirx),sqrt (theDist2(i)));
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
pararg1(NbrSol) = theParam(i);
|
||||
par1sol(NbrSol) = 0.;
|
||||
pnttg1sol(NbrSol) = pTan(i);
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanCenGeo::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2dTanCenGeo::
|
||||
NbSolutions () const { return NbrSol; }
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2dTanCenGeo::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
if (Index > NbrSol || Index <= 0) Standard_OutOfRange::Raise();
|
||||
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanCenGeo::
|
||||
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_Circ2dTanCenGeo::
|
||||
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 {
|
||||
PntSol = gp_Pnt2d(pnttg1sol(Index));
|
||||
ParSol = par1sol(Index);
|
||||
ParArg = pararg1(Index);
|
||||
}
|
||||
}
|
||||
|
@@ -41,20 +41,20 @@ class Circ2dTanOnRad from Geom2dGcc
|
||||
|
||||
-- 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
|
||||
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,
|
||||
Circ2dTanOnRadGeo from Geom2dGcc,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt
|
||||
|
||||
raises NegativeValue from Standard,
|
||||
OutOfRange from Standard,
|
||||
@@ -115,7 +115,7 @@ Results(me : in out ;
|
||||
is static;
|
||||
|
||||
Results(me : in out ;
|
||||
Circ : MyCirc2dTanOnRad from Geom2dGcc)
|
||||
Circ : Circ2dTanOnRadGeo from Geom2dGcc)
|
||||
is static;
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <Geom2dGcc_Circ2dTanOnRad.ixx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GccAna_Circ2dTanOnRad.hxx>
|
||||
#include <Geom2dGcc_MyCirc2dTanOnRad.hxx>
|
||||
#include <Geom2dGcc_Circ2dTanOnRadGeo.hxx>
|
||||
#include <Geom2dGcc_QCurve.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
@@ -114,7 +114,7 @@ Geom2dGcc_Circ2dTanOnRad::
|
||||
gp_Circ2d c1(CCC1->Circ2d());
|
||||
GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,
|
||||
Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2dTanOnRadGeo CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
@@ -123,14 +123,14 @@ Geom2dGcc_Circ2dTanOnRad::
|
||||
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);
|
||||
Geom2dGcc_Circ2dTanOnRadGeo CircGeo(Ql1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
}
|
||||
else {
|
||||
Geom2dGcc_QCurve Qc1(C1,Qualified1.Qualifier());
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2dTanOnRadGeo CircGeo(Qc1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
@@ -190,7 +190,7 @@ Geom2dGcc_Circ2dTanOnRad::
|
||||
//=============================================================================
|
||||
|
||||
else {
|
||||
Geom2dGcc_MyCirc2dTanOnRad CircGeo(point1,OnCurve,Radius,Tolerance);
|
||||
Geom2dGcc_Circ2dTanOnRadGeo CircGeo(point1,OnCurve,Radius,Tolerance);
|
||||
WellDone = CircGeo.IsDone();
|
||||
NbrSol = CircGeo.NbSolutions();
|
||||
Results(CircGeo);
|
||||
@@ -210,7 +210,7 @@ void Geom2dGcc_Circ2dTanOnRad::Results(const GccAna_Circ2dTanOnRad& Circ)
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRad::Results(const Geom2dGcc_MyCirc2dTanOnRad& Circ)
|
||||
void Geom2dGcc_Circ2dTanOnRad::Results(const Geom2dGcc_Circ2dTanOnRadGeo& Circ)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= NbrSol; j++) {
|
||||
cirsol(j) = Circ.ThisSolution(j);
|
||||
|
267
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cdl
Normal file
267
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cdl
Normal file
@@ -0,0 +1,267 @@
|
||||
-- Created on: 1991-04-03
|
||||
-- Created by: Remi GILET
|
||||
-- Copyright (c) 1991-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Circ2dTanOnRadGeo 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 use Tolerance it is impossible to
|
||||
-- find a solution in 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,
|
||||
Array1OfCirc2d from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
QualifiedCirc from GccEnt,
|
||||
QualifiedLin from GccEnt,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Position from GccEnt,
|
||||
Array1OfPosition from GccEnt,
|
||||
Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
QCurve from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d,
|
||||
HCurve from Geom2dAdaptor,
|
||||
CurveToolGeo from Geom2dGcc,
|
||||
TheIntConicCurveOfGInter from Geom2dInt,
|
||||
GInter from Geom2dInt
|
||||
|
||||
raises NegativeValue from Standard,
|
||||
OutOfRange from Standard,
|
||||
BadQualifier from GccEnt,
|
||||
NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
-- On a line .............................................................
|
||||
|
||||
Create(Qualified1 : QCurve from Geom2dGcc;
|
||||
OnLine : Lin2d from gp;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles tangent to a curve and centered on a 2d Line
|
||||
-- with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
-- -- On a circle ...........................................................
|
||||
|
||||
Create(Qualified1 : QCurve from Geom2dGcc;
|
||||
OnCirc : Circ2d from gp;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles tangent to a curve and centered on a 2d Circle
|
||||
-- with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
-- On a curve ............................................................
|
||||
|
||||
Create(Qualified1 : QualifiedCirc from GccEnt ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles tangent to a circle and centered on a 2d curve
|
||||
-- with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
Create(Qualified1 : QualifiedLin from GccEnt ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles tangent to a 2d Line and centered on a 2d curve
|
||||
-- with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
Create(Qualified1 : QCurve from Geom2dGcc;
|
||||
OnCurv : Curve from Geom2dAdaptor;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles tangent to a 2d curve and centered on a 2d curve
|
||||
-- with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue, BadQualifier;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
Create(Point1 : Pnt2d from gp ;
|
||||
OnCurv : Curve from Geom2dAdaptor ;
|
||||
Radius : Real from Standard;
|
||||
Tolerance : Real from Standard) returns Circ2dTanOnRadGeo
|
||||
---Purpose: This methods implements the algorithms used to create
|
||||
-- 2d Circles passing through a 2d point and centered on a
|
||||
-- 2d curve with a given radius.
|
||||
-- Tolerance is used to find solution in every limit cases.
|
||||
raises NegativeValue;
|
||||
---Purpose: raises NegativeValue in case of NegativeRadius.
|
||||
|
||||
-- -- ....................................................................
|
||||
|
||||
IsDone(me) returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: This method returns True if the construction
|
||||
-- algorithm succeeded.
|
||||
|
||||
NbSolutions(me) returns Integer from Standard
|
||||
---Purpose: This method returns the number of solutions.
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
|
||||
ThisSolution(me ;
|
||||
Index : Integer from Standard) returns Circ2d from gp
|
||||
---Purpose: Returns the solution number Index and raises OutOfRange
|
||||
-- exception if Index is greater than the number of solutions.
|
||||
-- Be careful: the Index is only a way to get all the
|
||||
-- solutions, but is not associated to theses outside the
|
||||
-- context of the algorithm-object.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
WhichQualifier(me ;
|
||||
Index : Integer from Standard;
|
||||
Qualif1 : out Position from GccEnt )
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
-- 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 )
|
||||
---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.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
CenterOn3 (me ;
|
||||
Index : Integer from Standard;
|
||||
ParArg : out Real from Standard;
|
||||
PntSol : out Pnt2d from gp )
|
||||
---Purpose: Returns informations about the center (on the curv)
|
||||
-- of the result.
|
||||
-- ParArg is the intrinsic parameter of the point on
|
||||
-- the argument curv.
|
||||
-- PntSol is the center point of the solution curv.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
IsTheSame1(me ;
|
||||
Index : Integer from Standard) returns Boolean from Standard
|
||||
---Purpose: Returns True if the solution number Index is equal to
|
||||
-- the first argument and False in the other cases.
|
||||
raises OutOfRange, NotDone
|
||||
is static;
|
||||
---Purpose: It raises NotDone if the construction algorithm
|
||||
-- didn't succeed.
|
||||
-- It raises OutOfRange if Index is greater than the
|
||||
-- number of solutions.
|
||||
|
||||
fields
|
||||
|
||||
WellDone : Boolean from Standard;
|
||||
---Purpose: True if the algorithm succeeded.
|
||||
|
||||
NbrSol : Integer from Standard;
|
||||
---Purpose: 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;
|
||||
---Purpose: 1 if the solution and the first argument are the same in the
|
||||
-- tolerance of Tolerance.
|
||||
-- 0 in the other cases.
|
||||
|
||||
pnttg1sol : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The tangency point between the solution and the first
|
||||
-- argument on the solution.
|
||||
|
||||
pntcen3 : Array1OfPnt2d from TColgp;
|
||||
---Purpose: The center point of the solution on the first argument.
|
||||
|
||||
par1sol : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution
|
||||
-- and the first argument on thesolution.
|
||||
|
||||
pararg1 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the tangency point between the solution
|
||||
-- and the first argument on the first argument.
|
||||
|
||||
parcen3 : Array1OfReal from TColStd;
|
||||
---Purpose: The parameter of the center point of the solution on the
|
||||
-- second argument.
|
||||
|
||||
end Circ2dTanOnRadGeo;
|
786
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx
Normal file
786
src/Geom2dGcc/Geom2dGcc_Circ2dTanOnRadGeo.cxx
Normal file
@@ -0,0 +1,786 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//========================================================================
|
||||
// circulaire tangent a un element de type : - Cercle. +
|
||||
// - Ligne. +
|
||||
// - Point. +
|
||||
// centre sur un deuxieme element de type : - Cercle. +
|
||||
// - Ligne. +
|
||||
// de rayon donne : Radius. +
|
||||
//========================================================================
|
||||
|
||||
#include <Geom2dGcc_Circ2dTanOnRadGeo.ixx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_NegativeValue.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <GccEnt_BadQualifier.hxx>
|
||||
#include <IntRes2d_Domain.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
|
||||
#include <Geom2dGcc_CurveTool.hxx>
|
||||
#include <Adaptor3d_OffsetCurve.hxx>
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Geom2dGcc_CurveToolGeo.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
|
||||
const gp_Lin2d& OnLine ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
|
||||
Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
|
||||
GccEnt_BadQualifier::Raise();
|
||||
return;
|
||||
}
|
||||
Standard_Integer nbrcote1 = 0;
|
||||
TColStd_Array1OfReal Coef(1,2);
|
||||
Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
|
||||
|
||||
if (Radius < 0.0) { Standard_NegativeValue::Raise(); }
|
||||
else {
|
||||
if (Qualified1.IsEnclosed()) {
|
||||
// ===========================
|
||||
nbrcote1 = 1;
|
||||
Coef(1) = Radius;
|
||||
}
|
||||
else if(Qualified1.IsOutside()) {
|
||||
// ===============================
|
||||
nbrcote1 = 1;
|
||||
Coef(1) = -Radius;
|
||||
}
|
||||
else if(Qualified1.IsUnqualified()) {
|
||||
// ===================================
|
||||
nbrcote1 = 2;
|
||||
Coef(1) = Radius;
|
||||
Coef(2) = -Radius;
|
||||
}
|
||||
IntRes2d_Domain D1;
|
||||
Geom2dInt_TheIntConicCurveOfGInter Intp;
|
||||
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
|
||||
Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
|
||||
Adaptor3d_OffsetCurve C2(HCu1,Coef(jcote1));
|
||||
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol);
|
||||
Intp.Perform(OnLine,D1,C2,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
|
||||
const gp_Circ2d& OnCirc ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
Standard_Integer nbrcote1=0;
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
|
||||
Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
|
||||
GccEnt_BadQualifier::Raise();
|
||||
return;
|
||||
}
|
||||
TColStd_Array1OfReal cote1(1,2);
|
||||
Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
|
||||
|
||||
if (Radius < 0.0) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
if (Qualified1.IsEnclosed()) {
|
||||
// ===========================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = Radius;
|
||||
}
|
||||
else if(Qualified1.IsOutside()) {
|
||||
// ===============================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = -Radius;
|
||||
}
|
||||
else if(Qualified1.IsUnqualified()) {
|
||||
// ===================================
|
||||
nbrcote1 = 2;
|
||||
cote1(1) = Radius;
|
||||
cote1(2) = -Radius;
|
||||
}
|
||||
IntRes2d_Domain D1(ElCLib::Value(0.,OnCirc), 0.,Tol,
|
||||
ElCLib::Value(2.*M_PI,OnCirc),2.*M_PI,Tol);
|
||||
D1.SetEquivalentParameters(0.,2.*M_PI);
|
||||
Geom2dInt_TheIntConicCurveOfGInter Intp;
|
||||
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
|
||||
Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
|
||||
Adaptor3d_OffsetCurve C2(HCu1,cote1(jcote1));
|
||||
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol);
|
||||
Intp.Perform(OnCirc,D1,C2,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const GccEnt_QualifiedCirc& Qualified1,
|
||||
const Geom2dAdaptor_Curve& OnCurv ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
Standard_Integer nbrcote1=0;
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
|
||||
Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
|
||||
GccEnt_BadQualifier::Raise();
|
||||
return;
|
||||
}
|
||||
TColStd_Array1OfReal cote1(1,2);
|
||||
gp_Circ2d C1 = Qualified1.Qualified();
|
||||
gp_Pnt2d center1(C1.Location());
|
||||
Standard_Real R1 = C1.Radius();
|
||||
|
||||
if (Radius < 0.0) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
if (Qualified1.IsEnclosed()) {
|
||||
// ===========================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = Radius;
|
||||
}
|
||||
else if(Qualified1.IsOutside()) {
|
||||
// ===============================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = -Radius;
|
||||
}
|
||||
else if(Qualified1.IsUnqualified()) {
|
||||
// ===================================
|
||||
nbrcote1 = 2;
|
||||
cote1(1) = Radius;
|
||||
cote1(2) = -Radius;
|
||||
}
|
||||
Geom2dInt_TheIntConicCurveOfGInter Intp;
|
||||
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
|
||||
gp_Circ2d Circ(C1.XAxis(),R1 + cote1(jcote1));
|
||||
IntRes2d_Domain D1(ElCLib::Value(0.,Circ), 0.,Tol,
|
||||
ElCLib::Value(2.*M_PI,Circ),2.*M_PI,Tol);
|
||||
D1.SetEquivalentParameters(0.,2.*M_PI);
|
||||
firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
|
||||
Intp.Perform(Circ,D1,OnCurv,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
Standard_Real distcc1 = Center.Distance(center1);
|
||||
if (!Qualified1.IsUnqualified()) {
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
}
|
||||
else if (Abs(distcc1+Radius-R1) < Tol) {
|
||||
qualifier1(NbrSol) = GccEnt_enclosed;
|
||||
}
|
||||
else if (Abs(distcc1-R1-Radius) < Tol) {
|
||||
qualifier1(NbrSol) = GccEnt_outside;
|
||||
}
|
||||
else { qualifier1(NbrSol) = GccEnt_enclosing; }
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),C1);
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const GccEnt_QualifiedLin& Qualified1,
|
||||
const Geom2dAdaptor_Curve& OnCurv ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (!(Qualified1.IsEnclosed() ||
|
||||
Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
|
||||
GccEnt_BadQualifier::Raise();
|
||||
return;
|
||||
}
|
||||
Standard_Integer nbrcote1=0;
|
||||
TColStd_Array1OfReal cote1(1,2);
|
||||
gp_Lin2d L1 = Qualified1.Qualified();
|
||||
gp_Pnt2d origin1(L1.Location());
|
||||
gp_Dir2d dir1(L1.Direction());
|
||||
gp_Dir2d norm1(-dir1.Y(),dir1.X());
|
||||
|
||||
if (Radius < 0.0) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
if (Qualified1.IsEnclosed()) {
|
||||
// ===========================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = Radius;
|
||||
}
|
||||
else if(Qualified1.IsOutside()) {
|
||||
// ===============================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = -Radius;
|
||||
}
|
||||
else if(Qualified1.IsUnqualified()) {
|
||||
// ===================================
|
||||
nbrcote1 = 2;
|
||||
cote1(1) = Radius;
|
||||
cote1(2) = -Radius;
|
||||
}
|
||||
Geom2dInt_TheIntConicCurveOfGInter Intp;
|
||||
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
|
||||
gp_Pnt2d Point(dir1.XY()+cote1(jcote1)*norm1.XY());
|
||||
gp_Lin2d Line(Point,dir1); // ligne avec deport.
|
||||
IntRes2d_Domain D1;
|
||||
firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
|
||||
Intp.Perform(Line,D1,OnCurv,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
gp_Dir2d dc1(origin1.XY()-Center.XY());
|
||||
if (!Qualified1.IsUnqualified()) {
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
}
|
||||
else if (dc1.Dot(norm1) > 0.0) {
|
||||
qualifier1(NbrSol) = GccEnt_outside;
|
||||
}
|
||||
else { qualifier1(NbrSol) = GccEnt_enclosed; }
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),L1);
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const Geom2dGcc_QCurve& Qualified1,
|
||||
const Geom2dAdaptor_Curve& OnCurv ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
Standard_Integer nbrcote1=0;
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
if (!(Qualified1.IsEnclosed() || Qualified1.IsEnclosing() ||
|
||||
Qualified1.IsOutside() || Qualified1.IsUnqualified())) {
|
||||
GccEnt_BadQualifier::Raise();
|
||||
return;
|
||||
}
|
||||
TColStd_Array1OfReal cote1(1,2);
|
||||
Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
|
||||
|
||||
if (Radius < 0.0) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
if (Qualified1.IsEnclosed()) {
|
||||
// ===========================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = Radius;
|
||||
}
|
||||
else if(Qualified1.IsOutside()) {
|
||||
// ===============================
|
||||
nbrcote1 = 1;
|
||||
cote1(1) = -Radius;
|
||||
}
|
||||
else if(Qualified1.IsUnqualified()) {
|
||||
// ===================================
|
||||
nbrcote1 = 2;
|
||||
cote1(1) = Radius;
|
||||
cote1(2) = -Radius;
|
||||
}
|
||||
Geom2dInt_GInter Intp;
|
||||
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
|
||||
Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
|
||||
Adaptor3d_OffsetCurve C1(HCu1,cote1(jcote1));
|
||||
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C1),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C1),thelast);
|
||||
IntRes2d_Domain D1(Geom2dGcc_CurveToolGeo::Value(C1,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveToolGeo::Value(C1,lastparam),lastparam,Tol);
|
||||
Handle(Geom2dAdaptor_HCurve) HOnCurv = new Geom2dAdaptor_HCurve(OnCurv);
|
||||
Adaptor3d_OffsetCurve C2(HOnCurv);
|
||||
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol);
|
||||
Intp.Perform(C1,D1,C2,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
qualifier1(NbrSol) = Qualified1.Qualifier();
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = gp_Pnt2d(Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol)));
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Cercle tangent : a un cercle Qualified1 (C1). +
|
||||
// centre : sur une droite OnLine. +
|
||||
// de rayon : Radius. +
|
||||
// +
|
||||
// On initialise le tableau de solutions cirsol ainsi que tous les +
|
||||
// champs. +
|
||||
// On elimine en fonction du qualifieur les cas ne presentant pas de +
|
||||
// solutions. +
|
||||
// On resoud l equation du second degre indiquant que le point de centre +
|
||||
// recherche (xc,yc) est a une distance Radius du cercle C1 et +
|
||||
// sur la droite OnLine. +
|
||||
// Les solutions sont representees par les cercles : +
|
||||
// - de centre Pntcen(xc,yc) +
|
||||
// - de rayon Radius. +
|
||||
//=========================================================================
|
||||
|
||||
Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
Geom2dGcc_Circ2dTanOnRadGeo (const gp_Pnt2d& Point1 ,
|
||||
const Geom2dAdaptor_Curve& OnCurv ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Real Tolerance ):
|
||||
|
||||
//=========================================================================
|
||||
// Initialisation des champs. +
|
||||
//=========================================================================
|
||||
|
||||
cirsol(1,8) ,
|
||||
qualifier1(1,8) ,
|
||||
TheSame1(1,8) ,
|
||||
pnttg1sol(1,8) ,
|
||||
pntcen3(1,8) ,
|
||||
par1sol(1,8) ,
|
||||
pararg1(1,8) ,
|
||||
parcen3(1,8)
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
Standard_Real thefirst = -100000.;
|
||||
Standard_Real thelast = 100000.;
|
||||
Standard_Real firstparam;
|
||||
Standard_Real lastparam;
|
||||
Standard_Real Tol = Abs(Tolerance);
|
||||
WellDone = Standard_False;
|
||||
NbrSol = 0;
|
||||
|
||||
if (Radius < 0.0) {
|
||||
Standard_NegativeValue::Raise();
|
||||
}
|
||||
else {
|
||||
// gp_Dir2d Dir(-y1dir,x1dir);
|
||||
gp_Circ2d Circ(gp_Ax2d(Point1,gp_Dir2d(1.,0.)),Radius);
|
||||
IntRes2d_Domain D1(ElCLib::Value(0.,Circ), 0.,Tol,
|
||||
ElCLib::Value(2.*M_PI,Circ),2*M_PI,Tol);
|
||||
D1.SetEquivalentParameters(0.,2.*M_PI);
|
||||
firstparam = Max(Geom2dGcc_CurveTool::FirstParameter(OnCurv),thefirst);
|
||||
lastparam = Min(Geom2dGcc_CurveTool::LastParameter(OnCurv),thelast);
|
||||
IntRes2d_Domain D2(Geom2dGcc_CurveTool::Value(OnCurv,firstparam),firstparam,Tol,
|
||||
Geom2dGcc_CurveTool::Value(OnCurv,lastparam),lastparam,Tol);
|
||||
Geom2dInt_TheIntConicCurveOfGInter Intp(Circ,D1,OnCurv,D2,Tol,Tol);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
|
||||
NbrSol++;
|
||||
gp_Pnt2d Center(Intp.Point(i).Value());
|
||||
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
|
||||
// =======================================================
|
||||
qualifier1(NbrSol) = GccEnt_noqualifier;
|
||||
TheSame1(NbrSol) = 0;
|
||||
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
|
||||
parcen3(NbrSol) = Intp.Point(i).ParamOnSecond();
|
||||
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
|
||||
pnttg1sol(NbrSol));
|
||||
pnttg1sol(NbrSol) = Point1;
|
||||
pntcen3(NbrSol) = Center;
|
||||
}
|
||||
WellDone = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
IsDone () const { return WellDone; }
|
||||
|
||||
Standard_Integer Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
NbSolutions () const { return NbrSol; }
|
||||
|
||||
gp_Circ2d Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
ThisSolution (const Standard_Integer Index) const
|
||||
{
|
||||
|
||||
if (Index > NbrSol || Index <= 0)
|
||||
Standard_OutOfRange::Raise();
|
||||
|
||||
return cirsol(Index);
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
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_Circ2dTanOnRadGeo::
|
||||
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 = gp_Pnt2d(pnttg1sol(Index));
|
||||
}
|
||||
}
|
||||
|
||||
void Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
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 = pnttg1sol(Index);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_Circ2dTanOnRadGeo::
|
||||
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;
|
||||
}
|
127
src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cdl
Normal file
127
src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cdl
Normal file
@@ -0,0 +1,127 @@
|
||||
-- Created on: 1992-06-04
|
||||
-- Created by: Jacques GOUSSARD
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class CurveToolGeo from Geom2dGcc
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Vec2d from gp,
|
||||
Lin2d from gp,
|
||||
Circ2d from gp,
|
||||
Elips2d from gp,
|
||||
Parab2d from gp,
|
||||
Hypr2d from gp,
|
||||
CurveType from GeomAbs,
|
||||
Shape from GeomAbs,
|
||||
Curve from Geom2dAdaptor,
|
||||
CurveTool from Geom2dGcc,
|
||||
OffsetCurve from Adaptor3d
|
||||
|
||||
is
|
||||
|
||||
TheType(myclass; C: OffsetCurve from Adaptor3d )
|
||||
returns CurveType from GeomAbs;
|
||||
|
||||
Line(myclass; C: OffsetCurve from Adaptor3d)
|
||||
---Purpose: Returns the Lin2d from gp corresponding to the curve C.
|
||||
-- This method is called only when TheType returns
|
||||
-- IntCurve_Lin.
|
||||
returns Lin2d from gp;
|
||||
|
||||
Circle(myclass; C: OffsetCurve from Adaptor3d)
|
||||
---Purpose: Returns the Circ2d from gp corresponding to the curve C.
|
||||
-- This method is called only when TheType returns
|
||||
-- IntCurve_Cir.
|
||||
returns Circ2d from gp;
|
||||
|
||||
Ellipse(myclass; C: OffsetCurve from Adaptor3d)
|
||||
---Purpose: Returns the Elips2d from gp corresponding to the curve C.
|
||||
-- This method is called only when TheType returns
|
||||
-- IntCurve_Eli.
|
||||
returns Elips2d from gp;
|
||||
|
||||
Parabola(myclass; C: OffsetCurve from Adaptor3d)
|
||||
---Purpose: Returns the Parab2d from gp corresponding to the curve C.
|
||||
-- This method is called only when TheType returns
|
||||
-- IntCurve_Prb.
|
||||
returns Parab2d from gp;
|
||||
|
||||
Hyperbola(myclass; C: OffsetCurve from Adaptor3d)
|
||||
---Purpose: Returns the Hypr2d from gp corresponding to the curve C.
|
||||
-- This method is called only when TheType returns
|
||||
-- IntCurve_Hpr.
|
||||
returns Hypr2d from gp;
|
||||
|
||||
-- The following method are used only when TheType returns IntCurve_Other.
|
||||
|
||||
FirstParameter(myclass;C: OffsetCurve from Adaptor3d)
|
||||
returns Real;
|
||||
|
||||
LastParameter(myclass;C: OffsetCurve from Adaptor3d)
|
||||
returns Real;
|
||||
|
||||
EpsX (myclass ;
|
||||
C : OffsetCurve from Adaptor3d ;
|
||||
Tol : Real from Standard)
|
||||
returns Real;
|
||||
|
||||
NbSamples(myclass ;
|
||||
C : OffsetCurve from Adaptor3d)
|
||||
returns Integer;
|
||||
|
||||
Value (myclass ;
|
||||
C : OffsetCurve from Adaptor3d;
|
||||
X : Real )
|
||||
returns Pnt2d from gp;
|
||||
|
||||
D1 (myclass; C : OffsetCurve from Adaptor3d ;
|
||||
U : Real ;
|
||||
P : out Pnt2d ;
|
||||
T : out Vec2d );
|
||||
|
||||
D2 (myclass; C : OffsetCurve from Adaptor3d ;
|
||||
U : Real ;
|
||||
P : out Pnt2d ;
|
||||
T,N : out Vec2d );
|
||||
|
||||
IsComposite(myclass; C:OffsetCurve from Adaptor3d)
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
-- The following methods are used only when IsComposite returns True.
|
||||
|
||||
|
||||
GetIntervals(myclass ; C:OffsetCurve from Adaptor3d) returns Integer from Standard;
|
||||
---Purpose : Outputs the number of interval of continuity C1 of
|
||||
-- the curve
|
||||
-- used if Type == Composite.
|
||||
|
||||
GetInterval (myclass; C : OffsetCurve from Adaptor3d
|
||||
; Index : Integer from Standard
|
||||
; U1, U2 : out Real from Standard);
|
||||
---Purpose : Outputs the bounds of interval of index <Index>
|
||||
-- used if Type == Composite.
|
||||
|
||||
SetCurrentInterval (myclass; C: in out OffsetCurve from Adaptor3d
|
||||
; Index : Integer from Standard);
|
||||
---Purpose : Set the current valid interval of index <Index>
|
||||
-- inside which the computations will be done
|
||||
-- (used if Type == Composite).
|
||||
|
||||
end CurveToolGeo;
|
||||
|
||||
|
||||
|
||||
|
147
src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cxx
Normal file
147
src/Geom2dGcc/Geom2dGcc_CurveToolGeo.cxx
Normal file
@@ -0,0 +1,147 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Geom2dGcc_CurveToolGeo.ixx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
#include <Extrema_POnCurv2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#include <Adaptor3d_OffsetCurve.hxx>
|
||||
|
||||
GeomAbs_CurveType Geom2dGcc_CurveToolGeo::
|
||||
TheType(const Adaptor3d_OffsetCurve& ) {
|
||||
return GeomAbs_OtherCurve;
|
||||
}
|
||||
|
||||
gp_Lin2d Geom2dGcc_CurveToolGeo::
|
||||
Line (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return gp_Lin2d();
|
||||
}
|
||||
|
||||
gp_Circ2d Geom2dGcc_CurveToolGeo::
|
||||
Circle (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return gp_Circ2d();
|
||||
}
|
||||
|
||||
gp_Elips2d Geom2dGcc_CurveToolGeo::
|
||||
Ellipse (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return gp_Elips2d();
|
||||
}
|
||||
|
||||
gp_Parab2d Geom2dGcc_CurveToolGeo::
|
||||
Parabola (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return gp_Parab2d();
|
||||
}
|
||||
|
||||
gp_Hypr2d Geom2dGcc_CurveToolGeo::
|
||||
Hyperbola (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return gp_Hypr2d();
|
||||
}
|
||||
|
||||
Standard_Real
|
||||
Geom2dGcc_CurveToolGeo::EpsX (const Adaptor3d_OffsetCurve& /*C*/,
|
||||
const Standard_Real Tol) {
|
||||
return Tol;
|
||||
}
|
||||
|
||||
Standard_Integer
|
||||
Geom2dGcc_CurveToolGeo::NbSamples (const Adaptor3d_OffsetCurve& C) {
|
||||
GeomAbs_CurveType typC = C.GetType();
|
||||
Standard_Integer nbs = 20;
|
||||
if(typC == GeomAbs_Line)
|
||||
nbs = 2;
|
||||
else if(typC == GeomAbs_BezierCurve)
|
||||
nbs = 3 + C.Bezier()->NbPoles();
|
||||
else if(typC == GeomAbs_BSplineCurve) {
|
||||
Handle(Geom2d_BSplineCurve) BSC = C.BSpline();
|
||||
nbs = BSC->NbKnots();
|
||||
nbs*= BSC->Degree();
|
||||
if(nbs < 2) nbs=2;
|
||||
}
|
||||
return(nbs);
|
||||
}
|
||||
|
||||
Standard_Real
|
||||
Geom2dGcc_CurveToolGeo::FirstParameter (const Adaptor3d_OffsetCurve& C) {
|
||||
return C.FirstParameter();
|
||||
}
|
||||
|
||||
Standard_Real
|
||||
Geom2dGcc_CurveToolGeo::LastParameter (const Adaptor3d_OffsetCurve& C) {
|
||||
return C.LastParameter();
|
||||
}
|
||||
|
||||
gp_Pnt2d
|
||||
Geom2dGcc_CurveToolGeo::Value (const Adaptor3d_OffsetCurve& C,
|
||||
const Standard_Real U) {
|
||||
|
||||
return C.Value(U);
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveToolGeo::D1(const Adaptor3d_OffsetCurve& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T) {
|
||||
C.D1(U,P,T);
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveToolGeo::D2(const Adaptor3d_OffsetCurve& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T,
|
||||
gp_Vec2d& N) {
|
||||
C.D2(U,P,T,N);
|
||||
}
|
||||
|
||||
Standard_Boolean Geom2dGcc_CurveToolGeo::
|
||||
IsComposite (const Adaptor3d_OffsetCurve& ) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer Geom2dGcc_CurveToolGeo::
|
||||
GetIntervals (const Adaptor3d_OffsetCurve& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveToolGeo::
|
||||
GetInterval (const Adaptor3d_OffsetCurve& ,
|
||||
const Standard_Integer ,
|
||||
Standard_Real& ,
|
||||
Standard_Real& ) {
|
||||
cout << "Not implemented" << endl;
|
||||
}
|
||||
|
||||
void Geom2dGcc_CurveToolGeo::
|
||||
SetCurrentInterval ( Adaptor3d_OffsetCurve& ,
|
||||
const Standard_Integer ) {
|
||||
cout << "Not implemented" << endl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user