09-30-2020 09:41 PM
I need a bouncing ball display in LabVIEW 2018 (the latest version my customer owns). I found this example: https://forums.ni.com/t5/LabVIEW/Particle-in-a-Box/td-p/3050969?profile.language=en and used it to cobble together the attached VI to show the motion I need. The only problem with the VI below is that I need the ball to be about 10 times bigger and the maximum size for a 'point' in a chart is as shown. I started trying a different method using a picture indicator and an array of images, but to show a single leg of the motion I would need to create somewhere around 256 images (1024, total). I made 1/4 of a leg's worth of images and created an array constant from the result as a test and found that this would be very time consuming and would take a long time to load. Any advice will be greatly appreciated.
Solved! Go to Solution.
09-30-2020 11:33 PM
I am sure there are better ways for whatever it is for. You really butchered my old code. There are some questionable code elements, such as the inner greedy loop.
You really need to size the drawing area to have the same scale in x and y.
@rkesmodel wrote:
I started trying a different method using a picture indicator and an array of images, but to show a single leg of the motion I would need to create somewhere around 256 images (1024, total). I made 1/4 of a leg's worth of images and created an array constant from the result as a test and found that this would be very time consuming and would take a long time to load. Any advice will be greatly appreciated.
I don't understand your description. A picture indicator is very simple and would require very few changes. All you need is an background picture where you would draw a new filled circle at a new position with every iteration. Of course you need to account for the ball size fo the bouncing.
10-01-2020 12:23 AM
Here's a quick rewrite of aa simplified version of my original VI, but using a picture indicator. Really not more complicated.
(Note that you can change the size of the picture before the run, but make sure it still fits the ball)
10-01-2020 05:25 PM
My apologies for the butchering, it was a quick and dirty attempt. The greedy inner loop was a mistake. I forgot the delay. Much appreciation for the picture solution. I think that is exactly what I need.
10-02-2020 09:04 AM - edited 10-02-2020 09:10 AM
@rkesmodel wrote:
My apologies for the butchering, it was a quick and dirty attempt. The greedy inner loop was a mistake. I forgot the delay. Much appreciation for the picture solution. I think that is exactly what I need.
😅
I accidantially made something looking like a coronavirus with samples = 32
when changing the plot to line, and increase samples = 128, you'll render a circle
10-02-2020 02:44 PM - edited 10-03-2020 06:34 AM
I still see a few questionable places. For example why would you convert from radians to degrees even though sine&cos expects radians? You are actually creating an alias frequency.
You could just do a few concentric circles, here's a draft (Of course you should tune the number of points per circle and number of circles separately, based on the radius. Note that the output tunnel is set to "concatenating").):