mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0025992: Method Geom2dAPI_InterCurveCurve::Segment(...) requires detail revision
1. Comment for IsOpposite() method has been amended. 2. Method Geom2dAPI_InterCurveCurve::Segment() has been rewritten in accordance with the Bug description requirements (described problem has been confirmed). The reason of the exception has been eliminated
This commit is contained in:
parent
306f5893ea
commit
5b055f07b3
@ -147,69 +147,73 @@ Standard_Integer Geom2dAPI_InterCurveCurve::NbSegments() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Segment
|
//function : Segment
|
||||||
//purpose :
|
//purpose :
|
||||||
|
// If aSeg.IsOpposite() == TRUE
|
||||||
|
//
|
||||||
|
// U1 U2
|
||||||
|
// Curve 1: *------------>*
|
||||||
|
//
|
||||||
|
// V2 V1
|
||||||
|
// Curve 2: *<------------*
|
||||||
|
//
|
||||||
|
// Segment: FirstPoint--->LastPoint
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// If aSeg.IsOpposite() == FALSE
|
||||||
|
//
|
||||||
|
// U1 U2
|
||||||
|
// Curve 1: *------------>*
|
||||||
|
//
|
||||||
|
// V1 V2
|
||||||
|
// Curve 2: *------------>*
|
||||||
|
//
|
||||||
|
// Segment: FirstPoint--->LastPoint
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void Geom2dAPI_InterCurveCurve::Segment
|
void Geom2dAPI_InterCurveCurve::Segment
|
||||||
(const Standard_Integer Index,
|
(const Standard_Integer theIndex,
|
||||||
Handle(Geom2d_Curve)& Curve1,
|
Handle(Geom2d_Curve)& theCurve1,
|
||||||
Handle(Geom2d_Curve)& Curve2) const
|
Handle(Geom2d_Curve)& theCurve2) const
|
||||||
{
|
{
|
||||||
Standard_OutOfRange_Raise_if(Index < 0 || Index > NbSegments(),
|
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > NbSegments(),
|
||||||
"Geom2dAPI_InterCurveCurve::Segment");
|
"Geom2dAPI_InterCurveCurve::Segment");
|
||||||
|
|
||||||
Standard_NullObject_Raise_if(myCurve2.IsNull(),
|
Standard_NullObject_Raise_if(myCurve1.IsNull() || myCurve2.IsNull(),
|
||||||
"Geom2dAPI_InterCurveCurve::Segment");
|
"Geom2dAPI_InterCurveCurve::Segment");
|
||||||
|
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real aU1 = myCurve1->FirstParameter(),
|
||||||
|
aU2 = myCurve1->LastParameter(),
|
||||||
|
aV1 = myCurve2->FirstParameter(),
|
||||||
|
aV2 = myCurve2->LastParameter();
|
||||||
|
|
||||||
IntRes2d_IntersectionSegment Seg = myIntersector.Segment(Index);
|
const IntRes2d_IntersectionSegment& aSeg = myIntersector.Segment(theIndex);
|
||||||
if ( Seg.IsOpposite()) {
|
const Standard_Boolean isOpposite = aSeg.IsOpposite();
|
||||||
if ( Seg.HasFirstPoint()) {
|
|
||||||
IntRes2d_IntersectionPoint IP1 = Seg.FirstPoint();
|
if(aSeg.HasFirstPoint())
|
||||||
U1 = IP1.ParamOnFirst();
|
{
|
||||||
V2 = IP1.ParamOnSecond();
|
const IntRes2d_IntersectionPoint& anIPF = aSeg.FirstPoint();
|
||||||
}
|
aU1 = anIPF.ParamOnFirst();
|
||||||
else {
|
|
||||||
U1 = Curve1->FirstParameter();
|
if(isOpposite)
|
||||||
V2 = Curve2->LastParameter();
|
aV2 = anIPF.ParamOnSecond();
|
||||||
}
|
else
|
||||||
if ( Seg.HasLastPoint()) {
|
aV1 = anIPF.ParamOnSecond();
|
||||||
IntRes2d_IntersectionPoint IP2 = Seg.LastPoint();
|
|
||||||
U2 = IP2.ParamOnFirst();
|
|
||||||
V1 = IP2.ParamOnSecond();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
U2 = Curve1->FirstParameter();
|
|
||||||
V1 = Curve2->LastParameter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ( Seg.HasFirstPoint()) {
|
|
||||||
IntRes2d_IntersectionPoint IP1 = Seg.FirstPoint();
|
|
||||||
U1 = IP1.ParamOnFirst();
|
|
||||||
V1 = IP1.ParamOnSecond();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
U1 = Curve1->FirstParameter();
|
|
||||||
V1 = Curve2->FirstParameter();
|
|
||||||
}
|
|
||||||
if ( Seg.HasLastPoint()) {
|
|
||||||
IntRes2d_IntersectionPoint IP2 = Seg.LastPoint();
|
|
||||||
U2 = IP2.ParamOnFirst();
|
|
||||||
V2 = IP2.ParamOnSecond();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
U2 = Curve1->FirstParameter();
|
|
||||||
V2 = Curve2->FirstParameter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Curve1 = new Geom2d_TrimmedCurve(myCurve1, U1, U2);
|
if(aSeg.HasLastPoint())
|
||||||
Curve2 = new Geom2d_TrimmedCurve(myCurve2, V1, V2);
|
{
|
||||||
|
const IntRes2d_IntersectionPoint& anIPL = aSeg.LastPoint();
|
||||||
|
aU2 = anIPL.ParamOnFirst();
|
||||||
|
|
||||||
|
if(isOpposite)
|
||||||
|
aV1 = anIPL.ParamOnSecond();
|
||||||
|
else
|
||||||
|
aV2 = anIPL.ParamOnSecond();
|
||||||
|
}
|
||||||
|
|
||||||
|
theCurve1 = new Geom2d_TrimmedCurve(myCurve1, aU1, aU2);
|
||||||
|
theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Segment
|
//function : Segment
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -40,7 +40,7 @@ is
|
|||||||
ReverseFlag : Boolean from Standard)
|
ReverseFlag : Boolean from Standard)
|
||||||
|
|
||||||
--Purpose: Creates an IntersectionSegment from two
|
--Purpose: Creates an IntersectionSegment from two
|
||||||
-- IntersectionPoint. Oppos is True if the 2 curves
|
-- IntersectionPoint. Oppos is FALSE if the 2 curves
|
||||||
-- have the same orientation. if ReverseFlag is True,
|
-- have the same orientation. if ReverseFlag is True,
|
||||||
-- P1 and P2 are the point on the first curve, and on
|
-- P1 and P2 are the point on the first curve, and on
|
||||||
-- the second curve. else, P1 is the point on the
|
-- the second curve. else, P1 is the point on the
|
||||||
@ -80,7 +80,7 @@ is
|
|||||||
|
|
||||||
IsOpposite(me)
|
IsOpposite(me)
|
||||||
|
|
||||||
---Purpose: Returns TRUE if the intersection segment has got
|
---Purpose: Returns FALSE if the intersection segment has got
|
||||||
-- the same orientation on both curves.
|
-- the same orientation on both curves.
|
||||||
|
|
||||||
---C++: inline
|
---C++: inline
|
||||||
|
Loading…
x
Reference in New Issue
Block a user