Incorrect SketchUp Calculations of XY Coordinates?
-
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
1080SIN(RADIANS(100)) = 32.894Google Calculator:
1080cos(100(pi/180)) = -187.540032
1080sin(100(pi/180)) = 1063.592371080 = radius of circle in inches
100 = example angle in degreesMath certainly isn't my strong point and I'm no master of dynamic components, but something strange is going on here. Any ideas?
-
@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
1080SIN(RADIANS(100)) = 32.894Google Calculator:
1080cos(100(pi/180)) = -187.540032
1080sin(100(pi/180)) = 1063.59237Math 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?)
-
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.
-
@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 = 1079basically, 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
-
@unknownuser said:
1080cos(100(pi/180))
-- pi/180 = .017
-- .017 * 100 = 1.7
-- cos 1.7 = .999
-- 1080 * .999 = 1079basically, 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.
-
@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 -
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..
-
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. -
edit.. deleted mistake
-
@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.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
-
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.
-
@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.785radiansso 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
-
Your points are very fair and make sense, but man was it frustrating to figure out the hard way.
Advertisement