0030480: Visualization - Clear of Select3D_SensitiveGroup does not update internal...
[occt.git] / src / GeomFill / GeomFill_SimpleBound.cxx
CommitLineData
b311480e 1// Created on: 1995-11-03
2// Created by: Laurent BOURESCHE
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <Adaptor3d_HCurve.hxx>
19#include <GeomFill_SimpleBound.hxx>
20#include <gp_Pnt.hxx>
21#include <gp_Vec.hxx>
7fd59977 22#include <Law.hxx>
42cf5bc1 23#include <Law_BSpFunc.hxx>
24#include <Law_Function.hxx>
25#include <Standard_Type.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(GeomFill_SimpleBound,GeomFill_Boundary)
28
7fd59977 29//=======================================================================
30//function : GeomFill_SimpleBound
31//purpose :
32//=======================================================================
7fd59977 33GeomFill_SimpleBound::GeomFill_SimpleBound
34(const Handle(Adaptor3d_HCurve)& Curve,
35 const Standard_Real Tol3d,
36 const Standard_Real Tolang) :
37 GeomFill_Boundary(Tol3d,Tolang), myC3d(Curve)
38{
39}
40
41//=======================================================================
42//function : Value
43//purpose :
44//=======================================================================
45
46gp_Pnt GeomFill_SimpleBound::Value(const Standard_Real U) const
47{
48 Standard_Real x = U;
49 if(!myPar.IsNull()) x = myPar->Value(U);
50 return myC3d->Value(x);
51}
52
53
54//=======================================================================
55//function : D1
56//purpose :
57//=======================================================================
58
59void GeomFill_SimpleBound::D1(const Standard_Real U,
60 gp_Pnt& P,
61 gp_Vec& V) const
62{
63 Standard_Real x = U, dx = 1.;
64 if(!myPar.IsNull()) myPar->D1(U,x,dx);
65 myC3d->D1(x, P, V);
66 V.Multiply(dx);
67}
68
69//=======================================================================
70//function : Reparametrize
71//purpose :
72//=======================================================================
73
74void GeomFill_SimpleBound::Reparametrize(const Standard_Real First,
75 const Standard_Real Last,
76 const Standard_Boolean HasDF,
77 const Standard_Boolean HasDL,
78 const Standard_Real DF,
79 const Standard_Real DL,
80 const Standard_Boolean Rev)
81{
82 Handle(Law_BSpline) curve = Law::Reparametrize(myC3d->Curve(),
83 First,Last,
84 HasDF,HasDL,DF,DL,
85 Rev,30);
86 myPar = new Law_BSpFunc();
c5f3a425 87 Handle(Law_BSpFunc)::DownCast (myPar)->SetCurve(curve);
7fd59977 88}
89
90//=======================================================================
91//function : Bounds
92//purpose :
93//=======================================================================
94
95void GeomFill_SimpleBound::Bounds(Standard_Real& First,
96 Standard_Real& Last) const
97{
98 if(!myPar.IsNull()) myPar->Bounds(First,Last);
99 else {
100 First = myC3d->FirstParameter();
101 Last = myC3d->LastParameter();
102 }
103}
104
105
106//=======================================================================
107//function : IsDegenerated
108//purpose :
109//=======================================================================
110
111Standard_Boolean GeomFill_SimpleBound::IsDegenerated() const
112{
113 return Standard_False;
114}