Drop unused resource strings
[TortoiseGit.git] / ext / OGDF / src / energybased / Overlap.cpp
blob5dd606cb7ac05fc4719c29e0a8574e2d4ea77d97
1 /*
2 * $Revision: 2552 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-05 16:45:20 +0200 (Do, 05. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Implementation of class Overlap
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 #include <ogdf/internal/energybased/Overlap.h>
46 namespace ogdf {
48 Overlap::Overlap(GraphAttributes &AG) : NodePairEnergy("Overlap",AG){}
50 double Overlap::computeCoordEnergy(node v1, node v2, const DPoint &p1, const DPoint &p2)
51 const
53 IntersectionRectangle i1(shape(v1)), i2(shape(v2));
54 i1.move(p1);
55 i2.move(p2);
56 IntersectionRectangle intersection = i1.intersection(i2);
57 double area = intersection.area();
58 if(area < 0.0) {
59 OGDF_ASSERT(area > -0.00001);
60 area = 0.0;
62 double minArea = min(i1.area(),i2.area());
63 double energy = area / minArea;
64 return energy;
67 }// namespace ogdf