<-- Previous || Up || Next -->

Volume Calc Function
Math Geometry Class

Public Function VolumeCalc( _
      Optional ByVal vShape As Variant _
    , Optional ByVal vBaseOrRadius As Variant _
    , Optional ByVal vHeightOrRadius2 As Variant _
    , Optional ByVal vDepthOrTop As Variant _
    ) As Variant

"Volume Calculator"
Calculate the Volume of some type of shape given certain other properties of the shape.

Examples:
    VolumeCalc("Cone", 2, 3) = 12.5663706143592
    VolumeCalc("Cone", 2, 4) = 16.7551608191456
    VolumeCalc("Cylinder", 2, 3) = 37.6991118430775
    VolumeCalc("Cylinder", 2, 4) = 50.2654824574367
    IsNull(VolumeCalc("Unknown", 2, 3, 4)) = True
See also:
    AreaCalc Function
    CubeCalc Function, et. al.
The meaning of each argument and the arguments that must be provided differ depending upon the shape whose area is to be calculated. See the details below which describe the properties that must be passed for each type of shape.
vShape: Name of the geometric shape whose volume is being calculated. Function returns Null if vShape is Null or cannot be fixed up to a String. The shape must be one of those detailed below. This name is case-insensitive, so for example, the names "CUBE" and "Cube" match each other.

vBaseOrRadius: The base or (first) radius of the shape. This value should be a number if it is known. If this value is not applicable to the shape, it should be missing or Null.
vHeightOrRadius2: The height or second radius of the shape. This value should be a number if it is known. If this value is not applicable to the shape, it should be missing or Null.
vDepthOrTop: The depth or top of the shape. This value should be a number if it is known. If this value is not applicable to the shape, it should be missing or Null.
Note: Function may return a complex number in the form of a string if the given dimensions are not consistent with the shape.

Cone: Requires Radius (of the base) in vBaseOrRadius. Requires Height in vHeightOrRadius2.

Cube: Requires Base in vBaseOrRadius.

Cylinder: Requires Radius in vBaseOrRadius. Requires Height in vHeightOrRadius2.

Pipe: Requires (smaller) Radius in vBaseOrRadius. Requires (larger) Radius in vHeightOrRadius2. Note: Radius #1 should be smaller than Radius #2.

Pyramid: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2. Requires Depth in vDepthOrTop.

Rectangular Solid: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2. Requires Depth in vDepthOrTop.

Sphere: Requires Radius in vBaseOrRadius.

Torus: Requires (smaller) Radius in vBaseOrRadius. Requires (larger) Radius in vHeightOrRadius2. Note: Radius #1 should be smaller than Radius #2.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.