Changeset 10222 for branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers
- Timestamp:
- 12/11/13 23:36:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/QhullWrapper.cs
r10211 r10222 27 27 namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers { 28 28 public static class QhullWrapper { 29 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_volume", CallingConvention = CallingConvention.Cdecl)] 30 public static extern double qhull_volume(int dim, int numpoints, [In]double[] data); 31 32 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_convex_hull", CallingConvention = CallingConvention.Cdecl)] 33 public unsafe static extern IntPtr qhull_convex_hull(int dim, int numpoints, [In]double[] data, [Out] Int32* retCode, [Out] Int32* nrOfFacets); 34 35 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_free", CallingConvention = CallingConvention.Cdecl)] 36 public static extern void qhull_free(IntPtr data); 37 29 38 public static double CalculateVolume(List<double[]> points) { 30 39 double result = 0.0; … … 43 52 } 44 53 45 public unsafe static List<int> CalculateConvexHull (List<double[]> points) {54 public unsafe static List<int> CalculateConvexHullIndices(List<double[]> points) { 46 55 int dimension = points.First().Length; 47 56 int numPoints = points.Count(); … … 73 82 } 74 83 75 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_volume", CallingConvention = CallingConvention.Cdecl)]76 public static extern double qhull_volume(int dim, int numpoints, [In]double[] data);77 78 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_convex_hull", CallingConvention = CallingConvention.Cdecl)]79 public unsafe static extern IntPtr qhull_convex_hull(int dim, int numpoints, [In]double[] data, [Out] Int32* retCode, [Out] Int32* nrOfFacets);80 81 [System.Runtime.InteropServices.DllImportAttribute("HeuristicLab.qhull.dll", EntryPoint = "qhull_free", CallingConvention = CallingConvention.Cdecl)]82 public static extern void qhull_free(IntPtr data);84 public static List<double[]> Calculate(List<double[]> points) { 85 var ret = new List<double[]>(); 86 List<int> indices = CalculateConvexHullIndices(points); 87 foreach (var d in indices) { 88 ret.Add(points[d]); 89 } 90 return ret; 91 } 83 92 } 84 93 }
Note: See TracChangeset
for help on using the changeset viewer.