00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _COMPOSITESURFACE_H
00034 #define _COMPOSITESURFACE_H
00035
00040 #include "SplineSurface.h"
00041
00042 namespace Go
00043 {
00046
00047
00048 class CompositeSurface : public ParamSurface
00049 {
00050 public:
00051 CompositeSurface()
00052 {}
00053 CompositeSurface(const std::vector<SplineSurface>& domain_maps,
00054 const SplineSurface& surf)
00055 : surf_(surf), domain_maps_(domain_maps)
00056 {
00057 int num_maps = domain_maps.size();
00058 for (int i = 0; i < num_maps; ++i) {
00059 ASSERT(domain_maps_[i].dimension() == 2);
00060 }
00061 }
00062
00065 virtual void read (std::istream& is)
00066 {
00067 surf_.read(is);
00068 int num_maps;
00069 is >> num_maps;
00070 domain_maps_.resize(num_maps);
00071 for (int i = 0; i < num_maps; ++i) {
00072 domain_maps_[i].read(is);
00073 }
00074 }
00077 virtual void write (std::ostream& os) const
00078 {
00079 surf_.write(os);
00080 int num_maps = domain_maps_.size();
00081 os << num_maps << '\n';
00082 for (int i = 0; i < num_maps; ++i) {
00083 domain_maps_[i].write(os);
00084 }
00085 }
00086
00088 virtual BoundingBox boundingBox() const
00089 { return surf_.boundingBox(); }
00090
00092 virtual int dimension() const
00093 { return surf_.dimension(); }
00094
00096 virtual ClassType instanceType() const
00097 { return CompositeSurface::classType(); }
00098
00100 static ClassType classType()
00101 { return Class_CompositeSurface; }
00102
00103
00105 virtual ~CompositeSurface()
00106 {}
00107
00111 virtual CompositeSurface* clone() const
00112 { return new CompositeSurface(*this); }
00118 virtual const RectDomain& parameterDomain() const
00119 { return domain_maps_.front().parameterDomain(); }
00120
00126 virtual RectDomain containingDomain() const
00127 { return domain_maps_.front().parameterDomain(); }
00128
00134 void setParameterDomain(double u1, double u2, double v1, double v2)
00135 { domain_maps_.front().setParameterDomain(u1, u2, v1, v2); }
00136
00137
00143 virtual CurveLoop outerBoundaryLoop(double degenerate_epsilon
00144 = DEFAULT_SPACE_EPSILON) const
00145 { THROW("Not implemented");return surf_.outerBoundaryLoop(degenerate_epsilon); }
00146
00155 virtual std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon
00156 = DEFAULT_SPACE_EPSILON) const
00157 { THROW("Not implemented");return surf_.allBoundaryLoops(degenerate_epsilon); }
00158
00162 virtual DirectionCone normalCone() const
00163 { THROW("Not implemented");return surf_.normalCone(); }
00164
00172 virtual DirectionCone tangentCone(bool pardir_is_u) const
00173 { THROW("Not implemented");return surf_.tangentCone(pardir_is_u); }
00174
00182 virtual CompositeBox compositeBox() const
00183 { THROW("Not implemented");return surf_.compositeBox(); }
00184
00189 virtual void point(Point& pt, double upar, double vpar) const
00190 {
00191 Point param(2);
00192 param[0] = upar;
00193 param[1] = vpar;
00194 Point param_next(2);
00195 int num_maps = domain_maps_.size();
00196 for (int i = 0; i < num_maps; ++i) {
00197 domain_maps_[i].point(param_next, param[0], param[1]);
00198 param = param_next;
00199 }
00200 surf_.point(pt, param[0], param[1]);
00201 }
00202
00226 virtual void point(std::vector<Point>& pts,
00227 double upar, double vpar,
00228 int derivs,
00229 bool u_from_right = true,
00230 bool v_from_right = true,
00231 double resolution = 1.0e-12) const
00232 { THROW("Not implemented"); }
00233
00249 virtual void normal(Point& n, double upar, double vpar) const
00250 {
00251 Point param(2);
00252 param[0] = upar;
00253 param[1] = vpar;
00254 Point param_next(2);
00255 int num_maps = domain_maps_.size();
00256 for (int i = 0; i < num_maps; ++i) {
00257 domain_maps_[i].point(param_next, param[0], param[1]);
00258 param = param_next;
00259 }
00260 surf_.normal(n, param[0], param[1]);
00261 }
00262
00273 virtual std::vector<boost::shared_ptr<ParamCurve> >
00274 constParamCurves(double parameter, bool pardir_is_u) const
00275 { THROW("Not implemented"); }
00276
00290 virtual std::vector<boost::shared_ptr<ParamSurface> >
00291 subSurfaces(double from_upar, double from_vpar,
00292 double to_upar, double to_vpar,
00293 double fuzzy = DEFAULT_PARAMETER_EPSILON) const
00294 { THROW("Not implemented"); }
00295
00314 virtual double nextSegmentVal(int dir, double par, bool forward, double tol) const
00315 { THROW("Not implemented"); }
00316
00329 virtual void closestPoint(const Point& pt,
00330 double& clo_u,
00331 double& clo_v,
00332 Point& clo_pt,
00333 double& clo_dist,
00334 double epsilon,
00335 const RectDomain* domain_of_interest = NULL,
00336 double *seed = 0) const
00337 { THROW("Not implemented"); }
00338
00339
00342 virtual void closestBoundaryPoint(const Point& pt,
00343 double& clo_u,
00344 double& clo_v,
00345 Point& clo_pt,
00346 double& clo_dist,
00347 double epsilon,
00348 const RectDomain* rd = NULL,
00349 double *seed = 0) const
00350 { THROW("Not implemented"); }
00351
00373 virtual void getBoundaryInfo(Point& pt1, Point& pt2,
00374 double epsilon, SplineCurve*& cv,
00375 SplineCurve*& crosscv, double knot_tol = 1e-05) const
00376 { THROW("Not implemented"); }
00377
00379 virtual void turnOrientation()
00380 { THROW("Not implemented"); }
00381
00385 virtual void reverseParameterDirection(bool direction_is_u)
00386 { THROW("Not implemented"); }
00387
00389 virtual void swapParameterDirection()
00390 { THROW("Not implemented"); }
00391
00394
00406 virtual bool isDegenerate(bool& b, bool& r,
00407 bool& t, bool& l, double tolerance) const
00408 { THROW("Not implemented"); }
00409
00410 private:
00411 SplineSurface surf_;
00412 std::vector<SplineSurface> domain_maps_;
00413 };
00414
00415
00417 }
00418
00419
00420
00421 #endif // _COMPOSITESURFACE_H
00422
00423