X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FGeom2dAPI%2FGeom2dAPI_InterCurveCurve.cxx;h=537a1ebb0a5da6f7680a33bc2452ed91d74cecef;hp=143c0f50e9e3dfb6e70fe8219b26aa53feb832d5;hb=dad7fede3945ee013c141bcdb9769c9ca5d822de;hpb=b311480ed597aed47b7bfbf01ddcebb41202bd53 diff --git a/src/Geom2dAPI/Geom2dAPI_InterCurveCurve.cxx b/src/Geom2dAPI/Geom2dAPI_InterCurveCurve.cxx old mode 100755 new mode 100644 index 143c0f50e9..537a1ebb0a --- a/src/Geom2dAPI/Geom2dAPI_InterCurveCurve.cxx +++ b/src/Geom2dAPI/Geom2dAPI_InterCurveCurve.cxx @@ -1,39 +1,36 @@ // Created on: 1994-03-24 // Created by: Bruno DUMORTIER // Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS +// Copyright (c) 1999-2014 OPEN CASCADE SAS // -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. +// This file is part of Open CASCADE Technology software library. // -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. // -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. - -#include - -#include +#include #include +#include +#include +#include +#include #include #include - #include +#include +#include //======================================================================= //function : Geom2dAPI_InterCurveCurve //purpose : //======================================================================= - Geom2dAPI_InterCurveCurve::Geom2dAPI_InterCurveCurve() { myIsDone = Standard_False; @@ -153,82 +150,81 @@ Standard_Integer Geom2dAPI_InterCurveCurve::NbSegments() const //======================================================================= //function : Segment //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 - (const Standard_Integer Index, - Handle(Geom2d_Curve)& Curve1, - Handle(Geom2d_Curve)& Curve2) const + (const Standard_Integer theIndex, + Handle(Geom2d_Curve)& theCurve1, + Handle(Geom2d_Curve)& theCurve2) const { - Standard_OutOfRange_Raise_if(Index < 0 || Index > NbSegments(), - "Geom2dAPI_InterCurveCurve::Segment"); - - Standard_NullObject_Raise_if(myCurve2.IsNull(), - "Geom2dAPI_InterCurveCurve::Segment"); - - Standard_Real U1, U2, V1, V2; - - IntRes2d_IntersectionSegment Seg = myIntersector.Segment(Index); - if ( Seg.IsOpposite()) { - if ( Seg.HasFirstPoint()) { - IntRes2d_IntersectionPoint IP1 = Seg.FirstPoint(); - U1 = IP1.ParamOnFirst(); - V2 = IP1.ParamOnSecond(); - } - else { - U1 = Curve1->FirstParameter(); - V2 = Curve2->LastParameter(); - } - if ( Seg.HasLastPoint()) { - IntRes2d_IntersectionPoint IP2 = Seg.LastPoint(); - U2 = IP2.ParamOnFirst(); - V1 = IP2.ParamOnSecond(); - } - else { - U2 = Curve1->FirstParameter(); - V1 = Curve2->LastParameter(); - } + Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > NbSegments(), + "Geom2dAPI_InterCurveCurve::Segment"); + + Standard_NullObject_Raise_if(myCurve1.IsNull(), + "Geom2dAPI_InterCurveCurve::Segment"); + + Standard_Real aU1, aU2, aV1, aV2; + aU1 = myCurve1->FirstParameter(); + aU2 = myCurve1->LastParameter(); + if (myCurve2.IsNull()) + { + aV1 = aU1; + aV2 = aU2; } - 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(); - } + else + { + aV1 = myCurve2->FirstParameter(); + aV2 = myCurve2->LastParameter(); } - Curve1 = new Geom2d_TrimmedCurve(myCurve1, U1, U2); - Curve2 = new Geom2d_TrimmedCurve(myCurve2, V1, V2); - -} - - -//======================================================================= -//function : Segment -//purpose : -//======================================================================= + const IntRes2d_IntersectionSegment& aSeg = myIntersector.Segment(theIndex); + const Standard_Boolean isOpposite = aSeg.IsOpposite(); + + if(aSeg.HasFirstPoint()) + { + const IntRes2d_IntersectionPoint& anIPF = aSeg.FirstPoint(); + aU1 = anIPF.ParamOnFirst(); + + if(isOpposite) + aV2 = anIPF.ParamOnSecond(); + else + aV1 = anIPF.ParamOnSecond(); + } -void Geom2dAPI_InterCurveCurve::Segment - (const Standard_Integer Index, - Handle(Geom2d_Curve)& //Curve1 - ) const -{ - Standard_NotImplemented::Raise(" "); + if(aSeg.HasLastPoint()) + { + const IntRes2d_IntersectionPoint& anIPL = aSeg.LastPoint(); + aU2 = anIPL.ParamOnFirst(); - Standard_OutOfRange_Raise_if(Index < 0 || Index > NbSegments(), - "Geom2dAPI_InterCurveCurve::Segment"); + if(isOpposite) + aV1 = anIPL.ParamOnSecond(); + else + aV2 = anIPL.ParamOnSecond(); + } + theCurve1 = new Geom2d_TrimmedCurve(myCurve1, aU1, aU2); + if (myCurve2.IsNull()) + theCurve2 = new Geom2d_TrimmedCurve(myCurve1, aV1, aV2); + else + theCurve2 = new Geom2d_TrimmedCurve(myCurve2, aV1, aV2); }