1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +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:
dln 2014-03-28 09:35:15 +04:00 committed by apn
parent 0b85f9a605
commit 578ce4bebf
26 changed files with 2361 additions and 2634 deletions

View File

@ -133,7 +133,6 @@ p FairCurve
p FilletSurf
p GccAna
p GccEnt
p GccGeo
p GccInt
p GccIter
p Geom2dAPI

View File

@ -1,55 +0,0 @@
-- Created on: 1991-04-04
-- 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.
package GccGeo
---Purpose :
-- This package provides an implementation of analytic algorithms
-- (using only non-persistant entities) used to create 2d lines or
-- circles with geometric constraints.
uses GccEnt,
GccInt,
IntCurve,
GeomAbs,
TColStd,
Standard,
StdFail,
TColgp,
gp
is
generic class CurvePGTool;
generic class ParGenCurve;
generic class Circ2dTanCen;
-- Create a 2d circle TANgent to a 2d entity and CENtered on a 2d point.
generic class Circ2d2TanRad;
-- Create a 2d circle TANgent to 2 2d entities with the given RADius.
generic class Circ2dTanOnRad;
-- Create a 2d circle TANgent to a 2d entity and centered ON a 2d
-- entity (not a point) with the given radius.
generic class Circ2d2TanOn;
-- Create a 2d circle TANgent to 2 2d entities (circle, line or point)
-- and centered ON a 2d curve.
end GccGeo;

File diff suppressed because it is too large Load Diff

View File

@ -1,777 +0,0 @@
// 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 <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>
//=========================================================================
// 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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const TheQCurve& 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);
TheCurve 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;
TheIntConicCurve Intp;
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
Handle(TheHParGenCurve) HCu1 = new TheHParGenCurve(Cu1);
TheParGenCurve C2(HCu1,Coef(jcote1));
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::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(TheTool::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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const TheQCurve& 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);
TheCurve 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);
TheIntConicCurve Intp;
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
Handle(TheHParGenCurve) HCu1 = new TheHParGenCurve(Cu1);
TheParGenCurve C2(HCu1,cote1(jcote1));
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::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(TheTool::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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const GccEnt_QualifiedCirc& Qualified1,
const TheCurve& 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;
}
TheIntConicCurve 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(TheTool::FirstParameter(OnCurv),thefirst);
lastparam = Min(TheTool::LastParameter(OnCurv),thelast);
IntRes2d_Domain D2(TheTool::Value(OnCurv,firstparam),firstparam,Tol,
TheTool::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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const GccEnt_QualifiedLin& Qualified1,
const TheCurve& 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;
}
TheIntConicCurve 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(TheTool::FirstParameter(OnCurv),thefirst);
lastparam = Min(TheTool::LastParameter(OnCurv),thelast);
IntRes2d_Domain D2(TheTool::Value(OnCurv,firstparam),firstparam,Tol,
TheTool::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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const TheQCurve& Qualified1,
const TheCurve& 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);
TheCurve 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;
}
TheIntCurveCurve Intp;
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
Handle(TheHParGenCurve) HCu1 = new TheHParGenCurve(Cu1);
TheParGenCurve C1(HCu1,cote1(jcote1));
firstparam = Max(TheCurvePGTool::FirstParameter(C1),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C1),thelast);
IntRes2d_Domain D1(TheCurvePGTool::Value(C1,firstparam),firstparam,Tol,
TheCurvePGTool::Value(C1,lastparam),lastparam,Tol);
Handle(TheHParGenCurve) HOnCurv = new TheHParGenCurve(OnCurv);
TheParGenCurve C2(HOnCurv);
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::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(TheTool::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. +
//=========================================================================
GccGeo_Circ2dTanOnRad::
GccGeo_Circ2dTanOnRad (const gp_Pnt2d& Point1 ,
const TheCurve& 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(TheTool::FirstParameter(OnCurv),thefirst);
lastparam = Min(TheTool::LastParameter(OnCurv),thelast);
IntRes2d_Domain D2(TheTool::Value(OnCurv,firstparam),firstparam,Tol,
TheTool::Value(OnCurv,lastparam),lastparam,Tol);
TheIntConicCurve 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 GccGeo_Circ2dTanOnRad::
IsDone () const { return WellDone; }
Standard_Integer GccGeo_Circ2dTanOnRad::
NbSolutions () const { return NbrSol; }
gp_Circ2d GccGeo_Circ2dTanOnRad::
ThisSolution (const Standard_Integer Index) const
{
if (Index > NbrSol || Index <= 0)
Standard_OutOfRange::Raise();
return cirsol(Index);
}
void GccGeo_Circ2dTanOnRad::
WhichQualifier(const Standard_Integer Index ,
GccEnt_Position& Qualif1 ) const
{
if (!WellDone) { StdFail_NotDone::Raise(); }
else if (Index <= 0 ||Index > NbrSol) { Standard_OutOfRange::Raise(); }
else {
Qualif1 = qualifier1(Index);
}
}
void GccGeo_Circ2dTanOnRad::
Tangency1 (const Standard_Integer Index,
Standard_Real& ParSol,
Standard_Real& ParArg,
gp_Pnt2d& PntSol) const{
if (!WellDone) {
StdFail_NotDone::Raise();
}
else if (Index <= 0 ||Index > NbrSol) {
Standard_OutOfRange::Raise();
}
else {
ParSol = par1sol(Index);
ParArg = pararg1(Index);
PntSol = gp_Pnt2d(pnttg1sol(Index));
}
}
void GccGeo_Circ2dTanOnRad::
CenterOn3 (const Standard_Integer Index,
Standard_Real& ParArg,
gp_Pnt2d& PntSol) const {
if (!WellDone) {
StdFail_NotDone::Raise();
}
else if (Index <= 0 ||Index > NbrSol) {
Standard_OutOfRange::Raise();
}
else {
ParArg = parcen3(Index);
PntSol = pnttg1sol(Index);
}
}
Standard_Boolean GccGeo_Circ2dTanOnRad::
IsTheSame1 (const Standard_Integer Index) const
{
if (!WellDone) StdFail_NotDone::Raise();
if (Index <= 0 ||Index > NbrSol) Standard_OutOfRange::Raise();
if (TheSame1(Index) == 0)
return Standard_False;
return Standard_True;
}

View File

@ -1,148 +0,0 @@
// 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 <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>
GeomAbs_CurveType GccGeo_CurvePGTool::
TheType(const TheParGenCurve& ) {
return GeomAbs_OtherCurve;
}
gp_Lin2d GccGeo_CurvePGTool::
Line (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return gp_Lin2d();
}
gp_Circ2d GccGeo_CurvePGTool::
Circle (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return gp_Circ2d();
}
gp_Elips2d GccGeo_CurvePGTool::
Ellipse (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return gp_Elips2d();
}
gp_Parab2d GccGeo_CurvePGTool::
Parabola (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return gp_Parab2d();
}
gp_Hypr2d GccGeo_CurvePGTool::
Hyperbola (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return gp_Hypr2d();
}
Standard_Real
GccGeo_CurvePGTool::EpsX (const TheParGenCurve& /*C*/,
const Standard_Real Tol) {
return Tol;
}
Standard_Integer
GccGeo_CurvePGTool::NbSamples (const TheParGenCurve& 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
GccGeo_CurvePGTool::FirstParameter (const TheParGenCurve& C) {
return C.FirstParameter();
}
Standard_Real
GccGeo_CurvePGTool::LastParameter (const TheParGenCurve& C) {
return C.LastParameter();
}
gp_Pnt2d
GccGeo_CurvePGTool::Value (const TheParGenCurve& C,
const Standard_Real U) {
return C.Value(U);
}
void GccGeo_CurvePGTool::D1(const TheParGenCurve& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T) {
C.D1(U,P,T);
}
void GccGeo_CurvePGTool::D2(const TheParGenCurve& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T,
gp_Vec2d& N) {
C.D2(U,P,T,N);
}
Standard_Boolean GccGeo_CurvePGTool::
IsComposite (const TheParGenCurve& ) {
return Standard_False;
}
Standard_Integer GccGeo_CurvePGTool::
GetIntervals (const TheParGenCurve& ) {
cout << "Not implemented" << endl;
return 0;
}
void GccGeo_CurvePGTool::
GetInterval (const TheParGenCurve& ,
const Standard_Integer ,
Standard_Real& ,
Standard_Real& ) {
cout << "Not implemented" << endl;
}
void GccGeo_CurvePGTool::
SetCurrentInterval ( TheParGenCurve& ,
const Standard_Integer ) {
cout << "Not implemented" << endl;
}

View File

@ -1,58 +0,0 @@
-- Created on: 1991-11-18
-- 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.
generic class ParGenCurve from GccGeo (TheCurve as any)
---Purpose: Definition of a virtual curve.
uses Pnt2d from gp,
Vec2d from gp
is
Create returns ParGenCurve;
Create(C : TheCurve) returns ParGenCurve;
Create(C : TheCurve ;
D : Real from Standard ) returns ParGenCurve;
Value(me; U : Real)returns Pnt2d;
--- Purpose : Computes the point of parameter U on the curve
D1 (me; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp);
--- Purpose : Computes the point of parameter U on the curve with its
-- first derivative.
D2 (me; U : Real; P : out Pnt2d from gp ; V1,V2 : out Vec2d from gp);
--- Purpose : Computes the point of parameter U on the curve with its
-- first derivative and second derivative.
FirstParameter(me) returns Real;
LastParameter(me) returns Real;
GetResolution(me) returns Real;
GetIntervals(me) returns Integer;
fields
Cu : TheCurve ;
Dep : Real from Standard;
end ParGenCurve;

View File

@ -1,122 +0,0 @@
// 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 <GccGeo_ParGenCurve_Gen.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Standard_NotImplemented.hxx>
GccGeo_ParGenCurve::
GccGeo_ParGenCurve () {
Dep = 0.;
}
GccGeo_ParGenCurve::
GccGeo_ParGenCurve (const TheCurve& C ,
const Standard_Real D ) {
Cu = C;
Dep = D;
}
Standard_Real GccGeo_ParGenCurve::GetResolution() {
return Cu.GetResolution();
}
Standard_Integer GccGeo_ParGenCurve::GetIntervals() {
return Cu.GetIntervals();
}
gp_Pnt2d
GccGeo_ParGenCurve::Value (const Standard_Real U) {
gp_Pnt2d P;
gp_Vec2d V;
Standard_Real NorTan;
if (deport!=0.) {
Cu.D1(U,P,V);
NorTan= V.Magnitude();
V.SetCoord(V.Y(),-V.X());
if (NorTan >= gp::Resolution()) {
return gp_Pnt2d(P.XY()+deport*V.XY()/NorTan);
}
else {
gp_VectorWithNullMagnitude::Raise();
}
}
else {
return Cu.Value(U);
}
}
void GccGeo_ParGenCurve::D1(const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T) {
gp_Vec2d V1,V2,V3;
gp_Pnt2d PP;
Standard_Real Nor1,Alfa;
Standard_Integer Index,firstKnot,lastKnot;
if (deport != 0.) {
Cu.D2(U,PP,V1,V2);
Nor1= V1.Magnitude();
V3.SetCoord(V1.Y(),-V1.X());
V2.SetCoord(V2.Y(),-V2.X());
if (Nor1 >= gp::Resolution()) {
P = gp_Pnt2d(PP.XY()+deport*V3.XY()/Nor1);
Alfa = V1.XY()/Nor1*V2.XY()/Nor1;
T = gp_Vec2d( V1.XY() + (deport/Nor1)*(V2.XY()-Alfa*V3.XY()));
}
else {
gp_VectorWithNullMagnitude::Raise();
}
}
else {
Cu.D1(U,P,T);
}
}
void GccGeo_ParGenCurve::D2(const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T,
gp_Vec2d& N) {
gp_Pnt2d PP;
gp_Vec2d V11,V22,V1t,V2t,V33;
Standard_Real Nor1,Alfa,Dalfa;
Standard_Integer Index,firstKnot,lastKnot;
if (deport!=0.) {
Cu.D3(U,PP,V11,V22,V33);
Nor1= V1.Magnitude();
V1t.SetCoord(V11.Y(),-V11.X());
V2t.SetCoord(V22.Y(),-V22.X());
V33.SetCoord(V33.Y(),-V33.X());
if (Nor1 >= gp::Resolution()) {
P = gp_Pnt2d(PP.XY()+deport*V1t.XY()/Nor1);
Alfa = V1t.XY()/Nor1*V2t.XY()/Nor1;
Dalfa= (V2t.XY()/Nor1*V2t.XY()/Nor1)+
(V1t.XY()/Nor1*V33.XY()/Nor1)-
2.*Alfa*Alfa;
T = gp_Vec2d( V11.XY() + (deport/Nor1)*(V2t.XY()-Alfa*V1t.XY()));
N = gp_Vec2d( V22.XY() + (deport/Nor1)*(V33.XY()-2.*Alfa*V2t.XY()-
(Dalfa-Alfa*Alfa)*V1t.XY()));
}
else {
gp_VectorWithNullMagnitude::Raise();
}
}
else {
Cu.D2(U,P,T,N);
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -14,22 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Circ2d2TanOn from GccGeo (
TheCurve as any; --
TheTool as any; --
TheQCurve as any; -- as QualifiedCurve from GccEnt
-- (TheCurve)
TheParGenCurve as any; -- as ParGenCurve from GccGeo
-- (TheCurve)
TheHParGenCurve as Transient;
TheCurvePGTool as any; -- as CurvePGTool from GccGeo
-- (Thecurve,
-- TheTool,
-- TheParGenCurve)
TheIntConicCurve as any) -- as TheIntConicCurveOfGOffsetInter from IntCurve
-- (TheParGenCurve,
-- TheCurvePGTool)
class Circ2d2TanOnGeo from Geom2dGcc
---Purpose: This class implements the algorithms used to
-- create 2d circles TANgent to 2 entities and
@ -55,7 +40,14 @@ uses Pnt2d from gp,
Array1OfInteger from TColStd,
Array1OfReal from TColStd,
Position from GccEnt,
Array1OfPosition 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,
@ -65,8 +57,8 @@ is
Create(Qualified1 : QualifiedCirc from GccEnt ;
Qualified2 : QualifiedCirc from GccEnt ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn
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.
@ -74,8 +66,8 @@ raises BadQualifier from GccEnt;
Create(Qualified1 : QualifiedCirc from GccEnt ;
Qualified2 : QualifiedLin from GccEnt ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn
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.
@ -83,8 +75,8 @@ raises BadQualifier from GccEnt;
Create(Qualified1 : QualifiedCirc from GccEnt ;
Point2 : Pnt2d from gp ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn
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.
@ -92,8 +84,8 @@ raises BadQualifier from GccEnt;
Create(Qualified1 : QualifiedLin from GccEnt ;
Qualified2 : QualifiedLin from GccEnt ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn
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.
@ -101,8 +93,8 @@ raises BadQualifier from GccEnt;
Create(Qualified1 : QualifiedLin from GccEnt ;
Qualified2 : Pnt2d from gp ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn
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.
@ -110,8 +102,8 @@ raises BadQualifier from GccEnt;
Create(Point1 : Pnt2d from gp ;
Point2 : Pnt2d from gp ;
OnCurv : TheCurve ;
Tolerance : Real from Standard) returns Circ2d2TanOn ;
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.
@ -298,4 +290,4 @@ fields
---Purpose: The parameter of the center point of the solution on the
-- second argument.
end Circ2d2TanOn;
end Circ2d2TanOnGeo;

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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);

View File

@ -14,23 +14,8 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Circ2d2TanRad from GccGeo (
TheCurve as any;
TheTool as any;
TheQCurve as any; -- as QualifiedCurve from GccEnt
-- (TheCurve)
TheParGenCurve as any; -- as ParGenCurve from GccGeo
-- (TheCurve)
TheHParGenCurve as Transient;
TheCurvePGTool as any; -- as CurvePGTool from GccGeo
-- (Thecurve,
-- TheTool,
-- TheParGenCurve)
TheIntConicCurve as any; -- as IntConicCurveOfGOffsetInter
TheIntCurveCurve as any) -- as GOffsetInter from Geom2dInt
-- (TheParGenCurve,
-- TheCurvePGTool)
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.
@ -64,7 +49,15 @@ uses Pnt2d from gp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Position from GccEnt,
Array1OfPosition 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,
@ -73,40 +66,40 @@ raises OutOfRange from Standard,
is
Create(Qualified1 : QualifiedCirc from GccEnt ;
Qualified2 : TheQCurve ;
Create(Qualified1 : QualifiedCirc from GccEnt;
Qualified2 : QCurve from Geom2dGcc;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2d2TanRad
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 : TheQCurve ;
Create(Qualified1 : QualifiedLin from GccEnt;
Qualified2 : QCurve from Geom2dGcc;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2d2TanRad
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 : TheQCurve ;
Qualified2 : TheQCurve ;
Create(Qualified1 : QCurve from Geom2dGcc;
Qualified2 : QCurve from Geom2dGcc;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2d2TanRad
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 : TheQCurve ;
Create(Qualified1 : QCurve from Geom2dGcc;
Point2 : Pnt2d from gp ;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2d2TanRad
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.
@ -265,4 +258,4 @@ fields
---Purpose: The parameter of the tangency point between the solution
-- and the second argument on the second argument.
end Circ2d2TanRad;
end Circ2d2TanRadGeo;

View File

@ -12,6 +12,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Geom2dGcc_Circ2d2TanRadGeo.ixx>
#include <ElCLib.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Circ2d.hxx>
@ -24,6 +26,12 @@
#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>
// circulaire tant a une courbe et une droite ,de rayon donne
//==============================================================
@ -38,11 +46,11 @@
// On remplit les champs. +
//========================================================================
GccGeo_Circ2d2TanRad::
GccGeo_Circ2d2TanRad (const GccEnt_QualifiedLin& Qualified1,
const TheQCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
Geom2dGcc_Circ2d2TanRadGeo::
Geom2dGcc_Circ2d2TanRadGeo (const GccEnt_QualifiedLin& Qualified1,
const Geom2dGcc_QCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
//========================================================================
// initialisation des champs. +
@ -92,7 +100,7 @@ pararg2(1,16)
Standard_Real lyloc = (L1.Location()).Y();
gp_Pnt2d origin1(lxloc,lyloc);
gp_Dir2d normL1(-y1dir,x1dir);
TheCurve Cu2= Qualified2.Qualified();
Geom2dAdaptor_Curve Cu2= Qualified2.Qualified();
if (Radius < 0.0) { Standard_NegativeValue::Raise(); }
else {
if (Qualified1.IsEnclosed() && Qualified2.IsEnclosed()) {
@ -170,13 +178,13 @@ pararg2(1,16)
gp_Lin2d Line(Point,L1.Direction()); // ligne avec deport.
IntRes2d_Domain D1;
for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) {
Handle(TheHParGenCurve) HCu2 = new TheHParGenCurve(Cu2);
TheParGenCurve C2(HCu2,cote2(jcote2));
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::Value(C2,lastparam),lastparam,Tol);
TheIntConicCurve Intp(Line,D1,C2,D2,Tol,Tol);
Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2);
Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2));
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);
Geom2dInt_TheIntConicCurveOfGInter Intp(Line,D1,C2,D2,Tol,Tol);
if (Intp.IsDone()) {
if (!Intp.IsEmpty()) {
for (Standard_Integer i = 1 ; i <= Intp.NbPoints() ; i++) {
@ -198,7 +206,7 @@ pararg2(1,16)
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
pararg2(NbrSol) = Intp.Point(i).ParamOnSecond();
pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),L1);
pnttg2sol(NbrSol) = TheTool::Value(Cu2,pararg2(NbrSol));
pnttg2sol(NbrSol) = Geom2dGcc_CurveTool::Value(Cu2,pararg2(NbrSol));
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));
par2sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
@ -226,11 +234,11 @@ pararg2(1,16)
// On remplit les champs. +
//========================================================================
GccGeo_Circ2d2TanRad::
GccGeo_Circ2d2TanRad (const GccEnt_QualifiedCirc& Qualified1,
const TheQCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
Geom2dGcc_Circ2d2TanRadGeo::
Geom2dGcc_Circ2d2TanRadGeo (const GccEnt_QualifiedCirc& Qualified1,
const Geom2dGcc_QCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
//========================================================================
// initialisation des champs. +
@ -274,7 +282,7 @@ pararg2(1,16)
}
gp_Circ2d C1 = Qualified1.Qualified();
gp_Pnt2d center1(C1.Location());
TheCurve Cu2 = Qualified2.Qualified();
Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
if (Radius < 0.0) { Standard_NegativeValue::Raise(); }
else {
if (Qualified1.IsEnclosed() && Qualified2.IsEnclosed()) {
@ -347,19 +355,19 @@ pararg2(1,16)
cote2(2) = -Radius;
}
Standard_Real R1 = C1.Radius();
TheIntConicCurve Intp;
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);
for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) {
Handle(TheHParGenCurve) HCu2 = new TheHParGenCurve(Cu2);
TheParGenCurve C2(HCu2,cote2(jcote2));
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::Value(C2,lastparam),lastparam,Tol);
Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2);
Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2));
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(Circ,D1,C2,D2,Tol,Tol);
if (Intp.IsDone()) {
if (!Intp.IsEmpty()) {
@ -391,7 +399,7 @@ pararg2(1,16)
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
pararg2(NbrSol) = Intp.Point(i).ParamOnSecond();
pnttg1sol(NbrSol) = ElCLib::Value(pararg1(NbrSol),C1);
pnttg2sol(NbrSol) = TheTool::Value(Cu2,pararg2(NbrSol));
pnttg2sol(NbrSol) = Geom2dGcc_CurveTool::Value(Cu2,pararg2(NbrSol));
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));
par2sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
@ -419,11 +427,11 @@ pararg2(1,16)
// On remplit les champs. +
//========================================================================
GccGeo_Circ2d2TanRad::
GccGeo_Circ2d2TanRad (const TheQCurve& Qualified1,
const gp_Pnt2d& Point2 ,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
Geom2dGcc_Circ2d2TanRadGeo::
Geom2dGcc_Circ2d2TanRadGeo (const Geom2dGcc_QCurve& Qualified1,
const gp_Pnt2d& Point2 ,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
//========================================================================
// initialisation des champs. +
@ -461,7 +469,7 @@ pararg2(1,16)
GccEnt_BadQualifier::Raise();
return;
}
TheCurve Cu1 = Qualified1.Qualified();
Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
if (Radius < 0.0) { Standard_NegativeValue::Raise(); }
else {
if (Qualified1.IsEnclosed()) {
@ -484,14 +492,14 @@ pararg2(1,16)
IntRes2d_Domain D1(ElCLib::Value(0.,Circ), 0.,Tol,
ElCLib::Value(M_PI+M_PI,Circ),M_PI+M_PI,Tol);
D1.SetEquivalentParameters(0.,M_PI+M_PI);
TheIntConicCurve Intp;
Geom2dInt_TheIntConicCurveOfGInter Intp;
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
Handle(TheHParGenCurve) HCu1 = new TheHParGenCurve(Cu1);
TheParGenCurve Cu2(HCu1,cote1(jcote1));
firstparam = Max(TheCurvePGTool::FirstParameter(Cu2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(Cu2),thelast);
IntRes2d_Domain D2(TheCurvePGTool::Value(Cu2,firstparam),firstparam,Tol,
TheCurvePGTool::Value(Cu2,lastparam),lastparam,Tol);
Handle(Geom2dAdaptor_HCurve) HCu1 = new Geom2dAdaptor_HCurve(Cu1);
Adaptor3d_OffsetCurve Cu2(HCu1,cote1(jcote1));
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(Cu2),thefirst);
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(Cu2),thelast);
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(Cu2,firstparam),firstparam,Tol,
Geom2dGcc_CurveToolGeo::Value(Cu2,lastparam),lastparam,Tol);
Intp.Perform(Circ,D1,Cu2,D2,Tol,Tol);
if (Intp.IsDone()) {
if (!Intp.IsEmpty()) {
@ -506,7 +514,7 @@ pararg2(1,16)
TheSame2(NbrSol) = 0;
pararg1(NbrSol) = Intp.Point(i).ParamOnSecond();
pararg2(NbrSol) = 0.;
pnttg1sol(NbrSol) = TheTool::Value(Cu1,pararg1(NbrSol));
pnttg1sol(NbrSol) = Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol));
pnttg2sol(NbrSol) = Point2;
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));
@ -520,19 +528,19 @@ pararg2(1,16)
}
}
static void PrecRoot(const TheParGenCurve& theC1,
const TheParGenCurve& theC2,
const Standard_Real theU0,
const Standard_Real theV0,
const Standard_Real theUmin,
const Standard_Real theUmax,
const Standard_Real theVmin,
const Standard_Real theVmax,
Standard_Real& theUfinal,
Standard_Real& theVfinal)
static void PrecRoot(const Adaptor3d_OffsetCurve& theC1,
const Adaptor3d_OffsetCurve& theC2,
const Standard_Real theU0,
const Standard_Real theV0,
const Standard_Real theUmin,
const Standard_Real theUmax,
const Standard_Real theVmin,
const Standard_Real theVmax,
Standard_Real& theUfinal,
Standard_Real& theVfinal)
{
const Standard_Real aInitStepU = (theUmax - theUmin)/2.0,
aInitStepV = (theVmax - theVmin)/2.0;
aInitStepV = (theVmax - theVmin)/2.0;
Standard_Real aStepU = aInitStepU, aStepV = aInitStepV;
@ -542,8 +550,8 @@ static void PrecRoot(const TheParGenCurve& theC1,
gp_Pnt2d aP1, aP2;
gp_Vec2d aD1, aD2;
TheCurvePGTool::D1(theC1, theU0, aP1, aD1);
TheCurvePGTool::D1(theC2, theV0, aP2, aD2);
Geom2dGcc_CurveToolGeo::D1(theC1, theU0, aP1, aD1);
Geom2dGcc_CurveToolGeo::D1(theC2, theV0, aP2, aD2);
gp_Vec2d vP12(aP1.XY() - aP2.XY());
@ -552,7 +560,7 @@ static void PrecRoot(const TheParGenCurve& theC1,
theVfinal = theV0;
Standard_Real aSQDistPrev = aP1.SquareDistance(aP2);
Standard_Integer aNbIter = 1;
do
@ -580,8 +588,8 @@ static void PrecRoot(const TheParGenCurve& theC1,
//method diverges
return;
TheCurvePGTool::D1(theC1, aU, aP1, aD1);
TheCurvePGTool::D1(theC2, aV, aP2, aD2);
Geom2dGcc_CurveToolGeo::D1(theC1, aU, aP1, aD1);
Geom2dGcc_CurveToolGeo::D1(theC2, aV, aP2, aD2);
const Standard_Real aSQDist = aP1.SquareDistance(aP2);
if(Precision::IsInfinite(aSQDist))
@ -627,8 +635,8 @@ static void PrecRoot(const TheParGenCurve& theC1,
if(!isInBound)
{
TheCurvePGTool::D1(theC1, aU, aP1, aD1);
TheCurvePGTool::D1(theC2, aV, aP2, aD2);
Geom2dGcc_CurveToolGeo::D1(theC1, aU, aP1, aD1);
Geom2dGcc_CurveToolGeo::D1(theC2, aV, aP2, aD2);
Standard_Real aV1 = (aD2.X() == 0.0) ? aV :((theUfinal - aU)*aD1.X() + aV*aD2.X() + (aP1.X() - aP2.X()))/aD2.X();
Standard_Real aV2 = (aD2.Y() == 0.0) ? aV :((theUfinal - aU)*aD1.Y() + aV*aD2.Y() + (aP1.Y() - aP2.Y()))/aD2.Y();
@ -644,12 +652,12 @@ static void PrecRoot(const TheParGenCurve& theC1,
if(aV2 > theVmax)
aV2 = theVmax;
aP1 = TheCurvePGTool::Value(theC1,theUfinal);
aP2 = TheCurvePGTool::Value(theC2,aV1);
aP1 = Geom2dGcc_CurveToolGeo::Value(theC1,theUfinal);
aP2 = Geom2dGcc_CurveToolGeo::Value(theC2,aV1);
Standard_Real aSQ1 = aP1.SquareDistance(aP2);
aP2 = TheCurvePGTool::Value(theC2,aV2);
aP2 = Geom2dGcc_CurveToolGeo::Value(theC2,aV2);
Standard_Real aSQ2 = aP1.SquareDistance(aP2);
if(aSQ1 < aSQ2)
@ -681,8 +689,8 @@ static void PrecRoot(const TheParGenCurve& theC1,
if(isInBound)
return;
TheCurvePGTool::D1(theC1, aU, aP1, aD1);
TheCurvePGTool::D1(theC2, aV, aP2, aD2);
Geom2dGcc_CurveToolGeo::D1(theC1, aU, aP1, aD1);
Geom2dGcc_CurveToolGeo::D1(theC2, aV, aP2, aD2);
Standard_Real aU1 = (aD1.X() == 0.0) ? aU :((theVfinal - aV)*aD2.X() + aU*aD1.X() + (aP2.X() - aP1.X()))/aD1.X();
Standard_Real aU2 = (aD1.Y() == 0.0) ? aU :((theVfinal - aV)*aD2.Y() + aU*aD1.Y() + (aP2.Y() - aP1.Y()))/aD1.Y();
@ -698,12 +706,12 @@ static void PrecRoot(const TheParGenCurve& theC1,
if(aU2 > theUmax)
aU2 = theUmax;
aP2 = TheCurvePGTool::Value(theC2,theVfinal);
aP1 = TheCurvePGTool::Value(theC1,aU1);
aP2 = Geom2dGcc_CurveToolGeo::Value(theC2,theVfinal);
aP1 = Geom2dGcc_CurveToolGeo::Value(theC1,aU1);
Standard_Real aSQ1 = aP1.SquareDistance(aP2);
aP1 = TheCurvePGTool::Value(theC1,aU2);
aP1 = Geom2dGcc_CurveToolGeo::Value(theC1,aU2);
Standard_Real aSQ2 = aP1.SquareDistance(aP2);
if(aSQ1 < aSQ2)
@ -726,11 +734,11 @@ static void PrecRoot(const TheParGenCurve& theC1,
// On remplit les champs. +
//========================================================================
GccGeo_Circ2d2TanRad::
GccGeo_Circ2d2TanRad (const TheQCurve& Qualified1,
const TheQCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
Geom2dGcc_Circ2d2TanRadGeo::
Geom2dGcc_Circ2d2TanRadGeo (const Geom2dGcc_QCurve& Qualified1,
const Geom2dGcc_QCurve& Qualified2,
const Standard_Real Radius ,
const Standard_Real Tolerance ):
//========================================================================
// initialisation des champs. +
@ -772,8 +780,8 @@ pararg2(1,16)
GccEnt_BadQualifier::Raise();
return;
}
TheCurve Cu1 = Qualified1.Qualified();
TheCurve Cu2 = Qualified2.Qualified();
Geom2dAdaptor_Curve Cu1 = Qualified1.Qualified();
Geom2dAdaptor_Curve Cu2 = Qualified2.Qualified();
if (Radius < 0.0) { Standard_NegativeValue::Raise(); }
else {
if (Qualified1.IsEnclosed() && Qualified2.IsEnclosed()) {
@ -845,30 +853,30 @@ pararg2(1,16)
cote2(1) = Radius;
cote2(2) = -Radius;
}
TheIntCurveCurve Intp;
Geom2dInt_GInter Intp;
for (Standard_Integer jcote1 = 1 ; jcote1 <= nbrcote1 ; jcote1++) {
Handle(TheHParGenCurve) HCu1 = new TheHParGenCurve(Cu1);
TheParGenCurve C1(HCu1,cote1(jcote1));
firstparam = Max(TheCurvePGTool::FirstParameter(C1),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C1),thelast);
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);
#ifdef DEB
IntRes2d_Domain D2(TheCurvePGTool::Value(C1,firstparam),firstparam,Tol,
TheCurvePGTool::Value(C1,lastparam),lastparam,Tol);
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C1,firstparam),firstparam,Tol,
Geom2dGcc_CurveToolGeo::Value(C1,lastparam),lastparam,Tol);
#else
TheCurvePGTool::Value(C1,firstparam);
TheCurvePGTool::Value(C1,lastparam);
Geom2dGcc_CurveToolGeo::Value(C1,firstparam);
Geom2dGcc_CurveToolGeo::Value(C1,lastparam);
#endif
for (Standard_Integer jcote2 = 1 ; jcote2 <= nbrcote2 ; jcote2++) {
Handle(TheHParGenCurve) HCu2 = new TheHParGenCurve(Cu2);
TheParGenCurve C2(HCu2,cote2(jcote2));
firstparam = Max(TheCurvePGTool::FirstParameter(C2),thefirst);
lastparam = Min(TheCurvePGTool::LastParameter(C2),thelast);
Handle(Geom2dAdaptor_HCurve) HCu2 = new Geom2dAdaptor_HCurve(Cu2);
Adaptor3d_OffsetCurve C2(HCu2,cote2(jcote2));
firstparam = Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2),thefirst);
lastparam = Min(Geom2dGcc_CurveToolGeo::LastParameter(C2),thelast);
#ifdef DEB
IntRes2d_Domain D2(TheCurvePGTool::Value(C2,firstparam),firstparam,Tol,
TheCurvePGTool::Value(C2,lastparam),lastparam,Tol);
IntRes2d_Domain D2(Geom2dGcc_CurveToolGeo::Value(C2,firstparam),firstparam,Tol,
Geom2dGcc_CurveToolGeo::Value(C2,lastparam),lastparam,Tol);
#else
TheCurvePGTool::Value(C2,firstparam);
TheCurvePGTool::Value(C2,lastparam);
Geom2dGcc_CurveToolGeo::Value(C2,firstparam);
Geom2dGcc_CurveToolGeo::Value(C2,lastparam);
#endif
Intp.Perform(C1,C2,Tol,Tol);
if (Intp.IsDone()) {
@ -884,10 +892,10 @@ pararg2(1,16)
Standard_Real aU2 = aU0+Precision::PApproximation();
Standard_Real aV2 = aV0+Precision::PApproximation();
gp_Pnt2d P11 = TheCurvePGTool::Value(C1,aU1);
gp_Pnt2d P12 = TheCurvePGTool::Value(C2,aV1);
gp_Pnt2d P21 = TheCurvePGTool::Value(C1,aU2);
gp_Pnt2d P22 = TheCurvePGTool::Value(C2,aV2);
gp_Pnt2d P11 = Geom2dGcc_CurveToolGeo::Value(C1,aU1);
gp_Pnt2d P12 = Geom2dGcc_CurveToolGeo::Value(C2,aV1);
gp_Pnt2d P21 = Geom2dGcc_CurveToolGeo::Value(C1,aU2);
gp_Pnt2d P22 = Geom2dGcc_CurveToolGeo::Value(C2,aV2);
Standard_Real aDist1112 = P11.Distance(P12);
Standard_Real aDist1122 = P11.Distance(P22);
@ -896,18 +904,18 @@ pararg2(1,16)
Standard_Real aDist2122 = P21.Distance(P22);
if( Min(aDist1112, aDist1122) <= Precision::Approximation() &&
Min(aDist1221, aDist2122) <= Precision::Approximation())
Min(aDist1221, aDist2122) <= Precision::Approximation())
{
PrecRoot(C1, C2, aU0, aV0,
Max(TheCurvePGTool::FirstParameter(C1), aU0 - 10.0),
Min(TheCurvePGTool::LastParameter(C1), aU0 + 10.0),
Max(TheCurvePGTool::FirstParameter(C2), aV0 - 10.0),
Min(TheCurvePGTool::LastParameter(C2), aV0 + 10.0),
aU0, aV0);
Max(Geom2dGcc_CurveToolGeo::FirstParameter(C1), aU0 - 10.0),
Min(Geom2dGcc_CurveToolGeo::LastParameter(C1), aU0 + 10.0),
Max(Geom2dGcc_CurveToolGeo::FirstParameter(C2), aV0 - 10.0),
Min(Geom2dGcc_CurveToolGeo::LastParameter(C2), aV0 + 10.0),
aU0, aV0);
}
NbrSol++;
gp_Pnt2d Center(TheCurvePGTool::Value(C1, aU0));
gp_Pnt2d Center(Geom2dGcc_CurveToolGeo::Value(C1, aU0));
cirsol(NbrSol) = gp_Circ2d(gp_Ax2d(Center,dirx),Radius);
// =======================================================
qualifier1(NbrSol) = Qualified1.Qualifier();
@ -916,8 +924,8 @@ pararg2(1,16)
TheSame2(NbrSol) = 0;
pararg1(NbrSol) = Intp.Point(i).ParamOnFirst();
pararg2(NbrSol) = Intp.Point(i).ParamOnSecond();
pnttg1sol(NbrSol) = TheTool::Value(Cu1,pararg1(NbrSol));
pnttg2sol(NbrSol) = TheTool::Value(Cu2,pararg2(NbrSol));
pnttg1sol(NbrSol) = Geom2dGcc_CurveTool::Value(Cu1,pararg1(NbrSol));
pnttg2sol(NbrSol) = Geom2dGcc_CurveTool::Value(Cu2,pararg2(NbrSol));
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));
par2sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
@ -934,13 +942,13 @@ pararg2(1,16)
//=========================================================================
Standard_Boolean GccGeo_Circ2d2TanRad::
Standard_Boolean Geom2dGcc_Circ2d2TanRadGeo::
IsDone () const { return WellDone; }
Standard_Integer GccGeo_Circ2d2TanRad::
Standard_Integer Geom2dGcc_Circ2d2TanRadGeo::
NbSolutions () const { return NbrSol; }
gp_Circ2d GccGeo_Circ2d2TanRad::
gp_Circ2d Geom2dGcc_Circ2d2TanRadGeo::
ThisSolution (const Standard_Integer Index) const
{
if (!WellDone) { StdFail_NotDone::Raise(); }
@ -948,7 +956,7 @@ ThisSolution (const Standard_Integer Index) const
return cirsol(Index);
}
void GccGeo_Circ2d2TanRad::
void Geom2dGcc_Circ2d2TanRadGeo::
WhichQualifier(const Standard_Integer Index ,
GccEnt_Position& Qualif1 ,
GccEnt_Position& Qualif2 ) const
@ -961,7 +969,7 @@ WhichQualifier(const Standard_Integer Index ,
}
}
void GccGeo_Circ2d2TanRad::
void Geom2dGcc_Circ2d2TanRadGeo::
Tangency1 (const Standard_Integer Index,
Standard_Real& ParSol,
Standard_Real& ParArg,
@ -978,7 +986,7 @@ Tangency1 (const Standard_Integer Index,
}
}
void GccGeo_Circ2d2TanRad::
void Geom2dGcc_Circ2d2TanRadGeo::
Tangency2 (const Standard_Integer Index,
Standard_Real& ParSol,
Standard_Real& ParArg,
@ -995,7 +1003,7 @@ Tangency2 (const Standard_Integer Index,
}
}
Standard_Boolean GccGeo_Circ2d2TanRad::
Standard_Boolean Geom2dGcc_Circ2d2TanRadGeo::
IsTheSame1 (const Standard_Integer Index) const
{
if (!WellDone) { StdFail_NotDone::Raise(); }
@ -1005,7 +1013,7 @@ IsTheSame1 (const Standard_Integer Index) const
return Standard_True;
}
Standard_Boolean GccGeo_Circ2d2TanRad::
Standard_Boolean Geom2dGcc_Circ2d2TanRadGeo::
IsTheSame2 (const Standard_Integer Index) const
{
if (!WellDone) { StdFail_NotDone::Raise(); }

View File

@ -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++) {

View File

@ -14,13 +14,8 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Circ2dTanCen from GccGeo
(TheCurve as any; --
TheCurveTool as any; -- as CurveTool(TheCurve) from GccInt
TheExtPC as any; -- as ExtPC(TheCurve,TheCurveTool) from Extrema
TheQualifiedCurve as any) -- as QCurve from GccInt
-- (TheCurve)
class Circ2dTanCenGeo from Geom2dGcc
---Purpose: This class implements the algorithms used to
-- create 2d circles tangent to a curve and
-- centered on a point.
@ -48,7 +43,11 @@ uses Pnt2d from gp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Position from GccEnt,
Array1OfPosition from GccEnt
Array1OfPosition from GccEnt,
Curve from Geom2dAdaptor,
CurveTool from Geom2dGcc,
ExtPC2d from Extrema,
QCurve from Geom2dGcc
raises OutOfRange from Standard,
BadQualifier from GccEnt,
@ -56,9 +55,9 @@ raises OutOfRange from Standard,
is
Create( Qualified1 : TheQualifiedCurve ;
Pcenter : Pnt2d from gp ;
Tolerance : Real from Standard) returns Circ2dTanCen
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.
@ -148,4 +147,4 @@ fields
-- The parameter of the tangency point between the solution and the first
-- argument on the first argument.
end Circ2dTanCen;
end Circ2dTanCenGeo;

View File

@ -12,6 +12,8 @@
// 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>
@ -22,26 +24,28 @@
#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. +
//=========================================================================
GccGeo_Circ2dTanCen::
GccGeo_Circ2dTanCen (const TheQualifiedCurve& Qualified1,
const gp_Pnt2d& Pcenter ,
const Standard_Real Tolerance ):
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)
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);
@ -53,27 +57,27 @@ GccGeo_Circ2dTanCen::
Standard_Integer nbsol = 0;
gp_Dir2d dirx(1.0,0.0);
Standard_Real thePar;
TheCurve curve = Qualified1.Qualified();
TheExtPC distmin(Pcenter,curve,TheCurveTool::NbSamples(curve),
TheCurveTool::EpsX(curve,Tol),Tol);
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>=TheCurveTool::FirstParameter(curve) &&
thePar <= TheCurveTool::LastParameter(curve)) {
theDist2(1) = distmin.SquareDistance(i);
theParam(1) = thePar;
pTan(1) = distmin.Point(i).Value();
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>=TheCurveTool::FirstParameter(curve) &&
thePar <= TheCurveTool::LastParameter(curve)) {
theDist2(2) = distmin.SquareDistance(i);
theParam(2) = thePar;
pTan(2) = distmin.Point(i).Value();
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++;
}
@ -82,7 +86,7 @@ GccGeo_Circ2dTanCen::
for (i = 1 ; i <= nbsol; i++) {
gp_Pnt2d point1;
gp_Vec2d Tan1;
TheCurveTool::D1(curve,theParam(i),point1,Tan1);
Geom2dGcc_CurveTool::D1(curve,theParam(i),point1,Tan1);
Standard_Real normetan1 = Tan1.Magnitude();
gp_Vec2d Vec1(point1,Pcenter);
Standard_Real normevec1 = Vec1.Magnitude();
@ -95,16 +99,16 @@ GccGeo_Circ2dTanCen::
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;
(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;
}
}
}
@ -115,23 +119,23 @@ GccGeo_Circ2dTanCen::
//=========================================================================
Standard_Boolean GccGeo_Circ2dTanCen::
IsDone () const { return WellDone; }
Standard_Boolean Geom2dGcc_Circ2dTanCenGeo::
IsDone () const { return WellDone; }
Standard_Integer GccGeo_Circ2dTanCen::
NbSolutions () const { return NbrSol; }
Standard_Integer Geom2dGcc_Circ2dTanCenGeo::
NbSolutions () const { return NbrSol; }
gp_Circ2d GccGeo_Circ2dTanCen::
ThisSolution (const Standard_Integer Index) const
gp_Circ2d Geom2dGcc_Circ2dTanCenGeo::
ThisSolution (const Standard_Integer Index) const
{
if (Index > NbrSol || Index <= 0) Standard_OutOfRange::Raise();
return cirsol(Index);
}
void GccGeo_Circ2dTanCen::
WhichQualifier(const Standard_Integer Index ,
GccEnt_Position& Qualif1 ) const
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(); }
@ -140,21 +144,21 @@ void GccGeo_Circ2dTanCen::
}
}
void GccGeo_Circ2dTanCen::
Tangency1 (const Standard_Integer Index,
Standard_Real& ParSol,
Standard_Real& ParArg,
gp_Pnt2d& PntSol) const{
if (!WellDone) {
StdFail_NotDone::Raise();
}
else if (Index <= 0 ||Index > NbrSol) {
Standard_OutOfRange::Raise();
}
else {
PntSol = gp_Pnt2d(pnttg1sol(Index));
ParSol = par1sol(Index);
ParArg = pararg1(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);
}
}

View File

@ -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

View File

@ -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);

View File

@ -14,21 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Circ2dTanOnRad from GccGeo (
TheCurve as any; --
TheTool as any; --
TheQCurve as any; -- as QualifiedCurv from GccEnt (TheCurve)
TheParGenCurve as any; -- as ParGenCurve from GccGeo
-- (TheCurve)
TheHParGenCurve as Transient;
TheCurvePGTool as any; -- as CurvePGTool from GccGeo
-- (Thecurve,
-- TheTool,
-- TheParGenCurve)
TheIntConicCurve as any; -- as IntConicCurveOfGOffsetInter
TheIntCurveCurve as any) -- as GOffSetInter from Geom2dInt
-- (TheParGenCurve,
-- TheCurvePGTool)
class Circ2dTanOnRadGeo from Geom2dGcc
---Purpose: This class implements the algorithms used to
-- create a 2d circle tangent to a 2d entity,
@ -65,7 +51,15 @@ uses Lin2d from gp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
Position from GccEnt,
Array1OfPosition 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,
@ -76,10 +70,10 @@ is
-- On a line .............................................................
Create(Qualified1 : TheQCurve ;
OnLine : Lin2d from gp ;
Create(Qualified1 : QCurve from Geom2dGcc;
OnLine : Lin2d from gp;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -89,10 +83,10 @@ raises NegativeValue, BadQualifier;
-- -- On a circle ...........................................................
Create(Qualified1 : TheQCurve ;
OnCirc : Circ2d from gp ;
Create(Qualified1 : QCurve from Geom2dGcc;
OnCirc : Circ2d from gp;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -103,9 +97,9 @@ raises NegativeValue, BadQualifier;
-- On a curve ............................................................
Create(Qualified1 : QualifiedCirc from GccEnt ;
OnCurv : TheCurve ;
OnCurv : Curve from Geom2dAdaptor ;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -114,9 +108,9 @@ raises NegativeValue, BadQualifier;
---Purpose: raises NegativeValue in case of NegativeRadius.
Create(Qualified1 : QualifiedLin from GccEnt ;
OnCurv : TheCurve ;
OnCurv : Curve from Geom2dAdaptor ;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -124,10 +118,10 @@ Create(Qualified1 : QualifiedLin from GccEnt ;
raises NegativeValue, BadQualifier;
---Purpose: raises NegativeValue in case of NegativeRadius.
Create(Qualified1 : TheQCurve ;
OnCurv : TheCurve ;
Create(Qualified1 : QCurve from Geom2dGcc;
OnCurv : Curve from Geom2dAdaptor;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -136,9 +130,9 @@ raises NegativeValue, BadQualifier;
---Purpose: raises NegativeValue in case of NegativeRadius.
Create(Point1 : Pnt2d from gp ;
OnCurv : TheCurve ;
OnCurv : Curve from Geom2dAdaptor ;
Radius : Real from Standard;
Tolerance : Real from Standard) returns Circ2dTanOnRad
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.
@ -270,4 +264,4 @@ fields
---Purpose: The parameter of the center point of the solution on the
-- second argument.
end Circ2dTanOnRad;
end Circ2dTanOnRadGeo;

View 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;
}

View File

@ -14,11 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class CurvePGTool from GccGeo (
TheCurve as any;
TheCurveTool as any; -- as CurveTool(TheCurve) from GccInt
TheParGenCurve as any) -- as ParGenCurve(TheCurve) from GccGeo
---Purpose:
class CurveToolGeo from Geom2dGcc
uses Pnt2d from gp,
Vec2d from gp,
@ -28,38 +24,41 @@ uses Pnt2d from gp,
Parab2d from gp,
Hypr2d from gp,
CurveType from GeomAbs,
Shape from GeomAbs
Shape from GeomAbs,
Curve from Geom2dAdaptor,
CurveTool from Geom2dGcc,
OffsetCurve from Adaptor3d
is
TheType(myclass; C: TheParGenCurve )
TheType(myclass; C: OffsetCurve from Adaptor3d )
returns CurveType from GeomAbs;
Line(myclass; C: TheParGenCurve)
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: TheParGenCurve)
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: TheParGenCurve)
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: TheParGenCurve)
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: TheParGenCurve)
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.
@ -67,61 +66,61 @@ is
-- The following method are used only when TheType returns IntCurve_Other.
FirstParameter(myclass;C: TheParGenCurve)
FirstParameter(myclass;C: OffsetCurve from Adaptor3d)
returns Real;
LastParameter(myclass;C: TheParGenCurve)
LastParameter(myclass;C: OffsetCurve from Adaptor3d)
returns Real;
EpsX (myclass ;
C : TheParGenCurve ;
C : OffsetCurve from Adaptor3d ;
Tol : Real from Standard)
returns Real;
NbSamples(myclass ;
C : TheParGenCurve)
C : OffsetCurve from Adaptor3d)
returns Integer;
Value (myclass ;
C : TheParGenCurve;
C : OffsetCurve from Adaptor3d;
X : Real )
returns Pnt2d from gp;
D1 (myclass; C : TheParGenCurve ;
D1 (myclass; C : OffsetCurve from Adaptor3d ;
U : Real ;
P : out Pnt2d ;
T : out Vec2d );
D2 (myclass; C : TheParGenCurve ;
D2 (myclass; C : OffsetCurve from Adaptor3d ;
U : Real ;
P : out Pnt2d ;
T,N : out Vec2d );
IsComposite(myclass; C:TheParGenCurve)
IsComposite(myclass; C:OffsetCurve from Adaptor3d)
returns Boolean from Standard;
-- The following methods are used only when IsComposite returns True.
GetIntervals(myclass ; C:TheParGenCurve) returns Integer from Standard;
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 : TheParGenCurve
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 TheParGenCurve
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 CurvePGTool;
end CurveToolGeo;

View 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;
}

View File

@ -17,7 +17,6 @@ GccAna
GccEnt
GccInt
GccIter
GccGeo
HatchGen
Geom2dHatch
Law