Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
solve.h
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Copyright (c) 1999 The CGAL Consortium
4 
5 // This software and related documentation is part of the Computational
6 // Geometry Algorithms Library (CGAL).
7 // This software and documentation is provided "as-is" and without warranty
8 // of any kind. In no event shall the CGAL Consortium be liable for any
9 // damage of any kind.
10 //
11 // Every use of CGAL requires a license.
12 //
13 // Academic research and teaching license
14 // - For academic research and teaching purposes, permission to use and copy
15 // the software and its documentation is hereby granted free of charge,
16 // provided that it is not a component of a commercial product, and this
17 // notice appears in all copies of the software and related documentation.
18 //
19 // Commercial licenses
20 // - A commercial license is available through Algorithmic Solutions, who also
21 // markets LEDA (http://www.algorithmic-solutions.de).
22 // - Commercial users may apply for an evaluation license by writing to
23 // Algorithmic Solutions (contact@algorithmic-solutions.com).
24 //
25 // The CGAL Consortium consists of Utrecht University (The Netherlands),
26 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
27 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
28 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
29 // and Tel-Aviv University (Israel).
30 //
31 // ----------------------------------------------------------------------
32 //
33 // release : CGAL-2.2
34 // release_date : 2000, September 30
35 //
36 // source : solve.fw
37 // file : include/CGAL/solve.h
38 // package : Kernel_basic (3.14)
39 // revision : 3.14
40 // revision_date : 15 Sep 2000
41 // author(s) : Andreas Fabri
42 //
43 // coordinator : MPI, Saarbruecken (<Stefan.Schirra>)
44 // email : contact@cgal.org
45 // www : http://www.cgal.org
46 //
47 // ======================================================================
48 
49 
50 #ifndef CGAL_SOLVE_H
51 #define CGAL_SOLVE_H
52 
54 
55 
56 template <class FT>
57 void solve (const FT &a1, const FT &a2, const FT &a3,
58  const FT &b1, const FT &b2, const FT &b3,
59  const FT &c1, const FT &c2, const FT &c3,
60  const FT &d1, const FT &d2, const FT &d3,
61  FT &x, FT &y, FT &z)
62 {
63  FT denom = b2*c1*a3-b1*c2*a3+c3*b1*a2+b3*c2*a1-c1*b3*a2-b2*c3*a1;
64 
65  x = - (b2*c3*d1-b2*c1*d3+c1*b3*d2+b1*c2*d3-c3*b1*d2-b3*c2*d1)/denom;
66 
67  z = (b2*d1*a3-b2*a1*d3+b1*a2*d3-b1*d2*a3-d1*b3*a2+a1*b3*d2)/denom;
68 
69  y = (a2*c3*d1-a2*c1*d3-c2*d1*a3+c2*a1*d3+d2*c1*a3-d2*c3*a1)/denom;
70 }
71 
72 
73 // this is for a parabola c1, c2, c3 are equal to 1
74 template <class FT>
75 void solve_quadratic (const FT &a1, const FT &a2, const FT &a3,
76  const FT &b1, const FT &b2, const FT &b3,
77  const FT &d1, const FT &d2, const FT &d3,
78  FT &x, FT &y, FT &z)
79 {
80  FT denom = b2*a3-b1*a3+b1*a2+b3*a1-b3*a2-b2*a1;
81 
82  x = - (b2*d1-b2*d3+b3*d2+b1*d3-b1*d2-b3*d1)/denom;
83 
84  z = (b2*d1*a3-b2*a1*d3+b1*a2*d3-b1*d2*a3-d1*b3*a2+a1*b3*d2)/denom;
85 
86  y = (a2*d1-a2*d3-d1*a3+a1*d3+d2*a3-d2*a1)/denom;
87 }
88 
89 
91 
92 #endif // CGAL_SOLVE_H
void int int REAL REAL * y
Definition: read.cpp:74
void solve_quadratic(const FT &a1, const FT &a2, const FT &a3, const FT &b1, const FT &b2, const FT &b3, const FT &d1, const FT &d2, const FT &d3, FT &x, FT &y, FT &z)
Definition: solve.h:75
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
CGAL_BEGIN_NAMESPACE void solve(const FT &a1, const FT &a2, const FT &a3, const FT &b1, const FT &b2, const FT &b3, const FT &c1, const FT &c2, const FT &c3, const FT &d1, const FT &d2, const FT &d3, FT &x, FT &y, FT &z)
Definition: solve.h:57