07-31-2015 11:28 AM - edited 07-31-2015 11:30 AM
hi there,
iam struggling with a little a problem here ... what iam trying to do is basically convert a xy graph to a boolean array (doesnt matter if it's graphic or tabular)
i've made a sketch in photoshop so it's easier to understand.
xy graph: boolean array:
any idea on how to do this?
kind regards,
oli
Solved! Go to Solution.
07-31-2015 11:40 AM - edited 07-31-2015 11:41 AM
Initializ a boolean array of the desired dimension and put it in a shift register. iterate over the xy pairs, map the coordinates to array indices, and use replace array subset to turn the LED ON at that index. Repeat for all points.
(If the points are relatively far apart and you need to create interpolation lines, you would add a little bit more code)
07-31-2015 12:59 PM
Here's my attempt.
Cheers
08-03-2015 08:53 AM - edited 08-03-2015 08:56 AM
thx guys!!
the answer was pretty obvious 🙂
but now iam stucked with the next problem .. i want to floodfill (set TRUE) everything within the shape. i've attached the code for the floodfill.
it works well with simple figures like a rectangle ... but not with bended figures. any idea why?
edit: i can't attach the vi ... it says "The attachment's FloodFill.vi content type (application/octet_stream) does not match its file extension and has been removed." 😞
08-03-2015 09:00 AM
@re-fuse wrote:
it works well with simple figures like a rectangle ... but not with bended figures. any idea why?
edit: i can't attach the vi ... it says "The attachment's FloodFill.vi content type (application/octet_stream) does not match its file extension and has been removed." 😞
1. You really should learn about Autoindexing Tunnels. They will simplify your loop since you will not need the Array Size or the Index Array.
2. The attaching the VI is a common issue on these forums. Put your code in a zip file and attach that as an alternative.
08-03-2015 12:06 PM
Zip the VI up or use a different browser. Is floodfill from a toolkit or your own code? Please attach that too.
08-10-2015 04:45 AM - edited 08-10-2015 04:47 AM
Thanks for the hint with autoindexing! Much easier indeed 🙂
To get an idea what the VI is all about:
I want to write waveguide structures (via electron beam) onto a wafer (semiconducting material) based on Bezier curves made in Inkscape.
These Curves are loaded into Labview, then there's a SubVI to calculate a graph (x/y pairs) based on this structure.
This array then needs to be transformed into a 2D boolean array to pass it on to the AD converter.
The Floodfill VI is from somebody on this forum and he wrote it for a 2D picture array of unsigned long integer ... so i had to convert it there and back.
Actually the Floodline VI works well with bended figures, but just small ones. It takes an awful while with big figures.
Therefore i'd prefer the scanline algorithm but it's much harder to implement in Labview.
There is actually no point 😄
They aren't integer cause i need the the x/y pairs to be pretty precise (about 5 decimal places).
You mean the "Iteration Points"? That comes from the user and defines how fine/sharp (decimal places) the calculation of the x/y graph will be.
08-12-2015 07:53 AM - edited 08-12-2015 08:09 AM
hi altenbach,
unfortunately iam still stucked ...
the x/y values of the figure have 5 decimal places but using your method (via replace array subset) it only takes the value before the decimal point.
so no matter how precise or how many xy pairs describes the figure in the xy graph the figure in the 2D boolean array stays the same.
got any idea on how to solve this problem?
the actual reason why i convert the xy graph to a 2D boolean array is to fill the figure with equidistant points.
i've found no method to do this in a xy graph.
here's the actual code + floodfill.zip:
many many thanks in advance!! you guys are so much help 🙂
08-12-2015 11:09 AM
08-12-2015 12:06 PM
you mean by multiplying the xy values by the amount of decimal places?
and then channeling them into the array subset function?