• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Incorrect SketchUp Calculations of XY Coordinates?

Scheduled Pinned Locked Moved Dynamic Components
sketchup
13 Posts 2 Posters 1.6k Views
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.
  • D Offline
    descoteaux
    last edited by 19 Apr 2012, 19:36

    I'm trying to calculate the coordinates of a circle's edge to position an object there based on a user selected angle. However, SketchUp's calculations aren't making any sense. For example:

    SketchUp (when put in the Position X and Y of a Dynamic Component):
    1080COS(RADIANS(100)) = 1079.499
    1080
    SIN(RADIANS(100)) = 32.894

    Google Calculator:
    1080cos(100(pi/180)) = -187.540032
    1080sin(100(pi/180)) = 1063.59237

    1080 = radius of circle in inches
    100 = example angle in degrees

    Math certainly isn't my strong point and I'm no master of dynamic components, but something strange is going on here. Any ideas?

    1 Reply Last reply Reply Quote 0
    • J Offline
      jeff hammond
      last edited by 19 Apr 2012, 19:47

      @descoteaux said:

      I'm trying to calculate the coordinates of a circle's edge to position an object there based on a user selected angle. However, SketchUp's calculations aren't making any sense. For example:

      SketchUp (when put in the Position X and Y of a Dynamic Component):
      1080COS(RADIANS(100)) = 1079.499
      1080
      SIN(RADIANS(100)) = 32.894

      Google Calculator:
      1080cos(100(pi/180)) = -187.540032
      1080sin(100(pi/180)) = 1063.59237

      Math certainly isn't my strong point and I'm no master of dynamic components, but something strange is going on here. Any ideas?

      it's the 2nd set of results that are wrong.. the dc results are correct..

      fwiw, you don't have to use radians in dynamic components as the default is degrees (opposite of excel etc.)

      =1080cos(100(pi()/180)) would work in the DC as well (and will give you the same result of 1079.499

      EDIT (or maybe you were using Radians as you couldn't get PI to work? if so, use pi() instead of just pi

      can you give a better explanation of what you're trying to do? (or an example .skp or 2d image of the requirements?)

      dotdotdot

      1 Reply Last reply Reply Quote 0
      • D Offline
        descoteaux
        last edited by 19 Apr 2012, 20:16

        Are you sure SketchUp is correct? Maybe I'm misunderstanding how it works.

        SketchUp calculates:

        1080cos(0(pi()/180)) = 1080 (correct)
        1080cos(180(pi()/180)) = 1078.377 (incorrect?)

        Shouldn't 180 degrees mean it's -1080? 180 degrees is opposite of 0 on the circle. Also I used the RADIANS() function because it looks cleaner. Thanks for your help.

        1 Reply Last reply Reply Quote 0
        • J Offline
          jeff hammond
          last edited by 19 Apr 2012, 20:29

          @descoteaux said:

          Are you sure SketchUp is correct? Maybe I'm misunderstanding how it works.

          SketchUp calculates:

          1080cos(0(pi()/180)) = 1080 (correct)
          1080cos(180(pi()/180)) = 1078.377 (incorrect?)

          Shouldn't 180 degrees mean it's -1080? 180 degrees is opposite of 0 on the circle. Thanks for your help.

          1080cos(100(pi/180))

          -- pi/180 = .017
          -- .017 * 100 = 1.7
          -- cos 1.7 = .999
          -- 1080 * .999 = 1079

          basically, it's going to work from the innermost parenthesis outward…

          5* (20*(10/5))

          would be 10 divided by 5 first (2)
          then 2 * 20 (40)
          then 5 * 40 =200

          (not going to the appropriate decimals etc in that example)

          edit--

          1080cos([b]0(pi()/180)) = 1080 (correct)
          1080cos(180(pi()/180)) = 1078.377 (incorrect?)[/b]

          in the first example, you're just doing 1080 * cos0 ….cos 0 = 1 so that one is obvious

          the second example is pi or 3.14 / 180 = 0.17 which is then multiplied by 180 …so you just arrive at pi again..

          cos (PI) = .998 which when multiplied by 1080 gives you 1078.38…

          you following?

          point is, i think you have the wrong formula for what you want to happen.. but we don't know what you want to happen so it's hard to give a solution 😉

          dotdotdot

          1 Reply Last reply Reply Quote 0
          • D Offline
            descoteaux
            last edited by 19 Apr 2012, 20:39

            @unknownuser said:

            1080cos(100(pi/180))

            -- pi/180 = .017
            -- .017 * 100 = 1.7
            -- cos 1.7 = .999
            -- 1080 * .999 = 1079

            basically, it's going to work from the innermost parenthesis outward…

            5* (20*(10/5))

            would be 10 divided by 5 first (2)
            then 2 * 20 (40)
            then 5 * 40 =200

            (not going to the appropriate decimals etc in that example)

            -- cos 1.7 = .999

            How did you calculate this? I believe it's -.0128844. EDIT: and cos(pi) = -1

            EDIT2: I'm mostly trying to prove that SketchUp is wrong and I'm wondering why.

            1 Reply Last reply Reply Quote 0
            • J Offline
              jeff hammond
              last edited by 19 Apr 2012, 20:53

              @descoteaux said:

              -- cos 1.7 = .999

              How did you calculate this? I believe it's -.0128844. EDIT: and cos(pi) = -1

              i'm working in DEGrees.. not RADians
              so is sketchup

              dotdotdot

              1 Reply Last reply Reply Quote 0
              • J Offline
                jeff hammond
                last edited by 19 Apr 2012, 21:24

                you might of seen this already but just in case:

                http://support.google.com/sketchup/bin/answer.py?hl=en&answer=115752#

                dc trig functions

                EDIT --hmm … some of that documentation is apparently wrong.. for instance:
                The SIN function returns the sine of the number in radians.

                SIN returns in degrees, not radians.. ❓

                if you click on the functions tab in the DC attributes panel then select SIN, it will describe the proper usage with sketchup..

                dotdotdot

                1 Reply Last reply Reply Quote 0
                • D Offline
                  descoteaux
                  last edited by 19 Apr 2012, 22:25

                  Thanks a lot for your help and patience.

                  If SketchUp returns cos() in degrees, shouldn't cos(pi()) = -57.2957795?

                  EDIT:
                  These are the calculators I'm comparing SketchUp against.

                  http://www.wolframalpha.com/input/?i=cos%28pi%29+in+degrees

                  https://www.google.com/#hl=en&safe=off&sclient=psy-ab&q=cos%28pi%29+in+degrees&oq=cos%28pi%29+in+degrees&aq=f&aqi=&aql=&gs_nf=1&gs_l=hp.3...303786.303786.1.304489.1.1.0.0.0.0.100.100.0j1.1.0.tB44GhnwbxM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=658b538c23bb4e18

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jeff hammond
                    last edited by 19 Apr 2012, 22:56

                    edit.. deleted mistake 😉

                    dotdotdot

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      jeff hammond
                      last edited by 19 Apr 2012, 23:02

                      @descoteaux said:

                      Thanks a lot for your help and patience.

                      If SketchUp returns cos() in degrees, shouldn't cos(pi()) = -57.2957795?

                      EDIT:
                      These are the calculators I'm comparing SketchUp against.

                      http://www.wolframalpha.com/input/?i=cos%28pi%29+in+degrees

                      https://www.google.com/#hl=en&safe=off&sclient=psy-ab&q=cos%28pi%29+in+degrees&oq=cos%28pi%29+in+degrees&aq=f&aqi=&aql=&gs_nf=1&gs_l=hp.3...303786.303786.1.304489.1.1.0.0.0.0.100.100.0j1.1.0.tB44GhnwbxM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=658b538c23bb4e18

                      if you enter cos(pi) in degrees into google, it will give you -57.2957795 degrees

                      what that's doing however is getting the cos(pi) in radians which is -1… then it's taking -1 and converting it to degrees…
                      (fwiw, 1 Radian = 57.29º)

                      that's not working in degrees.. to use, say, google calculator to get the same result as sketchup will give, you'd have to enter it as:

                      cos (pi degrees)

                      that will tell the calculator you'll be working in degrees.. the same way sketchup sees it by default

                      dotdotdot

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        descoteaux
                        last edited by 19 Apr 2012, 23:25

                        You finally got it through to me. Sorry for being so slow. It's extremely confusing having SketchUp calculate differently from other calculator defaults, not to mention it says nothing about calculating in degrees within the Component Attributes window. It's good to know nothing is actually broken with SketchUp though. I built my equation outside SketchUp so now I'll rebuild it inside.

                        Thanks a bunch for this conversation.

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jeff hammond
                          last edited by 20 Apr 2012, 04:06

                          @descoteaux said:

                          It's extremely confusing having SketchUp calculate differently from other calculator defaults, not to mention it says nothing about calculating in degrees within the Component Attributes window. It's good to know nothing is actually broken with SketchUp though. I built my equation outside SketchUp so now I'll rebuild it inside.

                          i imagine the DC developers faced the decision of radians vs degrees at some point.. (make it like every other spreadsheet out there or use degrees by default)

                          personally, i'm glad they went with degrees (and i also wish i could switch my spreadsheet app (Numbers) to degrees)

                          the reason being is that while radians are certainly better for creating simpler equations, they aren't very practical in real world use..
                          meaning-- any decent carpenter will know a 12:12 roof is 45º but i highly doubt a single one of them will know it's 0.785radians 😉

                          so while radians may make better formulas, degrees are much more easy to visualize and communicate with..

                          also, with my spreadsheets, i always wish for a 'carpenter mode' which would allow not only degrees by default, but also the ability to enter feet&inches (ala sketchup) as opposed to something like .3021 for 3 5/8"… so in this regard, i think using degrees alongside other architectural notation just makes sense..

                          one other point as to why sketchup might use degrees by default is that the tools such as rotate and protractor are in degrees as well..
                          (and imagine if those 2 tools were in radians instead… that would more likely than not cause an uproar 😉 )

                          @unknownuser said:

                          Thanks a bunch for this conversation.

                          no problem 😄

                          dotdotdot

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            descoteaux
                            last edited by 20 Apr 2012, 17:26

                            Your points are very fair and make sense, but man was it frustrating to figure out the hard way. 😳

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

                            Advertisement