sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Help needed with sin, cos & co...

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 264 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      hi there,
      so i stick in place with a math-problem:

      let us assume, i have

      two lines in a traingle defined with
      a1
      b1

      i can count the angle by

      
      @mainangle_l = Math;;atan(a1/b1).radians
      
      

      puts also gives me the right angle in the console (compared with the drawing = check)

      in the next step i have to calculate another triangle, same angle, but have values
      @mainangle_l
      c2

      BUT

      
      a2 = c2 * Math.sin(@mainangle_l))
      
      

      does not give me the right value for a2

      i tried different variations of the syntax, but no way to get it.

      obviously i define the Math-function in a wrong way. but in the api, i canot find examples.

      can anybody help fo rgeneral understanding of trigon. functions??

      thanx a lot!!!

      stan


      131215.jpg

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        The atan only works for a right-angled triangle.
        Because all 3 angles always add up to 180 degrees then:

        a2 = 180.degrees - (Math::atan(a1/b1))

        The angle a2 is in radians

        a2.radians

        gives it in degrees...

        I think you are jumbling up radians and degrees [again] πŸ˜’

        You can use other 'Sine Rule' formulas to find relationships between the enclosed angles and their opposing sides etc, when there is NO right-angle in the three angles - like:

        a/sinA = b/sinB = c/sinC = d
        Where ' d' is the diameter of the enclosing circle that passes through the 3 vertices
        substitute the desired lengths and the real sine values for the angles [using radians/degrees appropriately]...

        Rearrange the formulas to get any value... e.g.

        a = sinA*b/sinB

        or

        A = asin(a*sinB/b)

        Note too that the triangle's area is found using a*b*sinC/2
        or similar permutations of the values...

        TIG

        1 Reply Last reply Reply Quote 0
        • artmusicstudioA Offline
          artmusicstudio
          last edited by

          hi tig,
          great , good formulas for further studies.
          my code works now, by the way.

          just to precise my informations:

          i understand, that "atan" only works for right-angled triangles (one angle = 90 degrees),
          but: is the sum of angles not 180 degrees in all triangles?
          so the criterium is the right angle, not the sum of 180 Β°, right ?

          "jumbling up radians and degrees [again]" _:)
          yes, i still sometimes mix it somehow, but i try to keep all calculaction in skp-origin
          and only to display in the console in degrees. seems to work now! _ πŸ˜„

          so thanx again, all your tips makes my learning much easier!

          btw.: when a beta of the ruby is done and i made my tests, do you think, you and maybe somebody else , too, could check it on his machine?

          i have lots of rubys in my sketchup, so the compatibility here is ok, but who knows...!!!

          thanx stan

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement