Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / internal / energybased / Attraction.h
blob06af82adb3af65af9b5e88981939dc9145a4f8ca
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declares class Attraction.
12 * \author Rene Weiskircher
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
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
26 * for details.
28 * \par
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.
34 * \par
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 ***************************************************************/
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
48 #ifndef OGDF_ATTRACTION_H
49 #define OGDF_ATTRACTION_H
52 #include <ogdf/internal/energybased/NodePairEnergy.h>
54 namespace ogdf {
57 //! Energy function for attraction between two adjacent vertices.
58 /**
59 * Implements an energy function that simulates
60 * attraction between two adjacent vertices. There is an optimum
61 * distance where the energy is zero. The energy grows quadratic
62 * with the difference to the optimum distance. The optimum
63 * distance between two adjacent vertices depends on the size of
64 * the two vertices.
66 class Attraction: public NodePairEnergy {
67 public:
68 //Initializes data structures to speed up later computations
69 Attraction(GraphAttributes &AG);
70 ~Attraction() {}
71 //! set the preferred edge length to the absolute value l
72 void setPreferredEdgelength(double l) {m_preferredEdgeLength = l;}
73 //! set multiplier for the edge length with repspect to node size to multi
74 void reinitializeEdgeLength(double multi);
75 #ifdef OGDF_DEBUG
76 void printInternalData() const;
77 #endif
78 private:
79 //! Average length and height of nodes is multiplied by this factor to get preferred edge length
80 static const double MULTIPLIER;
81 //! the length that that all edges should ideally have
82 double m_preferredEdgeLength;
83 //! computes the energy contributed by the two nodes if they are placed at the two given positions
84 double computeCoordEnergy(node,node, const DPoint&, const DPoint &) const;
87 }// namespace ogdf
89 #endif