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 _ALGOBJ3DINT_H 00034 #define _ALGOBJ3DINT_H 00035 00036 00037 #include "AlgObjectInt.h" 00038 #include "Array.h" 00039 #include "BernsteinTetrahedralPoly.h" 00040 #include "BaryCoordSystem.h" 00041 #include <vector> 00042 00043 00044 namespace Go { 00047 00048 00049 00053 00054 struct Alg3DElem { 00055 00057 double factor_; 00058 00060 Array<int, 3> degrees_; // (deg_x, deg_y, deg_z). 00061 00063 Alg3DElem(double factor, int degree_x, int degree_y, int degree_z) 00064 : factor_(factor), 00065 degrees_(Array<int, 3>(degree_x, degree_y, degree_z)) 00066 {} 00067 }; 00068 00069 00073 00074 class AlgObj3DInt : public AlgObjectInt { 00075 public: 00079 AlgObj3DInt(int degree); 00080 00084 AlgObj3DInt(const std::vector<Alg3DElem>& terms); 00085 00094 AlgObj3DInt(const BernsteinTetrahedralPoly& implicit, 00095 const BaryCoordSystem3D& bc); 00096 00098 virtual ~AlgObj3DInt(); 00099 00102 int numTerms() 00103 { return terms_.size(); } 00104 00107 int degree() 00108 { return degree_; } 00109 00113 Alg3DElem term(int index); 00114 00118 void getImplicit(BernsteinTetrahedralPoly& impl, BaryCoordSystem3D& bc) 00119 { 00120 impl = implicit_; 00121 bc = bc_; 00122 } 00123 00130 bool usingPowerBasis() 00131 { return power_basis_; } 00132 00133 00134 protected: 00135 int degree_; // Total degree, i.e. the highest sum of the degrees 00136 // of a term in the polynomial. 00137 00138 std::vector<Alg3DElem> terms_; 00139 bool power_basis_; // The other option is Bernstein basis & 00140 // barycentric coordinates. 00141 00142 // @@sbr Not sure which to use! 00143 // Should the approximative impclicitization take place inside 00144 // this function? Would assume that it was to be calculated on 00145 // the outside and only stored here. Could then use class in 00146 // Implicitization, which depends on that structure not to change. 00147 // But tu implement easy support for converting from power to 00148 // Bernstein basis this approach makes sense. 00149 BernsteinTetrahedralPoly implicit_; // deg & 00150 // (deg+1)*(deg+2)*(deg+3)/6 00151 // basis elements. 00152 BaryCoordSystem3D bc_; // 4 3D-corners. Requires boundingbox for 00153 // alg obj. 00154 00155 private: 00156 00157 // // We need a utility function to change from power basis to 00158 // // Bernstein, using the format in implicitization. 00159 // BernsteinTetrahedralPoly powerToBernstein(); 00160 00161 // // We convert x to the Bernstein basis. 00162 // SplineSurface unitSf(); 00163 00164 }; 00165 00166 00168 } // namespace Go 00169 00170 00171 #endif // _ALGOBJ3DINT_H 00172 00173