Click to See Complete Forum and Search --> : Cos and the US Measuring System
toecutter
Mar 17th, 2010, 12:59 AM
Hi
In my app i apply cos to a metric variable like so
3.000 / 15 cos
is it the same for feet and inches, eg 3.000m = 9.84251 feet
9.84251 / 15 cos ?
or do i have to convert the degrees to some other type?
thanks
toe
jemidiah
Mar 17th, 2010, 01:20 AM
In programs, trig functions (cos, sin, tan, etc.) almost always take their arguments in radians. These are in some sense a more natural system mathematically than degrees. To convert from degrees to radians, multiply by pi/180. That is, if you have 100 degrees, that becomes 100*pi/180 = about 1.74 radians.
This has nothing to do with meters or feet or anything like that. Trig functions *require* degrees or radians as input, which are by definition not units of distance measurement. I'm not sure what you're doing when you say you "apply cos to a metric variable".... Could you be more specific?
toecutter
Mar 17th, 2010, 01:29 AM
What i am doing is getting a horizontal dimension of a roof rafter and applying the fall/angle to get the actual length.
Public Sub aActualSheetLength()
'cos of sheet length
Dim returnvalue As Double = 0
Const Pl As Double = 3.14159265358979
Dim lLength As Double = 0
lLength = Double.Parse(RoofM2.txtFirstDimension.Text) / 1000 'sheet length
Dim pPitch As Double = CDbl(Form1.ToolStriptxtPitch.Text) 'pitch
Dim tTrueSheetLength As Double = 0.0
RoofM2.txtActualSheetLength.Text = CStr(lLength / Math.Cos(pPitch * (Pl / 180)))
Dim aActualSheetLength As Double = Double.Parse(RoofM2.txtActualSheetLength.Text)
RoofM2.txtActualSheetLength.Text = Math.Round(aActualSheetLength, 3)
End Sub
Basically i just need to know if it is the same formula when using feet and inch's
Of course i need to convert feet and inch's to metric and do the above and then i will output the results back to feet and inch's
regards
toe
jemidiah
Mar 17th, 2010, 03:34 AM
If you convert all of your length measurements as you suggest you will, you'll be fine :). There's no need to touch anything inside the trig functions for unit conversions, or to change the general format of your equation at all so long as iLength changes its units. The only lines of your code that should have to change at all are iLength = Double.Parse... and (if you want to format your output slightly nicer for English units) the last line.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.