Help needed with sin, cos & co...
-
hi there,
so i stick in place with a math-problem:let us assume, i have
two lines in a traingle defined with
a1
b1i 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
c2BUT
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
-
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 radiansa2.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... -
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
Advertisement