LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bouncing Large Ball in LabVIEW 2018

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(1,837 Views)

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.

0 Kudos
Message 2 of 6
(1,800 Views)
Solution
Accepted by topic author rkesmodel

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)

 

altenbach_0-1601529726844.png

 

 

 

Message 3 of 6
(1,785 Views)

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. 

0 Kudos
Message 4 of 6
(1,727 Views)



@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

2020-10-02 160010_bouncy-ball.jpg

 

when changing the plot to line, and increase samples = 128, you'll render a circle

0 Kudos
Message 5 of 6
(1,668 Views)

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").):

 

altenbach_0-1601667785688.png

 

Message 6 of 6
(1,651 Views)