facebook

var cheeseburger="2";

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #342000 Reply

    SKnoxmn
    Member

    I was thinking that I don’t need to create more variables (yet), I was wondering if something along these lines would work to produce the same result.

    function onSuccess(position)
    {
    $(‘#m1-Learning-textField1’).val(position.coords.latitude);
    $(‘#m1-Learning-textField2’).val(position.coords.longitude);
    $(‘#m1-Learning-textField3’).val(Math.round(position.coords.altitude));
    $(‘#m1-Learning-textField7’).val((Math.COS(RADIANS(position.coords.latitude))*(1037.5646)));
    }

    as it turns out, in the Milestone TC it gives me another cheeseburger…

    I think this might have something to do with a “Float” being my lat / lon is a decimal.

    SKnox

    p.s. Notify me when a reply is posted isn’t notifying me when replies are posted.

    #342018 Reply

    support-michael
    Keymaster

    >p.s. Notify me when a reply is posted isn’t notifying me when replies are posted.

    Did you enable the topic option be notified to response of your post? If yes, check your spam filter to ensure that replies are not being siphoned off to oblivion.

    Also, does Math.COS() work for you? JavaScript is case sensitive and the function should be Math.cos().

    Lastly, the cheeseburger issue has been resolved and will be in the next milestone, hopefully next week if all goes well.

    #342025 Reply

    SKnoxmn
    Member

    I was looking at the trig functions and I think all of them said Math.COS() and No, that wasn’t working for me. So I think I’ll do it your way.

    I was able to insert the variables but I think they are local. and Im not sure but I think the Math is going to have to be a global function.

    I was trying to fire off the math from the (position.coords.latitude) and all I managed to do was screw up the entire function. So I took it out of the js.

    Pretty much how I’m learning is trying things, running it, get the results, change it again, and again.

    Finally, yeah I did set it to notify, I’ll check my spam filters

    SKnox
    Keep the Cheesebuger, it lets me know I screwed something up.

    #342026 Reply

    SKnoxmn
    Member

    function findPosition()
    {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }
    function onSuccess(position)

    {
    var lat = position.coords.latitude
    var lon = position.coords.longitude
    var alt = position.coords.altitude
    $(‘#m1-Learning-latTxt’).text(lat.toFixed(8));
    $(‘#m1-Learning-lonTxt’).text(lon.toFixed(8));
    $(‘#m1-Learning-altTxt’).text(Math.round(alt));
    }

    What Im trying to get is:
    $(‘#m1-Learning-hVelTxt).text(=COS(RADIANS(lat))*(1037.5646)toFixed(3));

    SKnox

    #342031 Reply

    Stu Wade
    Member

    Math.cos(lat*Math.PI/180)*1037.5646

    180 degrees = PI radians

    #342049 Reply

    SKnoxmn
    Member

    Stu,

    Again you rock! I appreciate all of the direction on this. I would like to know if you have some suggestions as to where I can read up on some of these things like the Math.PI that you added. It seems that the Math.something needs to be in everything at every step when doing any Math function.

    I’ll post a new topic, asking yet another question about some return.this but Im looking to get a better understanding rather than someone posting code for me.

    But I don’t want anyone to think that I don’t appreciate everything that you guys have shown me.

    That goes for “Doc Oct”, Wayne, 1TC and of course “UK” Stu.

    SKnox

    #342061 Reply

    Stu Wade
    Member

    Have a look at

    http://www.w3schools.com/jsref/jsref_obj_math.asp

    Although w3schools have been ridiculed in the past for ‘schoolboy errors’ latterly I have found them to be a largely reliable source

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: var cheeseburger="2";

You must be logged in to post in the forum log in