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

Area Calc Function
Math Geometry Class

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

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

Examples:
    AreaCalc("Circle", 1) = 3.14159265358979
    AreaCalc("Circle", 2) = 12.5663706143592
    AreaCalc("Cone", 2, 3) = 22.654346798278
    IsNull(AreaCalc("Unknown", 2, 3, 4)) = True
See also:
    VolumeCalc Function
    SquareCalc 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 area 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 "CIRCLE" and "Circle" 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.

Circle: Requires Radius in vBaseOrRadius.

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.

Ellipse: Requires Radius #1 in vBaseOrRadius. Requires Radius #2 in vHeightOrRadius2.

Parallelogram: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2.

Rectangle: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2.

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

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

Sector: Requires Base in vBaseOrRadius. Requires Radius in vHeightOrRadius2.

Sphere: Requires Radius in vBaseOrRadius.

Square: Requires Base in vBaseOrRadius.

Torus: Requires Radius #1 in vBaseOrRadius. Requires Radius #2 in vHeightOrRadius2.

Trapezoid: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2. Requires Top in vDepthOrTop.

Triangle: Requires Base in vBaseOrRadius. Requires Height in vHeightOrRadius2.

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