08-02-2011 09:03 AM
Hi, I was wondering how would one create a triangle shape from a 2D array? For example, if I wanted to create a 'white' 2x2 square, I would initialise a 2x2 square with values of 255. But I don't see how you could represent a diagonal line in a 2D array, such as in the case of a triangle. Note : I'm not looking to do this in IMAQ or using any picture functions, just in array format.
Solved! Go to Solution.
08-02-2011 10:43 AM
Doing some bitmap graphics, are we?
Isosceles, scalene, right, or equilateral? Filled in, or only the border?
Obviously, you can't "draw" a triangle with a 2x2 array. You'd need to draw on a "diagonal", similar to the way you draw diagonal lines in the VI Icon Editor. You can think of the Icon Editor as a 2D array, and you can see how the individual array "elements" are filled to draw the line. If you're going to limit it equilateral then it's much simpler since you're always drawing on the actual diagonal for 2 of the sides.
08-03-2011 06:13 AM
Nah just some code testing on simple patterns but it doesnt like IMAQ etc. Yeah I dont really want to draw a triangle just a diagonal line from one corner of a 1000x100 array to the opposite top corner, doesnt seem possible to do this without creating a jagged edge along the diagonal instead of a straight line.
08-03-2011 06:48 AM
Hello,
every Line is jagged on any PC using Pxeils to diplay it. It is called Aliasing and you can see it an any image, if you look carefully (with no cleartype etc activated, just look at the / in your Browsers Adressline).
What you can do is to smooth edges (Look for Anti-Aliasing)
08-03-2011 09:21 AM
yeah I was wondering if there was any inbuilt labview function for this, nevermind, thanks anyway.
08-03-2011 05:44 PM
This is the best I could come up with. lol