06-21-2016 03:59 PM
Hi,
I am still in the process of learning LV. My current goal is having a circle drawn in picture control move while following the trajectory of a curved line. The catch is that I want that each time I run the VI a new different trajectory is programatically created for my circle.
I have no idea how to approach this problem.
In a similar VI, I had balls moving in linear fashion, so I simply added a speed component to the position component of my balls. I initially though to use the same design here, but I can't design a set of rules that would make the change in position result in a curved line trajectory. I think generating an array of the entire trajectory before each run would probably work better here, but I can't think of a function to do it either. Playing with basic trig resulted in sinusiodal or curved trajectory, but nothing really random aside from amplitude and period.
Ideally, I want as much variance in trajectory as possible (ex: a function that could give me S-shaped, U-shaped, spiral-shaped, loop-shaped, etc.) while still retaining control over certain parameters (lenght, position, max dX, etc.)
Anyone has an idea?
Thank you!
Solved! Go to Solution.
06-21-2016 05:22 PM
Time is a "thing" in LabVIEW. A Picture is an area of 2D space. A point in this space can be described in Cartesian coordinates as [X(t), Y(t)], or in polar coordinates as [R(t), Theta(t)].
To make a point move in 2D space, express its coordinates (either Cartesian or Polar) as a function of t. Change the function, you get a different curve. For example R(t) = 1, Theta(t) = 2*pi*t will give you a point moving in a circle of radius 1 and going around once/second (assuming t is in seconds), while R(t) = t/20, Theta(t) = 2*pi*t will give you a spiral.
Bob Schor
06-21-2016 05:38 PM
06-22-2016 09:33 PM - edited 06-22-2016 09:37 PM
Sounds like a Random Walker. Here's one I just made up. At every time point (0.1 sec in this example), it takes a unit step in some direction, with the direction changing by a random amount within some angular range. It can get pretty wild ...
Bob Schor