Start a new topic

## Calculating Scalling Factor

Calculating Scalling Factor

I'd like to know how to do this as well.  It seems the Wikitude app itself is doing something similar (besides clustering POI markers).

Is there an option in 1.2 to disable scaling based on distance away?

I am using the SDK example project and adding markers at 1 Scalling Unit.  I want all markers to be the same size regardless of distance away from their original location.  So I am using Scale property on AR.drawable2D  to increase the size of the marker when you are far away and increase it when you are closer.    I am using the following function to work out the scale size so that I can rescale the marker on a location change and force the marker to all appear at the same size regardless of distance.  However I am strugally to get the return value of this correct.  Could you please help me find this scale value?

function calculateScaleFactor(location)
{
distance = location.distanceToUser();
if (distance < 10) distance = 10;
if (distance <= 200000) distance = 200000;

orignalScallingFactor = Math.pow(distance,0.2);
ScaleFactor = 7.25 / orignalScallingFactor;

return ScaleFactor;
}

I am looping though each marker as below.  Each marker is contained in a JSONObject and I add the AR.GeoLocation to the location property.

AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){

for(i = 0; i < jsonObject.length; i++)
{

jsonObject.poiObj.drawables.cam.scaling = calculateScaleFactor(jsonObject.location);

}

}

Any help would be most appreciated

Patrick 