On 1 July 2013 13:40, zetah <ot...@hush.ai> wrote:

> Hi,
>
> I have set of points in a plane and make triplot:
>
>     subplot(121)
>     plot(points[:,0], points[:,1], 'o')
>     title('Set of points')
>     subplot(122)
>     triplot(points[:,0], points[:,1])
>     title('Triangulation')
>
> result: http://i.imgur.com/1LG4fxC.png
>
> Does anyone know how to extract just the lines describing each
> circumscribed circle in this example?
> Perhaps by using Delaunay from scipy.spatial?
>
> Just to inform you, I want to do this through triangulation and above
> example is trivial that can be solved differently, while real problem
> doesn't contain circles...
>

You need to use a matplotlib.tri.Triangulation (your use of triplot does
this for you behind the scenes anyway), something like:

import matplotlib.tri as mtri
triang = mtri.Triangulation(xpoints, ypoints)

Now triang.triangles is an array of integers of shape (?, 3) such that
triang.triangles[i,:] are the three indices of the points that comprise
triangle i.  You will need to use these to determine the information you
want.  The triplot example (
http://matplotlib.org/examples/pylab_examples/triplot_demo.html) does
something similar, identifying which triangles are within a particular
circle; I guess in your case a simple approach would be to test if the
distance from the centre of each triangle edge to your circle of interest
is below some threshold or not.

Incidentally, if you have a Triangulation object then subsequent calls to
functions like triplot can be of the form triplot(triang), which will be
faster than repeated calls to triplot(xpoints, ypoints) as in the latter
case a separate Delaunay triangulation needs to be performed for each
triplot call.

Ian
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to