1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
-- File: LocalAnalysis.cdl
-- Created: Wed Jul 24 14:40:18 1996
-- Author: Herve LOUESSARD
-- <hl1@sgi29>
---Copyright: Matra Datavision 1996
package LocalAnalysis
---Purpose:
-- This package gives tools to check the local continuity
-- between two points situated on two curves or two surfaces.
uses
Standard,
StdFail,
LProp,
GeomAbs,
Geom,
Geom2d,
GeomLProp,
gp
is
-- enumeration used to describe the status error
enumeration StatusErrorType is NullFirstDerivative, NullSecondDerivative,
TangentNotDefined,NormalNotDefined,
CurvatureNotDefined
end StatusErrorType;
class SurfaceContinuity;
---Purpose:
-- This class computes and gives tools to check the local
-- continuity between two points situated on 2 surfaces
class CurveContinuity;
---Purpose:
-- This class compute
-- s and gives tools to check the local
-- continuity between two points situated on 2 curves)
Dump( surfconti : SurfaceContinuity from LocalAnalysis;
o: in out OStream);
---Purpose:
-- This fonction gives informations about a variable CurveContinuity
Dump( curvconti : CurveContinuity from LocalAnalysis;
o: in out OStream);
---Purpose:
-- This fonction gives informations about a variable SurfaceContinuity
end LocalAnalysis;

View File

@@ -0,0 +1,208 @@
// File: LocalAnalysis.cxx
// Created: Mon Sep 9 15:01:49 1996
// Author: Herve LOUESSARD
// <hl1@sgi38>
#include<LocalAnalysis.ixx>
#include<LocalAnalysis_SurfaceContinuity.hxx>
#include<LocalAnalysis_CurveContinuity.hxx>
/*********************************************************************************/
/*********************************************************************************/
void LocalAnalysis::Dump(const LocalAnalysis_SurfaceContinuity& surfconti, Standard_OStream& o)
{ if (!surfconti.IsDone())
{ o<<"Problem in the computation "<<endl;
if (surfconti.StatusError()==LocalAnalysis_NullFirstDerivative)
o<<"one of the first derivatives is null" <<endl;
else if(surfconti.StatusError()==LocalAnalysis_NullSecondDerivative)
o<<"one of the second derivatives is null" <<endl;
else if(surfconti.StatusError()==LocalAnalysis_NormalNotDefined)
o<<"one (or both) normal is undefined" <<endl;
else if(surfconti.StatusError()==LocalAnalysis_CurvatureNotDefined)
o<<"one of the mean curvatures is undefined" <<endl; }
else
switch(surfconti.ContinuityStatus())
{ case GeomAbs_C0 :{ if (surfconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : No C0 "<<endl;
o<<" C0Value = "<<surfconti.C0Value() <<endl;
} break;
case GeomAbs_C1 :{ if (surfconti.IsC1())
o<<" Continuity Status : C1 " <<endl;
else
{if (surfconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : NoC0 "<<endl;
}
o<<" C0Value = "<<surfconti.C0Value()<<endl;
o<<" C1UAngle = "<<surfconti.C1UAngle()<<endl;
o<<" C1URatio = "<<surfconti.C1URatio()<<endl;
o<<" C1VAngle = "<<surfconti.C1VAngle()<<endl;
o<<" C1VRatio = "<<surfconti.C1VRatio()<<endl;
} break;
case GeomAbs_C2 :{ if (surfconti.IsC2())
o<<" Continuity Status : C2 " <<endl;
else
{if (surfconti.IsC1() )
o<<" Continuity Status : C1 " <<endl;
else
{ if (surfconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : NoC0 "<<endl;}
}
o<<" C0Value = "<<surfconti.C0Value()<<endl;
o<<" C1UAngle = "<<surfconti.C1UAngle()<<endl;
o<<" C1VAngle = "<<surfconti.C1VAngle()<<endl;
o<<" C2UAngle = "<<surfconti.C2UAngle()<<endl;
o<<" C2VAngle = "<<surfconti.C2VAngle()<<endl;
o<<" C1URatio = "<<surfconti.C1URatio()<<endl;
o<<" C1VRatio = "<<surfconti.C1VRatio()<<endl;
o<<" C2URatio = "<<surfconti.C2URatio()<<endl;
o<<" C2VRatio = "<<surfconti.C2VRatio()<<endl;
} break;
case GeomAbs_G1 :{ if (surfconti.IsG1())
o<<" Continuity Status : G1 " <<endl;
else
{if (surfconti.IsC0() )
o<<" Continuity Status : G0 " <<endl;
else o<<" Continuity Status : NoG0 "<<endl;
}
o<<" G0Value = "<<surfconti.C0Value()<<endl;
o<<" G1Angle = "<<surfconti.G1Angle()<<endl<<endl;
} break;
case GeomAbs_G2 :{ if (surfconti.IsG2())
o<<" Continuity Status : G2 " <<endl;
else
{if (surfconti.IsG1() )
o<<" Continuity Status : G1 " <<endl;
else
{ if (surfconti.IsC0() )
o<<" Continuity Status : G0 " <<endl;
else o<<" Continuity Status : NoG0 "<<endl;}
}
o<<" G0Value = "<<surfconti.C0Value()<<endl;
o<<" G1Value = "<<surfconti.G1Angle()<<endl;
o<<" G2CurvatureGap = "<<surfconti.G2CurvatureGap()<<endl;
} break;
default : {}
}
}
/*********************************************************************************/
void LocalAnalysis::Dump(const LocalAnalysis_CurveContinuity& curvconti, Standard_OStream& o)
{ if (!curvconti.IsDone())
{ o<<"Problem in the computation "<<endl;
if (curvconti.StatusError()==LocalAnalysis_NullFirstDerivative)
o<<"one (or both) first derivative is null" <<endl;
else if(curvconti.StatusError()==LocalAnalysis_NullSecondDerivative)
o<<"one (or both) second derivative is null" <<endl;
else if(curvconti.StatusError()==LocalAnalysis_TangentNotDefined)
o<<"one (or both) tangent is undefined " <<endl;
else if(curvconti.StatusError()==LocalAnalysis_NormalNotDefined)
o<<"one (or both) normal is undefined" <<endl;}
else
switch(curvconti.ContinuityStatus())
{ case GeomAbs_C0 :{ if (curvconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : No C0 "<<endl;
o<<" C0Value = "<<curvconti.C0Value() <<endl;
} break;
case GeomAbs_C1 :{ if (curvconti.IsC1())
o<<" Continuity Status : C1 " <<endl;
else
{if (curvconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : NoC0 "<<endl;
}
o<<" C0Value = "<<curvconti.C0Value()<<endl;
o<<" C1Angle = "<<curvconti.C1Angle()<<endl;
o<<" C1Ratio = "<<curvconti.C1Ratio()<<endl;
} break;
case GeomAbs_C2 :{ if (curvconti.IsC2())
o<<" Continuity Status : C2 " <<endl;
else
{if (curvconti.IsC1() )
o<<" Continuity Status : C1 " <<endl;
else
{ if (curvconti.IsC0() )
o<<" Continuity Status : C0 " <<endl;
else o<<" Continuity Status : NoC0 "<<endl;}
}
o<<" C0Value = "<<curvconti.C0Value()<<endl;
o<<" C1Angle = "<<curvconti.C1Angle()<<endl;
o<<" C2Angle = "<<curvconti.C2Angle()<<endl;
o<<" C1Ratio = "<<curvconti.C1Ratio()<<endl;
o<<" C2Ratio = "<<curvconti.C2Ratio()<<endl;
}break;
case GeomAbs_G1 :{ if (curvconti.IsG1())
o<<" Continuity Status : G1 " <<endl;
else
{if (curvconti.IsC0() )
o<<" Continuity Status : G0 " <<endl;
else o<<" Continuity Status : NoG0 "<<endl;
}
o<<" G0Value = "<<curvconti.C0Value()<<endl;
o<<" G1Angle = "<<curvconti.G1Angle()<<endl;
} break;
case GeomAbs_G2 :{ if (curvconti.IsG2())
o<<" Continuity Status : G2 " <<endl;
else
{if (curvconti.IsG1() )
o<<" Continuity Status : G1 " <<endl;
else
{ if (curvconti.IsC0() )
o<<" Continuity Status : G0 " <<endl;
else o<<" Continuity Status : NoG0 "<<endl;}
}
o<<" G0Value = "<<curvconti.C0Value()<<endl;
o<<" G1Angle = "<<curvconti.G1Angle()<<endl;
o<<" G2Angle = "<<curvconti.G2Angle()<<endl;
o<<" Relative curvature variation = "<<curvconti.G2CurvatureVariation()<<endl;
} break;
default : {}
}
}
/*********************************************************************************/
/*********************************************************************************/

View File

@@ -0,0 +1,315 @@
-- File: LocalAnalysis_CurveContinuity.cdl
-- Created: Fri Aug 9 10:58:30 1996
-- Author: Herve LOUESSARD
-- <hl1@sgi30>
---Copyright: Matra Datavision 1996
class CurveContinuity from LocalAnalysis
---Purpose:
-- This class gives tools to check local continuity C0
-- C1 C2 G1 G2 between two points situated on two curves
uses
Shape from GeomAbs,
Boolean, Integer, Real from Standard,
Curve from Geom,
CLProps from GeomLProp,
StatusErrorType from LocalAnalysis
raises
NotDone from StdFail
is
Create( Curv1: Curve from Geom; u1: Real from Standard;
Curv2: Curve from Geom; u2: Real from Standard;
Order: Shape from GeomAbs;
EpsNul: Real from Standard= 0.001;
EpsC0 : Real from Standard= 0.001;
EpsC1 : Real from Standard= 0.001;
EpsC2 : Real from Standard= 0.001;
EpsG1 : Real from Standard= 0.001;
EpsG2 : Real from Standard= 0.001;
Percent :Real from Standard= 0.01;
Maxlen: Real from Standard =10000)
---Purpose:
--
-- -u1 is the parameter of the point on Curv1
-- -u2 is the parameter of the point on Curv2
-- -Order is the required continuity:
-- GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
-- GeomAbs_G1 GeomAbs_G2
--
-- -EpsNul is used to detect a a vector with nul
-- magnitude (in mm)
--
-- -EpsC0 is used for C0 continuity to confuse two
-- points (in mm)
--
-- -EpsC1 is an angular tolerance in radians used
-- for C1 continuity to compare the angle between
-- the first derivatives
--
-- -EpsC2 is an angular tolerance in radians used
-- for C2 continuity to compare the angle between
-- the second derivatives
--
-- -EpsG1 is an angular tolerance in radians used
-- for G1 continuity to compare the angle between
-- the tangents
--
-- -EpsG2 is an angular tolerance in radians used
-- for G2 continuity to compare the angle between
-- the normals
--
-- - percent : percentage of curvature variation (unitless)
-- used for G2 continuity
--
-- - Maxlen is the maximum length of Curv1 or Curv2 in
-- meters used to detect nul curvature (in mm)
--
--
--
--
-- the constructor computes the quantities which are
-- necessary to check the continuity in the following cases:
--
-- case C0
-- --------
-- - the distance between P1 and P2 with P1=Curv1 (u1) and
-- P2=Curv2(u2)
--
-- case C1
-- -------
--
-- - the angle between the first derivatives
-- dCurv1(u1) dCurv2(u2)
-- -------- and ---------
-- du du
--
-- - the ratio between the magnitudes of the first
-- derivatives
--
-- the angle value is between 0 and PI/2
--
-- case C2
-- -------
-- - the angle between the second derivatives
-- 2 2
-- d Curv1(u1) d Curv2(u2)
-- ---------- ----------
-- 2 2
-- du du
--
-- the angle value is between 0 and PI/2
--
-- - the ratio between the magnitudes of the second
-- derivatives
--
-- case G1
-- -------
-- the angle between the tangents at each point
--
-- the angle value is between 0 and PI/2
--
-- case G2
-- -------
-- -the angle between the normals at each point
--
-- the angle value is between 0 and PI/2
--
-- - the relative variation of curvature:
-- |curvat1-curvat2|
-- ------------------
-- 1/2
-- (curvat1*curvat2)
--
-- where curvat1 is the curvature at the first point
-- and curvat2 the curvature at the second point
--
returns CurveContinuity from LocalAnalysis;
IsDone(me) returns Boolean from Standard;
-- returns true if there is no problem in the constructor
--
StatusError(me) returns StatusErrorType from LocalAnalysis;
-- returns the error status:
-- NullFirstDerivative : one (or both) first derivative is null
-- NullSecondDerivative: one (or both) second derivative is null
-- TangentNotDefined: one (or both) tangent is undefined
-- NormalNotDefined: one (or both) normal is undefined
ContinuityStatus (me) returns Shape from GeomAbs raises NotDone ;
-- returns the continuity required in the constructor
-- The following functions return the quantities
-- which are necessary to check continuity
C0Value(me) returns Real from Standard raises NotDone ;
-- returns the distance between P1 and P2 with P1=Curv1 (u1) and
-- P2=Curv2(u2)
C1Angle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the first derivatives :
-- dCurv1(u1) dCurv2(u2)
-- -------- and ---------
-- du du
--
-- the angle value is 0 and PI/2
C1Ratio(me) returns Real from Standard raises NotDone ;
-- returns the ratio between the magnitudes of the first
-- derivatives dCurv1(u1) dCurv2(u2)
-- -------- and ---------
-- du du
C2Angle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the second derivatives
-- 2 2
-- d Curv1(u1) d Curv2(u2)
-- ---------- and ----------
-- 2 2
-- du du
--
-- the angle value is between 0 and PI/2
C2Ratio(me) returns Real from Standard raises NotDone;
-- returns the ratio between the magnitudes of the second
-- derivatives 2 2
-- d Curv1(u1) d Curv2(u2)
-- ---------- and ----------
-- 2 2
-- du du
G1Angle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the tangents at each point
-- the angle value is between 0 and PI/2
G2Angle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the normals at each point
-- the angle value is between 0 and PI/2
G2CurvatureVariation(me) returns Real from Standard raises NotDone;
-- returns the relative variation of curvature
-- the following functions check the local continuity and return
-- true if the required continuity is satisfied :
IsC0(me) returns Boolean from Standard
raises NotDone;
-- returns true if the local continuity is C0 that is :
-- C0Value(me) < EpsC0
IsC1(me) returns Boolean from Standard
raises NotDone ;
-- returns true if the local continuity is C1 that is :
-- C0Value(me) < EpsC0
-- C1Angle(me) < EpsC1
IsC2(me) returns Boolean from Standard
raises NotDone;
-- returns true if the local continuity is C2 that is :
-- C0Value(me) < EpsC0 ,
-- C1Angle(me) < EpsC1
-- C2Angle (me) < EpsC2 and
-- C2Ratio is the square of C1Ratio up to a tolerance
IsG1(me) returns Boolean from Standard
raises NotDone;
-- returns true is the local continuity is G1 that is
-- C0Value(me) < EpsC0 and
-- G1Angle(me)< EpsG1
IsG2(me) returns Boolean from Standard
raises NotDone;
-- returns true if the local continuity is G2 that is
-- C0Value(me) < EpsC0,
-- G1Angle(me) < EpsG1
-- G2Angle(me) < EpsG2
-- G2CurvatureVariation < percent
-- The following function are private and used in the constructor
--
CurvC0(me:in out; Curv1, Curv2 : out CLProps from GeomLProp)is private;
CurvC1(me:in out; Curv1, Curv2 : out CLProps from GeomLProp ) is private;
CurvC2(me :in out ; Curv1, Curv2 : out CLProps from GeomLProp)is private;
CurvG1(me:in out; Curv1, Curv2 :out CLProps from GeomLProp ) is private ;
CurvG2(me:in out; Curv1, Curv2 :out CLProps from GeomLProp)is private ;
fields
myContC0 : Real from Standard;
myContC1 : Real from Standard;
myContC2 : Real from Standard;
myContG0 : Real from Standard;
myContG1 : Real from Standard;
myContG2 : Real from Standard;
myCourbC1 : Real from Standard;
myCourbC2 : Real from Standard;
myG2Variation : Real from Standard;
myLambda1 : Real from Standard;
myLambda2 : Real from Standard;
myTypeCont : Shape from GeomAbs;
myepsnul : Real from Standard;
myepsC0 : Real from Standard;
myepsC1 : Real from Standard;
myepsC2 : Real from Standard;
myepsG1 : Real from Standard;
myepsG2 : Real from Standard;
myMaxLon : Real from Standard;
myperce : Real from Standard;
myIsDone : Boolean from Standard;
myErrorStatus : StatusErrorType from LocalAnalysis ;
end CurveContinuity;

View File

@@ -0,0 +1,363 @@
#include <LocalAnalysis_CurveContinuity.ixx>
#include <LocalAnalysis_StatusErrorType.hxx>
#include <GeomLProp_CLProps.hxx>
#include <gp.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <StdFail_NotDone.hxx>
/***********************************************************************/
void LocalAnalysis_CurveContinuity::CurvC0( GeomLProp_CLProps& Curv1,
GeomLProp_CLProps& Curv2)
{ myContC0= (Curv1.Value()).Distance(Curv2.Value());
}
/****************************************************************************/
void LocalAnalysis_CurveContinuity::CurvC1( GeomLProp_CLProps& Curv1,
GeomLProp_CLProps& Curv2)
{ gp_Vec V1, V2;
Standard_Real ang;
V1 = Curv1.D1();
V2 = Curv2.D1();
Standard_Real norm1,norm2;
norm1 = V1.Magnitude();
norm2 = V2.Magnitude();
if ((norm1>myepsnul)&&(norm2>myepsnul))
{ if ( norm1 >= norm2 )
{ myLambda1 = norm2 / norm1;}
else { myLambda1 = norm1 / norm2;}
ang= V1.Angle(V2);
if (ang>PI/2) myContC1=PI-ang;
else myContC1=ang;
}
else {myIsDone= Standard_False;
myErrorStatus=LocalAnalysis_NullFirstDerivative;}
}
/*********************************************************************************/
void LocalAnalysis_CurveContinuity::CurvC2(GeomLProp_CLProps& Curv1,
GeomLProp_CLProps& Curv2)
{ gp_Vec V1, V2, V12, V22;
// gp_Dir D1, D2;
Standard_Real norm1, norm2, norm12, norm22,ang;
V1 = Curv1.D1();
V2 = Curv2.D1();
V12 = Curv1.D2();
V22 = Curv2.D2();
norm1 = V1.Magnitude();
norm2 = V2.Magnitude();
norm12 = V12.Magnitude();
norm22 = V22.Magnitude();
if ((norm1>myepsnul)&&(norm2>myepsnul))
{if((norm12>myepsnul)&&(norm22>myepsnul))
{if (norm1 >= norm2 )
{ myLambda1 = norm2 / norm1;
myLambda2 = norm22 / norm12;}
else {myLambda1 = norm1 / norm2;
myLambda2 = norm12 / norm22;}
ang=V12.Angle(V22);
if (ang>PI/2) myContC2=PI-ang;
else myContC2=ang; }
else{myIsDone= Standard_False ;
myErrorStatus=LocalAnalysis_NullSecondDerivative;} }
else {myIsDone= Standard_False ;
myErrorStatus=LocalAnalysis_NullFirstDerivative;}
}
/*********************************************************************************/
void LocalAnalysis_CurveContinuity::CurvG1 ( GeomLProp_CLProps& Curv1,
GeomLProp_CLProps & Curv2)
{ gp_Dir Tang1,Tang2;
Standard_Real ang;
if (Curv1.IsTangentDefined() && Curv2.IsTangentDefined ())
{ Curv1.Tangent(Tang1);
Curv2.Tangent(Tang2);
ang=Tang1.Angle(Tang2);
if (ang>PI/2) myContG1=PI-ang;
else myContG1=ang;
}
else {myIsDone= Standard_False ;
myErrorStatus=LocalAnalysis_TangentNotDefined;}
}
/*********************************************************************************/
void LocalAnalysis_CurveContinuity::CurvG2( GeomLProp_CLProps& Curv1,
GeomLProp_CLProps & Curv2 )
{ gp_Vec V1, V2;
gp_Dir D1, D2;
Standard_Real ang;
Standard_Real epscrb= 8*myepsC0/(myMaxLon*myMaxLon);
if (Curv1.IsTangentDefined() && Curv2.IsTangentDefined())
{ myCourbC1= Curv1.Curvature();
myCourbC2 = Curv2.Curvature();
if( (Abs(myCourbC1)>epscrb)&& (Abs(myCourbC2)>epscrb))
{ V1 = Curv1.D1();
V2 = Curv2.D1();
Curv1.Normal(D1);
Curv2.Normal(D2);
ang =D1.Angle(D2);
if (ang>PI/2) myContG2=PI-ang;
else myContG2=ang;
myCourbC1= Curv1.Curvature();
myCourbC2 = Curv2.Curvature();
myG2Variation= Abs(myCourbC1-myCourbC2) / sqrt (myCourbC1* myCourbC2);}
else {myIsDone = Standard_False ;
myErrorStatus=LocalAnalysis_NormalNotDefined; }
}
else { myIsDone = Standard_False ;
myErrorStatus=LocalAnalysis_TangentNotDefined;}
}
/*********************************************************************************/
LocalAnalysis_CurveContinuity::LocalAnalysis_CurveContinuity(const Handle(Geom_Curve)& Curv1,
const Standard_Real u1, const Handle(Geom_Curve)& Curv2, const Standard_Real u2,
const GeomAbs_Shape Order,
const Standard_Real Epsnul,
const Standard_Real EpsC0,
const Standard_Real EpsC1,
const Standard_Real EpsC2,
const Standard_Real EpsG1,
const Standard_Real EpsG2,
const Standard_Real Percent,
const Standard_Real Maxlen )
{ myTypeCont = Order;
myepsnul= Epsnul;
myMaxLon=Maxlen;
myepsC0= EpsC0;
myepsC1= EpsC1;
myepsC2= EpsC2;
myepsG1= EpsG1;
myepsG2= EpsG2;
myperce=Percent;
myIsDone = Standard_True;
switch ( Order)
{ case GeomAbs_C0 : { //TypeCont=GeomAbs_C0;
GeomLProp_CLProps Curve1 ( Curv1, u1, 0, myepsnul);
GeomLProp_CLProps Curve2 ( Curv2, u2, 0, myepsnul);
CurvC0(Curve1, Curve2);}
break;
case GeomAbs_C1 : { //TypeCont=GeomAbs_C1;
GeomLProp_CLProps Curve1 ( Curv1, u1, 1, myepsnul);
GeomLProp_CLProps Curve2 ( Curv2, u2, 1, myepsnul );
CurvC0(Curve1, Curve2);
CurvC1(Curve1, Curve2);}
break;
case GeomAbs_C2 : { //TypeCont=GeomAbs_C2;
GeomLProp_CLProps Curve1 ( Curv1, u1, 2, myepsnul);
GeomLProp_CLProps Curve2 ( Curv2, u2, 2, myepsnul);
CurvC0(Curve1, Curve2);
CurvC1(Curve1, Curve2);
CurvC2(Curve1, Curve2);}
break;
case GeomAbs_G1 : { //TypeCont=GeomAbs_G1;
GeomLProp_CLProps Curve1 ( Curv1, u1, 1, myepsnul);
GeomLProp_CLProps Curve2 ( Curv2, u2, 1, myepsnul);
CurvC0(Curve1, Curve2);
CurvG1(Curve1, Curve2);}
break;
case GeomAbs_G2 : { //TypeCont=GeomAbs_G2;
GeomLProp_CLProps Curve1 ( Curv1, u1, 2, myepsnul);
GeomLProp_CLProps Curve2 ( Curv2, u2, 2, myepsnul);
CurvC0(Curve1, Curve2);
CurvG1(Curve1, Curve2);
CurvG2(Curve1, Curve2);}
break;
default : {}
}
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsC0() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
if (myContC0 <= myepsC0 )
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsC1() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC0() && ( (myContC1 <= myepsC1)||(Abs(myContC1-PI)<=myepsC1)))
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsC2() const
{ Standard_Real epsil1, epsil2;
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC1())
{ if ((myContC2 <= myepsC2)||(Abs(myContC2-PI)<=myepsC2))
{ epsil1 = 0.5*myepsC1*myepsC1*myLambda1;
epsil2 = 0.5*myepsC2*myepsC2*myLambda2;
if ( (Abs(myLambda1*myLambda1-myLambda2)) <= (epsil1*epsil1+epsil2))
return Standard_True;}
else return Standard_False;
}
return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsG1() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC0() && (( myContG1 <= myepsG1||(Abs(myContG1-PI)<=myepsG1))))
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsG2()const
{ Standard_Real CRBINF, CRBNUL;
Standard_Integer IETA1, IETA2;
// etat des coubures IETA. -> 0 Crbure nulle
// -> 1 Crbure finie
// -> 2 Crbure infinie
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsG1 ())
{ CRBINF = 1/myepsC0;
CRBNUL = 8*myepsC0/(myMaxLon*myMaxLon);
if (myCourbC1 > CRBINF) IETA1=2;
else if (myCourbC1 < CRBNUL) IETA1=0;
else IETA1=1;
if (myCourbC2 > CRBINF) IETA2=2;
else if (myCourbC2 < CRBNUL) IETA2=0;
else IETA2=1;
if (IETA1 == IETA2)
{ if (IETA1 == 1)
{ Standard_Real eps= RealPart( (myContG2+myepsG2)/PI) * PI;
if (Abs( eps - myepsG2) < myepsG2)
{if (myG2Variation < myperce )
return Standard_True;
else return Standard_False;}
else return Standard_False;
}
else return Standard_True;
}
else return Standard_False;
}
else return Standard_False;
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::C0Value() const
{
if (!myIsDone) {StdFail_NotDone::Raise();}
return ( myContC0 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::C1Angle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC1 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::C2Angle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC2 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::G1Angle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContG1 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::G2Angle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContG2 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::C1Ratio() const
{
if (!myIsDone) {StdFail_NotDone::Raise();}
return ( myLambda1 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::C2Ratio() const
{
if (!myIsDone) {StdFail_NotDone::Raise();}
return ( myLambda2 );
}
/********************************************************************************/
Standard_Real LocalAnalysis_CurveContinuity::G2CurvatureVariation() const
{
if (!myIsDone) {StdFail_NotDone::Raise();}
return ( myG2Variation);
}
/********************************************************************************/
Standard_Boolean LocalAnalysis_CurveContinuity::IsDone() const
{ return ( myIsDone );
}
/*********************************************************************************/
LocalAnalysis_StatusErrorType LocalAnalysis_CurveContinuity::StatusError() const
{
return myErrorStatus;
}
/*************************************************************************/
GeomAbs_Shape LocalAnalysis_CurveContinuity::ContinuityStatus() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return (myTypeCont);
}
/*********************************************************************************/

View File

@@ -0,0 +1,364 @@
-- File: LocalAnalysis_SurfaceContinuity.cdl
-- Created: Fri Aug 9 10:54:22 1996
-- Author: Herve LOUESSARD
-- <hl1@sgi30>
--modified by Jerome LEMONIER
--Wed Aug 13 10:46
--New constructor and new method ComputeAnalysis
---Copyright: Matra Datavision 1996
class SurfaceContinuity from LocalAnalysis
---Purpose:
-- This class gives tools to check local continuity C0
-- C1 C2 G1 G2 between two points situated on two surfaces
uses
Shape from GeomAbs,
Boolean, Integer, Real from Standard,
Surface from Geom,
SLProps from GeomLProp,
Curve from Geom,
Curve from Geom2d,
StatusErrorType from LocalAnalysis
raises
NotDone from StdFail
is
Create( Surf1: Surface from Geom; u1, v1: Real from Standard;
Surf2: Surface from Geom; u2, v2: Real from Standard;
Order: Shape from GeomAbs;
EpsNul: Real from Standard= 0.001;
EpsC0 : Real from Standard= 0.001;
EpsC1 : Real from Standard= 0.001;
EpsC2 : Real from Standard= 0.001;
EpsG1 : Real from Standard= 0.001;
Percent :Real from Standard= 0.01;
Maxlen: Real from Standard =10000)
---Purpose:
-- -u1,v1 are the parameters of the point on Surf1
-- -u2,v2 are the parameters of the point on Surf2
-- -Order is the required continuity:
-- GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
-- GeomAbs_G1 GeomAbs_G2
--
-- -EpsNul is used to detect a a vector with nul
-- magnitude
--
-- -EpsC0 is used for C0 continuity to confuse two
-- points (in mm)
--
-- -EpsC1 is an angular tolerance in radians used
-- for C1 continuity to compare the angle between
-- the first derivatives
--
-- -EpsC2 is an angular tolerance in radians used
-- for C2 continuity to compare the angle between
-- the second derivatives
--
-- -EpsG1 is an angular tolerance in radians used
-- for G1 continuity to compare the angle between
-- the normals
--
--
-- -Percent : percentage of curvature variation (unitless)
-- used for G2 continuity
--
-- - Maxlen is the maximum length of Surf1 or Surf2 in
-- meters used to detect null curvature (in mm)
--
--
--
-- the constructor computes the quantities which are
-- necessary to check the continuity in the following cases:
--
-- case C0
-- --------
-- - the distance between P1 and P2 with P1=Surf (u1,v1) and
-- P2=Surfv2(u2,v2)
--
--
-- case C1
-- -------
--
-- - the angle between the first derivatives in u :
--
-- dSurf1(u1,v1) dSurf2(u2,v2)
-- ----------- and ---------
-- du du
--
-- the angle value is between 0 and PI/2
--
-- - the angle between the first derivatives in v :
--
-- dSurf1(u1,v1) dSurf2(u2,v2)
-- -------- and ---------
-- dv dv
--
-- - the ratio between the magnitudes of the first derivatives in u
-- - the ratio between the magnitudes of the first derivatives in v
--
-- the angle value is between 0 and pi/2
--
-- case C2
-- -------
-- - the angle between the second derivatives in u
-- 2 2
-- d Surf1(u1,v1) d Surf2(u2,v2)
-- ---------- ----------
-- 2 2
-- d u d u
--
-- - the ratio between the magnitudes of the second derivatives in u
-- - the ratio between the magnitudes of the second derivatives in v
--
-- the angle value is between 0 and PI/2
--
-- case G1
-- -------
-- -the angle between the normals at each point
-- the angle value is between 0 and PI/2
--
-- case G2
-- -------
-- - the maximum normal curvature gap between the two
-- points
--
returns SurfaceContinuity from LocalAnalysis;
Create( curv1: Curve from Geom2d; curv2 : Curve from Geom2d;
U: Real from Standard;Surf1: Surface from Geom ;
Surf2: Surface from Geom;
Order: Shape from GeomAbs;
EpsNul: Real from Standard= 0.001;
EpsC0 : Real from Standard= 0.001;
EpsC1 : Real from Standard= 0.001;
EpsC2 : Real from Standard= 0.001;
EpsG1 : Real from Standard= 0.001;
Percent :Real from Standard= 0.01;
Maxlen: Real from Standard =10000)
-- - the first point is located by surf1(curv1(U))
-- - the second point is located by surf2(curv2(U))
--
-- - Order is the required continuity:
-- GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
-- GeomAbs_G1 GeomAbs_G2
--
-- (see the above constructor for the tolerances)
returns SurfaceContinuity from LocalAnalysis;
Create( EpsNul: Real from Standard= 0.001;
EpsC0 : Real from Standard= 0.001;
EpsC1 : Real from Standard= 0.001;
EpsC2 : Real from Standard= 0.001;
EpsG1 : Real from Standard= 0.001;
Percent :Real from Standard= 0.01;
Maxlen: Real from Standard =10000)
returns SurfaceContinuity from LocalAnalysis;
---Purpose:
-- This constructor is used when we want to compute many analysis.
-- After we use the method ComputeAnalysis
ComputeAnalysis( me:in out; Surf1, Surf2: in out SLProps from GeomLProp;
Order: Shape from GeomAbs);
-- This method computes the analysis for two SLProps which contains
-- the properties of the two surfaces and the two points
-- Order is the required continuity:
-- GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
-- GeomAbs_G1 GeomAbs_G2
IsDone(me) returns Boolean from Standard;
-- returns true if there is no problem in the constructor
ContinuityStatus(me) returns Shape from GeomAbs raises NotDone ;
-- returns the continuity required in the constructor
StatusError(me) returns StatusErrorType from LocalAnalysis;
-- returns the status of error :
-- NullFirstDerivative : one of the first derivatives is null
-- NullSecondDerivative: one of the second derivatives is null
-- NormalNotDefined: one (or both) normal is undefined
-- CurvatureNotDefined: one of the mean curvatures is undefined
-- The following functions return the quantities
-- which are necessary to check continuity
C0Value(me) returns Real from Standard raises NotDone ;
-- returns the distance between P1 and P2 with P1=Surf (u1,v1) and
-- P2=Surfv2(u2,v2)
C1UAngle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the first derivatives in u :
--
-- dSurf1(u1,v1) dSurf2(u2,v2)
-- -------- and ---------
-- du du
--
-- the angle value is between 0 and PI/2
C1URatio (me) returns Real from Standard raises NotDone ;
-- returns the ratio between the magnitudes of the first
-- derivatives in u
--
--
C1VAngle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the first derivatives in v:
--
-- dSurf1(u1,v1) dSurf2(u2,v2)
-- -------- and ---------
-- dv dv
--
-- the angle value is between 0 and PI/2
C1VRatio(me) returns Real from Standard raises NotDone ;
-- returns the ratio between the magnitudes of the first
-- derivatives in v
C2UAngle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the second derivatives in u
-- 2 2
-- d Surf1(u1,v1) d Surf2(u2,v2)
-- ---------- and ----------
-- 2 2
-- du du
C2URatio(me) returns Real from Standard raises NotDone ;
-- returns the ratio between the magnitudes of the second
-- derivatives in u
C2VAngle(me) returns Real from Standard raises NotDone ;
-- returns the angle between the second derivatives in v
-- 2 2
-- d Surf1(u1,v1) d Surf2(u2,v2)
-- ---------- and ----------
-- 2 2
-- dv dv
--
-- the angle value is between 0 and PI/2
--
C2VRatio(me) returns Real from Standard raises NotDone ;
-- returns the ratio between the magnitudes of the first
-- derivatives in v
G1Angle(me) returns Real from Standard raises NotDone ;
--returns the angle between the normals at the two points
--
-- the angle value is between 0 and PI/2
G2CurvatureGap (me) returns Real from Standard raises NotDone ;
-- returns the maximum normal curvature gap
-- the following functions check the local continuity and return
-- true if the required continuity is satisfied :
IsC0(me) returns Boolean from Standard
raises NotDone ;
-- returns true if the local continuity is C0 that is :
-- ContC0(me) < EpsC0
IsC1(me) returns Boolean from Standard
raises NotDone ;
-- returns true if the local continuity is C1 that is :
-- C0Value (me) < EpsC0 ,
-- C1UAngle (me) < EpsC1
-- C1VAngle (me) < EpsC1
IsC2(me) returns Boolean from Standard
raises NotDone ;
-- returns true if the local continuity is C2 that is :
-- C0Value (me) < EpsC0,
-- C1UAngle(me) < EpsC1
-- C1VAngle(me) < EpsC1
-- C2UAngle(me) < EpsC2
-- C2VAngle(me) < EpsC2
-- C2URatio(me) is the square of C1URatio up to a tolerance
-- C2VRatio(me) is the square of C1VRatio up to a tolerance
--
IsG1(me) returns Boolean from Standard
raises NotDone ;
-- returns true is the local continuity is G1 that is
-- C0Value(me) < EpsC0
-- G1Angle(me) < EpsG1
--
IsG2(me) returns Boolean from Standard
raises NotDone ;
-- returns true is the local continuity is G2
-- The following function are private and used in the constructor
SurfC0(me:in out; Surf1, Surf2: SLProps from GeomLProp) is private ;
SurfC1(me:in out; Surf1, Surf2:in out SLProps from GeomLProp)is private ;
SurfC2(me:in out; Surf1, Surf2:in out SLProps from GeomLProp)is private;
SurfG1(me:in out; Surf1, Surf2:in out SLProps from GeomLProp) is private;
SurfG2(me:in out; Surf1, Surf2:in out SLProps from GeomLProp) is private;
fields
myContC0 : Real from Standard;
myContC1U : Real from Standard;
myContC1V : Real from Standard;
myContC2U : Real from Standard;
myContC2V : Real from Standard;
myContG1 : Real from Standard;
myLambda1U : Real from Standard;
myLambda2U : Real from Standard;
myLambda1V : Real from Standard;
myLambda2V : Real from Standard;
myETA1 : Real from Standard;
myETA2 : Real from Standard;
myETA : Real from Standard;
myZETA1 : Real from Standard;
myZETA2 : Real from Standard;
myZETA : Real from Standard;
myAlpha : Real from Standard;
myTypeCont : Shape from GeomAbs;
myepsC0 : Real from Standard;
myepsnul : Real from Standard;
myepsC1 : Real from Standard;
myepsC2 : Real from Standard;
myepsG1 : Real from Standard;
myperce : Real from Standard;
mymaxlen : Real from Standard;
myGap : Real from Standard;
myIsDone : Boolean from Standard;
myErrorStatus : StatusErrorType from LocalAnalysis;
end SurfaceContinuity;

View File

@@ -0,0 +1,560 @@
// File: LocalAnalysis_SurfaceContinuity.cxx
// Created: Mon Sep 9 15:01:49 1996
// Author: Herve LOUESSARD
// <hl1@sgi38>
#include <LocalAnalysis_SurfaceContinuity.ixx>
#include <GeomLProp_SLProps.hxx>
#include <gp.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt2d.hxx>
#include <Geom_Surface.hxx>
#include <Geom2d_Curve.hxx>
/*********************************************************************************/
/*********************************************************************************/
void LocalAnalysis_SurfaceContinuity::SurfC0 (const GeomLProp_SLProps& Surf1,
const GeomLProp_SLProps& Surf2
)
{ myContC0=(Surf1.Value()).Distance(Surf2.Value());
}
/*********************************************************************************/
void LocalAnalysis_SurfaceContinuity::SurfC1( GeomLProp_SLProps& Surf1,
GeomLProp_SLProps & Surf2)
{ gp_Vec V1u, V2u, V1v, V2v;
Standard_Real norm1u, norm2u, norm1v, norm2v,angu,angv;
V1u = Surf1.D1U();
V2u = Surf2.D1U();
V1v = Surf1.D1V();
V2v = Surf2.D1V();
norm1u = V1u.Magnitude();
norm2u = V2u.Magnitude();
norm1v = V1v.Magnitude();
norm2v = V2v.Magnitude();
if ((norm1u>myepsnul )&&(norm2u>myepsnul )&&(norm1v>myepsnul)
&&(norm2v>myepsnul))
{ if (norm1u >= norm2u )
myLambda1U= norm2u / norm1u;
else myLambda1U = norm2u / norm1u;
if (norm1v >= norm2v )
myLambda1V= norm2v / norm1v;
else myLambda1V = norm2v / norm1v;
angu= V1u.Angle(V2u);
if (angu>PI/2) myContC1U=PI-angu;
else myContC1U=angu;
angv= V1v.Angle(V2v);
if (angv>PI/2) myContC1V=PI-angv;
else myContC1V=angv; }
else {myIsDone = Standard_False;
myErrorStatus=LocalAnalysis_NullFirstDerivative;}
}
/*********************************************************************************/
void LocalAnalysis_SurfaceContinuity::SurfC2( GeomLProp_SLProps& Surf1,
GeomLProp_SLProps& Surf2)
{ gp_Vec V11u, V12u, V21u, V22u, V11v, V12v, V21v, V22v;
Standard_Real norm11u, norm12u, norm21u, norm22u, norm11v, norm12v, norm21v, norm22v;
Standard_Real ang;
V11u = Surf1.D1U();
V12u = Surf2.D1U();
V21u = Surf1.D2U();
V22u = Surf2.D2U();
norm11u = V11u.Magnitude();
norm12u = V12u.Magnitude();
norm21u = V21u.Magnitude();
norm22u = V22u.Magnitude();
if ((norm11u>myepsnul)&&(norm12u>myepsnul))
{ if( (norm21u>myepsnul)&&(norm22u>myepsnul))
{ if (norm11u >= norm12u )
{myLambda1U= norm12u / norm11u;
myLambda2U = norm22u /norm21u;}
else {myLambda1U = norm11u / norm12u;
myLambda2U = norm21u / norm22u;}
ang=V21u.Angle(V22u);
if(ang>PI/2) myContC2U=PI-ang;
else myContC2U=ang; }
else
{ myIsDone=Standard_False;
myErrorStatus=LocalAnalysis_NullSecondDerivative;}
}
else { myIsDone=Standard_False;
myErrorStatus=LocalAnalysis_NullFirstDerivative;}
V11v = Surf1.D1V();
V12v = Surf2.D1V();
V21v = Surf1.D2V();
V22v = Surf2.D2V();
norm11v = V11v.Magnitude();
norm12v = V12v.Magnitude();
norm21v = V21v.Magnitude();
norm22v = V22v.Magnitude();
if ((norm11v>myepsnul)&&(norm12v>myepsnul))
{if ((norm21v>myepsnul)&&(norm22v>myepsnul))
{if ( norm11v >= norm12v )
{myLambda1V= norm12v / norm11v;
myLambda2V= norm22v / norm21v;}
else{ myLambda1V = norm11v / norm12v;
myLambda2V = norm21v / norm22v;}
ang= V21v.Angle(V22v);
if (ang>PI/2) myContC2V=PI-ang;
else myContC2V=ang;
}
else{ myIsDone= Standard_False;
myErrorStatus=LocalAnalysis_NullSecondDerivative; }
}
else{ myIsDone=Standard_False;
myErrorStatus=LocalAnalysis_NullFirstDerivative;}
}
/*********************************************************************************/
void LocalAnalysis_SurfaceContinuity::SurfG1( GeomLProp_SLProps& Surf1,
GeomLProp_SLProps& Surf2)
{ if (Surf1.IsNormalDefined()&&Surf2.IsNormalDefined())
{ gp_Dir D1 = Surf1.Normal();
gp_Dir D2 = Surf2.Normal();
Standard_Real ang=D1.Angle(D2);
if (ang>PI/2) myContG1= PI-ang;
else myContG1=ang;
}
else{ myIsDone=Standard_False;
myErrorStatus=LocalAnalysis_NormalNotDefined;}
}
/*********************************************************************************/
void LocalAnalysis_SurfaceContinuity::SurfG2 ( GeomLProp_SLProps& Surf1,
GeomLProp_SLProps & Surf2)
{ gp_Dir DMIN1, DMIN2, DMAX1, DMAX2;
Standard_Real RMIN1,RMIN2,RMAX1,RMAX2;
Standard_Real x1, x2, y1, y2, z1, z2;
if ( Surf1.IsCurvatureDefined() && Surf2.IsCurvatureDefined())
{
Surf1.CurvatureDirections(DMIN1, DMAX1);
Surf2.CurvatureDirections(DMIN2, DMAX2);
DMIN1.Coord(x1, y1, z1);
DMAX1.Coord(x2, y2, z2);
gp_Dir MCD1( (Abs(x1)+Abs(x2))/2, (Abs(y1)+Abs(y2))/2, (Abs(z1)+Abs(z2))/2 );
DMIN2.Coord(x1, y1, z1);
DMAX2.Coord(x2, y2, z2);
gp_Dir MCD2( (Abs(x1)+Abs(x2))/2, (Abs(y1)+Abs(y2))/2, (Abs(z1)+Abs(z2))/2 );
myAlpha = MCD1.Angle( MCD2 );
RMIN1 = Surf1.MinCurvature();
RMAX1 = Surf1.MaxCurvature();
RMIN2 = Surf2.MinCurvature();
RMAX2 = Surf2.MaxCurvature();
myETA1 = (RMIN1+RMAX1)/2;
myETA2 = (RMIN2+RMAX2)/2;
myETA = (myETA1+myETA2)/2;
myZETA1 = (RMAX1-RMIN1)/2;
myZETA2 = (RMAX2-RMIN2)/2;
myZETA = (myZETA1+myZETA2)/2;
Standard_Real DETA,DZETA;
DETA = ( myETA1- myETA2)/2;
DZETA =( myZETA1- myZETA2)/2;
myGap= Abs(DETA) + sqrt( DZETA*DZETA*Cos(myAlpha)*Cos(myAlpha)
+ myZETA*myZETA*Sin(myAlpha)*Sin(myAlpha));
}
else {myIsDone = Standard_False;
myErrorStatus=LocalAnalysis_CurvatureNotDefined;}
}
LocalAnalysis_SurfaceContinuity::LocalAnalysis_SurfaceContinuity(const Standard_Real EpsNul,
const Standard_Real EpsC0,
const Standard_Real EpsC1,
const Standard_Real EpsC2,
const Standard_Real EpsG1,
const Standard_Real Percent,
const Standard_Real Maxlen)
{ myepsnul=EpsNul;
myepsC0= EpsC0;
myepsC1= EpsC1;
myepsC2= EpsC2;
myepsG1= EpsG1;
myperce= Percent;
mymaxlen= Maxlen;
myIsDone = Standard_True;
}
void LocalAnalysis_SurfaceContinuity::ComputeAnalysis(GeomLProp_SLProps& Surf1,
GeomLProp_SLProps& Surf2,
const GeomAbs_Shape Order)
{ myTypeCont = Order;
switch ( Order )
{ case GeomAbs_C0 : {
SurfC0(Surf1, Surf2);
}
break;
case GeomAbs_C1 : {
SurfC0(Surf1, Surf2);
SurfC1(Surf1, Surf2);}
break;
case GeomAbs_C2 : {
SurfC0(Surf1, Surf2);
SurfC1(Surf1, Surf2);
SurfC2(Surf1, Surf2);}
break;
case GeomAbs_G1 : {
SurfC0(Surf1, Surf2);
SurfG1(Surf1, Surf2);}
break;
case GeomAbs_G2 : {
SurfC0(Surf1, Surf2);
SurfG1(Surf1, Surf2);
SurfG2(Surf1, Surf2);}
break;
default : {}
}
}
/*********************************************************************************/
LocalAnalysis_SurfaceContinuity::LocalAnalysis_SurfaceContinuity( const Handle(Geom_Surface)& Surf1,
const Standard_Real u1, const Standard_Real v1,
const Handle(Geom_Surface)& Surf2, const Standard_Real u2,
const Standard_Real v2, const GeomAbs_Shape Ordre,
const Standard_Real EpsNul,
const Standard_Real EpsC0 ,
const Standard_Real EpsC1 ,
const Standard_Real EpsC2,
const Standard_Real EpsG1,
const Standard_Real Percent,
const Standard_Real Maxlen )
{ myTypeCont = Ordre;
myepsnul=EpsNul;
myepsC0= EpsC0;
myepsC1= EpsC1;
myepsC2= EpsC2;
myepsG1= EpsG1;
myperce= Percent;
mymaxlen= Maxlen;
myIsDone = Standard_True;
switch ( Ordre )
{ case GeomAbs_C0 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 0, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 0, myepsnul);
SurfC0(Surfa1, Surfa2);
}
break;
case GeomAbs_C1 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 1, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 1, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfC1(Surfa1, Surfa2);}
break;
case GeomAbs_C2 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 2, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 2, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfC1(Surfa1, Surfa2);
SurfC2(Surfa1, Surfa2);}
break;
case GeomAbs_G1 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 1, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 1, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfG1(Surfa1, Surfa2);}
break;
case GeomAbs_G2 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 2, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 2, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfG1(Surfa1, Surfa2);
SurfG2(Surfa1, Surfa2);}
break;
default : {}
}
}
/*********************************************************************************/
LocalAnalysis_SurfaceContinuity::LocalAnalysis_SurfaceContinuity(const Handle(Geom2d_Curve)& curv1,
const Handle(Geom2d_Curve)& curv2, const Standard_Real U,
const Handle(Geom_Surface)& Surf1 ,
const Handle(Geom_Surface)& Surf2,
const GeomAbs_Shape Ordre,
const Standard_Real EpsNul,
const Standard_Real EpsC0 ,
const Standard_Real EpsC1 ,
const Standard_Real EpsC2,
const Standard_Real EpsG1,
const Standard_Real Percent,
const Standard_Real Maxlen )
{ Standard_Real pard1, parf1, pard2, parf2, u1, v1, u2, v2;
myTypeCont = Ordre;
myepsnul=EpsNul;
myepsC0= EpsC0;
myepsC1= EpsC1;
myepsC2= EpsC2;
myepsG1= EpsG1;
myperce= Percent;
mymaxlen= Maxlen;
myIsDone = Standard_True;
pard1 = curv1->FirstParameter();
pard2 = curv2->FirstParameter();
parf1 = curv1->LastParameter();
parf2 = curv2->LastParameter();
if (!(((U <= parf1) && (U >= pard1)) &&((U <= parf2) && (U >= pard2))) ) myIsDone = Standard_False;
else
{ gp_Pnt2d pt1 = curv1->Value(U);
gp_Pnt2d pt2 = curv2->Value(U);
pt1.Coord(u1, v1);
pt2.Coord(u2, v2);
switch ( Ordre )
{ case GeomAbs_C0 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 0, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 0, myepsnul);
SurfC0(Surfa1, Surfa2);
}
break;
case GeomAbs_C1 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 1, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 1, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfC1(Surfa1, Surfa2);}
break;
case GeomAbs_C2 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 2, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 2, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfC1(Surfa1, Surfa2);
SurfC2(Surfa1, Surfa2);}
break;
case GeomAbs_G1 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 1, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 1, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfG1(Surfa1, Surfa2);}
break;
case GeomAbs_G2 : {
GeomLProp_SLProps Surfa1 ( Surf1, u1, v1, 2, myepsnul);
GeomLProp_SLProps Surfa2 ( Surf2, u2, v2, 2, myepsnul);
SurfC0(Surfa1, Surfa2);
SurfG1(Surfa1, Surfa2);
SurfG2(Surfa1, Surfa2);}
break;
default : {}
}
}
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsC0() const
{ if (!myIsDone) { StdFail_NotDone::Raise();}
if ( myContC0 <= myepsC0 )
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsC1() const
{ if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC0 () && (myContC1U <= myepsC1) && (myContC1V <= myepsC1))
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsC2() const
{ Standard_Real eps1u, eps1v, eps2u, eps2v;
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC1())
{ eps1u = 0.5*myepsC1*myepsC1*myLambda1U;
eps1v = 0.5*myepsC1*myepsC1*myLambda1V;
eps2u = 0.5*myepsC2*myepsC2*myLambda2U;
eps2v = 0.5*myepsC2*myepsC2*myLambda2V;
if ((myContC2U < myepsC2) && (myContC2V < myepsC2))
{ if (Abs(myLambda1U*myLambda1U-myLambda2U) <= (eps1u*eps1u+eps2u))
if (Abs(myLambda1V*myLambda1V-myLambda2V) <= (eps1v*eps1v+eps2v))
return Standard_True;
else return Standard_False;
else return Standard_False;
}
else return Standard_False;
}
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsG1() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
if ( IsC0 () &&( myContG1 <= myepsG1))
return Standard_True;
else return Standard_False;
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsG2()const
{ Standard_Real EPSNL;
Standard_Integer itype;
if (!myIsDone) { StdFail_NotDone::Raise();}
itype =0;
EPSNL= 8*myepsC0/(mymaxlen*mymaxlen);
if ( IsG1())
{ if ( ( Abs(myETA)< EPSNL) && ( Abs(myZETA)< EPSNL))
return Standard_True;
if ( ( Abs(myZETA1)< EPSNL) && ( Abs(myZETA2)< EPSNL))
itype =1;
else if ( ( Abs(myETA1)< EPSNL) && ( Abs(myETA2)< EPSNL))
itype =1;
else if ((Abs(Abs(myZETA)-Abs(myETA))) < EPSNL)
itype =1;
else if ((myETA1<myZETA1)&&(myETA2<myZETA2))
itype =1;
else if ((myETA1>myZETA1)&&(myETA2>myZETA2))
itype =1;
if (itype == 1)
{
if (( myETA >= (2*myZETA))&&(myGap<=(myperce*(myETA-myZETA)))) return Standard_True;
if (( myZETA>= myETA) && ( myGap<= (myperce*myZETA))) return Standard_True;
if (( myZETA<= myETA) && ( myETA <= (2*myZETA)) && (myGap <= (myperce * myETA)))
return Standard_True;
else return Standard_False;
}
else return Standard_False;
}
else return Standard_False;
}
/*********************************************************************************/
GeomAbs_Shape LocalAnalysis_SurfaceContinuity::ContinuityStatus() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return (myTypeCont);
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C0Value() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC0 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C1UAngle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC1U );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C1VAngle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC1V );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C2UAngle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC2U );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C2VAngle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContC2V );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::G1Angle() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myContG1 );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C1URatio() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myLambda1U );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C2URatio() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myLambda2U );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C1VRatio() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myLambda1V );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::C2VRatio() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myLambda2V );
}
/*********************************************************************************/
Standard_Real LocalAnalysis_SurfaceContinuity::G2CurvatureGap() const
{
if (!myIsDone) { StdFail_NotDone::Raise();}
return ( myGap );
}
/*********************************************************************************/
Standard_Boolean LocalAnalysis_SurfaceContinuity::IsDone() const
{ return ( myIsDone );
}
/*********************************************************************************/
LocalAnalysis_StatusErrorType LocalAnalysis_SurfaceContinuity::StatusError() const
{
return myErrorStatus;
}