Basic Shapes Formulas



Chapter 1 Basic Geometry An intersection of geometric shapes is the set of points they share in common. L and m intersect at point E. L and n intersect at point D. M and n intersect in line m 6, n, &. In this lesson, we'll go over some of the basic formulas and rules in geometry, the study of shapes and space. You'll learn formulas to find the perimeter, area, volume, and surface area of two. Here, we provide you with common geometry formulas for some basic shapes. Rectangle: Perimeter = l + l + w + w = 2 × l + 2 × w. Square: Perimeter = s + s + s + s = 4 × s. Basic Shapes Formulas comprises a selection of 28 different calculators that will simplify calculations which have given you headaches so far. Complex calculations, such as Surface Area of. Let's break the area into two parts: Part A is a square: Area of A = a 2 = 20m × 20m = 400m 2. Part B is a triangle. Viewed sideways it has a base of 20m and a height of 14m. Area of B = ½b × h = ½ × 20m × 14m = 140m 2. So the total area is: Area = Area of A + Area of B = 400m 2 + 140m 2 = 540m 2. Sam earns $0.10 per square meter.

Summary:

Formulas make it possible to extend ProSEM’s analysis capability to report what you need. Formulas use the JavaScript programming language, but in many cases, it is not necessary to learn much JavaScript syntax. For more complex needs, there is plentiful online documentation and lessons for JavaScript programming.

To demonstrate formula basics, here some characteristics of measured shapes are computed using user-defined formulas, such as Aspect Ratio of rectangles, Circular shape computations such as circularity or ellipticity, or grating metrics such as duty cycle or fill fraction.

Note: ProSEM 2.3.0 or higher is required for these examples.

Measurement Example 1: Aspect Ratio

In this first example, a formula is created to compute the Aspect Ratio of measured rectangles.

  1. A measurement of a rectangle is setup, stored, and then that stored measurement is selected in the tree in the Images panel.
Basic Shapes Formulas
  1. In the Variables panel, the “Create New Variable…” button is clicked. In the dialog:
  • The variable type is set to: “Formula”
  • The variable name is defined as: AspectRatio
  • The formula is defined as: Height / Width
  1. Optional: the new formula can be tested using the “Evaluate” button. If the variable is successfully setup, the value displayed will be the Aspect Ratio of the selected measurement.
  2. The OK button is clicked to complete the creation of the new formula variable.
    This formula will be evaluated for all measurements in the project, including measurements already stored and all measurements stored after the variable is created. The values of any defined variables for the currently selected measurement are shown in the table in the Variables panel.

In addition, each variable defined will appear as a new column in each data table, so in this case, the value of Aspect Ratio will be calculated for all rectangles measured in the project.

Notes:

Basic Shapes Formulas

Formula For Shapes Math

  • It isn’t strictly necessary to select a measurement before creating a variable, but in order to test the formula using the Evaluate button, a measurement must have been selected before editing the variable, so that ProSEM knows which measurement to compute the formula for. A measurement must also be selected in order to use the context portion of the Context Browser, covered a few sections below.
  • The formula is evaluated using JavaScript, and all values in JavaScript are case sensitive, so names such as Height and Width must be entered in the correct case, here with an initial capital letter.
  • The Display Precision field specifies how many decimal places to display for this variable.
  • To edit an existing variable, double-click on the variable entry in the table in the Variables panel, or right-click on the name and choose “Edit Variable”
  • When an element is selected in the Images tree which does not have the necessary properties to compute the formula, 'Error' is displayed instead of a value. For example, for this formula, for a Feature Type of 'Lines & Spaces', the AspectRatio is displayed as 'Error', because there is no Height or Width property defined for a Line measurement. It is possible to have other information displayed; that will be demonstrated in later example.

Measurement Example 2: Eccentricity, More Shape Computations, using the Object Browser and Snippet Gallery

In this example, the Eccentricity, also sometimes called Ellipticity, of ellipses and circles is computed, and the Object Browser and Snippet Gallery are introduced.

Basic Shapes Formulas

To compute the Eccentricity of measured Ellipses and Circles, the formula to be used is:

Sheet

Where a is the semimajor axis, or half the length of the major axis, and b is semiminor axis.

But how does one know the property names within ProSEM for these measured values? The Object Browser is displayed on the right side of the Edit Variables dialog when a Formula is being edited, and contains all of the properties of the selected measurement, as well as the group and the image containing the selected measurement.

For this example, a multi-line formula will be used, to increase the readability of the formula. So first a and b will be defined as variables, and then the full formula will be computed using those variables.

For example, to compute the Eccentricity of a measured ellipse:

  1. An ellipse measurement is setup, stored, and then the stored measurement selected n the Images tree.
  1. In the Variables panel, a new variable is created. In the Create New Variable dialog:
  • The variable type is set to: “Formula”
  • The variable name is defined as: Eccentricity

To compute the eccentricity, the lengths of the semimajor and semiminor axes are needed, each half of their respective diameters. Within the formula, these will be stored as local variables named a and b. The length of the major and minor axes could be typed into the formula, or in this case, the property name is drag-and-dropped from the Context branch of the Object Browser. Each line is terminated by a semicolon character “;” keeping with JavaScript syntax requirement.

  • The formula for a, the semimajor axis, is defined by typing in a =
  • Then in the object browser, the Context branch is opened, and the property MajorDiameter is drag-and-dropped into the formula
  • The formula is completed by typing in: / 2 ;
  • The formula for b is then created in the same way, but using the MinorDiameter property
  • Finally, the full formula is entered, using drag-and-drop from the Math branch of the Object Browser to find the JavaScript syntax for the square root and power functions. The function names sqrt and pow could also be typed, but the Math branch provides a convenient reference of common functions. Of course, the same result as pow(a,2) is also obtained by just: (a * a) Either works fine.) Again, the Evaluate button tests the formula on the selected measured shape.

The complete formula contents for the Eccentricity in this example are:

This could also be written on a single line as:

The formulas in this example demonstrate some basic elements of using Formulas in ProSEM. See other examples on this site for more advanced examples.

Perimeter is the distance around a two-dimensional shape.

Example: the perimeter of this rectangle is 7+3+7+3 = 20

Example: the perimeter of this regular pentagon is:

3+3+3+3+3 = 5×3 = 15

The perimeter of a circle is called the circumference:

Circumference = 2π × radius

Perimeter Formulas

Area Of Shapes Formula Sheet

Triangle
Perimeter = a + b + c
Square
Perimeter = 4 × a
a = length of side
Rectangle
Perimeter = 2 × (a + b)
Quadrilateral
Perimeter = a + b + c + d
Circle
Circumference = 2πr
r = radius
Sector
Perimeter = r(θ+2)
r = radius
θ = angle in radians
Ellipse
Perimeter = very hard!

Basic Geometry Shapes Formulas

Try It Yourself