convex-hull

OpenMP C program run slower than sequential code

左心房为你撑大大i 提交于 2019-12-01 13:29:37
问题 I am a newbie to OpenMP, trying to parallelize Jarvis's algorithm. However it turns out that the parallel program take 2-3 times longer compare to sequential code. Is it that the problem itself cannot be parallelize? Or there is something wrong in how i parallelize it. This is my openMP program for the problem, with 2 parts being parallelize: #include <stdio.h> #include <sys/time.h> #include <omp.h> typedef struct Point { int x, y; } Point; // To find orientation of ordered triplet (p, q, r).

ConvexHull in Graphics - Mathematica

你离开我真会死。 提交于 2019-12-01 06:39:04
Trying to plot a ConvexHull Using PlanarGraphPlot from the ComputationalGeometry package, it does not work when used in graphics. Any Idea on how to plot the ConvexHull using Graphics ? Needs["ComputationalGeometry`"] pts = RandomReal[{0, 10}, {60, 2}]; Graphics[ { Point@pts, FaceForm[], EdgeForm[Red], Polygon@pts[[ConvexHull[pts]]] } ] or cpts = pts[[ConvexHull[pts]]]; AppendTo[cpts, cpts[[1]]]; Graphics[ { Point@pts, Red, Line@cpts } ] Not sure exactly what is wanted. Maybe the code below will get you started. pts = RandomReal[{-10, 10}, {20, 2}] (* Out[1]= {{1.7178, -1.11179}, {-7.10708, -8

ConvexHull in Graphics - Mathematica

£可爱£侵袭症+ 提交于 2019-12-01 03:55:29
问题 Trying to plot a ConvexHull Using PlanarGraphPlot from the ComputationalGeometry package, it does not work when used in graphics. Any Idea on how to plot the ConvexHull using Graphics ? 回答1: Needs["ComputationalGeometry`"] pts = RandomReal[{0, 10}, {60, 2}]; Graphics[ { Point@pts, FaceForm[], EdgeForm[Red], Polygon@pts[[ConvexHull[pts]]] } ] or cpts = pts[[ConvexHull[pts]]]; AppendTo[cpts, cpts[[1]]]; Graphics[ { Point@pts, Red, Line@cpts } ] 回答2: Not sure exactly what is wanted. Maybe the

Convex hull ggplot using data.tables in R

时光总嘲笑我的痴心妄想 提交于 2019-11-30 19:09:30
I found a nice example of plotting convex hull shapes using ggplot with ddply here: Drawing outlines around multiple geom_point groups with ggplot I thought I'd try something similar--create something like an Ashby Diagram--to practice with the data.table package: test<-function() { library(data.table) library(ggplot2) set.seed(1) Here I define a simple table: dt<-data.table(xdata=runif(15),ydata=runif(15),level=rep(c("a","b","c"),each=5),key="level") And then I define the hull positions by level: hulls<-dt[,as.integer(chull(.SD)),by=level] setnames(hulls,"V1","hcol") So then my thought was to

Convex hull library [closed]

耗尽温柔 提交于 2019-11-30 05:36:49
I'm new to C# and is having a hard time computing the convex hull. Does C# have some sort of a math library for this? If not, then I guess I'll just have to implement my own. Govert MIConvexHull - https://designengrlab.github.io/MIConvexHull/ - is a high-performance convex hull implementation in C#, supporting higher-dimensional convex hulls too. LGPL license. Here's a 2D convex hull algorithm that I wrote using the Monotone Chain algorithm, a.k.a. Andrew's Algorithm. public static IListSource<Point> ComputeConvexHull(List<Point> points, bool sortInPlace = false) { if (!sortInPlace) points =

Convex hull ggplot using data.tables in R

旧城冷巷雨未停 提交于 2019-11-30 03:09:55
问题 I found a nice example of plotting convex hull shapes using ggplot with ddply here: Drawing outlines around multiple geom_point groups with ggplot I thought I'd try something similar--create something like an Ashby Diagram--to practice with the data.table package: test<-function() { library(data.table) library(ggplot2) set.seed(1) Here I define a simple table: dt<-data.table(xdata=runif(15),ydata=runif(15),level=rep(c("a","b","c"),each=5),key="level") And then I define the hull positions by

Convex hull library [closed]

孤人 提交于 2019-11-29 04:51:04
问题 I'm new to C# and is having a hard time computing the convex hull. Does C# have some sort of a math library for this? If not, then I guess I'll just have to implement my own. 回答1: MIConvexHull - https://designengrlab.github.io/MIConvexHull/ - is a high-performance convex hull implementation in C#, supporting higher-dimensional convex hulls too. LGPL license. 回答2: Here's a 2D convex hull algorithm that I wrote using the Monotone Chain algorithm, a.k.a. Andrew's Algorithm. public static

Convex hull of 4 points

假装没事ソ 提交于 2019-11-28 21:33:34
I would like an algorithm to calculate the convex hull of 4 2D points. I have looked at the algorithms for the generalized problem, but I wonder if there is a simple solution for 4 points. Take three of the points, and determine whether their triangle is clockwise or counterclockwise:: triangle_ABC= (A.y-B.y)*C.x + (B.x-A.x)*C.y + (A.x*B.y-B.x*A.y) For a right-handed coordinate system, this value will be positive if ABC is counterclockwise, negative for clockwise, and zero if they are collinear. But, the following will work just as well for a left-handed coordinate system, as the orientation

Convex Hull on Java Android Opencv 2.3

落爺英雄遲暮 提交于 2019-11-28 12:33:02
Please help me, I have a problem for Convex Hull on Android. I use Java and OpenCV 2.3 . Before I made it on Java, I made it on C++ with Visual Studio 2008. This code can running successfully on C++. Now, i want to convert it from C++ to Java on Android. And I found error like "force close" when i run it on SDK Android simulator. This is my code on C++: vector<vector<Point> > contours; vector<Vec4i> hierarchy; findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); drawing = Mat::zeros( canny_output.size(), CV_64F ); /// Find the convex hull object

Volume of convex hull with QHull from SciPy

陌路散爱 提交于 2019-11-28 09:13:04
I'm trying to get the volume of the convex hull of a set of points using the SciPy wrapper for QHull . According to the documentation of QHull , I should be passing the "FA" option to get the total surface area and volume. Here is what I get.. What am I doing wrong? > pts [(494.0, 95.0, 0.0), (494.0, 95.0, 1.0) ... (494.0, 100.0, 4.0), (494.0, 100.0, 5.0)] > hull = spatial.ConvexHull(pts, qhull_options="FA") > dir(hull) ['__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',