convex

Alpha shapes in 3D

一个人想着一个人 提交于 2021-01-20 19:55:35
问题 Is there an "alpha shape" function in 3 dimensions in python, other than the CGAL python bindings? Alternatively, is there a way to extend the example below into 3D? 2D example: draw a smooth polygon around data points in a scatter plot, in matplotlib I'm currently calculating volume using this ConvexHull example, but for my purposes the volumes are inflated due to the "convex" constraint. Thanks, 回答1: I wrote some code for finding alpha shape surface. I hope this helps. from scipy.spatial

Alpha shapes in 3D

北城余情 提交于 2021-01-20 19:52:44
问题 Is there an "alpha shape" function in 3 dimensions in python, other than the CGAL python bindings? Alternatively, is there a way to extend the example below into 3D? 2D example: draw a smooth polygon around data points in a scatter plot, in matplotlib I'm currently calculating volume using this ConvexHull example, but for my purposes the volumes are inflated due to the "convex" constraint. Thanks, 回答1: I wrote some code for finding alpha shape surface. I hope this helps. from scipy.spatial

Libgdx polygon triangulation

你。 提交于 2020-01-23 08:05:13
问题 Ok, so I have a polygon (simple but concave) that I'm trying to cut into triangles to make it collide with an other polygon. I knew my polygone was concave, so i decided to use LibGDX EarClippingTriangulator to manage to cut it into triangles. So, with this code, I get my triangles vertices : public void triangulate() { Vector<float[]> trianglesVertices = new Vector<float[]>(); ShortArray pointsCoords = new ShortArray(); EarClippingTriangulator triangulator = new EarClippingTriangulator(); //

Finding largest subset of points forming a convex polygon

匆匆过客 提交于 2019-12-20 11:55:55
问题 I'm looking for an algorithm for finding largest subset of points (by largest i mean in number) that form a convex polygon from the given set of point. I think this might be solvable using DP but i'm not sure. Is it possible to do this in O(n^3) ? Actually i just need the size of the largest subset, so it doesn't need to have unique solution Edit : just to keep this simple, Given input : a set of points in 2D Desired output : maximum number of points that form a convex polygon, like in the

Maximizing linear objective subject to quadratic constraints

冷暖自知 提交于 2019-12-20 04:37:05
问题 I have a programming formulation from a paper and want to give it a tool for solving specific problems. The authors stated it as an linear programming (LP) instance, however I am not sure. Formulation is somewhat like as follows: max x1+x2+x3... s.t. x1.x3+x4.x5 <= 10 x2.x5+x3.x7+x1.x9 <=10 ... I tried to program it through cplexqcp function (due to quadratic constraints, however constraints do not include any x_i^2 variable). However I receive CPLEX Error 5002: Q in %s is not positive semi

Julia error using convex package with diagind function

那年仲夏 提交于 2019-12-13 03:09:40
问题 I'm trying to solve the problem d = 0.5 * ||X - \Sigma||_{Frobenius Norm} + 0.01 * ||XX||_{1}, where X is a symmetric positive definite matrix, and all the diagnoal element should be 1. XX is same with X except the diagonal matrix is 0. \Sigma is known, I want minimum d with X. My code is as following: using Convex m = 5; A = randn(m, m); x = Semidefinite(5); xx=x; xx[diagind(xx)].=0; obj=vecnorm(A-x,2)+sumabs(xx)*0.01; pro= minimize(obj, [x >= 0]); pro.constraints+=[x[diagind(x)].=1]; solve!

Finding largest subset of points forming a convex polygon

邮差的信 提交于 2019-12-03 02:01:29
I'm looking for an algorithm for finding largest subset of points (by largest i mean in number) that form a convex polygon from the given set of point. I think this might be solvable using DP but i'm not sure. Is it possible to do this in O(n^3) ? Actually i just need the size of the largest subset, so it doesn't need to have unique solution Edit : just to keep this simple, Given input : a set of points in 2D Desired output : maximum number of points that form a convex polygon, like in the example the output is 5 (ABHCD is one of the possible convex polygon) There's a similar problem spoj.com

Maximizing linear objective subject to quadratic constraints

社会主义新天地 提交于 2019-12-02 04:27:41
I have a programming formulation from a paper and want to give it a tool for solving specific problems. The authors stated it as an linear programming (LP) instance, however I am not sure. Formulation is somewhat like as follows: max x1+x2+x3... s.t. x1.x3+x4.x5 <= 10 x2.x5+x3.x7+x1.x9 <=10 ... I tried to program it through cplexqcp function (due to quadratic constraints, however constraints do not include any x_i^2 variable). However I receive CPLEX Error 5002: Q in %s is not positive semi-definite error . Is this an instance of non-linear programming with non-convex constraints? Can I solve