[RESOLVED] Cubic Area of a Cylinder
I have adapted <ABX's example from this thread, is the volume the same as the cubic area?
I am inputting metric numbers [ radius = 600mm, height = 1000mm]
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Height As Double
Dim Radius As Double
Dim Volume As Double
Try
Height = Double.Parse(Me.TextBox2.Text) / 1000
Radius = Double.Parse(Me.TextBox1.Text) / 1000
'Call the function to get the volume
Volume = VolumeOfCylinder(Radius, Height)
Volume = Math.Round(Volume, 3)
MsgBox("The Cubic Meters of the Cylinder is: " & Volume.ToString & "m3")
Catch ex As Exception
MsgBox("Enter Numbers only in the Textboxes")
End Try
End Sub
Public Function VolumeOfCylinder(ByVal Radius As Double, ByVal Height As Double) As Double
Return CDec((Math.PI * Radius ^ 2 * Height))
End Function
Answer = 1.131 m3
regards
toe
Re: Cubic Area of a Cylinder
I don't know what you mean by "is the volume the same as the cubic area?" Volume has units of distance*distance*distance = distance^3; cubic area would have units of (distance*distance)^3 = distance^6.... Maybe you meant cubic distance, in which case, yes, volume is the same as cubic distance.
The code you've given correctly converts input, which is assumed to be in mm's, into meters. It uses these to correctly find the volume of a cylinder with the given height and radius, where it outputs the answer in cubic meters.
Re: Cubic Area of a Cylinder
Sorry for being so confusing, i am trying to calculate the cubic meters of concrete to order to fill a house footing
regards
toe
Re: Cubic Area of a Cylinder
Okie. If your house footing is cylindrical, your routine does just fine. That is... a concrete block with width 1 meter, height 1 meter, and depth 1.131 meters (giving a volume of 1*1*1.131 m^3 = 1.131 cubic meters) will exactly fill your house footing of radius 600mm and height 1000mm, if the concrete were, say, liquid poured into the cylindrical mold. The only thing needed to prove this proposition is conservation of volume--effectively, the concrete doesn't expand or contract as it's poured, which seems very safe to assume. Is that clear?
If you wanted to be more technical, you could cut your original block of concrete into many very small blocks. You could then arrange the very small blocks into a cylindrical shape--the shape would have some jagged edges, but viewed from a ways away it would look very close to correct. Take the "limit" as the block size gets microscopically small, and you'll see that volume is preserved.
Re: Cubic Area of a Cylinder