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

51
src/IntRes2d/IntRes2d.cdl Executable file
View File

@@ -0,0 +1,51 @@
-- File: IntRes2d.cdl
-- Created: Fri Apr 3 14:41:30 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn2>
---Copyright: Matra Datavision 1992
package IntRes2d
---Purpose: This package provides the definition of the results of
-- the intersection between 2D curves and the definition
-- of a domain on a 2D curve.
---Level: Public
--
-- All the methods of all the classes of this package are public.
--
uses
Standard, TCollection, gp, StdFail
is
class IntersectionPoint;
class IntersectionSegment;
class Transition;
class Domain;
deferred class Intersection;
enumeration Position is Head,Middle,End;
enumeration TypeTrans is In,Out,Touch,Undecided;
enumeration Situation is Inside, Outside, Unknown;
class SequenceOfIntersectionPoint instantiates
Sequence from TCollection (IntersectionPoint);
class SequenceOfIntersectionSegment instantiates
Sequence from TCollection (IntersectionSegment);
end IntRes2d;

257
src/IntRes2d/IntRes2d_Domain.cdl Executable file
View File

@@ -0,0 +1,257 @@
-- File: Domain.cdl
-- Created: Thu Mar 5 09:45:19 1992
-- Author: Laurent BUCHARD
-- <lbr@phobox>
---Copyright: Matra Datavision 1992
class Domain from IntRes2d
---Purpose: Definition of the domain of parameter on a 2d-curve.
-- Most of the time, a domain is defined by two extremities.
-- An extremity is made of :
-- - a point in 2d-space (Pnt2d from gp),
-- - a parameter on the curve,
-- - a tolerance in the 2d-space.
-- Sometimes, it can be made of 0 or 1 point ( for an infinite
-- or semi-infinite line for example).
--
-- For Intersection algorithms, Ellipses and Circles
-- Domains must be closed.
-- So, SetEquivalentParameters(.,.) method must be called
-- after initializing the first and the last bounds.
uses Pnt2d from gp
raises DomainError from Standard
is
Create
---Purpose: Creates an infinite Domain (HasFirstPoint = False
-- and HasLastPoint = False).
returns Domain from IntRes2d;
Create(Pnt1: Pnt2d from gp;
Par1: Real from Standard;
Tol1: Real from Standard;
Pnt2: Pnt2d from gp;
Par2: Real from Standard;
Tol2: Real from Standard)
---Purpose: Creates a bounded Domain.
returns Domain from IntRes2d;
Create(Pnt: Pnt2d from gp;
Par: Real from Standard;
Tol: Real from Standard;
First: Boolean from Standard)
---Purpose: Creates a semi-infinite Domain. If First is set to
-- True, the given point is the first point of the domain,
-- otherwise it is the last point.
returns Domain from IntRes2d;
SetValues(me: in out;
Pnt1: Pnt2d from gp;
Par1: Real from Standard;
Tol1: Real from Standard;
Pnt2: Pnt2d from gp;
Par2: Real from Standard;
Tol2: Real from Standard)
---Purpose: Sets the values for a bounded domain.
is static;
SetValues(me: in out)
---Purpose : Sets the values for an infinite domain.
is static;
SetValues(me: in out;
Pnt: Pnt2d from gp;
Par: Real from Standard;
Tol: Real from Standard;
First: Boolean from Standard)
---Purpose: Sets the values for a semi-infinite domain.
is static;
SetEquivalentParameters(me: in out; zero,period: Real from Standard)
---Purpose: Defines a closed domain.
---C++: inline
is static;
HasFirstPoint(me)
---Purpose: Returns True if the domain has a first point, i-e
-- a point defining the lowest admitted parameter on the
-- curve.
---C++: inline
returns Boolean from Standard
is static;
FirstParameter(me)
---Purpose: Returns the parameter of the first point of the domain
-- The exception DomainError is raised if HasFirstPoint
-- returns False.
---C++: inline
returns Real from Standard
raises DomainError from Standard
is static;
FirstPoint(me)
---Purpose: Returns the first point of the domain.
-- The exception DomainError is raised if HasFirstPoint
-- returns False.
---C++: inline
---C++: return const &
returns Pnt2d from gp
raises DomainError from Standard
is static;
FirstTolerance(me)
---Purpose: Returns the tolerance of the first (left) bound.
-- The exception DomainError is raised if HasFirstPoint
-- returns False.
---C++: inline
returns Real from Standard
raises DomainError from Standard
is static;
HasLastPoint(me)
---Purpose: Returns True if the domain has a last point, i-e
-- a point defining the highest admitted parameter on the
-- curve.
---C++: inline
returns Boolean from Standard
is static;
LastParameter(me)
---Purpose: Returns the parameter of the last point of the domain.
-- The exception DomainError is raised if HasLastPoint
-- returns False.
---C++: inline
returns Real from Standard
raises DomainError from Standard
is static;
LastPoint(me)
---Purpose: Returns the last point of the domain.
-- The exception DomainError is raised if HasLastPoint
-- returns False.
---C++: inline
---C++: return const &
returns Pnt2d from gp
raises DomainError from Standard
is static;
LastTolerance(me)
---Purpose: Returns the tolerance of the last (right) bound.
-- The exception DomainError is raised if HasLastPoint
-- returns False.
---C++: inline
returns Real from Standard
raises DomainError from Standard
is static;
IsClosed(me)
---Purpose: Returns True if the domain is closed.
---C++: inline
returns Boolean from Standard
is static;
EquivalentParameters(me; zero,zeroplusperiod:out Real from Standard)
---Purpose: Returns Equivalent parameters if the domain is closed.
-- Otherwise, the exception DomainError is raised.
---C++: inline
raises DomainError from Standard
is static;
fields
status : Integer from Standard;
----------------------------------------
-- Bit 0 : HasFist
-- Bit 1 : HasLast
-- Bit 2 : Closed
----------------------------------------
first_param : Real from Standard;
last_param : Real from Standard;
first_tol : Real from Standard;
last_tol : Real from Standard;
first_point : Pnt2d from gp;
last_point : Pnt2d from gp;
periodfirst : Real from Standard;
periodlast : Real from Standard;
end Domain;

118
src/IntRes2d/IntRes2d_Domain.cxx Executable file
View File

@@ -0,0 +1,118 @@
// File: IntRes2d_Domain.cxx
// Created: Wed Jun 10 15:06:44 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
// modified by Edward AGAPOV (eap) Jun 7 2002 (occ 438)
// --- limit infinite points and parameters in order to make
// --- arithmetic operation on them safe
#include <IntRes2d_Domain.ixx>
#include <Precision.hxx>
const Standard_Real infVal = Precision::Infinite();
//=======================================================================
//function : LimitInfinite
//purpose :
//=======================================================================
static inline Standard_Real LimitInfinite(const Standard_Real Val)
{
return ( Abs(Val) > infVal ? (Val>0 ? infVal : -infVal) : Val );
}
//=======================================================================
//function : IntRes2d_Domain
//purpose :
//=======================================================================
IntRes2d_Domain::IntRes2d_Domain():
status(0),
first_param(0.0), last_param(0.0),
first_tol(0.0), last_tol(0.0),
first_point(0.0, 0.0), last_point(0.0, 0.0),
periodfirst(0.0),
periodlast(0.0) { }
void IntRes2d_Domain::SetValues() {
status=0;
periodfirst=periodlast=0.0;
}
//=======================================================================
//function : IntRes2d_Domain
//purpose : Creates a bounded Domain.
//=======================================================================
IntRes2d_Domain::IntRes2d_Domain(const gp_Pnt2d& Pnt1,
const Standard_Real Par1,
const Standard_Real Tol1,
const gp_Pnt2d& Pnt2,
const Standard_Real Par2,
const Standard_Real Tol2) {
SetValues(Pnt1,Par1,Tol1,Pnt2,Par2,Tol2);
}
//=======================================================================
//function : SetValues
//purpose : Sets the values for a bounded domain.
//=======================================================================
void IntRes2d_Domain::SetValues(const gp_Pnt2d& Pnt1,
const Standard_Real Par1,
const Standard_Real Tol1,
const gp_Pnt2d& Pnt2,
const Standard_Real Par2,
const Standard_Real Tol2) {
status = 3;
periodfirst = periodlast = 0.0;
first_param=LimitInfinite(Par1);
first_point.SetCoord( LimitInfinite(Pnt1.X()), LimitInfinite(Pnt1.Y()) );
first_tol=Tol1;
last_param=LimitInfinite(Par2);
last_point.SetCoord( LimitInfinite(Pnt2.X()), LimitInfinite(Pnt2.Y()) );
last_tol=Tol2;
}
IntRes2d_Domain::IntRes2d_Domain(const gp_Pnt2d& Pnt,
const Standard_Real Par,
const Standard_Real Tol,
const Standard_Boolean First) :
first_param(0.0), last_param(0.0),
first_tol(0.0), last_tol(0.0),
first_point(0.0, 0.0), last_point(0.0, 0.0)
{
SetValues(Pnt,Par,Tol,First);
}
void IntRes2d_Domain::SetValues(const gp_Pnt2d& Pnt,
const Standard_Real Par,
const Standard_Real Tol,
const Standard_Boolean First) {
periodfirst=periodlast=0.0;
if(First) {
status=1;
first_param=LimitInfinite(Par);
first_point.SetCoord( LimitInfinite(Pnt.X()), LimitInfinite(Pnt.Y()) );
first_tol=Tol;
}
else {
status=2;
last_param=LimitInfinite(Par);
last_point.SetCoord( LimitInfinite(Pnt.X()), LimitInfinite(Pnt.Y()) );
last_tol=Tol;
}
}

View File

@@ -0,0 +1,75 @@
// File: IntRes2d_Domain.lxx
// Created: Tue Mar 31 09:42:12 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <Standard_DomainError.hxx>
//-------------------------------------------------
//-- hasfirst <--> status & 1
//-- haslast <--> status & 2
//-- closed <--> status & 4
//-------------------------------------------------
inline void IntRes2d_Domain::SetEquivalentParameters
(const Standard_Real p_first,
const Standard_Real p_last) {
if((status&3)!=3) { Standard_DomainError::Raise(); }
status|=4;
periodfirst=p_first;
periodlast=p_last;
}
inline Standard_Boolean IntRes2d_Domain::HasFirstPoint () const {
return (status & 1) ? Standard_True : Standard_False;
}
inline Standard_Real IntRes2d_Domain::FirstParameter () const {
if(!(status&1)) { Standard_DomainError::Raise(); }
return(first_param);
}
inline const gp_Pnt2d& IntRes2d_Domain::FirstPoint () const {
if(!(status&1)) { Standard_DomainError::Raise(); }
return(first_point);
}
inline Standard_Real IntRes2d_Domain::FirstTolerance () const {
if(!(status&1)) { Standard_DomainError::Raise(); }
return(first_tol);
}
inline Standard_Boolean IntRes2d_Domain::HasLastPoint () const {
return (status & 2) ? Standard_True : Standard_False;
}
inline Standard_Real IntRes2d_Domain::LastParameter () const {
if(!(status&2)) { Standard_DomainError::Raise(); }
return(last_param);
}
inline const gp_Pnt2d& IntRes2d_Domain::LastPoint () const {
if(!(status&2)) { Standard_DomainError::Raise(); }
return(last_point);
}
inline Standard_Real IntRes2d_Domain::LastTolerance () const {
if(!(status&2)) { Standard_DomainError::Raise(); }
return(last_tol);
}
inline Standard_Boolean IntRes2d_Domain::IsClosed () const {
return (status & 4) ? Standard_True : Standard_False;
}
inline void IntRes2d_Domain::EquivalentParameters(Standard_Real& p_first,
Standard_Real& p_last) const
{
p_first=periodfirst;
p_last=periodlast;
}

View File

@@ -0,0 +1,189 @@
-- File: Intersection.cdl
-- Created: Mon Apr 27 16:46:10 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn3>
---Copyright: Matra Datavision 1992
deferred class Intersection from IntRes2d
---Purpose: Defines the root class of all the Intersections
-- between two 2D-Curves, and provides all the methods
-- about the results of the Intersections Algorithms.
uses IntersectionPoint from IntRes2d,
IntersectionSegment from IntRes2d,
SequenceOfIntersectionPoint from IntRes2d,
SequenceOfIntersectionSegment from IntRes2d
raises NotDone from StdFail,
OutOfRange from Standard
is
Initialize
---Purpose: Empty constructor.
is protected;
---C++:inline
Initialize(Other: Intersection from IntRes2d)
---C++:inline
is protected;
IsDone(me)
---Purpose: returns TRUE when the computation was successful.
---C++: inline
returns Boolean from Standard
is static;
IsEmpty(me)
---Purpose: Returns TRUE if there is no intersection between the
-- given arguments.
-- The exception NotDone is raised if IsDone returns FALSE.
---C++: inline
returns Boolean from Standard
raises NotDone from StdFail
is static;
NbPoints(me)
---Purpose: This function returns the number of intersection
-- points between the 2 curves.
-- The exception NotDone is raised if IsDone returns FALSE.
---C++: inline
returns Integer from Standard
raises NotDone from StdFail
is static;
Point(me; N : Integer from Standard)
---Purpose: This function returns the intersection point
-- of range N;
-- The exception NotDone is raised if IsDone returns FALSE.
-- The exception OutOfRange is raised if (N <= 0)
-- or (N > NbPoints).
---C++: inline
returns IntersectionPoint from IntRes2d
---C++: return const &
raises NotDone from StdFail,
OutOfRange from Standard
is static;
NbSegments(me)
---Purpose: This function returns the number of intersection
-- segments between the two curves.
-- The exception NotDone is raised if IsDone returns FALSE.
---C++: inline
returns Integer from Standard
raises NotDone from StdFail
is static;
Segment(me; N : Integer)
---Purpose: This function returns the intersection segment
-- of range N;
-- The exception NotDone is raised if IsDone returns FALSE.
-- The exception OutOfRange is raised if (N <= 0)
-- or (N > NbPoints).
---C++: inline
returns IntersectionSegment from IntRes2d
---C++: return const &
raises NotDone from StdFail,
OutOfRange from Standard
is static;
SetValues(me: in out; Inter: Intersection from IntRes2d)
--Purpose: Copies the Inters values into the current object.
is static protected;
Append(me: in out; Inter : Intersection from IntRes2d;
FirstParam1: Real from Standard;
LastParam1 : Real from Standard;
FirstParam2: Real from Standard;
LastParam2 : Real from Standard)
--Purpose: Appends the Inters values to the current object
-- FirstParam and LastParam are the parameters of
-- the bounds of the parameter interval of the
-- curves.
is static protected;
Append(me: in out; Seg: IntersectionSegment from IntRes2d)
--Purpose: Appends a new Intersection Segment.
---C++: inline
is static protected;
Append(me: in out; Pnt: IntersectionPoint from IntRes2d)
--Purpose: Appends a new Intersection Point.
---C++: inline
is static protected;
Insert(me: in out; Pnt: IntersectionPoint from IntRes2d)
--Purpose: Inserts a new Intersection Point.
is static protected;
ResetFields(me: in out)
--Purpose: Resets all fields.
---C++: inline
is static protected;
SetReversedParameters(me: in out; Reverseflag: Boolean from Standard)
--Purpose: Initialize the reverse flag. This flag is used to
-- determine if the first and second parameters have
-- to be swaped when the intersection points and
-- segments are created.
---C++: inline
is static;
ReversedParameters(me)
--Purpose: Returns the value of the reverse flag.
---C++: inline
returns Boolean from Standard
is static protected;
fields
done : Boolean from Standard is protected;
reverse : Boolean from Standard;
lpnt : SequenceOfIntersectionPoint from IntRes2d;
lseg : SequenceOfIntersectionSegment from IntRes2d;
end Intersection;

View File

@@ -0,0 +1,454 @@
// File: IntRes2d_Intersection.cxx
// Created: Tue Apr 28 10:21:36 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <IntRes2d_Intersection.ixx>
#include <StdFail_NotDone.hxx>
#include <Standard_OutOfRange.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
#include <IntRes2d_SequenceOfIntersectionSegment.hxx>
#include <IntRes2d_Position.hxx>
#define PARAMEQUAL(a,b) (Abs((a)-(b))< (1e-8))
static void InternalVerifyPosition(IntRes2d_Transition& T1,
IntRes2d_Transition& T2,
const Standard_Real PParamOnFirst,
const Standard_Real PParamOnSecond,
const Standard_Real FirstParam1,
const Standard_Real LastParam1,
const Standard_Real FirstParam2,
const Standard_Real LastParam2);
//----------------------------------------------------------------------
static Standard_Boolean TransitionEqual( const IntRes2d_Transition& T1
,const IntRes2d_Transition& T2);
Standard_Boolean TransitionEqual( const IntRes2d_Transition& T1
,const IntRes2d_Transition& T2) {
if(T1.PositionOnCurve() == T2.PositionOnCurve()) {
if(T1.TransitionType() == T2.TransitionType()) {
if(T1.TransitionType() == IntRes2d_Touch) {
if(T1.IsTangent()==T2.IsTangent()) {
if(T1.Situation() == T2.Situation()) {
if(T1.IsOpposite() == T2.IsOpposite()) {
return(Standard_True);
}
}
}
}
else {
return(Standard_True);
}
}
}
return(Standard_False);
}
void IntRes2d_Intersection::Insert(const IntRes2d_IntersectionPoint& Pnt) {
Standard_Integer n = lpnt.Length();
if(n==0) {
lpnt.Append(Pnt);
}
else {
Standard_Real u = Pnt.ParamOnFirst();
Standard_Integer i = 1;
Standard_Integer b = n+1;
while(i<=n) {
const IntRes2d_IntersectionPoint& Pnti=lpnt(i);
Standard_Real ui = Pnti.ParamOnFirst();
if(ui >= u) { b=i; i=n; }
if(PARAMEQUAL(ui,u)) {
if(PARAMEQUAL((Pnt.ParamOnSecond()),(Pnti.ParamOnSecond()))) {
if( (TransitionEqual(Pnt.TransitionOfFirst(),Pnti.TransitionOfFirst()))
&& (TransitionEqual(Pnt.TransitionOfSecond(),Pnti.TransitionOfSecond()))) {
b=0;
i=n;
}
}
}
//----------------------------------------------------------------
i++;
}
if(b>n) { lpnt.Append(Pnt); }
else if(b>0) { lpnt.InsertBefore(b,Pnt); }
}
}
void IntRes2d_Intersection::SetValues(const IntRes2d_Intersection& Other) {
Standard_Integer i ;
if(Other.done) {
lseg.Clear();
lpnt.Clear();
Standard_Integer N = Other.lpnt.Length();
for( i=1; i<= N ; i++) {
lpnt.Append(Other.lpnt(i));
}
N = Other.lseg.Length();
for(i=1; i<= N ; i++) {
lseg.Append(Other.lseg(i));
}
//-----------------------
//lpnt=Other.lpnt; Pose des problemes
//lseg=Other.lseg; pour des objets composites
//-----------------------
done=Standard_True;
}
else {
done=Standard_False;
}
}
//----------------------------------------------------------------------
//-- Function used to Merge the results of two Intersections .
//-- for Composite Curves only. FirstParam and LastParam are the
//-- parameter of the bounds of the composite Curve
//-- Merge of two Intersection Segments S1 and S2 when :
//--
//-- S1 : U1First,PosU1Fisrt --> U1Last,PosU1Last
//-- V1First,PosV1Fisrt --> V1Last,PosV1Last
//-- S2 : U2First,PosU2Fisrt --> U2Last,PosU2Last
//-- V2First,PosV2Fisrt --> V2Last,PosV2Last
//--
//-- 1 U : X------1-------E H-----2-------X U -->
//-- V : X------1-------X X-----2-------X <- V -> ?
//--
//-- PosU1Last == End && PosU2First == Head
//-- && U1Last == U2First
//-- && V1Last == V2First
//--
//-- OR
//--
//-- 2 U : X------1-------H E-----2-------X U <--
//-- V : X------1-------X X-----2-------X <- V -> ?
//--
//-- PosU1Last == Head && PosU2First == End
//-- && U1Last == U2First
//-- && V1Last == V2First
//--
//-- merge the two Segment in :
//--
//-- U : X------1----------2-------X U
//-- V : X------1----------2-------X <- V -> ?
//--
//--
//--
//-- The Position of Intersection Point is set to Middle
//-- when the Parameters U et V are between FirstParam1, EndParam1
//-- and FirstParam2, EndParam2
//--
void IntRes2d_Intersection::Append( const IntRes2d_Intersection& Other
,const Standard_Real FirstParam1
,const Standard_Real LastParam1
,const Standard_Real FirstParam2
,const Standard_Real LastParam2) {
if(Other.done) {
//-- Verification of the Position of the IntersectionPoints
Standard_Integer n=Other.lpnt.Length();
Standard_Integer i ;
for( i=1; i<=n ; i++) {
const IntRes2d_IntersectionPoint& P=Other.lpnt(i);
Standard_Real PParamOnFirst=P.ParamOnFirst();
Standard_Real PParamOnSecond=P.ParamOnSecond();
IntRes2d_Transition T1=P.TransitionOfFirst();
IntRes2d_Transition T2=P.TransitionOfSecond();
gp_Pnt2d Pt=P.Value();
InternalVerifyPosition(T1,T2
,PParamOnFirst,PParamOnSecond
,FirstParam1,LastParam1
,FirstParam2,LastParam2);
this->Insert(IntRes2d_IntersectionPoint(Pt,
PParamOnFirst,
PParamOnSecond,
T1,T2,
Standard_False));
}
//--------------------------------------------------
//-- IntersectionSegment
//-- (we assume that a composite curve is always bounded)
//-- (a segment has always a FirstPoint and a LastPoint)
//--------------------------------------------------
n=Other.lseg.Length();
Standard_Real SegModif_P1First=0,SegModif_P1Second=0;
Standard_Real SegModif_P2First=0,SegModif_P2Second=0;
for(i=1; i<=n ; i++) {
const IntRes2d_IntersectionPoint& P1=Other.lseg(i).FirstPoint();
Standard_Real P1PParamOnFirst=P1.ParamOnFirst();
Standard_Real P1PParamOnSecond=P1.ParamOnSecond();
IntRes2d_Transition P1T1=P1.TransitionOfFirst();
IntRes2d_Transition P1T2=P1.TransitionOfSecond();
const gp_Pnt2d& P1Pt=P1.Value();
InternalVerifyPosition(P1T1,P1T2
,P1PParamOnFirst,P1PParamOnSecond
,FirstParam1,LastParam1
,FirstParam2,LastParam2);
const IntRes2d_IntersectionPoint& P2=Other.lseg(i).LastPoint();
Standard_Real P2PParamOnFirst=P2.ParamOnFirst();
Standard_Real P2PParamOnSecond=P2.ParamOnSecond();
IntRes2d_Transition P2T1=P2.TransitionOfFirst();
IntRes2d_Transition P2T2=P2.TransitionOfSecond();
const gp_Pnt2d& P2Pt=P2.Value();
Standard_Boolean Opposite=Other.lseg(i).IsOpposite();
InternalVerifyPosition(P2T1,P2T2
,P2PParamOnFirst,P2PParamOnSecond
,FirstParam1,LastParam1
,FirstParam2,LastParam2);
//-- Loop on the previous segments
//--
Standard_Integer an=lseg.Length();
Standard_Boolean NotYetModified=Standard_True;
for(Standard_Integer j=1;(j<=an)&&(NotYetModified);j++) {
const IntRes2d_IntersectionPoint& AnP1=lseg(j).FirstPoint();
Standard_Real AnP1PParamOnFirst=AnP1.ParamOnFirst();
Standard_Real AnP1PParamOnSecond=AnP1.ParamOnSecond();
#if DEB
const IntRes2d_Transition& AnP1T1=AnP1.TransitionOfFirst();
#else
AnP1.TransitionOfFirst();
#endif
#if DEB
const IntRes2d_Transition& AnP1T2=AnP1.TransitionOfSecond();
#else
AnP1.TransitionOfSecond();
#endif
#if DEB
const gp_Pnt2d& AnPt1=AnP1.Value();
#else
AnP1.Value();
#endif
const IntRes2d_IntersectionPoint& AnP2=lseg(j).LastPoint();
Standard_Real AnP2PParamOnFirst=AnP2.ParamOnFirst();
Standard_Real AnP2PParamOnSecond=AnP2.ParamOnSecond();
#if DEB
const IntRes2d_Transition& AnP2T1=AnP2.TransitionOfFirst();
#else
AnP2.TransitionOfFirst();
#endif
#if DEB
const IntRes2d_Transition& AnP2T2=AnP2.TransitionOfSecond();
#else
AnP2.TransitionOfSecond();
#endif
#if DEB
const gp_Pnt2d& AnPt2=AnP2.Value();
#else
AnP2.Value();
#endif
if(Opposite == lseg(j).IsOpposite()) {
//---------------------------------------------------------------
//-- AnP1---------AnP2
//-- P1-------------P2
//--
if( PARAMEQUAL(P1PParamOnFirst,AnP2PParamOnFirst)
&&PARAMEQUAL(P1PParamOnSecond,AnP2PParamOnSecond)) {
NotYetModified=Standard_False;
lseg(j)=IntRes2d_IntersectionSegment(AnP1,P2,
Opposite,Standard_False);
SegModif_P1First = AnP1PParamOnFirst;
SegModif_P1Second = AnP1PParamOnSecond;
SegModif_P2First = P2PParamOnFirst;
SegModif_P2Second = P2PParamOnSecond;
}
//---------------------------------------------------------------
//-- AnP1---------AnP2
//-- P1-------------P2
//--
else if( PARAMEQUAL(P2PParamOnFirst,AnP1PParamOnFirst)
&&PARAMEQUAL(P2PParamOnSecond,AnP1PParamOnSecond)) {
NotYetModified=Standard_False;
lseg(j)=IntRes2d_IntersectionSegment(P1,AnP2,
Opposite,Standard_False);
SegModif_P1First = P1PParamOnFirst;
SegModif_P1Second = P1PParamOnSecond;
SegModif_P2First = AnP2PParamOnFirst;
SegModif_P2Second = AnP2PParamOnSecond;
}
//---------------------------------------------------------------
//-- AnP2---------AnP1
//-- P1-------------P2
//--
if( PARAMEQUAL(P1PParamOnFirst,AnP1PParamOnFirst)
&&PARAMEQUAL(P1PParamOnSecond,AnP1PParamOnSecond)) {
NotYetModified=Standard_False;
lseg(j)=IntRes2d_IntersectionSegment(AnP2,P2,
Opposite,Standard_False);
SegModif_P1First = P2PParamOnFirst;
SegModif_P1Second = P2PParamOnSecond;
SegModif_P2First = AnP2PParamOnFirst;
SegModif_P2Second = AnP2PParamOnSecond;
}
//---------------------------------------------------------------
//-- AnP2---------AnP1
//-- P1-------------P2
//--
else if( PARAMEQUAL(P2PParamOnFirst,AnP2PParamOnFirst)
&&PARAMEQUAL(P2PParamOnSecond,AnP2PParamOnSecond)) {
NotYetModified=Standard_False;
lseg(j)=IntRes2d_IntersectionSegment(P1,AnP1,
Opposite,Standard_False);
SegModif_P1First = P1PParamOnFirst;
SegModif_P1Second = P1PParamOnSecond;
SegModif_P2First = AnP1PParamOnFirst;
SegModif_P2Second = AnP1PParamOnSecond;
}
}
}
if(NotYetModified) {
this->Append(IntRes2d_IntersectionSegment(
IntRes2d_IntersectionPoint(P1Pt,
P1PParamOnFirst,
P1PParamOnSecond,
P1T1,P1T2,
Standard_False),
IntRes2d_IntersectionPoint(P2Pt,
P2PParamOnFirst,
P2PParamOnSecond,
P2T1,P2T2,
Standard_False),
Opposite,Standard_False));
} //-- if(NotYetModified)
else {
//--------------------------------------------------------------
//-- Are some Existing Points in this segment ?
//--------------------------------------------------------------
Standard_Integer rnbpts=lpnt.Length();
for(Standard_Integer rp=1; (rp<=rnbpts)&&(rp>=1); rp++) {
Standard_Real PonFirst=lpnt(rp).ParamOnFirst();
Standard_Real PonSecond=lpnt(rp).ParamOnSecond();
if( ((PonFirst >= SegModif_P1First && PonFirst <= SegModif_P2First)
||(PonFirst <= SegModif_P1First && PonFirst >= SegModif_P2First))
&& ((PonSecond >= SegModif_P1Second && PonSecond <= SegModif_P2Second)
||(PonSecond<= SegModif_P1Second && PonSecond >= SegModif_P2Second))) {
lpnt.Remove(rp);
rp--;
rnbpts--;
}
} //-- for(Standard_Integer rp=1; (rp<=rnbpts)&&(rp>=1); rp++)
}
}
//--------------------------------------------------
//-- Remove some Points ?
//-- Example : Points which lie in a segment.
//--------------------------------------------------
done=Standard_True;
}
else {
done=Standard_False;
}
}
//----------------------------------------------------------------------
//--
#define DEBUGPOSITION 0
#if DEBUGPOSITION
void AffPosition(IntRes2d_Transition& T,const Standard_Real u,const char *Texte);
void AffPosition(IntRes2d_Transition& T,const Standard_Real u,const char *Texte) {
if(T.PositionOnCurve() == IntRes2d_End) { cout <<Texte<<" Param :"<<u<<" End "<<endl; }
if(T.PositionOnCurve() == IntRes2d_Middle) { cout <<Texte<<" Param :"<<u<<" Middle "<<endl; }
if(T.PositionOnCurve() == IntRes2d_Head) { cout <<Texte<<" Param :"<<u<<" Head "<<endl; }
}
#endif
void InternalVerifyPosition(IntRes2d_Transition& T1,
IntRes2d_Transition& T2,
const Standard_Real PParamOnFirst,
const Standard_Real PParamOnSecond,
const Standard_Real FirstParam1,
const Standard_Real LastParam1,
const Standard_Real FirstParam2,
const Standard_Real LastParam2) {
#if DEBUGPOSITION
AffPosition(T1,PParamOnFirst," Point 1 ");
AffPosition(T2,PParamOnSecond," Point 2 ");
#endif
if(T1.PositionOnCurve() != IntRes2d_Middle) {
if(!( PARAMEQUAL(PParamOnFirst,FirstParam1)
|| PARAMEQUAL(PParamOnFirst,LastParam1))) {
//-- Middle on the Curve 1
// modified by NIZHNY-MKK Tue Nov 26 14:23:24 2002.BEGIN
if((PParamOnFirst > FirstParam1) && (PParamOnFirst < LastParam1))
// modified by NIZHNY-MKK Tue Nov 26 14:23:27 2002.END
T1.SetPosition(IntRes2d_Middle);
}
}
if(T2.PositionOnCurve() != IntRes2d_Middle) {
if(!( PARAMEQUAL(PParamOnSecond,FirstParam2)
|| PARAMEQUAL(PParamOnSecond,LastParam2))) {
// modified by NIZHNY-MKK Tue Nov 26 14:24:15 2002.BEGIN
if((PParamOnSecond > FirstParam2) && (PParamOnSecond < LastParam2))
// modified by NIZHNY-MKK Tue Nov 26 14:24:19 2002.END
T2.SetPosition(IntRes2d_Middle);
}
}
}
//----------------------------------------------------------------------
#if 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define Debug(q) cout<<"IntRes2d_Intersection"<<"q ="<<q<<endl;
char *DebugPos(const IntRes2d_Position P);
Debug(FirstParam1);
Debug(LastParam1);
Debug(FirstParam2);
Debug(LastParam2);
Debug(PParamOnFirst);
Debug(PParamOnSecond);
cout<<" ##### T1 <> Middle ###### "<<DebugPos(T1.PositionOnCurve())<<endl;
char *DebugPos(const IntRes2d_Position P) {
if(P==IntRes2d_Middle) return(" Middle ");
if(P==IntRes2d_Head) return(" Head ");
if(P==IntRes2d_End) return(" End ");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#endif

View File

@@ -0,0 +1,75 @@
// File: IntRes2d_Intersection.lxx
// Created: Wed May 27 16:17:41 1992
// Author: Laurent BUCHARD
// <lbr@topsn3>
#include <StdFail_NotDone.hxx>
#include <Standard_OutOfRange.hxx>
inline Standard_Boolean IntRes2d_Intersection::IsDone() const {
return done;
}
//----------------------------------------------------------------------
inline IntRes2d_Intersection::IntRes2d_Intersection() {
done=reverse=Standard_False;
}
//----------------------------------------------------------------------
inline IntRes2d_Intersection::IntRes2d_Intersection(const IntRes2d_Intersection& Other) {
done=reverse=Standard_False;
lpnt = Other.lpnt;
lseg = Other.lseg;
}
//----------------------------------------------------------------------
inline Standard_Boolean IntRes2d_Intersection::IsEmpty() const {
if (!done) {StdFail_NotDone::Raise();}
return ((lpnt.Length() == 0) && (lseg.Length() == 0));
}
//----------------------------------------------------------------------
inline Standard_Integer IntRes2d_Intersection::NbPoints() const {
if (!done) {StdFail_NotDone::Raise();}
return lpnt.Length();
}
//----------------------------------------------------------------------
inline const IntRes2d_IntersectionPoint&
IntRes2d_Intersection::Point( const Standard_Integer N) const {
if (!done) {StdFail_NotDone::Raise();}
return lpnt(N);
}
//----------------------------------------------------------------------
inline Standard_Integer IntRes2d_Intersection::NbSegments() const {
if (!done) {StdFail_NotDone::Raise();}
return lseg.Length();
}
//----------------------------------------------------------------------
inline const IntRes2d_IntersectionSegment&
IntRes2d_Intersection::Segment(const Standard_Integer N) const {
if (!done) {StdFail_NotDone::Raise();}
return lseg(N);
}
//----------------------------------------------------------------------
inline void IntRes2d_Intersection::Append(const IntRes2d_IntersectionSegment& Seg) {
lseg.Append(Seg);
}
//----------------------------------------------------------------------
inline void IntRes2d_Intersection::Append(const IntRes2d_IntersectionPoint& Pnt) {
lpnt.Append(Pnt);
}
//----------------------------------------------------------------------
inline void IntRes2d_Intersection::ResetFields() {
if(done) {
lseg.Clear();
lpnt.Clear();
done=Standard_False;
}
}
//----------------------------------------------------------------------
inline void IntRes2d_Intersection::SetReversedParameters(const Standard_Boolean flag) {
reverse=flag;
}
//----------------------------------------------------------------------
inline Standard_Boolean IntRes2d_Intersection::ReversedParameters() const {
return(reverse);
}

View File

@@ -0,0 +1,121 @@
-- File: IntersectionPoint.cdl
-- Created: Fri Apr 3 14:43:20 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn2>
---Copyright: Matra Datavision 1992
class IntersectionPoint from IntRes2d
---Purpose: Definition of an intersection point between two
-- 2D curves.
inherits Storable from Standard
uses Pnt2d from gp,
Transition from IntRes2d
is
Create
---Purpose: Empty constructor.
returns IntersectionPoint from IntRes2d;
Create(P: Pnt2d from gp; Uc1,Uc2:Real from Standard;
Trans1,Trans2: Transition from IntRes2d;
ReversedFlag: Boolean from Standard)
---Purpose: Creates an IntersectionPoint.
-- if ReversedFlag is False, the parameter Uc1(resp. Uc2)
-- and the Transition Trans1 (resp. Trans2) refer to
-- the first curve (resp. second curve) otherwise Uc1
-- and Trans1 (resp. Uc2 and Trans2) refer to the
-- second curve (resp. the first curve).
---C++: inline
returns IntersectionPoint from IntRes2d;
SetValues(me:in out; P: Pnt2d from gp; Uc1,Uc2:Real from Standard;
Trans1,Trans2: Transition from IntRes2d;
ReversedFlag: Boolean from Standard)
---Purpose: Sets the values for an existing intersection
-- point. The meaning of the parameters are the same
-- as for the Create.
---C++: inline
is static;
Value(me)
---Purpose: Returns the value of the coordinates of the
-- intersection point in the 2D space.
---C++: inline
---C++: return const &
returns Pnt2d from gp
is static;
ParamOnFirst(me)
---Purpose: Returns the parameter on the first curve.
---C++: inline
returns Real from Standard
is static;
ParamOnSecond(me)
---Purpose: Returns the parameter on the second curve.
---C++: inline
returns Real from Standard
is static;
TransitionOfFirst(me)
---Purpose: Returns the transition of the 1st curve compared to
-- the 2nd one.
---C++: inline
---C++: return const &
returns Transition from IntRes2d
is static;
TransitionOfSecond(me)
---Purpose: returns the transition of the 2nd curve compared to
-- the 1st one.
---C++: inline
---C++: return const &
returns Transition from IntRes2d
is static;
fields
pt : Pnt2d from gp;
p1 : Real from Standard;
p2 : Real from Standard;
trans1 : Transition from IntRes2d;
trans2 : Transition from IntRes2d;
end IntersectionPoint;

View File

@@ -0,0 +1,11 @@
// File: IntRes2d_IntersectionPoint.cxx
// Created: Thu Oct 1 10:59:18 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <IntRes2d_IntersectionPoint.ixx>
IntRes2d_IntersectionPoint::IntRes2d_IntersectionPoint ():
pt(),p1(RealLast()),p2(RealLast()),trans1(),trans2()
{}

View File

@@ -0,0 +1,64 @@
// File: IntRes2d_IntersectionPoint.lxx
// Created: Thu Oct 1 10:59:18 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
inline IntRes2d_IntersectionPoint::IntRes2d_IntersectionPoint
(const gp_Pnt2d& P,
const Standard_Real Uc1, const Standard_Real Uc2,
const IntRes2d_Transition& Trans1,
const IntRes2d_Transition& Trans2,
const Standard_Boolean ReversedFlag):
pt(P),p1(Uc1),p2(Uc2),trans1(Trans1),trans2(Trans2)
{
if(ReversedFlag) {
trans1=Trans2;
trans2=Trans1;
p1=Uc2;
p2=Uc1;
}
}
inline void IntRes2d_IntersectionPoint::SetValues
(const gp_Pnt2d& P,
const Standard_Real Uc1, const Standard_Real Uc2,
const IntRes2d_Transition& Trans1,
const IntRes2d_Transition& Trans2,
const Standard_Boolean ReversedFlag)
{
pt=P;
if (!ReversedFlag) {
trans1 = Trans1;
trans2 = Trans2;
p1 = Uc1;
p2 = Uc2;
}
else {
trans1 = Trans2;
trans2 = Trans1;
p1 = Uc2;
p2 = Uc1;
}
}
inline const gp_Pnt2d &IntRes2d_IntersectionPoint::Value () const {
return pt;
}
inline Standard_Real IntRes2d_IntersectionPoint::ParamOnFirst () const {
return p1;
}
inline Standard_Real IntRes2d_IntersectionPoint::ParamOnSecond () const {
return p2;
}
inline const IntRes2d_Transition& IntRes2d_IntersectionPoint::TransitionOfFirst () const {
return trans1;
}
inline const IntRes2d_Transition& IntRes2d_IntersectionPoint::TransitionOfSecond ()
const {
return trans2;
}

View File

@@ -0,0 +1,152 @@
-- File: IntersectionSegment.cdl
-- Created: Fri Apr 3 14:45:13 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn2>
---Copyright: Matra Datavision 1992
class IntersectionSegment from IntRes2d
---Purpose: Definition of an intersection curve between
-- two 2D curves.
inherits Storable from Standard
uses IntersectionPoint from IntRes2d
raises DomainError from Standard
is
Create
---Purpose: Empty constructor.
returns IntersectionSegment from IntRes2d;
Create(P1,P2 : IntersectionPoint from IntRes2d;
Oppos : Boolean from Standard;
ReverseFlag : Boolean from Standard)
--Purpose: Creates an IntersectionSegment from two
-- IntersectionPoint. Oppos is True if the 2 curves
-- have the same orientation. if ReverseFlag is True,
-- P1 and P2 are the point on the first curve, and on
-- the second curve. else, P1 is the point on the
-- second curve and P2 the intersection point on the
-- first curve.
---C++: inline
returns IntersectionSegment from IntRes2d;
Create(P : IntersectionPoint from IntRes2d;
First : Boolean from Standard;
Oppos : Boolean from Standard;
ReverseFlag: Boolean from Standard)
--Purpose: Creates a semi-infinite segment of intersection.
-- if First is set to True, P is the first point of
-- the segment. Otherwise P is the last point of the
-- segment. P belongs to the first curve if
-- ReversedFlag is set to False; otherwise it belongs
-- to the second curve.
---C++: inline
returns IntersectionSegment from IntRes2d;
Create(Oppos: Boolean from Standard)
---Purpose: Creates an infinite segment of intersection.
---C++: inline
returns IntersectionSegment from IntRes2d;
IsOpposite(me)
---Purpose: Returns TRUE if the intersection segment has got
-- the same orientation on both curves.
---C++: inline
returns Boolean from Standard
is static;
HasFirstPoint(me)
---Purpose: Returns True if the segment is limited by a first
-- point. This point defines the lowest parameter
-- admitted on the first curve for the segment. If
-- IsOpposite returns False, it defines the lowest
-- parameter on the second curve, otherwise, it is
-- the highest parameter on the second curve.
---C++: inline
returns Boolean from Standard
is static;
FirstPoint(me)
---Purpose: Returns the first point of the segment as an
-- IntersectionPoint (with a transition). The
-- exception DomainError is raised if HasFirstPoint
-- returns False.
---C++: inline
---C++: return const &
returns IntersectionPoint from IntRes2d
raises DomainError from Standard
is static;
HasLastPoint(me)
---Purpose: Returns True if the segment is limited by a last
-- point. This point defines the highest parameter
-- admitted on the first curve for the segment. If
-- IsOpposite returns False, it defines the highest
-- parameter on the second curve, otherwise, it is
-- the lowest parameter on the second curve.
---C++: inline
returns Boolean from Standard
is static;
LastPoint(me)
---Purpose: Returns the last point of the segment as an
-- IntersectionPoint (with a transition). The
-- exception DomainError is raised if
-- HasLastExtremity returns False.
---C++: inline
---C++: return const &
returns IntersectionPoint from IntRes2d
raises DomainError from Standard
is static;
fields
oppos : Boolean from Standard;
first : Boolean from Standard;
last : Boolean from Standard;
ptfirst : IntersectionPoint from IntRes2d;
ptlast : IntersectionPoint from IntRes2d;
end IntersectionSegment;

View File

@@ -0,0 +1,14 @@
// File: IntRes2d_IntersectionSegment.cxx
// Created: Wed Jun 10 15:06:44 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <IntRes2d_IntersectionSegment.ixx>
IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment ():
ptfirst(),ptlast() { }

View File

@@ -0,0 +1,87 @@
#include <Standard_DomainError.hxx>
inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
const IntRes2d_IntersectionPoint& P1,
const IntRes2d_IntersectionPoint& P2,
const Standard_Boolean Oppos,
const Standard_Boolean ReverseFlag):
oppos(Oppos),
first(Standard_True),
last(Standard_True),
ptfirst(P1),
ptlast(P2)
{
if(ReverseFlag) {
if(Oppos) {
ptfirst= P2;
ptlast = P1;
}
}
}
inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
const IntRes2d_IntersectionPoint& P,
const Standard_Boolean First,
const Standard_Boolean Oppos,
const Standard_Boolean ReverseFlag):
oppos(Oppos),
ptfirst(),
ptlast()
{
if(ReverseFlag && Oppos) {
if (First) {
first=Standard_False; last=Standard_True; ptlast=P;
}
else {
first=Standard_True; last=Standard_False; ptfirst=P;
}
}
else {
if (First) {
first=Standard_True; last=Standard_False; ptfirst=P;
}
else {
first=Standard_False; last=Standard_True; ptlast=P;
}
}
}
inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
const Standard_Boolean Oppos):
oppos(Oppos),
first(Standard_False),
last(Standard_False),
ptfirst(),
ptlast()
{ }
inline Standard_Boolean IntRes2d_IntersectionSegment::IsOpposite () const {
return oppos;
}
inline Standard_Boolean IntRes2d_IntersectionSegment::HasFirstPoint () const {
return first;
}
inline Standard_Boolean IntRes2d_IntersectionSegment::HasLastPoint () const {
return last;
}
inline const IntRes2d_IntersectionPoint&
IntRes2d_IntersectionSegment::FirstPoint () const {
if (!first) { Standard_DomainError::Raise(); }
return ptfirst;
}
inline const IntRes2d_IntersectionPoint&
IntRes2d_IntersectionSegment::LastPoint () const {
if (!last) { Standard_DomainError::Raise();}
return ptlast;
}

View File

@@ -0,0 +1,192 @@
-- File: Transition.cdl
-- Created: Fri Apr 3 14:49:41 1992
-- Author: Laurent BUCHARD
-- <lbr@topsn2>
---Copyright: Matra Datavision 1992
class Transition from IntRes2d
inherits Storable from Standard
---Purpose: Definition of the type of transition near an
-- intersection point between two curves. The transition
-- is either a "true transition", which means that one of
-- the curves goes inside or outside the area defined by
-- the other curve near the intersection, or a "touch
-- transition" which means that the first curve does not
-- cross the other one, or an "undecided" transition,
-- which means that the curves are superposed.
uses Position from IntRes2d,
Situation from IntRes2d,
TypeTrans from IntRes2d
raises DomainError from Standard
is
Create
---Purpose: Empty constructor.
returns Transition from IntRes2d;
Create(Tangent: Boolean from Standard;
Pos : Position from IntRes2d;
Type : TypeTrans from IntRes2d)
---Purpose: Creates an IN or OUT transition.
---C++: inline
returns Transition from IntRes2d;
Create(Tangent: Boolean from Standard;
Pos : Position from IntRes2d;
Situ : Situation from IntRes2d;
Oppos : Boolean from Standard)
---Purpose: Creates a TOUCH transition.
---C++: inline
returns Transition from IntRes2d;
Create(Pos: Position from IntRes2d)
---Purpose: Creates an UNDECIDED transition.
---C++: inline
returns Transition from IntRes2d;
SetValue(me: in out; Tangent: Boolean from Standard;
Pos : Position from IntRes2d;
Type : TypeTrans from IntRes2d)
---Purpose: Sets the values of an IN or OUT transition.
---C++: inline
is static;
SetValue(me: in out; Tangent: Boolean from Standard;
Pos : Position from IntRes2d;
Situ : Situation from IntRes2d;
Oppos : Boolean from Standard)
---Purpose: Sets the values of a TOUCH transition.
---C++: inline
is static;
SetValue(me: in out; Pos: Position from IntRes2d)
---Purpose: Sets the values of an UNDECIDED transition.
---C++: inline
is static;
SetPosition(me: in out; Pos: Position from IntRes2d)
---Purpose: Sets the value of the position.
---C++: inline
is static;
PositionOnCurve(me)
---Purpose: Indicates if the intersection is at the beginning
-- (IntRes2d_Head), at the end (IntRes2d_End), or in
-- the middle (IntRes2d_Middle) of the curve.
---C++: inline
returns Position from IntRes2d
is static;
TransitionType(me)
---Purpose: Returns the type of transition at the intersection.
-- It may be IN or OUT or TOUCH, or UNDECIDED if the
-- two first derivatives are not enough to give
-- the tangent to one of the two curves.
---C++: inline
returns TypeTrans from IntRes2d
is static;
IsTangent(me)
---Purpose: Returns TRUE when the 2 curves are tangent at the
-- intersection point.
-- Theexception DomainError is raised if the type of
-- transition is UNDECIDED.
---C++: inline
returns Boolean from Standard
raises DomainError from Standard
is static;
Situation(me)
---Purpose: returns a significant value if TransitionType returns
-- TOUCH. In this case, the function returns :
-- INSIDE when the curve remains inside the other one,
-- OUTSIDE when it remains outside the other one,
-- UNKNOWN when the calculus, based on the second derivatives
-- cannot give the result.
-- If TransitionType returns IN or OUT or UNDECIDED, the
-- exception DomainError is raised.
---C++: inline
returns Situation from IntRes2d
raises DomainError from Standard
is static;
IsOpposite(me)
---Purpose: returns a significant value if TransitionType
-- returns TOUCH. In this case, the function returns
-- true when the 2 curves locally define two
-- different parts of the space. If TransitionType
-- returns IN or OUT or UNDECIDED, the exception
-- DomainError is raised.
---C++: inline
returns Boolean from Standard
raises DomainError from Standard
is static;
fields
tangent : Boolean from Standard;
posit : Position from IntRes2d;
typetra : TypeTrans from IntRes2d;
situat : Situation from IntRes2d;
oppos : Boolean from Standard;
end Transition;

View File

@@ -0,0 +1,76 @@
// File: IntRes2d_Transition.cxx
// Created: Wed Jun 10 15:06:44 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <IntRes2d_Transition.ixx>
IntRes2d_Transition::IntRes2d_Transition() : tangent(Standard_True),
posit(IntRes2d_Middle),
typetra(IntRes2d_Undecided),
situat(IntRes2d_Unknown),
oppos(Standard_False)
{
}
ostream& operator << (ostream& os, IntRes2d_Transition& Trans) {
os << " Position : ";
if (Trans.PositionOnCurve()==IntRes2d_Head) {
os << "Debut\n";
}
else if (Trans.PositionOnCurve()==IntRes2d_Middle) {
os << "Milieu\n";
}
else {
os << "Fin\n";
}
os << " Type de transition : ";
if (Trans.TransitionType()==IntRes2d_Undecided) {
os << "Indeterminee\n";
}
else {
if (Trans.TransitionType()==IntRes2d_In) {
os << "Entrante\n";
}
else if (Trans.TransitionType()==IntRes2d_Out) {
os << "Sortante\n";
}
else {
os << "Touch\n";
os << " Position par rapport a l'autre courbe : ";
if (Trans.Situation()==IntRes2d_Inside) {
os << "Interieure\n";
}
else if (Trans.Situation()==IntRes2d_Outside) {
os << "Exterieure\n";
}
else if (Trans.Situation()==IntRes2d_Unknown) {
os << "Indeterminee\n";
}
os << " Position matiere : ";
if (Trans.IsOpposite()) {
os << "Opposee\n";
}
else {
os << "Idem\n";
}
}
os << " Cas de tangence : ";
if (Trans.IsTangent()) {
os << "Oui\n";
}
else {
os << "Non\n";
}
}
os << "\n";
return os;
}

View File

@@ -0,0 +1,100 @@
// File: IntRes2d_Transition.lxx
// Created: Wed Jun 10 15:06:44 1992
// Author: Laurent BUCHARD
// <lbr@sdsun2>
#include <Standard_DomainError.hxx>
ostream& operator << (ostream&, IntRes2d_Transition&);
inline IntRes2d_Transition::IntRes2d_Transition (const Standard_Boolean Tangent,
const IntRes2d_Position Pos,
const IntRes2d_TypeTrans Type ):
tangent(Tangent),posit(Pos),typetra(Type),situat(IntRes2d_Unknown),oppos(Standard_False)
{
}
inline IntRes2d_Transition::IntRes2d_Transition (const Standard_Boolean Tangent,
const IntRes2d_Position Pos,
const IntRes2d_Situation Situ,
const Standard_Boolean Oppos):
tangent(Tangent),posit(Pos),typetra(IntRes2d_Touch),
situat(Situ),oppos(Oppos)
{
}
inline IntRes2d_Transition::IntRes2d_Transition (const IntRes2d_Position Pos):
tangent(Standard_True),posit(Pos),typetra(IntRes2d_Undecided),situat(IntRes2d_Unknown),oppos(Standard_False)
{
}
inline void IntRes2d_Transition::SetValue (const Standard_Boolean Tangent,
const IntRes2d_Position Pos,
const IntRes2d_TypeTrans Type ) {
tangent=Tangent;
posit=Pos;
typetra=Type;
}
inline void IntRes2d_Transition::SetValue (const Standard_Boolean Tangent,
const IntRes2d_Position Pos,
const IntRes2d_Situation Situ,
const Standard_Boolean Oppos) {
tangent=Tangent;
posit=Pos;
typetra=IntRes2d_Touch;
situat=Situ;
oppos=Oppos;
}
inline void IntRes2d_Transition::SetValue (const IntRes2d_Position Pos ) {
posit=Pos;
typetra=IntRes2d_Undecided;
}
inline void IntRes2d_Transition::SetPosition (const IntRes2d_Position Pos ) {
posit=Pos;
}
inline IntRes2d_Position IntRes2d_Transition::PositionOnCurve () const {
return posit;
}
inline IntRes2d_TypeTrans IntRes2d_Transition::TransitionType () const {
return typetra;
}
inline Standard_Boolean IntRes2d_Transition::IsTangent () const {
if (typetra==IntRes2d_Undecided) {
Standard_DomainError::Raise();
}
return tangent;
}
inline IntRes2d_Situation IntRes2d_Transition::Situation () const {
if (typetra!=IntRes2d_Touch) {
Standard_DomainError::Raise();
}
return situat;
}
inline Standard_Boolean IntRes2d_Transition::IsOpposite () const {
if (typetra!=IntRes2d_Touch) {
Standard_DomainError::Raise();
}
return oppos;
}