File indexing completed on 2025-01-18 10:03:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _GeomAdaptor_Surface_HeaderFile
0018 #define _GeomAdaptor_Surface_HeaderFile
0019
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <BSplSLib_Cache.hxx>
0022 #include <GeomAbs_Shape.hxx>
0023 #include <GeomEvaluator_Surface.hxx>
0024 #include <Geom_Surface.hxx>
0025 #include <Standard_NullObject.hxx>
0026 #include <TColStd_Array1OfReal.hxx>
0027
0028 DEFINE_STANDARD_HANDLE(GeomAdaptor_Surface, Adaptor3d_Surface)
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class GeomAdaptor_Surface : public Adaptor3d_Surface
0039 {
0040 DEFINE_STANDARD_RTTIEXT(GeomAdaptor_Surface, Adaptor3d_Surface)
0041 public:
0042
0043 GeomAdaptor_Surface()
0044 : myUFirst(0.), myULast(0.),
0045 myVFirst(0.), myVLast (0.),
0046 myTolU(0.), myTolV(0.),
0047 mySurfaceType (GeomAbs_OtherSurface) {}
0048
0049 GeomAdaptor_Surface(const Handle(Geom_Surface)& theSurf)
0050 : myTolU(0.), myTolV(0.)
0051 {
0052 Load (theSurf);
0053 }
0054
0055
0056 GeomAdaptor_Surface (const Handle(Geom_Surface)& theSurf,
0057 const Standard_Real theUFirst, const Standard_Real theULast,
0058 const Standard_Real theVFirst, const Standard_Real theVLast,
0059 const Standard_Real theTolU = 0.0, const Standard_Real theTolV = 0.0)
0060 {
0061 Load (theSurf, theUFirst, theULast, theVFirst, theVLast, theTolU, theTolV);
0062 }
0063
0064
0065 Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
0066
0067 void Load (const Handle(Geom_Surface)& theSurf)
0068 {
0069 if (theSurf.IsNull()) { throw Standard_NullObject("GeomAdaptor_Surface::Load"); }
0070
0071 Standard_Real aU1, aU2, aV1, aV2;
0072 theSurf->Bounds (aU1, aU2, aV1, aV2);
0073 load (theSurf, aU1, aU2, aV1, aV2);
0074 }
0075
0076
0077 void Load (const Handle(Geom_Surface)& theSurf,
0078 const Standard_Real theUFirst, const Standard_Real theULast,
0079 const Standard_Real theVFirst, const Standard_Real theVLast,
0080 const Standard_Real theTolU = 0.0, const Standard_Real theTolV = 0.0)
0081 {
0082 if (theSurf.IsNull()) { throw Standard_NullObject("GeomAdaptor_Surface::Load"); }
0083 if (theUFirst > theULast || theVFirst > theVLast) { throw Standard_ConstructionError("GeomAdaptor_Surface::Load"); }
0084
0085 load (theSurf, theUFirst, theULast, theVFirst, theVLast, theTolU, theTolV);
0086 }
0087
0088 const Handle(Geom_Surface)& Surface() const { return mySurface; }
0089
0090 virtual Standard_Real FirstUParameter() const Standard_OVERRIDE { return myUFirst; }
0091
0092 virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return myULast; }
0093
0094 virtual Standard_Real FirstVParameter() const Standard_OVERRIDE { return myVFirst; }
0095
0096 virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return myVLast; }
0097
0098 Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
0099
0100 Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
0101
0102
0103
0104 Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
0105
0106
0107
0108 Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
0109
0110
0111
0112 Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0113
0114
0115
0116 Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0117
0118
0119
0120
0121
0122
0123 Standard_EXPORT Handle(Adaptor3d_Surface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0124
0125
0126
0127
0128
0129 Standard_EXPORT Handle(Adaptor3d_Surface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0130
0131 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0132
0133 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0134
0135 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0136
0137 Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
0138
0139 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0140
0141 Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
0142
0143
0144 Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
0145
0146
0147 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
0148
0149
0150
0151
0152
0153
0154
0155
0156 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
0157
0158
0159
0160
0161
0162
0163
0164
0165 Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
0166
0167
0168
0169
0170
0171
0172
0173
0174 Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
0185
0186
0187
0188 Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
0189
0190
0191
0192 Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
0193
0194
0195
0196
0197
0198 virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurfaceType; }
0199
0200 Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
0201
0202 Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
0203
0204 Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
0205
0206 Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
0207
0208 Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
0209
0210 Standard_EXPORT Standard_Integer UDegree() const Standard_OVERRIDE;
0211
0212 Standard_EXPORT Standard_Integer NbUPoles() const Standard_OVERRIDE;
0213
0214 Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE;
0215
0216 Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE;
0217
0218 Standard_EXPORT Standard_Integer NbUKnots() const Standard_OVERRIDE;
0219
0220 Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE;
0221
0222 Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
0223
0224 Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
0225
0226
0227
0228
0229
0230
0231 Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
0232
0233
0234
0235
0236
0237
0238 Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
0239
0240 Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
0241
0242 Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
0243
0244 Standard_EXPORT Handle(Adaptor3d_Curve) BasisCurve() const Standard_OVERRIDE;
0245
0246 Standard_EXPORT Handle(Adaptor3d_Surface) BasisSurface() const Standard_OVERRIDE;
0247
0248 Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE;
0249
0250 private:
0251
0252 Standard_EXPORT void Span (const Standard_Integer Side, const Standard_Integer Ideb, const Standard_Integer Ifin, Standard_Integer& OutIdeb, Standard_Integer& OutIfin, const Standard_Integer FKIndx, const Standard_Integer LKIndx) const;
0253
0254 Standard_EXPORT Standard_Boolean IfUVBound (const Standard_Real U, const Standard_Real V, Standard_Integer& Ideb, Standard_Integer& Ifin, Standard_Integer& IVdeb, Standard_Integer& IVfin, const Standard_Integer USide, const Standard_Integer VSide) const;
0255
0256 Standard_EXPORT void load (const Handle(Geom_Surface)& S, const Standard_Real UFirst, const Standard_Real ULast, const Standard_Real VFirst, const Standard_Real VLast, const Standard_Real TolU = 0.0, const Standard_Real TolV = 0.0);
0257
0258
0259
0260
0261 Standard_EXPORT void RebuildCache (const Standard_Real theU, const Standard_Real theV) const;
0262
0263 protected:
0264
0265 Handle(Geom_Surface) mySurface;
0266 Standard_Real myUFirst;
0267 Standard_Real myULast;
0268 Standard_Real myVFirst;
0269 Standard_Real myVLast;
0270 Standard_Real myTolU;
0271 Standard_Real myTolV;
0272
0273 Handle(Geom_BSplineSurface) myBSplineSurface;
0274 mutable Handle(BSplSLib_Cache) mySurfaceCache;
0275
0276 GeomAbs_SurfaceType mySurfaceType;
0277 Handle(GeomEvaluator_Surface) myNestedEvaluator;
0278 };
0279
0280 #endif