-// File: BRepBlend_SurfRstLineBuilder.cxx
-// Created: Fri Jan 24 10:39:44 1997
-// Author: Jacques GOUSSARD
-// Author: Laurent BOURESCHE
-// <lbo@pomalox.paris1.matra-dtv.fr>
+// Created on: 1997-01-24
+// Created by: Laurent BOURESCHE
+// Copyright (c) 1997-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 <stdio.h>
#endif
static Standard_Integer IndexOfSection = 0;
extern Standard_Boolean Blend_GettraceDRAWSECT();
-// Pour debug : visualisation de la section
+#ifdef DEB_BBPP_N_TRDERIV
+// for debug : visualisation of the section
static Standard_Boolean BBPP(const Standard_Real param,
Blend_SurfRstFunction& Func,
const math_Vector& sol,
Standard_Real scal = 1./(param1-param2);
cout<<endl;
- cout<<"controle des derivees au point : "<<param1<<endl;
+ cout<<"control derivatives at point : "<<param1<<endl;
for(i = 1; i <= hp; i++){
cout<<endl;
cout<<"point : "<<i<<endl;
- cout<<"dx calcule : "<<TDP1(i).X()<<endl;
- cout<<"dx estime : "<<scal*(TP1(i).X()-TP2(i).X())<<endl;
- cout<<"dy calcule : "<<TDP1(i).Y()<<endl;
- cout<<"dy estime : "<<scal*(TP1(i).Y()-TP2(i).Y())<<endl;
- cout<<"dz calcule : "<<TDP1(i).Z()<<endl;
- cout<<"dz estime : "<<scal*(TP1(i).Z()-TP2(i).Z())<<endl;
- cout<<"dw calcule : "<<TDW1(i)<<endl;
- cout<<"dw estime : "<<scal*(TW1(i)-TW2(i))<<endl;
+ cout<<"dx calculated : "<<TDP1(i).X()<<endl;
+ cout<<"dx estimated : "<<scal*(TP1(i).X()-TP2(i).X())<<endl;
+ cout<<"dy calculated : "<<TDP1(i).Y()<<endl;
+ cout<<"dy estimated : "<<scal*(TP1(i).Y()-TP2(i).Y())<<endl;
+ cout<<"dz calculated : "<<TDP1(i).Z()<<endl;
+ cout<<"dz estimated : "<<scal*(TP1(i).Z()-TP2(i).Z())<<endl;
+ cout<<"dw calculated : "<<TDW1(i)<<endl;
+ cout<<"dw estimated : "<<scal*(TW1(i)-TW2(i))<<endl;
}
for(i = 1; i <= hp2d; i++){
cout<<endl;
cout<<"point 2d : "<<i<<endl;
- cout<<"dx calcule : "<<TDP2d1(i).X()<<endl;
- cout<<"dx estime : "<<scal*(TP2d1(i).X()-TP2d2(i).X())<<endl;
- cout<<"dy calcule : "<<TDP2d1(i).Y()<<endl;
- cout<<"dy estime : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
+ cout<<"dx calculated : "<<TDP2d1(i).X()<<endl;
+ cout<<"dx estimated : "<<scal*(TP2d1(i).X()-TP2d2(i).X())<<endl;
+ cout<<"dy calculated : "<<TDP2d1(i).Y()<<endl;
+ cout<<"dy estimated : "<<scal*(TP2d1(i).Y()-TP2d2(i).Y())<<endl;
}
}
-
+#endif
static void Drawsect(const Standard_Real param,
Blend_SurfRstFunction& Func)
{
//=======================================================================
//function : ArcToRecadre
-//purpose : Cherche un arc candidat
-// PrevIndex est utilise pour rejeter un arc deja teste
+//purpose : Find a suitable arc
+// PrevIndex is used to reject an already tested arc
//=======================================================================
Standard_Integer BRepBlend_SurfRstLineBuilder::
- ArcToRecadre(const math_Vector& sol,
+ ArcToRecadre(const math_Vector& theSol,
const Standard_Integer PrevIndex,
gp_Pnt2d& lastpt2d,
gp_Pnt2d& pt2d,
Standard_Boolean ok = Standard_False;
Standard_Boolean byinter = (line->NbPoints() != 0), okinter = 0;
Standard_Real distmin = RealLast();
- Standard_Real uprev,vprev, prm, dist;
+ Standard_Real uprev = 0.,vprev = 0., prm = 0., dist = 0.;
if(byinter) previousP.ParametersOnS(uprev,vprev);
- pt2d.SetCoord(sol(1),sol(2));
+ pt2d.SetCoord(theSol(1),theSol(2));
lastpt2d.SetCoord(uprev,vprev);
domain1->Init();
Drawsect(param,Func);
}
#endif
- // Mettre a jour la ligne.
+ // Update the line.
line->Append(previousP);
Standard_Real U,V;
previousP.ParametersOnS(U,V);
else {
sens = -1.;
}
-#ifndef DEB
Blend_Status State = Blend_OnRst12;
Standard_Real trst = 0.;
-#else
- Blend_Status State;
- Standard_Real trst;
-#endif
Standard_Boolean recadp,recadrst,recads;
Standard_Real wp,wrst,ws;
- Standard_Real U,V;
+ Standard_Real U = 0.,V = 0.;
math_Vector infbound(1,3),supbound(1,3),tolerance(1,3);
math_Vector solinvp(1,3),solinvrst(1,4),solinvs(1,3);
Handle(Adaptor3d_HVertex) Vtxp,Vtxrst,Vtxs,Vtxc;
}
if (!recads && !recadp && !recadrst) return Standard_False;
if (recadp && recadrst) {
- if(sens*(wrst-wp) > tolgui){ //on sort du domaine d abord
+ if(sens*(wrst-wp) > tolgui){ //first one leaves the domain
wrst = wp;
U = solinvp(2);
V = solinvp(3);
sol(3) = solinvs(2);
}
else if(sens*(ws-wrst)<0){
- // sol sur surf
+ // ground on surf
State = Blend_OnRst1;
param = ws;
Arc->Value(solinvs(3)).Coord(U,V);
sol(3) = solinvs(2);
}
else{
- // sol sur rst
+ // ground on rst
State = Blend_OnRst2;
param = wrst;
sol(1) = U;
Func.Set(param);
}
else if(recads){
- // sol sur surf
+ // ground on surf
State = Blend_OnRst1;
param = ws;
Arc->Value(solinvs(3)).Coord(U,V);
Func.Set(param);
}
else if(recadrst){
- // sol sur rst
+ // ground on rst
State = Blend_OnRst2;
param = wrst;
sol(1) = U;
{
Standard_Real stepw = pasmax;
Standard_Integer nbp = line->NbPoints();
- if(nbp >= 2){ //On reprend le dernier step s il n est pas trop petit.
+ if(nbp >= 2){ //The last step is reproduced if it is not too small.
if(sens < 0.){
stepw = (line->Point(2).Parameter() - line->Point(1).Parameter());
}
if (sens*(parprec - Bound) >= -tolgui) {
return;
}
-#ifndef DEB
Blend_Status State = Blend_OnRst12;
-#else
- Blend_Status State;
-#endif
- TopAbs_State situonc,situons;
- Standard_Boolean decroch;
+ TopAbs_State situonc = TopAbs_UNKNOWN, situons = TopAbs_UNKNOWN;
+ Standard_Boolean decroch = Standard_False;
Standard_Boolean Arrive,recadp,recadrst,recads,echecrecad;
Standard_Real wp,wrst,ws;
- Standard_Real U,V;
-#ifndef DEB
- Standard_Real trst = 0.;
-#else
- Standard_Real trst;
-#endif
+ Standard_Real U = 0.,V = 0.;
+ Standard_Real trst = 0.;
math_Vector infbound(1,3),supbound(1,3);
math_Vector parinit(1,3),tolerance(1,3);
math_Vector solinvp(1,3),solinvrst(1,4),solinvs(1,3);
while (!Arrive) {
Standard_Boolean bonpoint = 1;
-#if 0
+#ifdef DEB_BBPP_N_TRDERIV
//debdebdebdebdebdeb
Func.Set(param);
rsnld.Perform(Func,parinit,infbound,supbound);
recads = Recadre(FinvC,solinvs,Arc,IsVtxs,Vtxs);
if (recads) {
ws = solinvs(1);
- // Il faut reevaluer le decrochage (BUC60360)
+ // It is necessary to reevaluate the deviation (BUC60360)
gp_Vec t, n;
Func.Set(ws);
Arc->Value(solinvs(3)).Coord(U,V);
if(recadp || recads || recadrst) echecrecad = Standard_False;
if (!echecrecad) {
if (recadp && recadrst) {
- if(sens*(wrst-wp) > tolgui){ //on sort du domaine d abord
+ if(sens*(wrst-wp) > tolgui){ //first one leaves the domain
wrst = wp;
U = solinvp(2);
V = solinvp(3);
sol(3) = solinvs(3);
}
else if(sens*(ws-wrst)<0){
- // sol sur surf
+ // ground on surf
decroch = 0;
State = Blend_OnRst1;
param = ws;
sol(3) = solinvs(2);
}
else{
- // sol sur rst
+ // ground on rst
State = Blend_OnRst2;
param = wrst;
sol(1) = U;
Func.Set(param);
}
else if(recads){
- // sol sur surf
+ // ground on surf
State = Blend_OnRst1;
param = ws;
Arc->Value(solinvs(3)).Coord(U,V);
Func.Set(param);
}
else if(recadrst){
- // sol sur rst
+ // ground on rst
State = Blend_OnRst2;
param = wrst;
sol(1) = U;
State = TestArret(Func,Standard_True,State);
}
else{
- // echec recadrage. On sort avec PointsConfondus
+ // Failed reframing. Leave with PointsConfondus
#if DEB
- cout<<"SurfRstLineBuilder : echec recadrage"<<endl;
+ cout<<"SurfRstLineBuilder : failed reframing"<<endl;
#endif
State = Blend_SamePoints;
}
Drawsect(param,Func);
}
#endif
- // Mettre a jour la ligne.
+ // Update the line.
if (sens>0.) {
line->Append(previousP);
}
sol(1),sol(2),
previousP.Parameter(),tolesp);
MakeExtremity(Extrst,Standard_False,rst,sol(3),IsVtxrst,Vtxrst);
- // Indiquer que fin sur Bound.
+ // Indicate end on Bound.
}
else {
param = param + sens*stepw;
previousP.Parameter(),tolesp);
Arrive = Standard_True;
if (line->NbPoints()>=2) {
- // Indiquer qu on s arrete en cours de cheminement
+ // Indicate that one stops during the processing
#if DEB
- cout<<"SurfRstLineBuilder :On n avance plus dans le cheminement"<<endl;
+ cout<<"SurfRstLineBuilder : No advancement in the processing"<<endl;
#endif
}
}
else {
- param = parprec + sens*stepw; // on ne risque pas de depasser Bound.
+ param = parprec + sens*stepw; // no risk to exceed Bound.
}
}
break;
Drawsect(param,Func);
}
#endif
- // Mettre a jour la ligne.
+ // Update the line.
if (sens>0.) {
line->Append(previousP);
}
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),
previousP.Parameter(),tolesp);
MakeExtremity(Extrst,Standard_False,rst,sol(3),IsVtxrst,Vtxrst);
- // Indiquer que fin sur Bound.
+ // Indicate end on Bound.
}
else {
param = param + sens*stepw;
case Blend_SamePoints :
{
- // On arrete
+ // Stop
#if DEB
- cout << "SurfRstLineBuilder Points confondus dans le cheminement" << endl;
+ cout << "SurfRstLineBuilder Points mixed in the processing" << endl;
#endif
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
Arrive = Standard_True;
}
break;
-#ifndef DEB
default:
break;
-#endif
}
if (Arrive) {
if (sens > 0.) {
//=======================================================================
//function : Recadre
-//purpose : Recadre une section Surface / Restriction
+//purpose : Reframe section Surface / Restriction
//=======================================================================
Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfCurvFuncInv& FinvC,
Handle(Adaptor3d_HVertex)& Vtx)
{
Standard_Boolean recadre = Standard_False;
-#ifdef DEB
- Standard_Boolean byinter = (line->NbPoints() != 0);
-#endif
+
gp_Pnt2d pt2d, lastpt2d;
Standard_Integer IndexSol, nbarc;
Standard_Real pmin;
#endif
}
else {
- // On doit verifier la valeur de la fonction
+ // It is necessary to check the value of the function
rsnld.Root(Solinv);
recadre = FinvC.IsSolution(Solinv,tolesp);
}
- // En cas d'echecs, on regarde si un autre arc
- // peut faire l'affaire (cas des sorties a proximite d'un vertex)
+ // In case of fail, it is checked if another arc
+ // can be useful (case of output at the proximity of a vertex)
if (!recadre) {
IndexSol = ArcToRecadre(sol, IndexSol,
lastpt2d, pt2d, pmin);
if (IndexSol == 0) {
- return Standard_False; // Pas d'autre solution
+ return Standard_False; // No other solution
}
domain1->Init();
#endif
}
else {
- // On doit verifier la valeur de la fonction
+ // It is necessary to check the value of the function
rsnld.Root(Solinv);
recadre = FinvC.IsSolution(Solinv,tolesp);
}
if (!domain2->MoreVertex()) {
IsVtx = Standard_False;
}
- // On recalcule la section par resolution directe, sinon, on se recupere
- // des incoherences entre le parametre et sol dues au baillement.
+ // The section is recalculated by direct resolution, otherwise
+ // incoherences between the parameter and the ground caused by yawn are returned.
math_Vector infbound(1,3),supbound(1,3);
math_Vector parinit(1,3),tolerance(1,3);
else {
Extrem.SetVertex(Vtx);
while (Iter->More()) {
-//#ifndef DEB
Handle(Adaptor2d_HCurve2d) arc = Iter->Value();
-//#else
-// Handle(Adaptor2d_HCurve2d)& arc = Iter->Value();
-//#endif
if (arc != Arc) {
Iter->Initialize(arc);
Iter->InitVertexIterator();
Blend_Status BRepBlend_SurfRstLineBuilder::CheckDeflectionOnSurf(const Blend_Point& CurPoint)
{
- //Controles 3d du Blend_CSWalking.
+ //Controls 3d of Blend_CSWalking.
- // regle par tests dans U4 correspond a 11.478 d
+ //rule by tests in U4 corresponds to 11.478 d
const Standard_Real CosRef3D = 0.98;
Standard_Real Cosi=0, Cosi2=0;
Standard_Boolean curpointistangent = CurPoint.IsTangencyPoint();
if(!prevpointistangent){
prevTg = previousP.TangentOnS();
}
-#ifndef DEB
Standard_Real Norme,prevNorme = 0.;
-#else
- Standard_Real Norme,prevNorme;
-#endif
gp_Vec Corde(prevP,Psurf);
Norme = Corde.SquareMagnitude();
// if(!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
- // il faudra peut etre forcer meme point
+ // it can be necessary to force same point
return Blend_SamePoints;
}
if(!prevpointistangent){
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
- if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
+ if (Cosi <0.) { // angle 3d>pi/2. --> return back
return Blend_Backward;
}
}
if(!curpointistangent){
- // Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
+ // Check if it is necessary to control the sign of prevtg*Tgsurf
Cosi = sens*Corde*Tgsurf;
Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D || Cosi < 0.) {
}
if(!curpointistangent && !prevpointistangent){
- // Estimation de la fleche courante
+ // Estimation of the current arrow
Standard_Real FlecheCourante =
(prevTg.Normalized().XYZ()-Tgsurf.Normalized().XYZ()).SquareModulus()*Norme/64.;
return Blend_StepTooSmall;
}
if (FlecheCourante > fleche*fleche) {
- // pas trop grand : commentaire interessant
+ // not too great :
return Blend_StepTooLarge;
}
}
Blend_Status BRepBlend_SurfRstLineBuilder::CheckDeflectionOnRst(const Blend_Point& CurPoint)
{
- //Controles 3d du Blend_CSWalking.
+ //Controls 3D of Blend_CSWalking.
- // regle par tests dans U4 correspond a 11.478 d
+ // rule by tests in U4 corresponds to 11.478 d
const Standard_Real CosRef3D = 0.98;
Standard_Real Cosi, Cosi2;
Standard_Boolean curpointistangent = CurPoint.IsTangencyPoint();
if(!prevpointistangent){
prevTg = previousP.TangentOnC();
}
-#ifndef DEB
Standard_Real Norme,prevNorme = 0.;
-#else
- Standard_Real Norme,prevNorme;
-#endif
gp_Vec Corde(prevP,Psurf);
Norme = Corde.SquareMagnitude();
// if(!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
- // il faudra peut etre forcer meme point
+ // it can be necessary to force same point
return Blend_SamePoints;
}
if(!prevpointistangent){
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
- if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
+ if (Cosi <0.) { // angle 3d>pi/2. --> return back
return Blend_Backward;
}
}
if(!curpointistangent){
- // Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
+ // Check if it is necessary to control the sign of prevtg*Tgsurf
Cosi = sens*Corde*Tgsurf;
Cosi2 = Cosi * Cosi / Tgsurf.SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D || Cosi < 0.) {
}
if(!curpointistangent && !prevpointistangent){
- // Estimation de la fleche courante
+ // Estimation of the current arrow
Standard_Real FlecheCourante =
(prevTg.Normalized().XYZ()-Tgsurf.Normalized().XYZ()).SquareModulus()*Norme/64.;
return Blend_StepTooSmall;
}
if (FlecheCourante > fleche*fleche) {
- // pas trop grand : commentaire interessant
+ // not too great
return Blend_StepTooLarge;
}
}
gp_Vec tgs,tgrst;
gp_Vec2d tg2ds,tg2drst;
Blend_Status StateS,StateRst;
-#ifndef DEB
IntSurf_TypeTrans tras = IntSurf_Undecided, trarst = IntSurf_Undecided;
-#else
- IntSurf_TypeTrans tras,trarst;
-#endif
Blend_Point curpoint;
if (Func.IsSolution(sol,tolesp)) {
{
math_Vector tolerance(1,3);
Func.GetTolerance(tolerance,tolesp);
- //cote pcurve.
+ //face pcurve.
Standard_Real w = sol(3);
if(w < rst->FirstParameter() - tolerance(3)||
w > rst->LastParameter() + tolerance(3)){
}
else SituOnC = TopAbs_ON;
- //cote surface
+ //face surface
gp_Pnt2d p2d(sol(1),sol(2));
SituOnS = domain1->Classify(p2d,Min(tolerance(1),tolerance(2)),0);
- //decrochage
+ //lost contact
gp_Vec tgs,nors;
Decroch = Func.Decroch(sol,tgs,nors);