infuriating Cos problems

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default infuriating Cos problems

    Hi, I realise this has been asked alot in the past, and I've been searching
    around trying to figure out what is going wrong, but I'm beginning to lose
    my hair, so I hope someone can just prod me with a big stick and tell me
    what on earth I'm doing wrong here.

    Ok i dug out the old trig book, to try and work out an angle from the length
    of the adjacent and hypotenuse lines from a right angle triangle.

    which reads:

    cosine x = hypotenuse / adjacent

    so in their example

    cosine x = 9 / 11 = 0.81818

    no probs there.

    I then want to turn that in to degrees sooooo after searching around the net
    and google came up with:

    put cos(0.818181818) * (180 / pi())

    --39.164573749

    unfortunatly the book says I should be getting 35.1 so as you can see I'm 4
    degrees out! Have I got completely the wrong end of the stick here (should I
    start arguing with the book?).

    I really wish I had managed to stay awake in math at school, hope someone
    out there can help me :-)

    thanks
    James


    James Guest

  2. Similar Questions and Discussions

    1. Installation problems are infuriating!
      I am so frustrated and mad that I am not able to install flash player and i'm sure a lot of you guys are as well! I don't know why anybody from...
    2. Problems with %
      Anyone ever had a problem with passing the % sign in their code, and having the server go crazy and start producing too many threads?
    3. problems with preLoadNetThing and fileName (was problems with preLoadNetThing and importFileInto)
      You don't want to leave the QT member in your cast when you publish your movie - it's not really there, it's linked. When you run the movie it will...
    4. xkb problems (still)
      Solaris 8 - latest patches. xkb is mostly better than it's been, but I still can't figure out how to get repeat to work, including by changing...
  3. #2

    Default Re: infuriating Cos problems

    You're looking at the wrong thing. The cosine of the angle is
    adjacent/hypotenuse. So the cosine of the angle is 0.81818. The angle
    itself isn't 0.81818. To find the angle you need to use acos, not cos. I
    just did it on my calculator [acos(0.81818)] and got 35.0968 degrees.

    HTH,
    Matt

    James <james@twisted-pixel.com> wrote in message
    news:br5fqu$acl$1@forums.macromedia.com...
    > Hi, I realise this has been asked alot in the past, and I've been
    searching
    > around trying to figure out what is going wrong, but I'm beginning to lose
    > my hair, so I hope someone can just prod me with a big stick and tell me
    > what on earth I'm doing wrong here.
    >
    > Ok i dug out the old trig book, to try and work out an angle from the
    length
    > of the adjacent and hypotenuse lines from a right angle triangle.
    >
    > which reads:
    >
    > cosine x = hypotenuse / adjacent
    >
    > so in their example
    >
    > cosine x = 9 / 11 = 0.81818
    >
    > no probs there.
    >
    > I then want to turn that in to degrees sooooo after searching around the
    net
    > and google came up with:
    >
    > put cos(0.818181818) * (180 / pi())
    >
    > --39.164573749
    >
    > unfortunatly the book says I should be getting 35.1 so as you can see I'm
    4
    > degrees out! Have I got completely the wrong end of the stick here (should
    I
    > start arguing with the book?).
    >
    > I really wish I had managed to stay awake in math at school, hope someone
    > out there can help me :-)
    >
    > thanks
    > James
    >
    >

    MGaston Guest

  4. #3

    Default Re: infuriating Cos problems

    ok cheers but that then gives me the prblem that the arc cos fuction doesnt
    exist within director, and i've just messed around with an example script
    that is supposed to emulate it, but i'm not having ne luck so far. I'll keep
    searching, but if you have a lingo example of this working i would be
    eteinally grateful :-)

    james


    "MGaston" <mattgaston@interfold.com> wrote in message
    news:br5na9$jq4$1@forums.macromedia.com...
    > You're looking at the wrong thing. The cosine of the angle is
    > adjacent/hypotenuse. So the cosine of the angle is 0.81818. The angle
    > itself isn't 0.81818. To find the angle you need to use acos, not cos. I
    > just did it on my calculator [acos(0.81818)] and got 35.0968 degrees.
    >
    > HTH,
    > Matt
    >
    > James <james@twisted-pixel.com> wrote in message
    > news:br5fqu$acl$1@forums.macromedia.com...
    > > Hi, I realise this has been asked alot in the past, and I've been
    > searching
    > > around trying to figure out what is going wrong, but I'm beginning to
    lose
    > > my hair, so I hope someone can just prod me with a big stick and tell me
    > > what on earth I'm doing wrong here.
    > >
    > > Ok i dug out the old trig book, to try and work out an angle from the
    > length
    > > of the adjacent and hypotenuse lines from a right angle triangle.
    > >
    > > which reads:
    > >
    > > cosine x = hypotenuse / adjacent
    > >
    > > so in their example
    > >
    > > cosine x = 9 / 11 = 0.81818
    > >
    > > no probs there.
    > >
    > > I then want to turn that in to degrees sooooo after searching around the
    > net
    > > and google came up with:
    > >
    > > put cos(0.818181818) * (180 / pi())
    > >
    > > --39.164573749
    > >
    > > unfortunatly the book says I should be getting 35.1 so as you can see
    I'm
    > 4
    > > degrees out! Have I got completely the wrong end of the stick here
    (should
    > I
    > > start arguing with the book?).
    > >
    > > I really wish I had managed to stay awake in math at school, hope
    someone
    > > out there can help me :-)
    > >
    > > thanks
    > > James
    > >
    > >
    >
    >

    James Guest

  5. #4

    Default Re: infuriating Cos problems

    and ya never know it might help my typos too ;-)

    "James" <james@twisted-pixel.com> wrote in message
    news:br5oco$l4i$1@forums.macromedia.com...
    > ok cheers but that then gives me the prblem that the arc cos fuction
    doesnt
    > exist within director, and i've just messed around with an example script
    > that is supposed to emulate it, but i'm not having ne luck so far. I'll
    keep
    > searching, but if you have a lingo example of this working i would be
    > eteinally grateful :-)
    >
    > james
    >
    >
    > "MGaston" <mattgaston@interfold.com> wrote in message
    > news:br5na9$jq4$1@forums.macromedia.com...
    > > You're looking at the wrong thing. The cosine of the angle is
    > > adjacent/hypotenuse. So the cosine of the angle is 0.81818. The angle
    > > itself isn't 0.81818. To find the angle you need to use acos, not cos.
    I
    > > just did it on my calculator [acos(0.81818)] and got 35.0968 degrees.
    > >
    > > HTH,
    > > Matt
    > >
    > > James <james@twisted-pixel.com> wrote in message
    > > news:br5fqu$acl$1@forums.macromedia.com...
    > > > Hi, I realise this has been asked alot in the past, and I've been
    > > searching
    > > > around trying to figure out what is going wrong, but I'm beginning to
    > lose
    > > > my hair, so I hope someone can just prod me with a big stick and tell
    me
    > > > what on earth I'm doing wrong here.
    > > >
    > > > Ok i dug out the old trig book, to try and work out an angle from the
    > > length
    > > > of the adjacent and hypotenuse lines from a right angle triangle.
    > > >
    > > > which reads:
    > > >
    > > > cosine x = hypotenuse / adjacent
    > > >
    > > > so in their example
    > > >
    > > > cosine x = 9 / 11 = 0.81818
    > > >
    > > > no probs there.
    > > >
    > > > I then want to turn that in to degrees sooooo after searching around
    the
    > > net
    > > > and google came up with:
    > > >
    > > > put cos(0.818181818) * (180 / pi())
    > > >
    > > > --39.164573749
    > > >
    > > > unfortunatly the book says I should be getting 35.1 so as you can see
    > I'm
    > > 4
    > > > degrees out! Have I got completely the wrong end of the stick here
    > (should
    > > I
    > > > start arguing with the book?).
    > > >
    > > > I really wish I had managed to stay awake in math at school, hope
    > someone
    > > > out there can help me :-)
    > > >
    > > > thanks
    > > > James
    > > >
    > > >
    > >
    > >
    >
    >

    James Guest

  6. #5

    Default Re: infuriating Cos problems

    by the way please ignore me typing in the adj and hyp the wrong way around,
    it was a typo as opposed to what I was actually doing *ehm* sorry about that
    I am using adjacent/hypotenuse and getting 0.81818 I just can't resolve it
    from there.

    "James" <james@twisted-pixel.com> wrote in message
    news:br5ogs$l7g$1@forums.macromedia.com...
    > and ya never know it might help my typos too ;-)
    >
    > "James" <james@twisted-pixel.com> wrote in message
    > news:br5oco$l4i$1@forums.macromedia.com...
    > > ok cheers but that then gives me the prblem that the arc cos fuction
    > doesnt
    > > exist within director, and i've just messed around with an example
    script
    > > that is supposed to emulate it, but i'm not having ne luck so far. I'll
    > keep
    > > searching, but if you have a lingo example of this working i would be
    > > eteinally grateful :-)
    > >
    > > james
    > >
    > >
    > > "MGaston" <mattgaston@interfold.com> wrote in message
    > > news:br5na9$jq4$1@forums.macromedia.com...
    > > > You're looking at the wrong thing. The cosine of the angle is
    > > > adjacent/hypotenuse. So the cosine of the angle is 0.81818. The
    angle
    > > > itself isn't 0.81818. To find the angle you need to use acos, not
    cos.
    > I
    > > > just did it on my calculator [acos(0.81818)] and got 35.0968 degrees.
    > > >
    > > > HTH,
    > > > Matt
    > > >
    > > > James <james@twisted-pixel.com> wrote in message
    > > > news:br5fqu$acl$1@forums.macromedia.com...
    > > > > Hi, I realise this has been asked alot in the past, and I've been
    > > > searching
    > > > > around trying to figure out what is going wrong, but I'm beginning
    to
    > > lose
    > > > > my hair, so I hope someone can just prod me with a big stick and
    tell
    > me
    > > > > what on earth I'm doing wrong here.
    > > > >
    > > > > Ok i dug out the old trig book, to try and work out an angle from
    the
    > > > length
    > > > > of the adjacent and hypotenuse lines from a right angle triangle.
    > > > >
    > > > > which reads:
    > > > >
    > > > > cosine x = hypotenuse / adjacent
    > > > >
    > > > > so in their example
    > > > >
    > > > > cosine x = 9 / 11 = 0.81818
    > > > >
    > > > > no probs there.
    > > > >
    > > > > I then want to turn that in to degrees sooooo after searching around
    > the
    > > > net
    > > > > and google came up with:
    > > > >
    > > > > put cos(0.818181818) * (180 / pi())
    > > > >
    > > > > --39.164573749
    > > > >
    > > > > unfortunatly the book says I should be getting 35.1 so as you can
    see
    > > I'm
    > > > 4
    > > > > degrees out! Have I got completely the wrong end of the stick here
    > > (should
    > > > I
    > > > > start arguing with the book?).
    > > > >
    > > > > I really wish I had managed to stay awake in math at school, hope
    > > someone
    > > > > out there can help me :-)
    > > > >
    > > > > thanks
    > > > > James
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    James Guest

  7. #6

    Default Re: infuriating Cos problems

    In a movie script:-

    on acos(x)
    if abs(x)>1 then
    alert("acos() does not support complex numbers.")
    return void
    end if
    return atan(sqrt(1-x*x), x)*180/pi
    end acos

    If you're going to use acos() a lot and you know you are not going to pass it a
    number outside [-1, 1] then take out the "if abs(x)>1...end if" part and set a
    global to the value of 180/pi and use that instead of calculating 180/pi every
    time.

    Andrew

    Andrew Morton Guest

  8. #7

    Default Re: infuriating Cos problems

    thanks Andrew it works beautifully :-D, have a pint on me (_)>

    James

    "Andrew Morton" <akm@in-press.co.uk.invalid> wrote in message
    news:br6oke$2o2$2@forums.macromedia.com...
    > In a movie script:-
    >
    > on acos(x)
    > if abs(x)>1 then
    > alert("acos() does not support complex numbers.")
    > return void
    > end if
    > return atan(sqrt(1-x*x), x)*180/pi
    > end acos
    >
    > If you're going to use acos() a lot and you know you are not going to pass
    it a
    > number outside [-1, 1] then take out the "if abs(x)>1...end if" part and
    set a
    > global to the value of 180/pi and use that instead of calculating 180/pi
    every
    > time.
    >
    > Andrew
    >

    James Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139