Rockwell Automation 5370-CVIM2 Module User Manual

Page 371

Advertising
background image

5

Chapter

Chapter 7

Inspection Tools

7–133

The

Misc Functions

panel lists various additional functions that a math tool

can perform.

After selecting a misc function, you must enter one or more values, as
required for the selected function, followed by a closing parenthesis. At that
point, the entry could operate as a “formula” by itself; however, it would
normally be used as one component of a longer formula.

Here is a brief description of each of the miscellaneous functions:

abs –– The “

abs

” (absolute) function converts a negative number to its

absolute value. For example, the formula “

abs(

*

45)

” will convert

*45 to

45.

dst –– The “

dst

” (distance) function calculates the distance, in pixels, from

one position in the image to another position. It performs this calculation on
the basis of entering the X–axis and Y–axis coordinate values after the
opening parenthesis (and separating them by commas). The

dst

function

formula takes the form “

dst(X

1

,Y

1

,X

2

,Y

2

)

,” where X

1

and Y

1

are the

coordinates of one position, and X

2

and Y

2

are the coordinates of the other

position.

The

dst

function performs the distance computation by using the

Pythagorean theorem: The square of the hypotenuse of a right angle triangle
is equal to the sum of the squares of the two sides
.

Thus, to find the distance between two points in the image (the hypotenuse of
a right angle triangle), the

dst

function squares the distance along the X–axis

(one side of the triangle) and the Y–axis (the other side of the triangle), then
computes the square root of the sum of the two squares.

For an example of using the

dst

function to measure a distance in the image,

refer to the Math Tool Formula Examples section on page 7–137.

mod –– The “

mod

” (modulo) function divides the first value entered after

the opening parenthesis by the second value, and it returns the remainder or
“modulo,” if any, resulting from the division operation. The

mod

function

formula takes the form “

mod(X

1

,X

2

)

,” where X

1

is the dividend, and X

2

is

the divisor.

For example, the formula “

mod(45,11)

” will divide 45 by 11 (which results

in a quotient of 4 and a remainder of 1) and return a modulo value of 1.000.

sqr –– The “

sqr

” (square) function calculates the square of the value entered

after the opening parenthesis. Thus, the formula “

sqr(25)

” will return a value

of 625.000.

Advertising