09-02-2009 08:29 AM
I'm slowly getting to grips with labview, mathscripts and so on.
My problem is i have a 2D array of real numbers, which correspond to points spread out in X and Y (see image)
I would like to calculate the associated Voronoi Tessilation that corresponds to these points. Now it says this can be done in a mathscript window, along the lines of :
(http://zone.ni.com/reference/en-XX/help/371361D-01/lvtextmath/msfunc_voronoi/)
voronoi(a, b)
[x, y] = voronoi(a, b)
Generates the Voronoi diagram of specified points in a plane. If you do not request an output, this function plots the Voronoi diagram in conjunction with the original points in the current plot window.
Name | Description |
a | Specifies a vector of x-coordinates of points in the plane. |
b | Specifies a vector of y-coordinates of points in the plane. length(b) must equal length(a). |
Name | Description |
x | Returns a 2-by-n matrix of real numbers. n is the number of x-coordinates of Voronoi points. LabVIEW defines the edges of the Voronoi diagram by all lines from (x(k), y(k)) to (x(k + 1), y(k + 1)). |
y | Returns a 2-by-n matrix of real numbers. n is the number of y-coordinates of Voronoi points. |
A = rand(12, 1);
B = rand(12, 1);
voronoi(A, B);
-----
I thought i had wired up the mathscripts window correctly, to at least generate the 2-by-n matrix it should generate but no luck.
Can anyone help, please. It maybe (an most likely) that i'm doing something stupid in the mathscript window, and not putting it in the correct syntax.
The same also goes for dong Delauney triangulation which i can't also get to work properly.
----
Any help would be most welcome and certainly greatly received.
Thanks.
Jon.
09-02-2009 01:19 PM
09-03-2009 02:35 PM
Thanks for this.
As you said, it all looked ok. I was using a mathscript node, and not a mathscript window and i wondered if i'd written something stupid in the mathscript node.
I repeated what i had done, admittedly in v8.6, and everything seems to be working spot on. (see attached VI as example of generating Voronoi diagram from an array of random number).
I've overlayed it onto a blank image, but doing similar onto an image of points isn't too hard.
Thanks for the help in any case.
hopefully this Vi might be of use to someone else.
Chhers,
jon.