BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Conic_2.h
Go to the documentation of this file.
00001 // Copyright (c) 2000,2001  Utrecht University (The Netherlands),
00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
00005 // and Tel-Aviv University (Israel).  All rights reserved.
00006 //
00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; version 2.1 of the License.
00010 // See the file LICENSE.LGPL distributed with CGAL.
00011 //
00012 // Licensees holding a valid commercial license may use this file in
00013 // accordance with the commercial license agreement provided with the software.
00014 //
00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 //
00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Conic_2/include/CGAL/Conic_2.h $
00019 // $Id: Conic_2.h 42932 2008-04-17 10:13:31Z spion $
00020 // 
00021 //
00022 // Author(s)     : Bernd Gaertner, Sven Schoenherr <sven@inf.ethz.ch>
00023 
00024 
00025 #ifndef CGAL_CONIC_2_H
00026 #define CGAL_CONIC_2_H
00027 
00028 #include <CGAL/Conic_misc.h>
00029 #include <CGAL/Dimension.h>
00030 
00031 CGAL_BEGIN_NAMESPACE
00032 
00033 template < class R_ >
00034 class Optimisation_ellipse_2;
00035 
00036 template < class R_>
00037 class Conic_2 : public R_::Kernel_base::Conic_2 {
00038 
00039     friend  class Optimisation_ellipse_2<R_>;
00040 
00041   public:
00042 
00043     typedef Dimension_tag<2>  Ambient_dimension;
00044     typedef Dimension_tag<1>  Feature_dimension;
00045 
00046     // types
00047     typedef  R_                    R;
00048     typedef  typename R_::RT       RT;
00049     typedef  typename R_::FT       FT;
00050     typedef  typename R_::Kernel_base::Conic_2  _Conic_2;
00051 
00052     // construction
00053     Conic_2 ()
00054     {}
00055     
00056     Conic_2 (RT r, RT s, RT t, RT u, RT v, RT w)
00057         : _Conic_2 (r, s, t, u, v, w)
00058     {}
00059 
00060     // general access
00061     RT r () const
00062     {
00063         return _Conic_2::r();
00064     }
00065     
00066     RT s () const
00067     {
00068         return _Conic_2::s();
00069     }
00070     
00071     RT t () const
00072     {
00073         return _Conic_2::t();
00074     }
00075     
00076     RT u () const
00077     {
00078         return _Conic_2::u();
00079     }
00080     
00081     RT v () const
00082     {
00083         return _Conic_2::v();
00084     }
00085     
00086     RT w () const
00087     {
00088         return _Conic_2::w();
00089     }
00090     
00091     CGAL::Point_2<R> center () const
00092     {
00093         return _Conic_2::center();
00094     }
00095     
00096     
00097 
00098     // type related access
00099     Conic_type conic_type () const
00100     {
00101         return _Conic_2::conic_type();
00102     }
00103     
00104     bool is_hyperbola () const
00105     {
00106         return _Conic_2::is_hyperbola();
00107     }
00108     
00109     bool is_parabola () const
00110     {
00111         return _Conic_2::is_parabola();
00112     }
00113     
00114     bool is_ellipse () const
00115     {
00116         return _Conic_2::is_ellipse();
00117     }
00118 
00119     bool is_circle () const
00120     {
00121         return _Conic_2::is_circle();
00122     }
00123     
00124     bool is_empty () const
00125     {
00126         return _Conic_2::is_empty();
00127     }
00128     
00129     bool is_trivial () const
00130     {
00131         return _Conic_2::is_trivial();
00132     }
00133     
00134     bool is_degenerate () const
00135     {
00136         return _Conic_2::is_degenerate();
00137     }
00138     
00139     
00140 
00141     // orientation related access
00142     CGAL::Orientation orientation () const
00143     {
00144         return _Conic_2::orientation ();
00145     }
00146     
00147     CGAL::Oriented_side oriented_side (const CGAL::Point_2<R>& p) const
00148     {
00149         return _Conic_2::oriented_side (p);
00150     }
00151     
00152     bool has_on_positive_side (const CGAL::Point_2<R>& p) const
00153     {
00154         return _Conic_2::has_on_positive_side (p);
00155     }
00156     
00157     bool has_on_negative_side (const CGAL::Point_2<R>& p) const
00158     {
00159         return _Conic_2::has_on_negative_side (p);
00160     }
00161     
00162     bool has_on_boundary (const CGAL::Point_2<R>& p) const
00163     {
00164         return _Conic_2::has_on_boundary (p);
00165     }
00166     
00167     bool has_on (const CGAL::Point_2<R>& p) const
00168     {
00169         return _Conic_2::has_on (p);
00170     }
00171     
00172     Convex_side convex_side (const CGAL::Point_2<R>& p) const
00173     {
00174         return _Conic_2::convex_side (p);
00175     }
00176     
00177     bool has_on_convex_side (const CGAL::Point_2<R>& p) const
00178     {
00179         return _Conic_2::has_on_convex_side (p);
00180     }
00181     
00182     bool has_on_nonconvex_side (const CGAL::Point_2<R>& p) const
00183     {
00184         return _Conic_2::has_on_nonconvex_side (p);
00185     }
00186     
00187     
00188 
00189     // comparisons
00190     bool operator == ( const Conic_2<R_>& c) const
00191     {
00192         return _Conic_2::operator == ( (Conic_2)c);
00193     }
00194     
00195     bool operator != ( const Conic_2<R_>& c) const
00196     {
00197         return( ! operator == ( c));
00198     }
00199 
00200     // set methods
00201     void set (RT r, RT s, RT t,
00202               RT u, RT v, RT w)
00203     {
00204         _Conic_2::set (r, s, t, u, v, w);
00205     }
00206     
00207     void set_opposite ()
00208     {
00209         _Conic_2::set_opposite();
00210     }
00211     
00212     void set_circle (const CGAL::Point_2<R>& p1, const CGAL::Point_2<R>& p2,
00213                      const CGAL::Point_2<R>& p3)
00214     {
00215         // the unique circle through the three points
00216         _Conic_2::set_circle(p1, p2, p3);
00217     }
00218 
00219     void set_linepair (const CGAL::Point_2<R>& p1, const CGAL::Point_2<R>& p2,
00220                        const CGAL::Point_2<R>& p3, const CGAL::Point_2<R>& p4)
00221     {
00222         _Conic_2::set_linepair (p1, p2, p3, p4);
00223     }
00224     
00225     void set_ellipse (const CGAL::Point_2<R>& p1, const CGAL::Point_2<R>& p2,
00226                       const CGAL::Point_2<R>& p3)
00227     {
00228         _Conic_2::set_ellipse (p1, p2, p3);
00229     }
00230     
00231     void set_ellipse (const CGAL::Point_2<R>& p1, const CGAL::Point_2<R>& p2,
00232                       const CGAL::Point_2<R>& p3, const CGAL::Point_2<R>& p4,
00233                       CGAL::Orientation o = POSITIVE)
00234     {
00235         _Conic_2::set_ellipse (p1, p2, p3, p4, o);
00236     }
00237     
00238     void set (const CGAL::Point_2<R>& p1, const CGAL::Point_2<R>& p2,
00239               const CGAL::Point_2<R>& p3, const CGAL::Point_2<R>& p4,
00240               const CGAL::Point_2<R>& p5,
00241               CGAL::Orientation o = POSITIVE)
00242     {
00243         _Conic_2::set (p1, p2, p3, p4, p5, o);
00244     }
00245     
00246     
00247 
00248   private:
00249     void set_linear_combination (
00250         const RT& a1, const Conic_2<R>& c1,
00251         const RT& a2, const Conic_2<R>& c2)
00252     {
00253         _Conic_2::set_linear_combination (a1, c1, a2, c2);
00254     }
00255     
00256     static void set_two_linepairs (const CGAL::Point_2<R>& p1,
00257                                    const CGAL::Point_2<R>& p2,
00258                                    const CGAL::Point_2<R>& p3,
00259                                    const CGAL::Point_2<R>& p4,
00260                                    Conic_2<R>& pair1,
00261                                    Conic_2<R>& pair2)
00262     {
00263         _Conic_2::set_two_linepairs (p1, p2, p3, p4, pair1, pair2);
00264     }
00265     
00266     void set_ellipse (const Conic_2<R>& pair1,
00267                       const Conic_2<R>& pair2)
00268     {
00269         _Conic_2::set_ellipse (pair1, pair2);
00270     }
00271     
00272     void set (const Conic_2<R>& c1, const Conic_2<R>& c2,
00273               const CGAL::Point_2<R>& p)
00274     {
00275         _Conic_2::set( c1, c2, p);  this->analyse();
00276     }
00277     
00278     CGAL::Sign vol_derivative (RT dr, RT ds,
00279                                RT dt, RT du,
00280                                RT dv, RT dw) const
00281     {
00282         return _Conic_2::vol_derivative (dr, ds, dt, du, dv, dw);
00283     }
00284     
00285     double vol_minimum (RT dr, RT ds,
00286                         RT dt, RT du,
00287                         RT dv, RT dw) const
00288     {
00289         return _Conic_2::vol_minimum (dr, ds, dt, du, dv, dw);
00290     }
00291     
00292     
00293 };
00294 
00295 
00296 
00297 #ifndef CGAL_NO_OSTREAM_INSERT_CONIC_2
00298 template< class R_>
00299 std::ostream& operator << ( std::ostream& os, const Conic_2<R_>& c)
00300 {
00301     return( os << c.r() << ' ' << c.s() << ' ' << c.t() << ' '
00302                << c.u() << ' ' << c.v() << ' ' << c.w());
00303 }
00304 #endif // CGAL_NO_OSTREAM_INSERT_CONIC_2
00305 
00306 CGAL_END_NAMESPACE
00307 
00308 #endif // CGAL_CONIC_2_H
00309 
00310 // ===== EOF ==================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines