A dynamic array of class "landmark", inside another single class "landmarks"
- by pinnacler
I'm working on a robot localization simulator and I created a class called "landmark".
The end result is going to be a robot that is always centered and always faces the top of the screen. As it turns, the birds eye view map will rotate around the robot. To accomplish this, I'm assuming I can rotate one class and have all elements inside rotate as well.
So, the landmark class has properties x,y, label, and radius. This is suppose to simulate a tree location in a forest.
To test everything, I need "forest data," and I wrote a script to generate 100 trees in a 100m x 100m area. The script automatically generates values within an acceptable range for x,y, radius. The generated data is stored in an object called tempForest and is 100x3.
Ideally, I want to create a class called "landmarks" (plural) that has 100 landmark instances inside.
How would I instantiate 100 instances of landmark in one instance of landmarks using that randomly generated data?
Ideally, I'd just type treeBeacons = landmarks(); and it would randomly populate 100 (user definable, set in config file) instances with x, y, radius data.
I'm not sure how to deal with a dynamic array of class "Landmark", inside another single class "landmarks."
Any ideas?