 # 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,

Thanks&regards,

Jayasuriya

• Dear all,

I am having one more doubt in this example(print inspection_blob). The reference angle alpha and chi were multiplied by 1024/90 and distance is multiplied by 4, what is the logic behind in this.

Thanks,

Jayasuriya

• Dear Jayasuriya,

thank you for your question. We use this procedure because only interger values are allowed for the parameters in VisualApplets.

The reference angle chi and alpha is multiplied by a factor 1024/90, to covert degree to fixed point parameter value

I.E. 90°= 1024, and 27,77°= 316

Also the multiplication by a factor of 2^2=4 of the distance is due to the fixed point t arithmetic and correspond to the subpixel accuracy.

This means: 2^2 correspond to distance of 1. If you like to set a distance Z of 0.5 we use value of 2 in VisualApplets.

• Dear CarmenZ,

Is there possible to do Affine transformation (translation,rotation&scaling) with minimum 3 reference points in silicon software?

Thanks&Regards,

Jayasuriya

• Dear JSuriya,