Intersector2Obj.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools
00003 //
00004 // GoTools module: Intersections, version 1.0
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _INTERSECTOR2OBJ_H
00034 #define _INTERSECTOR2OBJ_H
00035 
00036 
00037 #include "Intersector.h"
00038 #include "ParamGeomInt.h"
00039 
00040 
00041 namespace Go {
00044 
00045 
00046 
00049 
00050 class Intersector2Obj : public Intersector {
00051 public:
00052 
00054     Intersector2Obj() {}
00055 
00070     Intersector2Obj(boost::shared_ptr<ParamGeomInt> obj1, 
00071                     boost::shared_ptr<ParamGeomInt> obj2,
00072                     boost::shared_ptr<GeoTol> epsge, 
00073                     Intersector* prev = 0,
00074                     int eliminated_parameter = -1,
00075                     double eliminated_value = 0);
00076 
00091     Intersector2Obj(boost::shared_ptr<ParamGeomInt> obj1, 
00092                     boost::shared_ptr<ParamGeomInt> obj2,
00093                     double epsge, 
00094                     Intersector* prev = 0,
00095                     int eliminated_parameter = -1,
00096                     double eliminated_value = 0);
00097 
00099     virtual ~Intersector2Obj();
00100 
00101 //     // Validation of given intersection results
00102 //     virtual void validate(int level, ValidationStat status);  @bsp
00103 
00108     virtual int nmbBdObj(int idx) const
00109     { return (idx < 0 || idx > 1) ? 0 : obj_int_[idx]->nmbBdObj(); }
00110 
00117     virtual BoundaryGeomInt* getBoundaryObject(int idx, int bd_idx) const 
00118     { return (idx < 0 || idx > 1) ? 0 
00119           : obj_int_[idx]->getBoundaryObject(bd_idx); }
00120 
00123     void setSelfintCase(int type)
00124     { selfint_case_ = type; }
00125 
00130     virtual int isSelfintCase()
00131     { return selfint_case_; }
00132             
00133         
00134 protected:
00135     boost::shared_ptr<ParamGeomInt> obj_int_[2];
00136     int selfint_case_;
00137 
00138     // NB: The order of the objects ot input is not arbitrary!  The
00139     // knowledge of what is the 'first object' and the 'second object'
00140     // can be used internally, and must be consistent with the parent
00141     // Intersector.
00142     virtual void print_objs();
00143 
00144     virtual boost::shared_ptr<Intersector> 
00145     lowerOrderIntersector(boost::shared_ptr<ParamGeomInt> obj1,
00146                           boost::shared_ptr<ParamGeomInt> obj2,
00147                           Intersector* prev = 0,
00148                           int eliminated_parameter = -1,
00149                           double eliminated_value = 0) = 0;
00150 
00151     virtual int getBoundaryIntersections();
00152 
00153     virtual int performInterception();
00154 
00155     virtual bool foundIntersectionNearBoundary()
00156     { return false; }  // Special implementation in cases involving
00157                        // curves
00158 
00159     virtual int performRotatedBoxTest(double eps1, double eps2);
00160 
00161     // @@@ TODO. Perform interception using implicitization.
00162     // Real implementation only in SfSfIntersector for the time being
00163     virtual int performInterceptionByImplicitization()
00164     { return 1; }
00165 
00166     // @@@ TODO. Perform interception using implicitization when two
00167     // surfaces intersect along a common boundary. This result is
00168     // found already.
00169     // Real implementation only in SfSfIntersector for the time being
00170      virtual int interceptionBySeparationSurface()
00171     { return 1; }
00172 
00173     virtual int simpleCase();
00174 
00175     virtual int simpleCase2(Point& axis1, Point& axis2);
00176 
00177     // @@@ TODO. Perform simple case test using implicitization.
00178     // Real implementation only in SfSfIntersector for the time being
00179     virtual int simpleCaseByImplicitization()
00180     { return 0; }
00181 
00182     virtual bool isLinear();
00183 
00184     virtual bool complexityReduced()
00185     {
00186         // Default behaviour, continue recursion
00187         return true;
00188     }
00189 
00190     virtual void handleComplexity()
00191     {
00192         // Default, do nothing. Must be impelemted together with 
00193         // complexityReduced
00194     }
00195 
00196     virtual int checkCoincidence() = 0;
00197 
00198     virtual void microCase() = 0;
00199     
00200     virtual int updateIntersections() = 0;
00201 
00202     virtual int linearCase() = 0;
00203 
00204     virtual int doSubdivide() = 0;
00205 
00206     virtual int complexIntercept();
00207 
00208     virtual int complexSimpleCase();
00209 
00210     virtual void postIterate(int nmb_orig, int dir=-1, bool keep_endpt=true) { }
00211 
00212     virtual void doPostIterate()
00213         {
00214             postIterate(0, -1);
00215         }
00216 
00217     virtual void removeDegenerateConnections() { }
00218 
00219     void getSeedIteration(double seed[]);
00220 
00221     bool atSameBoundary(const double *par1, const double *par2);
00222 
00223     bool atBoundary(const double *par1, std::vector<bool>& boundaries);
00224 
00225     virtual void printDebugInfo();
00226 
00227     virtual void writeOut() { }
00228 
00229 private:
00230 
00231 };
00232 
00233 
00235 }  // namespace Go
00236 
00237 
00238 #endif  // _INTERSECTOR2OBJ_H
00239 

Generated on Fri Nov 23 12:24:33 2007 for GoTools Intersections Library by  doxygen 1.5.1