mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
62
src/TopTrans/TopTrans.cdl
Executable file
62
src/TopTrans/TopTrans.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: TopTrans.cdl
|
||||
-- Created: Mon Oct 28 14:59:09 1991
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phobox>
|
||||
---Copyright: Matra Datavision 1991, 1992
|
||||
|
||||
|
||||
package TopTrans
|
||||
|
||||
---Purpose: This package provides algorithms to compute
|
||||
-- complex transitions. A transition is the status of
|
||||
-- geometry near the boundary of a Shape. An example
|
||||
-- is the intersection of a curve and a surface
|
||||
-- enclosing a solid , the transition tells if the
|
||||
-- parts of the curve just before and just after the
|
||||
-- intersection are inside, outside or on the
|
||||
-- boundary of the solid.
|
||||
--
|
||||
-- The difficulty with transitions arise when dealing
|
||||
-- with trimmed geometries like edges and faces. When
|
||||
-- the geometric intersections are inside the trimmed
|
||||
-- geometry the transition is usually computed by the
|
||||
-- intersection algorithms as the trimming can be
|
||||
-- safely ignored. If the intersection falls on the
|
||||
-- trimming boundaries one must consider the
|
||||
-- neighbouring entities. Consider as an example the
|
||||
-- intersection of a curve and a solid, if the
|
||||
-- intersection falls on an edge of the solid it does
|
||||
-- not falls inside the two faces adjacent to the
|
||||
-- edge, a complex transition occurs.
|
||||
--
|
||||
-- This package provides two classes :
|
||||
--
|
||||
-- * CurveTransition is used to compute complex
|
||||
-- transitions with an other curve.
|
||||
--
|
||||
-- * SurfaceTransition is used to compute complex
|
||||
-- transitions in 3D space.
|
||||
--
|
||||
-- The curves and surfaces are given by a first or
|
||||
-- second order approximation around the intersection
|
||||
-- point. For a curve, the tangent vector or the
|
||||
-- osculating circle. For a surface the normal vector
|
||||
-- or the osculating quadric.
|
||||
|
||||
uses
|
||||
Standard,
|
||||
TCollection,
|
||||
TColStd,
|
||||
gp,
|
||||
TopAbs
|
||||
|
||||
is
|
||||
|
||||
class Array2OfOrientation instantiates
|
||||
Array2 from TCollection (Orientation from TopAbs);
|
||||
|
||||
class CurveTransition;
|
||||
|
||||
class SurfaceTransition;
|
||||
|
||||
end TopTrans;
|
124
src/TopTrans/TopTrans_CurveTransition.cdl
Executable file
124
src/TopTrans/TopTrans_CurveTransition.cdl
Executable file
@@ -0,0 +1,124 @@
|
||||
-- File: CurveTransition.cdl
|
||||
-- Created: Thu Jan 30 12:10:21 1992
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class CurveTransition from TopTrans
|
||||
|
||||
---Purpose: This algorithm is used to compute the transition
|
||||
-- of a Curve intersecting a curvilinear boundary.
|
||||
--
|
||||
-- The geometric elements are described locally at
|
||||
-- the intersection point by a second order
|
||||
-- development.
|
||||
--
|
||||
-- The curve is described by the intersection point,
|
||||
-- the tangent vector and the curvature.
|
||||
--
|
||||
-- The boundary is described by a set of curve
|
||||
-- elements, a curve element is either :
|
||||
--
|
||||
-- - A curve.
|
||||
--
|
||||
-- - A curve and an orientation called a half-curve,
|
||||
-- the boundary of the curve is before or after the
|
||||
-- intersection point depending on the orientation.
|
||||
--
|
||||
|
||||
uses
|
||||
|
||||
Boolean from Standard,
|
||||
Real from Standard,
|
||||
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
|
||||
State from TopAbs,
|
||||
Orientation from TopAbs
|
||||
|
||||
is
|
||||
|
||||
Create returns CurveTransition from TopTrans;
|
||||
---Purpose: Create an empty Curve Transition.
|
||||
|
||||
|
||||
Reset( me : in out;
|
||||
Tgt : in Dir from gp; -- Tangent at this point
|
||||
Norm : in Dir from gp; -- Normal vector at this point
|
||||
Curv : in Real from Standard);-- Curvature at this point
|
||||
---Purpose: Initialize a Transition with the local description
|
||||
-- of a Curve.
|
||||
|
||||
Reset( me : in out;
|
||||
Tgt : in Dir from gp); -- Tangent at this point
|
||||
---Purpose: Initialize a Transition with the local description
|
||||
-- of a straigth line.
|
||||
|
||||
Compare(me : in out;
|
||||
Tole : in Real from Standard; -- Cosine tolerance
|
||||
Tang : in Dir from gp; -- Tangent on curve for this point
|
||||
Norm : in Dir from gp; -- Normal vector at this point
|
||||
Curv : in Real from Standard; -- Curvature at this point
|
||||
S : in Orientation from TopAbs; -- transition locale
|
||||
Or : in Orientation from TopAbs);-- orientation de la tangente
|
||||
---Purpose: Add a curve element to the boundary. If Or is
|
||||
-- REVERSED the curve is before the intersection,
|
||||
-- else if Or is FORWARD the curv is after the
|
||||
-- intersection and if Or is INTERNAL the
|
||||
-- intersection is in the middle of the curv.
|
||||
|
||||
StateBefore(me) returns State from TopAbs;
|
||||
---Purpose: returns the state of the curve before the
|
||||
-- intersection, this is the position relative to the
|
||||
-- boundary of a point very close to the intersection
|
||||
-- on the negative side of the tangent.
|
||||
|
||||
StateAfter(me) returns State from TopAbs;
|
||||
---Purpose: returns the state of the curve after the
|
||||
-- intersection, this is the position relative to the
|
||||
-- boundary of a point very close to the intersection
|
||||
-- on the positive side of the tangent.
|
||||
|
||||
|
||||
---Implementation functions :
|
||||
|
||||
IsBefore( me;
|
||||
Tole : in Real from Standard;
|
||||
Angl : in Real from Standard;
|
||||
Nor1 : in Dir from gp;
|
||||
Cur1 : in Real from Standard;
|
||||
Nor2 : in Dir from gp;
|
||||
Cur2 : in Real from Standard)
|
||||
returns Boolean from Standard is private;
|
||||
---Purpose: Compare two curvature and return true if N1,C1 is
|
||||
-- before N2,C2 in the edge orientation
|
||||
|
||||
Compare(me;
|
||||
Ang1 : in Real from Standard;
|
||||
Ang2 : in Real from Standard;
|
||||
Tole : in Real from Standard)
|
||||
returns Integer from Standard is private;
|
||||
---Purpose: Compare two angles at tolerance Tole
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myTgt : Dir from gp; -- Tangent at this point
|
||||
myNorm : Dir from gp; -- Normal vector at this point
|
||||
myCurv : Real; -- Curvature at this point
|
||||
|
||||
Init : Boolean;
|
||||
|
||||
TgtFirst : Dir from gp; -- Elements to determine the state
|
||||
NormFirst : Dir from gp; --
|
||||
CurvFirst : Real; -- before the intersection
|
||||
TranFirst : Orientation from TopAbs;
|
||||
|
||||
TgtLast : Dir from gp; -- Elements to determine the state
|
||||
NormLast : Dir from gp; --
|
||||
CurvLast : Real; -- After the intersection
|
||||
TranLast : Orientation from TopAbs;
|
||||
|
||||
end CurveTransition;
|
354
src/TopTrans/TopTrans_CurveTransition.cxx
Executable file
354
src/TopTrans/TopTrans_CurveTransition.cxx
Executable file
@@ -0,0 +1,354 @@
|
||||
// File: TopTrans_CurveTransition.cxx
|
||||
// Created: Thu Jan 23 18:57:37 1992
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@sdsun1>
|
||||
// Copyright: Matra Datavision 1992
|
||||
|
||||
#include <TopTrans_CurveTransition.ixx>
|
||||
#include <TopAbs.hxx>
|
||||
|
||||
#define GREATER 1
|
||||
#define SAME 0
|
||||
#define LOWER -1
|
||||
|
||||
//=======================================================================
|
||||
//function : TopTrans_CurveTransition
|
||||
//purpose : Empty Constructor.
|
||||
//=======================================================================
|
||||
|
||||
TopTrans_CurveTransition::TopTrans_CurveTransition ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Reset
|
||||
//purpose : Initializer for a complex curve transition with the elements
|
||||
// of the intersecting curve.
|
||||
//=======================================================================
|
||||
|
||||
void TopTrans_CurveTransition::Reset (const gp_Dir& Tgt,
|
||||
const gp_Dir& Norm,
|
||||
const Standard_Real Curv)
|
||||
{
|
||||
myTgt=Tgt; myNorm=Norm; myCurv=Curv; Init=Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Reset
|
||||
//purpose : Initializer for a complex curve transition with the elements
|
||||
// of the intersecting straight line.
|
||||
//=======================================================================
|
||||
|
||||
void TopTrans_CurveTransition::Reset (const gp_Dir& Tgt)
|
||||
{
|
||||
myTgt=Tgt; myCurv=0.; Init=Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compare
|
||||
//purpose : Compare the elements of an interference on an intersected
|
||||
// curve with the interference stored in the complex Transition.
|
||||
//=======================================================================
|
||||
|
||||
void TopTrans_CurveTransition::Compare (const Standard_Real Tole,
|
||||
const gp_Dir& T,
|
||||
const gp_Dir& N,
|
||||
const Standard_Real C,
|
||||
const TopAbs_Orientation St,
|
||||
const TopAbs_Orientation Or)
|
||||
{
|
||||
// S is the transition, how the curve cross the boundary
|
||||
// O is the orientation, how the intersection is set on the boundary
|
||||
TopAbs_Orientation S = St;
|
||||
TopAbs_Orientation O = Or;
|
||||
|
||||
// adjustment for INTERNAL transition
|
||||
if (S == TopAbs_INTERNAL) {
|
||||
if (T * myTgt < 0)
|
||||
S = TopAbs::Reverse(O);
|
||||
else
|
||||
S = O;
|
||||
}
|
||||
|
||||
// It is the first comparaison for this complex transition
|
||||
if (Init) {
|
||||
Init=Standard_False;
|
||||
TgtFirst =T;
|
||||
NormFirst=N;
|
||||
CurvFirst=C;
|
||||
TranFirst=S;
|
||||
TgtLast =T;
|
||||
NormLast =N;
|
||||
CurvLast =C;
|
||||
TranLast =S;
|
||||
switch (O) {
|
||||
// Interference en fin d'arete il faut inverser la tangente
|
||||
case TopAbs_REVERSED :
|
||||
TgtFirst.Reverse();
|
||||
TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
// Interference en milieu d'arete il faut inverser en fonction de la
|
||||
// position de la tangente de reference
|
||||
if (myTgt*T>0) TgtFirst.Reverse();
|
||||
else TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Compare with the existent first and last transition :
|
||||
else {
|
||||
Standard_Boolean FirstSet=Standard_False;
|
||||
Standard_Real cosAngWithT=myTgt*T;
|
||||
switch (O) {
|
||||
case TopAbs_REVERSED :
|
||||
cosAngWithT= -cosAngWithT;
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
if (cosAngWithT>0) cosAngWithT=-cosAngWithT;
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
Standard_Real cosAngWith1=myTgt*TgtFirst;
|
||||
|
||||
switch (Compare(cosAngWithT, cosAngWith1, Tole)) {
|
||||
|
||||
case LOWER :
|
||||
// If the angle is greater than the first the new become the first
|
||||
FirstSet=Standard_True;
|
||||
TgtFirst =T;
|
||||
switch (O) {
|
||||
case TopAbs_REVERSED :
|
||||
TgtFirst.Reverse();
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
if (myTgt*T>0) TgtFirst.Reverse();
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
NormFirst=N;
|
||||
CurvFirst=C;
|
||||
TranFirst=S;
|
||||
break;
|
||||
|
||||
case SAME :
|
||||
// If same angles we look at the Curvature
|
||||
if (IsBefore(Tole, cosAngWithT, N, C, NormFirst, CurvFirst)) {
|
||||
FirstSet=Standard_True;
|
||||
TgtFirst =T;
|
||||
switch (O) {
|
||||
case TopAbs_REVERSED :
|
||||
TgtFirst.Reverse();
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
if (myTgt*T>0) TgtFirst.Reverse();
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
NormFirst=N;
|
||||
CurvFirst=C;
|
||||
TranFirst=S;
|
||||
}
|
||||
break;
|
||||
|
||||
case GREATER:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!FirstSet || O==TopAbs_INTERNAL) {
|
||||
// Dans les cas de tangence le premier peut etre aussi le dernier
|
||||
if (O==TopAbs_INTERNAL) cosAngWithT=-cosAngWithT;
|
||||
Standard_Real cosAngWith2=myTgt*TgtLast;
|
||||
|
||||
switch (Compare(cosAngWithT, cosAngWith2, Tole)) {
|
||||
|
||||
case GREATER:
|
||||
// If the angle is lower than the last the new become the last
|
||||
TgtLast =T;
|
||||
switch (O) {
|
||||
case TopAbs_REVERSED :
|
||||
TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
if (myTgt*T<0) TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
NormLast =N;
|
||||
CurvLast =C;
|
||||
TranLast =S;
|
||||
break;
|
||||
|
||||
case SAME:
|
||||
// If the angle is the same we look at the curvature
|
||||
if (IsBefore(Tole, cosAngWithT, NormLast, CurvLast, N, C)) {
|
||||
TgtLast =T;
|
||||
switch (O) {
|
||||
case TopAbs_REVERSED :
|
||||
TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_INTERNAL :
|
||||
if (myTgt*T<0) TgtLast.Reverse();
|
||||
break;
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
break;
|
||||
}
|
||||
NormLast=N;
|
||||
CurvLast=C;
|
||||
TranLast=S;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : StateBefore
|
||||
//purpose : Give the state of the curv before the interference.
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_State TopTrans_CurveTransition::StateBefore () const
|
||||
{
|
||||
if (Init) return TopAbs_UNKNOWN;
|
||||
switch (TranFirst)
|
||||
{
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
return TopAbs_OUT;
|
||||
case TopAbs_REVERSED :
|
||||
case TopAbs_INTERNAL :
|
||||
return TopAbs_IN;
|
||||
}
|
||||
return TopAbs_OUT;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : StateAfter
|
||||
//purpose : give the state of the curve after the interference.
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_State TopTrans_CurveTransition::StateAfter () const
|
||||
{
|
||||
if (Init) return TopAbs_UNKNOWN;
|
||||
switch (TranLast)
|
||||
{
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_INTERNAL :
|
||||
return TopAbs_IN;
|
||||
case TopAbs_REVERSED :
|
||||
case TopAbs_EXTERNAL :
|
||||
return TopAbs_OUT;
|
||||
}
|
||||
return TopAbs_OUT;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBefore
|
||||
//purpose : Compare the curvature of the two transition and return true
|
||||
// if T1 is before T2
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TopTrans_CurveTransition::IsBefore
|
||||
(const Standard_Real Tole,
|
||||
const Standard_Real CosAngl,
|
||||
const gp_Dir& N1,
|
||||
const Standard_Real C1,
|
||||
const gp_Dir& N2,
|
||||
const Standard_Real C2) const
|
||||
{
|
||||
Standard_Real TN1=myTgt*N1;
|
||||
Standard_Real TN2=myTgt*N2;
|
||||
Standard_Boolean OneBefore=Standard_False;
|
||||
|
||||
if (Abs(TN1)<=Tole || Abs(TN2)<=Tole) {
|
||||
// Tangent : The first is the interference which have the nearest curvature
|
||||
// from the reference.
|
||||
if (myCurv==0) {
|
||||
// The reference is straight
|
||||
// The first is the interference which have the lowest curvature.
|
||||
if (C1<C2) OneBefore=Standard_True;
|
||||
// Modified by Sergey KHROMOV - Wed Dec 27 17:08:49 2000 Begin
|
||||
if (CosAngl>0)
|
||||
OneBefore=!OneBefore;
|
||||
// Modified by Sergey KHROMOV - Wed Dec 27 17:08:50 2000 End
|
||||
}
|
||||
else {
|
||||
// The reference is curv
|
||||
// The first is the interference which have the nearest curvature
|
||||
// in the direction
|
||||
Standard_Real deltaC1, deltaC2;
|
||||
if (C1==0. || myCurv==0.) {
|
||||
deltaC1=C1-myCurv;
|
||||
}
|
||||
else {
|
||||
deltaC1=(C1-myCurv)*(N1*myNorm);
|
||||
}
|
||||
if (C2==0. || myCurv==0.) {
|
||||
deltaC2=C2-myCurv;
|
||||
}
|
||||
else {
|
||||
deltaC2=(C2-myCurv)*(N2*myNorm);
|
||||
}
|
||||
if (deltaC1 < deltaC2) OneBefore=Standard_True;
|
||||
if (CosAngl>0) OneBefore=!OneBefore;
|
||||
}
|
||||
}
|
||||
else if (TN1<0) {
|
||||
// Before the first interference we are in the curvature
|
||||
if (TN2>0) {
|
||||
// Before the second interference we are out the curvature
|
||||
// The first interference is before /* ->)( */
|
||||
OneBefore=Standard_True;
|
||||
}
|
||||
else {
|
||||
// Before the second interference we are in the curvature
|
||||
if (C1>C2) {
|
||||
// We choice the greater curvature
|
||||
// The first interference is before /* ->)) */
|
||||
OneBefore=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TN1>0) {
|
||||
// Before the first interference we are out the curvature
|
||||
if (TN2>0) {
|
||||
// Before the second interference we are out the curvature /* ->(( */
|
||||
if (C1<C2) {
|
||||
// We choice the lower curvature
|
||||
// The first interference is before
|
||||
OneBefore=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
return OneBefore;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compare
|
||||
//purpose : Compare two angles
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer TopTrans_CurveTransition::Compare(const Standard_Real Ang1,
|
||||
const Standard_Real Ang2,
|
||||
const Standard_Real Tole) const
|
||||
{
|
||||
Standard_Integer res=SAME;
|
||||
if (Ang1 - Ang2 > Tole) res=GREATER;
|
||||
else if (Ang2 - Ang1 > Tole) res=LOWER;
|
||||
|
||||
return res;
|
||||
}
|
145
src/TopTrans/TopTrans_SurfaceTransition.cdl
Executable file
145
src/TopTrans/TopTrans_SurfaceTransition.cdl
Executable file
@@ -0,0 +1,145 @@
|
||||
-- File: SurfaceTransition.cdl
|
||||
-- Created: Thu Jan 30 12:10:44 1992
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@sdsun1>
|
||||
-- xpu:4/3/97 implementation
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class SurfaceTransition from TopTrans
|
||||
|
||||
---Purpose: This algorithm is used to compute the transition
|
||||
-- of a 3D surface intersecting a topological surfacic
|
||||
-- boundary on a 3D curve ( intersection curve ).
|
||||
-- The boundary is described by a set of faces
|
||||
-- each face is described by
|
||||
-- - its support surface,
|
||||
-- - an orientation defining its matter side.
|
||||
-- The geometric elements are described locally at the
|
||||
-- intersection point by a second order development.
|
||||
-- A surface is described by the normal vector, the
|
||||
-- principal directions and the principal curvatures.
|
||||
-- A curve is described by the tangent, the normal
|
||||
-- and the curvature.
|
||||
-- The algorithm keeps track of the two faces elements
|
||||
-- closest to the part of the curve "before" and "after"
|
||||
-- the intersection, these two elements are updated
|
||||
-- for each new face.
|
||||
-- The position of the curve can be computed when at
|
||||
-- least one surface element has been given, this
|
||||
-- position is "In","Out" or "On" for the part of the
|
||||
-- curve "Before" or "After" the intersection.
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
State from TopAbs,
|
||||
Orientation from TopAbs,
|
||||
Array2OfReal from TColStd,
|
||||
Array2OfOrientation from TopTrans
|
||||
is
|
||||
|
||||
Create returns SurfaceTransition from TopTrans;
|
||||
---Purpose: Create an empty Surface Transition.
|
||||
|
||||
Reset ( me : in out;
|
||||
Tgt : Dir from gp; -- curve tangent at this point
|
||||
Norm : Dir from gp; -- surface normal at this point
|
||||
MaxD, MinD : Dir from gp; -- surface principal directions at this point
|
||||
MaxCurv, MinCurv : in Real ); -- curvatures on surface at this point
|
||||
---Purpose: Initialize a Surface Transition with the local
|
||||
-- description of the intersection curve and of the
|
||||
-- reference surface.
|
||||
-- PREQUESITORY : Norm oriented OUTSIDE "geometric matter"
|
||||
|
||||
Reset ( me : in out;
|
||||
Tgt : Dir from gp;
|
||||
Norm : Dir from gp );
|
||||
---Purpose: Initialize a Surface Transition with the local
|
||||
-- description of a straight line.
|
||||
|
||||
Compare(me : in out;
|
||||
Tole : Real; -- Cosine tolerance
|
||||
Norm : Dir from gp; -- surface normal oriented at this point
|
||||
MaxD, MinD : Dir from gp; -- surface principal directions at this point
|
||||
MaxCurv, MinCurv : in Real; -- curvatures on surface at this point
|
||||
S : Orientation from TopAbs;
|
||||
O : Orientation from TopAbs );
|
||||
---Purpose: Add a face element to the boundary.
|
||||
--
|
||||
-- - S defines topological orientation for the face :
|
||||
-- S FORWARD means: along the intersection curve on the
|
||||
-- reference surface, transition states while crossing
|
||||
-- the face are OUT,IN.
|
||||
-- S REVERSED means states are IN,OUT.
|
||||
-- S INTERNAL means states are IN,IN.
|
||||
--
|
||||
-- - O defines curve's position on face :
|
||||
-- O FORWARD means the face is before the intersection
|
||||
-- O REVERSED means the face is AFTER
|
||||
-- O INTERNAL means the curve intersection is in the face.
|
||||
-- PREQUESITORY : Norm oriented OUTSIDE "geometric matter"
|
||||
|
||||
Compare(me : in out;
|
||||
Tole : Real;
|
||||
Norm : Dir from gp;
|
||||
S : Orientation from TopAbs;
|
||||
O : Orientation from TopAbs);
|
||||
---Purpose: Add a plane or a cylindric face to the boundary.
|
||||
|
||||
StateBefore(me) returns State from TopAbs;
|
||||
---Purpose: Returns the state of the reference surface before
|
||||
-- the interference, this is the position relative to
|
||||
-- the surface of a point very close to the intersection
|
||||
-- on the negative side of the tangent.
|
||||
|
||||
StateAfter(me) returns State from TopAbs;
|
||||
---Purpose: Returns the state of the reference surface after
|
||||
-- interference, this is the position relative to the
|
||||
-- surface of a point very close to the intersection
|
||||
-- on the positive side of the tangent.
|
||||
|
||||
--
|
||||
-- Private :
|
||||
--
|
||||
|
||||
UpdateReference(me : in out;
|
||||
Tole : Real;
|
||||
isInfRef : Boolean;
|
||||
CosInf, CosSup : in out Real;
|
||||
Tran : Orientation from TopAbs;
|
||||
TranRef : in out Orientation from TopAbs) is private;
|
||||
|
||||
ComputeCos(me;
|
||||
Tole : Real; -- cosinus tolerance
|
||||
Norm : Dir from gp; -- face normal
|
||||
O : Orientation from TopAbs; -- intersection position on face
|
||||
isleft : out Boolean) returns Real is private;
|
||||
|
||||
GetBefore(myclass;
|
||||
Tran : Orientation from TopAbs)
|
||||
returns State from TopAbs;
|
||||
|
||||
GetAfter(myclass;
|
||||
Tran : Orientation from TopAbs)
|
||||
returns State from TopAbs;
|
||||
|
||||
fields
|
||||
|
||||
-- local reference input data :
|
||||
myTgt : Dir from gp; -- intersection curve tangent
|
||||
myNorm : Dir from gp; -- reference surface normal
|
||||
beafter : Dir from gp; -- direction (Before, After) on reference surface.
|
||||
myCurvRef : Real; -- for the reference surface
|
||||
|
||||
-- local data for boundary faces :
|
||||
myAng : Array2OfReal from TColStd;
|
||||
myCurv : Array2OfReal from TColStd;
|
||||
myOri : Array2OfOrientation from TopTrans;
|
||||
|
||||
-- flag for touch case (eap Mar 25 2002)
|
||||
myTouchFlag : Boolean from Standard;
|
||||
|
||||
end SurfaceTransition;
|
||||
|
||||
|
493
src/TopTrans/TopTrans_SurfaceTransition.cxx
Executable file
493
src/TopTrans/TopTrans_SurfaceTransition.cxx
Executable file
@@ -0,0 +1,493 @@
|
||||
// File: TopTrans_SurfaceTransition.cxx
|
||||
// Created: Tue Mar 4 16:44:54 1997
|
||||
// Author: Prestataire Xuan PHAM PHU
|
||||
// <xpu@poulopox.paris1.matra-dtv.fr>
|
||||
|
||||
// Modified: eap Mar 25 2002 (occ102,occ227), touch case
|
||||
#include <TopTrans_SurfaceTransition.ixx>
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#define Msr Standard_Real
|
||||
#define Msi Standard_Integer
|
||||
#define Msb Standard_Boolean
|
||||
#define Msf Standard_False
|
||||
#define Mst Standard_True
|
||||
#define MTAo TopAbs_Orientation
|
||||
#define MTAs TopAbs_State
|
||||
|
||||
static Standard_Boolean STATIC_DEFINED = Standard_False;
|
||||
|
||||
//#include <TopOpeBRepTool_EXPORT.hxx>
|
||||
static gp_Dir FUN_nCinsideS(const gp_Dir& tgC, const gp_Dir& ngS)
|
||||
{
|
||||
// Give us a curve C on suface S, <parOnC>, a parameter
|
||||
// Purpose : compute normal vector to C, tangent to S at
|
||||
// given point , oriented INSIDE S
|
||||
// <tgC> : geometric tangent at point of <parOnC>
|
||||
// <ngS> : geometric normal at point of <parOnC>
|
||||
gp_Dir XX(ngS^tgC);
|
||||
return XX;
|
||||
}
|
||||
|
||||
#define M_REVERSED(st) (st == TopAbs_REVERSED)
|
||||
#define M_INTERNAL(st) (st == TopAbs_INTERNAL)
|
||||
#define M_UNKNOWN(st) (st == TopAbs_UNKNOWN)
|
||||
|
||||
static Standard_Integer FUN_OO(const Standard_Integer i)
|
||||
{
|
||||
if (i == 1) return 2;
|
||||
if (i == 2) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//static Standard_Real FUN_Ang(const gp_Dir& Normref,
|
||||
static Standard_Real FUN_Ang(const gp_Dir& ,
|
||||
const gp_Dir& beafter,
|
||||
const gp_Dir& TgC,
|
||||
const gp_Dir& Norm,
|
||||
const TopAbs_Orientation O)
|
||||
{
|
||||
gp_Dir dironF = FUN_nCinsideS(TgC,Norm);
|
||||
if (M_REVERSED(O)) dironF.Reverse();
|
||||
|
||||
Standard_Real ang = beafter.AngleWithRef(dironF,TgC);
|
||||
return ang;
|
||||
}
|
||||
|
||||
static void FUN_getSTA(const Standard_Real Ang, const Standard_Real tola,
|
||||
Standard_Integer& i, Standard_Integer& j)
|
||||
{
|
||||
Standard_Real cos = Cos(Ang);
|
||||
Standard_Real sin = Sin(Ang);
|
||||
Standard_Boolean nullcos = Abs(cos) < tola;
|
||||
Standard_Boolean nullsin = Abs(sin) < tola;
|
||||
if (nullcos) i = 0;
|
||||
else i = (cos > 0.) ? 1 : 2;
|
||||
if (nullsin) j = 0;
|
||||
else j = (sin > 0.) ? 1 : 2;
|
||||
}
|
||||
|
||||
/*static void FUN_getSTA(const Standard_Real Ang, const Standard_Real tola,
|
||||
const Standard_Real Curv, const Standard_Real CurvRef,
|
||||
Standard_Integer& i, Standard_Integer& j)
|
||||
{
|
||||
// Choosing UV referential (beafter,myNorm).
|
||||
// purpose : computes position boundary face relative to the reference surface
|
||||
// notice : j==0 => j==1 : the boundary face is ABOVE the reference surface
|
||||
// j==2 : the boundary face is UNDER the reference surface
|
||||
// - j==0 : the boundary and the reference objects are tangent-
|
||||
|
||||
FUN_getSTA(Ang,tola,i,j);
|
||||
if (j == 0) {
|
||||
Standard_Real diff = Curv - CurvRef;
|
||||
if (Abs(diff) < tola) {STATIC_DEFINED = Standard_False; return;} // nyi FUN_Raise
|
||||
j = (diff < 0.) ? 1 : 2;
|
||||
}
|
||||
}*/
|
||||
#ifndef DEB
|
||||
#define M_Unknown (-100)
|
||||
#else
|
||||
#define M_Unknown (-100.)
|
||||
#endif
|
||||
#define M_noupdate (0)
|
||||
#define M_updateREF (1)
|
||||
#define M_Ointernal (10)
|
||||
static Standard_Integer FUN_refnearest(const Standard_Real Angref, const TopAbs_Orientation Oriref,
|
||||
const Standard_Real Ang, const TopAbs_Orientation Ori, const Standard_Real tola)
|
||||
{
|
||||
Standard_Boolean undef = (Angref == 100.);
|
||||
if (undef) return M_updateREF;
|
||||
|
||||
Standard_Real cosref = Cos(Angref), cos = Cos(Ang);
|
||||
Standard_Real dcos = Abs(cosref) - Abs(cos);
|
||||
if (Abs(dcos) < tola) {
|
||||
// Analysis for tangent cases : if two boundary faces are same sided
|
||||
// and have tangent normals, if they have opposite orientations
|
||||
// we choose INTERNAL as resulting complex transition (case EXTERNAL
|
||||
// refering to no logical case)
|
||||
if (TopAbs::Complement(Ori) == Oriref) return M_Ointernal;
|
||||
else return (Standard_Integer ) M_Unknown; // nyi FUN_RAISE
|
||||
}
|
||||
Standard_Integer updateref = (dcos > 0.)? M_noupdate : M_updateREF;
|
||||
return updateref;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FUN_refnearest
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer FUN_refnearest(const Standard_Integer i,
|
||||
const Standard_Integer j,
|
||||
const Standard_Real CurvSref,
|
||||
const Standard_Real Angref,
|
||||
const TopAbs_Orientation Oriref,
|
||||
const Standard_Real Curvref,
|
||||
const Standard_Real Ang,
|
||||
const TopAbs_Orientation Ori,
|
||||
const Standard_Real Curv,
|
||||
const Standard_Real tola,
|
||||
Standard_Boolean & TouchFlag) // eap Mar 25 2002
|
||||
{
|
||||
Standard_Boolean iisj = (i == j);
|
||||
Standard_Real abscos = Abs(Cos(Ang));
|
||||
Standard_Boolean i0 = (Abs(1. - abscos) < tola);
|
||||
Standard_Boolean j0 = (abscos < tola);
|
||||
Standard_Boolean nullcurv = (Curv == 0.);
|
||||
Standard_Boolean curvpos = (Curv > tola);
|
||||
Standard_Boolean curvneg = (Curv < -tola);
|
||||
Standard_Boolean nullcsref = (CurvSref == 0.);
|
||||
|
||||
Standard_Boolean undef = (Angref == 100.);
|
||||
if (undef) {
|
||||
if (i0) {
|
||||
if (iisj && curvneg) return M_noupdate;
|
||||
if (!iisj && curvpos) return M_noupdate;
|
||||
}
|
||||
if (j0) {
|
||||
if (!nullcsref && (j == 1) && iisj && (curvpos || nullcurv)) return M_updateREF;
|
||||
if (!nullcsref && (j == 1) && !iisj && (curvneg || nullcurv)) return M_updateREF;
|
||||
|
||||
if (iisj && curvpos) return M_noupdate;
|
||||
if (!iisj && curvneg) return M_noupdate;
|
||||
}
|
||||
return M_updateREF;
|
||||
} // undef
|
||||
|
||||
Standard_Real cosref = Cos(Angref), cos = Cos(Ang);
|
||||
Standard_Real dcos = Abs(cosref) - Abs(cos); Standard_Boolean samecos = Abs(dcos) < tola;
|
||||
if (samecos) {
|
||||
// Analysis for tangent cases : if two boundary faces are same sided
|
||||
// and have sma dironF.
|
||||
|
||||
if (Abs(Curvref - Curv) < 1.e-4) {
|
||||
if (TopAbs::Complement(Ori) == Oriref) return M_Ointernal;
|
||||
else return (Standard_Integer ) M_Unknown; // nyi FUN_RAISE
|
||||
}
|
||||
|
||||
Standard_Boolean noupdate = Standard_False;
|
||||
if (iisj && (Curvref > Curv)) noupdate = Standard_True;
|
||||
if (!iisj && (Curvref < Curv)) noupdate = Standard_True;
|
||||
Standard_Integer updateref = noupdate ? M_noupdate : M_updateREF;
|
||||
if (!j0) return updateref;
|
||||
|
||||
if (!noupdate && !nullcsref) {
|
||||
// check for (j==1) the face is ABOVE Sref
|
||||
// check for (j==2) the face is BELOW Sref
|
||||
if ((j == 2) && (Abs(Curv) < CurvSref)) updateref = M_noupdate;
|
||||
if ((j == 1) && (Abs(Curv) > CurvSref)) updateref = M_noupdate;
|
||||
}
|
||||
return updateref;
|
||||
} // samecos
|
||||
|
||||
Standard_Integer updateref = (dcos > 0.)? M_noupdate : M_updateREF;
|
||||
if (Oriref != Ori) TouchFlag = Standard_True; // eap Mar 25 2002
|
||||
|
||||
return updateref;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// methods
|
||||
// ============================================================
|
||||
|
||||
TopTrans_SurfaceTransition::TopTrans_SurfaceTransition()
|
||||
: myAng(1,2,1,2),myCurv(1,2,1,2),myOri(1,2,1,2)
|
||||
{
|
||||
STATIC_DEFINED = Standard_False;
|
||||
}
|
||||
|
||||
void TopTrans_SurfaceTransition::Reset(const gp_Dir& Tgt,
|
||||
const gp_Dir& Norm,
|
||||
const gp_Dir& MaxD,const gp_Dir& MinD,
|
||||
const Standard_Real MaxCurv,const Standard_Real MinCurv)
|
||||
{
|
||||
STATIC_DEFINED = Standard_True;
|
||||
|
||||
Standard_Real tola = Precision::Angular();
|
||||
Standard_Boolean curismax = (Abs(MaxD.Dot(myTgt)) < tola);
|
||||
Standard_Boolean curismin = (Abs(MinD.Dot(myTgt)) < tola);
|
||||
|
||||
if ((Abs(MaxCurv) < tola) && (Abs(MinCurv) < tola)) {
|
||||
Reset(Tgt,Norm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!curismax && !curismin) {
|
||||
// In the plane normal to <myTgt>, we see the boundary face as
|
||||
// a boundary curve.
|
||||
// NYIxpu : compute the curvature of the curve if not MaxCurv
|
||||
// nor MinCurv.
|
||||
|
||||
STATIC_DEFINED = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
if (curismax) myCurvRef = Abs(MaxCurv);
|
||||
if (curismin) myCurvRef = Abs(MinCurv);
|
||||
if (myCurvRef < tola) myCurvRef = 0.;
|
||||
|
||||
// ============================================================
|
||||
// recall : <Norm> is oriented OUTSIDE the "geometric matter" described
|
||||
// by the surface
|
||||
// - if (myCurvRef != 0.) Sref is UNDER axis (sin = 0)
|
||||
// referential (beafter,myNorm,myTgt) -
|
||||
// ============================================================
|
||||
|
||||
// beafter oriented (before, after) the intersection on the reference surface.
|
||||
myNorm = Norm;
|
||||
myTgt = Tgt;
|
||||
beafter = Norm^Tgt;
|
||||
for (Standard_Integer i = 1; i <=2; i++)
|
||||
for (Standard_Integer j = 1; j <=2; j++)
|
||||
myAng(i,j) = 100.;
|
||||
|
||||
myTouchFlag = Standard_False; // eap Mar 25 2002
|
||||
}
|
||||
|
||||
void TopTrans_SurfaceTransition::Reset(const gp_Dir& Tgt,
|
||||
const gp_Dir& Norm)
|
||||
{
|
||||
STATIC_DEFINED = Standard_True;
|
||||
|
||||
// beafter oriented (before, after) the intersection on the reference surface.
|
||||
myNorm = Norm;
|
||||
myTgt = Tgt;
|
||||
beafter = Norm^Tgt;
|
||||
for (Standard_Integer i = 1; i <=2; i++)
|
||||
for (Standard_Integer j = 1; j <=2; j++)
|
||||
myAng(i,j) = 100.;
|
||||
|
||||
myCurvRef = 0.;
|
||||
myTouchFlag = Standard_False; // eap Mar 25 2002
|
||||
}
|
||||
|
||||
void TopTrans_SurfaceTransition::Compare
|
||||
//(const Standard_Real Tole,
|
||||
(const Standard_Real ,
|
||||
const gp_Dir& Norm,
|
||||
const gp_Dir& MaxD,const gp_Dir& MinD,
|
||||
const Standard_Real MaxCurv,const Standard_Real MinCurv,
|
||||
const TopAbs_Orientation S,
|
||||
const TopAbs_Orientation O)
|
||||
{
|
||||
if (!STATIC_DEFINED) return;
|
||||
|
||||
Standard_Real Curv=0.;
|
||||
// ------
|
||||
Standard_Real tola = Precision::Angular();
|
||||
Standard_Boolean curismax = (Abs(MaxD.Dot(myTgt)) < tola);
|
||||
Standard_Boolean curismin = (Abs(MinD.Dot(myTgt)) < tola);
|
||||
if (!curismax && !curismin) {
|
||||
// In the plane normal to <myTgt>, we see the boundary face as
|
||||
// a boundary curve.
|
||||
// NYIxpu : compute the curvature of the curve if not MaxCurv
|
||||
// nor MinCurv.
|
||||
|
||||
STATIC_DEFINED = Standard_False;
|
||||
return;
|
||||
}
|
||||
if (curismax) Curv = Abs(MaxCurv);
|
||||
if (curismin) Curv = Abs(MinCurv);
|
||||
if (myCurvRef < tola) Curv = 0.;
|
||||
gp_Dir dironF = FUN_nCinsideS(myTgt,Norm);
|
||||
Standard_Real prod = (dironF^Norm).Dot(myTgt);
|
||||
if (prod < 0.) Curv = -Curv;
|
||||
|
||||
Standard_Real Ang;
|
||||
// -----
|
||||
Ang = ::FUN_Ang(myNorm,beafter,myTgt,Norm,O);
|
||||
|
||||
Standard_Integer i,j;
|
||||
// -----
|
||||
// i = 0,1,2 : cos = 0,>0,<0
|
||||
// j = 0,1,2 : sin = 0,>0,<0
|
||||
::FUN_getSTA(Ang,tola,i,j);
|
||||
|
||||
// update nearest :
|
||||
// ---------------
|
||||
Standard_Integer kmax = M_INTERNAL(O) ? 2 : 1;
|
||||
for (Standard_Integer k=1; k <=kmax; k++) {
|
||||
if (k == 2) {
|
||||
// get the opposite Ang
|
||||
i = ::FUN_OO(i);
|
||||
j = ::FUN_OO(j);
|
||||
}
|
||||
Standard_Boolean i0 = (i == 0), j0 = (j == 0);
|
||||
Standard_Integer nmax = (i0 || j0) ? 2 : 1;
|
||||
for (Standard_Integer n=1; n<=nmax; n++) {
|
||||
if (i0) i = n;
|
||||
if (j0) j = n;
|
||||
|
||||
// if (curvref == 0.) :
|
||||
// Standard_Boolean iisj = (i == j);
|
||||
// Standard_Boolean Curvpos = (Curv > 0.);
|
||||
// if ((Curv != 0.) && i0) {
|
||||
// if (iisj && !Curvpos) continue;
|
||||
// if (!iisj && Curvpos) continue;
|
||||
// }
|
||||
// if ((Curv != 0.) && j0) {
|
||||
// if (iisj && Curvpos) continue;
|
||||
// if (!iisj && !Curvpos) continue;
|
||||
// }
|
||||
|
||||
Standard_Integer refn = ::FUN_refnearest(i,j,myCurvRef,myAng(i,j),myOri(i,j),myCurv(i,j),
|
||||
Ang,/*O*/S,Curv,tola,myTouchFlag); // eap Mar 25 2002
|
||||
if (refn == M_Unknown) {STATIC_DEFINED = Standard_False; return;}
|
||||
if (refn > 0) {
|
||||
myAng(i,j) = Ang;
|
||||
myOri(i,j) = (refn == M_Ointernal) ? TopAbs_INTERNAL : S;
|
||||
myCurv(i,j) = Curv;
|
||||
}
|
||||
} // n=1..nmax
|
||||
} // k=1..kmax
|
||||
|
||||
}
|
||||
|
||||
void TopTrans_SurfaceTransition::Compare
|
||||
//(const Standard_Real Tole,
|
||||
(const Standard_Real ,
|
||||
const gp_Dir& Norm,
|
||||
const TopAbs_Orientation S,
|
||||
const TopAbs_Orientation O)
|
||||
{
|
||||
if (!STATIC_DEFINED) return;
|
||||
|
||||
// oriented Ang(beafter,dironF),
|
||||
// dironF normal to the curve, oriented INSIDE F, the added oriented support
|
||||
Standard_Real Ang = ::FUN_Ang(myNorm,beafter,myTgt,Norm,O);
|
||||
Standard_Real tola = Precision::Angular(); // nyi in arg
|
||||
|
||||
// i = 0,1,2 : cos = 0,>0,<0
|
||||
// j = 0,1,2 : sin = 0,>0,<0
|
||||
Standard_Integer i,j; ::FUN_getSTA(Ang,tola,i,j);
|
||||
|
||||
Standard_Integer kmax = M_INTERNAL(O) ? 2 : 1;
|
||||
for (Standard_Integer k=1; k <=kmax; k++) {
|
||||
if (k == 2) {
|
||||
// get the opposite Ang
|
||||
i = ::FUN_OO(i);
|
||||
j = ::FUN_OO(j);
|
||||
}
|
||||
|
||||
Standard_Boolean i0 = (i == 0), j0 = (j == 0);
|
||||
Standard_Integer nmax = (i0 || j0) ? 2 : 1;
|
||||
for (Standard_Integer n=1; n<=nmax; n++) {
|
||||
if (i0) i = n;
|
||||
if (j0) j = n;
|
||||
|
||||
Standard_Integer refn = ::FUN_refnearest(myAng(i,j),myOri(i,j),
|
||||
Ang,/*O*/S,tola); // eap
|
||||
if (refn == M_Unknown) {STATIC_DEFINED = Standard_False; return;}
|
||||
|
||||
if (refn > 0) {
|
||||
myAng(i,j) = Ang;
|
||||
myOri(i,j) = (refn == M_Ointernal) ? TopAbs_INTERNAL : S;
|
||||
}
|
||||
} // n=1..nmax
|
||||
} // k=1..kmax
|
||||
}
|
||||
|
||||
#define BEFORE (2)
|
||||
#define AFTER (1)
|
||||
static TopAbs_State FUN_getstate(const TColStd_Array2OfReal& Ang,
|
||||
const TopTrans_Array2OfOrientation& Ori,
|
||||
const Standard_Integer iSTA,
|
||||
const Standard_Integer iINDEX)
|
||||
{
|
||||
if (!STATIC_DEFINED) return TopAbs_UNKNOWN;
|
||||
|
||||
Standard_Real a1 = Ang(iSTA,1), a2 = Ang(iSTA,2);
|
||||
Standard_Boolean undef1 = (a1 == 100.), undef2 = (a2 == 100.);
|
||||
Standard_Boolean undef = undef1 && undef2;
|
||||
if (undef) return TopAbs_UNKNOWN;
|
||||
|
||||
if (undef1 || undef2) {
|
||||
Standard_Integer jok = undef1 ? 2 : 1;
|
||||
TopAbs_Orientation o = Ori(iSTA,jok);
|
||||
TopAbs_State st = (iINDEX == BEFORE) ? TopTrans_SurfaceTransition::GetBefore(o) :
|
||||
TopTrans_SurfaceTransition::GetAfter(o);
|
||||
return st;
|
||||
}
|
||||
|
||||
TopAbs_Orientation o1 = Ori(iSTA,1), o2 = Ori(iSTA,2);
|
||||
TopAbs_State st1 = (iINDEX == BEFORE) ? TopTrans_SurfaceTransition::GetBefore(o1) :
|
||||
TopTrans_SurfaceTransition::GetAfter(o1);
|
||||
TopAbs_State st2 = (iINDEX == BEFORE) ? TopTrans_SurfaceTransition::GetBefore(o2) :
|
||||
TopTrans_SurfaceTransition::GetAfter(o2);
|
||||
if (st1 != st2) return TopAbs_UNKNOWN; // Incoherent data
|
||||
return st1;
|
||||
}
|
||||
|
||||
|
||||
TopAbs_State TopTrans_SurfaceTransition::StateBefore() const
|
||||
{
|
||||
if (!STATIC_DEFINED) return TopAbs_UNKNOWN;
|
||||
|
||||
// we take the state before of before orientations
|
||||
TopAbs_State before = ::FUN_getstate(myAng,myOri,BEFORE,BEFORE);
|
||||
if (M_UNKNOWN(before)) {
|
||||
// looking back in before for defined states
|
||||
// we take the state before of after orientations
|
||||
before = ::FUN_getstate(myAng,myOri,AFTER,BEFORE);
|
||||
// eap Mar 25 2002
|
||||
if (myTouchFlag)
|
||||
if (before == TopAbs_OUT) before = TopAbs_IN;
|
||||
else if (before == TopAbs_IN) before = TopAbs_OUT;
|
||||
}
|
||||
return before;
|
||||
}
|
||||
|
||||
TopAbs_State TopTrans_SurfaceTransition::StateAfter() const
|
||||
{
|
||||
if (!STATIC_DEFINED) return TopAbs_UNKNOWN;
|
||||
|
||||
TopAbs_State after = ::FUN_getstate(myAng,myOri,AFTER,AFTER);
|
||||
if (M_UNKNOWN(after)) {
|
||||
// looking back in before for defined states
|
||||
after = ::FUN_getstate(myAng,myOri,BEFORE,AFTER);
|
||||
// eap Mar 25 2002
|
||||
if (myTouchFlag)
|
||||
if (after == TopAbs_OUT) after = TopAbs_IN;
|
||||
else if (after == TopAbs_IN) after = TopAbs_OUT;
|
||||
}
|
||||
return after;
|
||||
}
|
||||
|
||||
TopAbs_State TopTrans_SurfaceTransition::GetBefore
|
||||
(const TopAbs_Orientation Tran)
|
||||
{
|
||||
if (!STATIC_DEFINED) return TopAbs_UNKNOWN;
|
||||
|
||||
switch (Tran)
|
||||
{
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
return TopAbs_OUT;
|
||||
case TopAbs_REVERSED :
|
||||
case TopAbs_INTERNAL :
|
||||
return TopAbs_IN;
|
||||
}
|
||||
return TopAbs_OUT;
|
||||
}
|
||||
|
||||
TopAbs_State TopTrans_SurfaceTransition::GetAfter
|
||||
(const TopAbs_Orientation Tran)
|
||||
{
|
||||
if (!STATIC_DEFINED) return TopAbs_UNKNOWN;
|
||||
|
||||
switch (Tran)
|
||||
{
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_INTERNAL :
|
||||
return TopAbs_IN;
|
||||
case TopAbs_REVERSED :
|
||||
case TopAbs_EXTERNAL :
|
||||
return TopAbs_OUT;
|
||||
}
|
||||
return TopAbs_OUT;
|
||||
}
|
Reference in New Issue
Block a user