PlanarGC  1.0.2
 All Data Structures Functions Variables Enumerations Enumerator Friends Pages
CutPlanarDefs.h
1 /*****************************************************************************
2 * PlanarCut - software to compute MinCut / MaxFlow in a planar graph *
3 * Version 1.0 *
4 * *
5 * Copyright 2011 Eno Töppe <toeppe@in.tum.de> *
6 * Frank R. Schmidt <fschmidt@uwo.ca> *
7 ******************************************************************************
8 
9  If you use this software for research purposes, YOU MUST CITE the following
10  paper in any resulting publication:
11 
12  [1] Efficient Planar Graph Cuts with Applications in Computer Vision.
13  F. R. Schmidt, E. Töppe, D. Cremers,
14  IEEE CVPR, Miami, Florida, June 2009
15 
16 ******************************************************************************
17 
18  This software is released under the LGPL license. Details are explained
19  in the files 'COPYING' and 'COPYING.LESSER'.
20 
21 *****************************************************************************/
22 
23 #ifndef __PLANARCUTDEFS_H
24 #define __PLANARCUTDEFS_H
25 
26 #include <limits>
27 
28 
29 #define CAP_INF std::numeric_limits<double>::max()
30 
31 #define EPSILON 1e-6 //used for numerical issues
32 
33 typedef double CapType; /* data type for flow capacity */
34 typedef unsigned char uchar; /* for convenience */
35 typedef unsigned int uint;
36 
37 inline CapType mmin(CapType a, CapType b) {
38 
39  if (a < b)
40  return a;
41 
42  return b;
43 
44 }
45 
46 inline CapType mmax(CapType a, CapType b) {
47 
48  if (a > b)
49  return a;
50 
51  return b;
52 
53 }
54 
55 inline CapType mmin3(CapType a, CapType b, CapType c) {
56 
57  if (a < b) {
58  if (a < c)
59  return a;
60  else
61  return c;
62  } else {
63  if (b < c)
64  return b;
65  else
66  return c;
67  }
68 
69 }
70 
71 inline CapType mmax3(CapType a, CapType b, CapType c) {
72 
73  if (a > b) {
74  if (a > c)
75  return a;
76  else
77  return c;
78  } else {
79  if (b > c)
80  return b;
81  else
82  return c;
83  }
84 
85 }
86 
87 #endif
© 2009 - 2013 by Eno Töppe, Frank R. Schmidt
generated by Doxygen