Understanding ARItem: relativelocation and wordlocation

Jan 29, 2014 at 1:15 PM
Edited Jan 29, 2014 at 1:22 PM
Hello,

I'm trying to adapt something similar from this example:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202984(v=vs.105).aspx#BKMK_CreatingaSilverlightbasedAugmentedRealityApplication

where I could plot points around me, to something similar to the Bing Maps example (the one we can find in CodePlex) in which there are geolocation points.

The idea is when I plot something around me, besides the positioning the object related to my position P (x,y,z coordinates), I also save my georeference position G (Latitude, Longitude, Altitude).

I don't need to perform queries to Bing to retrieve relevant points.

My question is how should I save the positioning of a point P given a georeference position G? Besides the geoLocation property (where I save G), I saw that there are two properties in a ARItem: relativeLocation and wordLocation. Are they related somehow with what I'm trying to do for saving the information P?

How a person (in different location L) looking to the point georeference position G would see the point P that I plotted? Would the point appear exactly in G or would appear G plus a translation distance (according to where the point P was plotted)?

Many thanks for your attention,

Best regards,

Diogo
Coordinator
Jan 30, 2014 at 1:52 PM
I'm not entirely sure I follow what you're trying to do, but I will say that as long as the GeoLocation property of each item is set correctly, different observers at different locations will see each item correctly from their own vantage point. The augmented reality sample you link to is a very basic sample that defines it's own coordinate system and maps a virtual world to the real world. It does not take into account the actual location of objects in real-world space. GART uses Geo Coordinates (latitudes and longitudes) to automatically update its own virtual world space to match real world space in relation to where the user is standing.

The properties you mention on ARItem (RelativeLocation and WorldLocation) are used during the process of translating the virtual world to match the real world. WorldLocation is actually the final result of a calculation and it's used to map the item on the screen. It represents how many physical meters the object is away from the user on all three axis. This property is updated by a function that gets called whenever the user moves or tilts the device. The default implementation calculates this value by looking at where the user is standing and facing relative to the GeoLocation property of the item.

The function that is used to perform this calculation can be changed by setting the WorldCalculation property on the ARItem. The default value of the WorldCalculation property points to ARHelper.WorldFromGeoLocation - a static function on a helper class provided in the framework. There is another function on that same class called WorldFromRelativeLocation. As you might guess, this function calculates the WorldLocation for an item based on its RelativeLocation. With this function, RelativeLocation can be used to make an item appear always a certain distance away from the user no matter how far the user travels and no matter which direction the user looks. This feature can be used for HUD indicators, as an example.

It is also possible to provide your own function to do the calculation. If you want to do that, the signature for your method should be:

void MyCustomCalculation(ItemCalculationSettings settings, ARItem item)

The function receives an ItemCalculationSettings object which includes information about where the user is standing and the direction the user is facing. It also receives an ARItem. Your job is to look at where the item is in relation to the user and update the ARItem.WorldLocation property accordingly. Again, remember that WorldLocation will always be how far the item is from the user (in meters) on all three axis.

Hope that helps.
Dec 27, 2014 at 12:01 PM
hey guys!

jaredbienz, could you please show an example of how i can use the function that you suggest "void MyCustomCalculation(ItemCalculationSettings settings, ARItem item)
" to set an item appears always at a specific location based on my location, and even i change my position it would not change its position.

thanks!

Mario