6 * $Date: 2012-07-06 15:04:28 +0200 (Fr, 06. Jul 2012) $
7 ***************************************************************/
10 * \brief Declaration of class numexcept (handling of numeric problems).
12 * \author Stefan Hachul
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
48 #ifndef OGDF_NUMEXCEPT_H
49 #define OGDF_NUMEXCEPT_H
51 #include <ogdf/basic/geometry.h>
55 //--------------------------------------------------------------------------
56 // this class is developed for exceptions that might occure, when nodes are
57 // placed at the same position and a new random position has to be found, or
58 // when the calculated forces are near the machine accuracy, where no
59 // reasonable numeric and logic calculations are possible any more
60 //---------------------------------------------------------------------------
66 //Returns a distinct random point within the smallest disque D with center
67 //old_point that is contained in the box defined by xmin,...,ymax; The size of
68 //D is shrunk by multiplying with epsilon = 0.1; Precondition:
69 //old_point is contained in the box and the box is not equal to old_point.
70 DPoint
choose_distinct_random_point_in_disque(
77 //A random point (distinct from old_pos) on the disque around old_pos with
78 //radius epsilon = 0.1 is computed.
79 DPoint
choose_distinct_random_point_in_radius_epsilon(DPoint old_pos
);
81 //If distance has a value near the machine precision the repulsive force calculation
82 //is not possible (calculated values exceed the machine accuracy) in this cases
83 //true is returned and force is set to a reasonable value that does
84 //not cause problems; Else false is returned and force keeps unchanged.
85 bool f_rep_near_machine_precision(double distance
, DPoint
& force
);
87 //If distance has a value near the machine precision the (attractive)force
88 //calculation is not possible (calculated values exceed the machine accuracy) in
89 //this cases true is returned and force is set to a reasonable value that does
90 //not cause problems; Else false is returned and force keeps unchanged.
91 bool f_near_machine_precision(double distance
, DPoint
& force
);
93 //Returns true if a is "nearly" equal to b (needed, when machine accuracy is
94 //insufficient in functions well_seperated and bordering of NMM)
95 bool nearly_equal(double a
, double b
);