1 // Copyright (c) 2005-2006  INRIA Sophia-Antipolis (France).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org).
5 //
6 // Partially supported by the IST Programme of the EU as a Shared-cost
7 // RTD (FET Open) Project under Contract No  IST-2000-26473
8 // (ECG - Effective Computational Geometry for Curves and Surfaces)
9 // and a STREP (FET Open) Project under Contract No  IST-006413
10 // (ACS -- Algorithms for Complex Shapes)
11 //
12 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Algebraic_kernel_for_spheres/include/CGAL/Polynomials_for_line_3.h $
13 // $Id: Polynomials_for_line_3.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
14 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
15 //
16 // Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
17 //             Sylvain Pion
18 //             Pedro Machado
19 
20 #ifndef CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_FOR_LINE_3_H
21 #define CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_FOR_LINE_3_H
22 
23 #include <CGAL/license/Circular_kernel_3.h>
24 
25 
26 #include <CGAL/enum.h>
27 
28 namespace CGAL {
29 
30 template < typename FT_ >
31 class Polynomials_for_line_3
32 {
33   FT_ rep[6]; // stores a1, b1, a2, b2, c3, d3
34               // x = a1 t + b1
35               // y = a2 t + b2
36               // z = a3 t + b3
37 public:
38 
39   typedef FT_ FT;
40 
Polynomials_for_line_3()41   Polynomials_for_line_3(){}
42 
Polynomials_for_line_3(const FT & a1,const FT & b1,const FT & a2,const FT & b2,const FT & a3,const FT & b3)43   Polynomials_for_line_3(const FT & a1, const FT & b1,
44                  const FT & a2, const FT & b2,
45                  const FT & a3, const FT & b3)
46   {
47     rep[0] = a1;
48     rep[1] = b1;
49     rep[2] = a2;
50     rep[3] = b2;
51     rep[4] = a3;
52     rep[5] = b3;
53   }
54 
a1()55   const FT & a1() const
56   { return rep[0]; }
57 
b1()58   const FT & b1() const
59   { return rep[1]; }
60 
a2()61   const FT & a2() const
62   { return rep[2]; }
63 
b2()64   const FT & b2() const
65   { return rep[3]; }
66 
a3()67   const FT & a3() const
68   { return rep[4]; }
69 
b3()70   const FT & b3() const
71   { return rep[5]; }
72 
degenerated()73   bool degenerated() const {
74     return is_zero(a1()) &&
75            is_zero(a2()) &&
76            is_zero(a3());
77   }
78 
79 };
80 
81 template < typename FT >
82 inline
83 bool
84 operator == ( const Polynomials_for_line_3<FT> & p1,
85               const Polynomials_for_line_3<FT> & p2 )
86 {
87   return( (p1.a1() == p2.a1()) &&
88           (p1.b1() == p2.b1()) &&
89           (p1.a2() == p2.a2()) &&
90           (p1.b2() == p2.b2()) &&
91           (p1.a3() == p2.a3()) &&
92           (p1.b3() == p2.b3()));
93 }
94 
95 } //namespace CGAL
96 
97 #endif //CGAL_ALGEBRAIC_KERNEL_POLYNOMIALS_FOR_LINE_3_H
98