 # How to find angle Alpha,chi and distance Z.

• Dear all,

I am having doubts in PrintInspection_blob.va(example applet). How to find center of gravity of object,angle alpha,angle chi and distance Z.

pasted-from-clipboard.png

In ''split fraction and integer bit'' hierarchical box which conversion is used to convert 959 into 15712255 (input to 'is in range' operator).

Thanks & regards,

Jayasuriya

• Dear Jayasuriya,

"...

I am having doubts in PrintInspection_blob.va(example applet). How to find center of gravity of object,angle alpha,angle chi and distance Z...."

Please find attached a sketch of the patterns A and B ( part of object) and the Center of gravity (COG) of object.

If you want to rotate not around the center of gravity you can chhoose any other point to rotate around. You can select any pattern on the objects. I recommend to select patterns which appear only one time in the object and are mostly rotation invariant.

In the image in the attachment also the angles alpha, chi and the distance Z between pattern A and the COG are sketched.

Calculation of angle alpha:

with x_A, y_A : x and y coordinate of pattern A,

x_B, y_B : x and y coordinate of pattern B,

x_COG, y_COG: y coordinate of COG

alpha= arctan((y_A - y_COG)/(x_COG-x_A))-chi)

calculation of angle chi

chi=arctan((y_A - y_B)/(x_B-x_A))

calculation of distance Z:

Z=Sqrt((x_COG-x_A)^2+(y_A-y_COG)^2)

Also the design "PrintInspection_ImageMoments.va" maybe of interest for you:

In this design the rotation angle and position shift calculation of an object is not pattern based but it is based on the calculation of image moments

(see e.g. https://en.wikipedia.org/wiki/Image_moment).

"...

In ''split fraction and integer bit'' hierarchical box which conversion is used to convert 959 into 15712255 (input to 'is in range' operator)..."

In the hierarchical box "LimitCoordinateValues" in module "SplitFractional And IntegerBit" the coordinates are limited to the maximum input image coordinates. Due to the geometric transformation performed in module "InverseTrabnsformation" in module "geometricTransformation" 14 fractional bits remain.

This means coordinate of 959 corresponds to 959*2^14=15712255.

Best regards

Carmen Z

• Dear Carmen Z,