// Created on: 1997-11-21
// Created by: Philippe MANGIN
// Copyright (c) 1997-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.
// Modified by skv - Fri Feb 6 11:44:48 2004 OCC5073
#include <gp_GTrsf.hxx>
#include <gp_Mat.hxx>
#include <gp_Ax2.hxx>
+#include <gp_Sphere.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_TrimmedCurve.hxx>
#include <Approx_SweepApproximation.hxx>
#include <AdvApprox_PrefAndRec.hxx>
#include <Precision.hxx>
#include <ElCLib.hxx>
+#include <ElSLib.hxx>
//=======================================================================
//class : GeomFill_Sweep_Eval
const Standard_Integer Segmax)
{
Standard_Boolean Ok = Standard_False;
- Standard_Integer nbsegmax = Segmax, nbspan = myLoc->NbIntervals(GeomAbs_C1);
- if (Segmax < nbspan) nbsegmax = nbspan;
Handle(GeomFill_SweepFunction) Func
= new (GeomFill_SweepFunction) (mySec, myLoc, First, SFirst,
if (Approx.IsDone()) {
Ok = Standard_True;
-#if DEB
+#ifdef OCCT_DEBUG
Approx.Dump(cout);
#endif
myCurve2d = new (TColGeom2d_HArray1OfCurve) (1, 2);
CError = new (TColStd_HArray2OfReal) (1,2, 1,2);
- const Handle(Geom_BSplineSurface)& BSplSurf =
- Handle(Geom_BSplineSurface)::DownCast(mySurface);
+ Handle(Geom_BSplineSurface) BSplSurf (Handle(Geom_BSplineSurface)::DownCast(mySurface));
gp_Dir2d D(0., 1.);
gp_Pnt2d P(BSplSurf->UKnot(1), 0);
Segmax,
eval,
Preferentiel);
-#if DEB
+#ifdef OCCT_DEBUG
Approx.Dump(cout);
#endif
TfBegin.SetValues(GTfBegin(1,1), GTfBegin(1,2), GTfBegin(1,3), GTfBegin(1,4),
GTfBegin(2,1), GTfBegin(2,2), GTfBegin(2,3), GTfBegin(2,4),
- GTfBegin(3,1), GTfBegin(3,2), GTfBegin(3,3), GTfBegin(3,4),
- 1.e-12, 1.e-14);
+ GTfBegin(3,1), GTfBegin(3,2), GTfBegin(3,3), GTfBegin(3,4));
// Get the last transformation
theLoc->D0(aLast, M, VEnd);
TfEnd.SetValues(GTfEnd(1,1), GTfEnd(1,2), GTfEnd(1,3), GTfEnd(1,4),
GTfEnd(2,1), GTfEnd(2,2), GTfEnd(2,3), GTfEnd(2,4),
- GTfEnd(3,1), GTfEnd(3,2), GTfEnd(3,3), GTfEnd(3,4),
- 1.e-12, 1.e-14);
+ GTfEnd(3,1), GTfEnd(3,2), GTfEnd(3,3), GTfEnd(3,4));
Handle(Geom_Surface) aSurf = theSec->BSplineSurface();
Standard_Real Umin;
OCC_CATCH_SIGNALS
Tf2.SetValues(Tf(1,1), Tf(1,2), Tf(1,3), Tf(1,4),
Tf(2,1), Tf(2,2), Tf(2,3), Tf(2,4),
- Tf(3,1), Tf(3,2), Tf(3,3), Tf(3,4),
- 1.e-12, 1.e-14);
+ Tf(3,1), Tf(3,2), Tf(3,3), Tf(3,4));
}
catch (Standard_ConstructionError) {
IsTrsf = Standard_False;
// (1.1.b) Cas Cylindrique
if ( (SectionType == GeomAbs_Circle) && IsTrsf) {
+ const Standard_Real TolProd = 1.e-6;
+
gp_Circ C = AC.Circle();
C.Transform(Tf2);
DS.Normalize();
levier = Abs(DS.CrossMagnitude(DP)) * C.Radius();
SError = levier * Abs(Last - First);
- if (SError <= Tol) {
+ if (SError <= TolProd) {
Ok = Standard_True;
gp_Ax3 axe (C.Location(), DP, C.Position().XDirection());
S = new (Geom_CylindricalSurface)
// OCC_CATCH_SIGNALS
Tf2.SetValues(Tf(1,1), Tf(1,2), Tf(1,3), Tf(1,4),
Tf(2,1), Tf(2,2), Tf(2,3), Tf(2,4),
- Tf(3,1), Tf(3,2), Tf(3,3), Tf(3,4),
- 1.e-14, 1.e-15);
+ Tf(3,1), Tf(3,2), Tf(3,3), Tf(3,4));
// }
// catch (Standard_ConstructionError) {
// IsTrsf = Standard_False;
Standard_Real f = UFirst , l = ULast;
SError = error;
Centre.BaryCenter(1.0, C.Location(), 1.0);
- gp_Ax3 AxisOfSphere(Centre, DN, DS);
- S = new (Geom_SphericalSurface)
- (AxisOfSphere, (RotRadius + C.Radius())/2 );
+ gp_Ax3 AxisOfSphere(Centre, DN, DS);
+ gp_Sphere theSphere( AxisOfSphere, (RotRadius + C.Radius())/2 );
+ S = new Geom_SphericalSurface(theSphere);
// Pour les spheres on ne peut pas controler le parametre
// V (donc U car myExchUV = Standard_True)
// Il faut donc modifier UFirst, ULast...
- if (C.Position().Direction().
- IsOpposite(AxisOfSphere.YDirection(), 0.1) ) {
+ Standard_Real fpar = AC.FirstParameter();
+ Standard_Real lpar = AC.LastParameter();
+ Handle(Geom_Curve) theSection = new Geom_TrimmedCurve(Section, fpar, lpar);
+ theSection->Transform(Tf2);
+ gp_Pnt FirstPoint = theSection->Value(theSection->FirstParameter());
+ gp_Pnt LastPoint = theSection->Value(theSection->LastParameter());
+ Standard_Real UfirstOnSec, VfirstOnSec, UlastOnSec, VlastOnSec;
+ ElSLib::Parameters(theSphere, FirstPoint, UfirstOnSec, VfirstOnSec);
+ ElSLib::Parameters(theSphere, LastPoint, UlastOnSec, VlastOnSec);
+ if (VfirstOnSec < VlastOnSec)
+ {
+ f = VfirstOnSec;
+ l = VlastOnSec;
+ }
+ else
+ {
// L'orientation parametrique est inversee
- l = 2*M_PI - UFirst;
- f = 2*M_PI - ULast;
+ f = VlastOnSec;
+ l = VfirstOnSec;
isUReversed = Standard_True;
}
- // On calcul le "glissement" parametrique.
- Standard_Real rot;
- rot = C.Position().XDirection().AngleWithRef
- (AxisOfSphere.XDirection(), AxisOfSphere.YDirection());
- f -= rot;
- l -= rot;
if ( (f >= -M_PI/2) && (l <= M_PI/2)) {
Ok = Standard_True;
mySurface = new (Geom_RectangularTrimmedSurface)
(S,UFirst, ULast, Standard_True);
-#if DEB
+#ifdef OCCT_DEBUG
if (isUPeriodic && !mySurface->IsUPeriodic())
cout<<"Pb de periodicite en U" << endl;
if (isUPeriodic && !mySurface->IsUClosed())