Changeset 10275 for branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ConvexHullMeasures.cs
- Timestamp:
- 01/04/14 01:39:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ConvexHullMeasures.cs
r10274 r10275 90 90 } 91 91 92 public static double[] CalculateCentroid (List<double[]> convexHull) {92 public static double[] CalculateCentroids(List<double[]> convexHull) { 93 93 int n = convexHull.Count; 94 94 int dim = convexHull.First().Length; … … 132 132 double ca = c.EuclideanDistance(a); 133 133 134 return Math.Acos((ab * ab + bc * bc - ca * ca) / (2 * ab * bc)); 134 //return degrees 135 return Math.Acos((ab * ab + bc * bc - ca * ca) / (2 * ab * bc)) * 180.0 / Math.PI; 135 136 } 136 137 … … 145 146 return thetas; 146 147 } 148 149 public static double CalculateMaxDiameter(List<double[]> convexHull) { 150 double maxDist = double.MinValue; 151 152 for (int i = 0; i < convexHull.Count; i++) { 153 for (int j = 0; j < convexHull.Count; j++) { 154 if (i != j) { 155 double dist = convexHull[i].EuclideanDistance(convexHull[j]); 156 if (dist > maxDist) 157 maxDist = dist; 158 } 159 } 160 } 161 return maxDist; 162 } 147 163 } 148 164 }
Note: See TracChangeset
for help on using the changeset viewer.