Ask Your Question
1

How does one use the qhull optional package?

asked 2013-06-18 14:22:00 -0500

torrho gravatar image

updated 2015-01-14 07:25:05 -0500

FrédéricC gravatar image

Has anyone used the qhull optional package? I'm not so sure on how to use it. Is there a tutorial on this?

edit retag flag offensive close merge delete

Comments

Sorry. Deleted my post. I misread your question about installing, whereas you asked about *using*.

ppurka gravatar imageppurka ( 2013-06-19 04:44:10 -0500 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2013-06-19 06:21:48 -0500

tmonteil gravatar image

updated 2015-01-22 09:58:25 -0500

First, you can install it by typing:

$ sage -i qhull

Then, i do not think that there in an interface with qhull inside Sage. So, you have to use it from a shell, as if you installed it on your OS:

$ sage -sh

To get help and examples, just type:

(sage-sh) user@machine:~$ qhull

And then, you can try one of the examples:

(sage-sh) user@machine:~$ rbox y 1000 W0 | qhull

Convex hull of 1004 points in 3-d:

  Number of vertices: 4
  Number of facets: 4

Statistics for: rbox y 1000 W0 | qhull

  Number of points processed: 4
  Number of hyperplanes created: 5
  Number of distance tests for qhull: 11001
  CPU seconds to compute hull (after input):  0

To get informations about rbox, just type:

(sage-sh) user@machine:~$ rbox

EDIT : qhull is shipped with scipy (and also with matplotlib from version 1.4), so you could benefit from their Cython interface to use qhull features within Sage (Delaunay triangulation, Voronoi tesselation, convex hull), see this page.

edit flag offensive delete link more

Comments

I have no idea why I didn't think of that. I was going nuts over this. Thanks!

torrho gravatar imagetorrho ( 2013-06-19 11:37:49 -0500 )edit
0

answered 2017-01-26 12:21:42 -0500

pang gravatar image

I'll expand on tmonteil's last comment: there is an interface to qhull included on scipy!

For example, this code computes the hull of a random set of 2D points:

import numpy as np
from scipy.spatial import ConvexHull
points = np.random.rand(30, 2)   # 30 random points in 2-D
hull = ConvexHull(points)

and this code plots it:

my_plot = point2d(points)
for simplex in hull.simplices:
    my_plot += line2d([points[v,:] for v in simplex])
my_plot

While this code computes the hull of a random set of 3D points:

import numpy as np
from scipy.spatial import ConvexHull
points = np.random.rand(30, 3)   # 30 random points in 3-D
hull = ConvexHull(points)

and this code plots it:

my_plot = point3d(points)
for simplex in hull.simplices:
    my_plot += line3d([points[simplex[-1],:]]+[points[v,:] for v in simplex])
my_plot
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-18 14:22:00 -0500

Seen: 446 times

Last updated: Jan 26