hexagon logo

Some thoughts about vectors

PC-DMIS uses vectors in all features, and in some assignments.

1/ The extention for a vector is .IJK ; .I gives the first component, .J the second and .K the third.

2/ The length of a vector is 1 (1 mm in mm, 1 " in inches). It means that the sum of the squares of the components is 1.

3/ When you use "ANGLEBETWEEN", angle is calculated in degrees between 2 vectors.
Ex : ASSIGN/V1=ANGLEBETWEEN(PL1.IJK,LN1.IJK)
If PL1 and LN1 vectors are <0,0,1>,Anglebetween gives 0° (angle between vectors, not features !), but angle between the plane and the line is 90° !!!

4/ You can create vectors from hits.
Ex : ASSIGN/V1=PT2.XYZ-PT1.XYZ ; It gives the components of the vector PT1PT2 ; Its length is the 3D distance between PT1 and PT2 (ASSIGN/V2=DIST3D({PT1},{PT2}) or ASSIGn/V2=SQRT(DOT(PT2.XYZ-PT1.XYZ,PT2.XYZ-PT1.XYZ)), or ASSIGN/V2=SQRT(DOT(V1,V1))

5/ If you want a classical vector (length =1) along a line between PT1 and PT2, you don't need to create the line, you can use ASSIGN/V3=UNIT(PT2.XYZ-PT1.XYZ) or ASSIGN/V3=UNIT(V1).

6/ Alignment vectors ares calculated in the current alignment, with their name (ASSIGN/V4=AL1.ZAXIS in AL1 gives <0,0,1>, in AL2, it gives the rotation of Z axis between Al2 and Al1)

7/ Cross function (in PC-DMIS, not in the real life !!!) gives a unit vector, perp to the first and the second. ASSIGN/V5=CROSS(LN1.IJK,LN2.IJK) gives a vector perp to both lines. If you need to calculate the distance between 2 cylinders (non coplanar), then you can ASSIGN/V6=DOT(CYL1.XYZ-CYL2.XYZ,CROSS(CYL1.IJK,CYL2.IJK)), which gives directly the good result without any local alignment.

8/ Another way to create a vector, you can use MPOINT function : ASSIGN/V1=MPOINT(10,20,30) construct a point with coordinates <10,20,30> or a vector with the same components. Just to remember that coordinates of a point have the same values than components of a vector from origin to the point, so MPOINT can give a vector !!!

That's all for a monday morning, it's coffee time ! Slight smile
  • Thanks for the interesting lesson, Jefman. Although my level of PC-DMIS awareness is obviously nowhere near the level you reside at, so I must ultimately say thanks for nothing. Confused
  • Thanks Jeffman!


    I notice from your suggestions on here you do seem to do a lot of calculations in your day to day programming - I was wondering if it's because you feel you need to (due to the nature of your work or limitations within PC-Dmis), or you prefer to (not trusting the demon)?

    Anyway thanks for the info - vector manipulation is an area I should try to understand better.
  • I guess one of the reasons is that if you do angle calculations with vectors, it is 'basic' math which never changes (except for bugs, of course), if you do it with PC-DMIS angle dimensions you get different results from version to version (not all, but there have been a number of design changes during the years). If you're comfortable with vectors, they are unambiguous, no guesswork or try&error involved.
  • Thanks Jeffman!


    I notice from your suggestions on here you do seem to do a lot of calculations in your day to day programming - I was wondering if it's because you feel you need to (due to the nature of your work or limitations within PC-Dmis), or you prefer to (not trusting the demon)?

    Anyway thanks for the info - vector manipulation is an area I should try to understand better.


    I guess one of the reasons is that if you do angle calculations with vectors, it is 'basic' math which never changes (except for bugs, of course), if you do it with PC-DMIS angle dimensions you get different results from version to version (not all, but there have been a number of design changes during the years). If you're comfortable with vectors, they are unambiguous, no guesswork or try&error involved.


    Anders is right, one of the reasons is to know what i do, without using black boxes or skiping bugs or errors (from PC-DMIS or from CAD...)
    Another reason is to calculate some values which are hidden in PC-DMIS (T_value calculation, or distance between cylinders for example)
    The last reason(s) is that I like it, and that I don't want to use the cmm only by doing "bip bip" with the jogbox !
  • PC-DMIS uses vectors in all features, and in some assignments.

    1/ The extention for a vector is .IJK ; .I gives the first component, .J the second and .K the third.

    2/ The length of a vector is 1 (1 mm in mm, 1 " in inches). It means that the sum of the squares of the components is 1.

    3/ When you use "ANGLEBETWEEN", angle is calculated in degrees between 2 vectors.
    Ex : ASSIGN/V1=ANGLEBETWEEN(PL1.IJK,LN1.IJK)
    If PL1 and LN1 vectors are <0,0,1>,Anglebetween gives 0° (angle between vectors, not features !), but angle between the plane and the line is 90° !!!

    4/ You can create vectors from hits.
    Ex : ASSIGN/V1=PT2.XYZ-PT1.XYZ ; It gives the components of the vector PT1PT2 ; Its length is the 3D distance between PT1 and PT2 (ASSIGN/V2=DIST3D({PT1},{PT2}) or ASSIGn/V2=SQRT(DOT(PT2.XYZ-PT1.XYZ,PT2.XYZ-PT1.XYZ)), or ASSIGN/V2=SQRT(DOT(V1,V1))

    5/ If you want a classical vector (length =1) along a line between PT1 and PT2, you don't need to create the line, you can use ASSIGN/V3=UNIT(PT2.XYZ-PT1.XYZ) or ASSIGN/V3=UNIT(V1).

    6/ Alignment vectors ares calculated in the current alignment, with their name (ASSIGN/V4=AL1.ZAXIS in AL1 gives <0,0,1>, in AL2, it gives the rotation of Z axis between Al2 and Al1)

    7/ Cross function (in PC-DMIS, not in the real life !!!) gives a unit vector, perp to the first and the second. ASSIGN/V5=CROSS(LN1.IJK,LN2.IJK) gives a vector perp to both lines. If you need to calculate the distance between 2 cylinders (non coplanar), then you can ASSIGN/V6=DOT(CYL1.XYZ-CYL2.XYZ,CROSS(CYL1.IJK,CYL2.IJK)), which gives directly the good result without any local alignment.

    8/ Another way to create a vector, you can use MPOINT function : ASSIGN/V1=MPOINT(10,20,30) construct a point with coordinates <10,20,30> or a vector with the same components. Just to remember that coordinates of a point have the same values than components of a vector from origin to the point, so MPOINT can give a vector !!!

    That's all for a monday morning, it's coffee time ! Slight smile


    Nice work JEFMAN.

    For #2: Vectors Just to learn some of the vernacular.

    #4: How are you getting a vector from the difference in XYZ of two points? Is it just how PC-DMIS happens to handle them?

    What is the function of UNIT, in #5?

    #7: That's pretty cool. :Square:
  • That's all for a monday morning, it's coffee time ! Slight smile


    Sheesh Mister, all this before coffee on a Monday. Must have been one **** of a weekend!

    Now, I need some coffee Slight smile

    TK

    EDIT: OK is heck OK?
  • Nice work JEFMAN.

    For #2: Vectors Just to learn some of the vernacular.

    #4: How are you getting a vector from the difference in XYZ of two points? Is it just how PC-DMIS happens to handle them?

    What is the function of UNIT, in #5?

    #7: That's pretty cool. :Square:



    I'll haver a go at answering this...


    When it comes to vectors, PC-Dmis unitises them (that is it gives them a unit length of 1).

    So the vector for 45° is 0.7071, 0.7071, 0 - if you do Pythagoras on that you'll see the hypotenuse is 1 .


    However it will cope with non-unitised vectors. If I want to define a vector point at 45° I can enter the vector as 1,1,0, or 10,10,0 or 100,100,0 - the ratios are the same, so the angle/vector are the same.


    So if you've any two points, the difference between X1 and X2, Y1 and Y2, and Z1 and Z2 is actually the vector of the line between them (easier to picture if you make the first point 0,0,0).
  • It is real nice to find out a workaround for an old Pcdmis bug.
    (Complementary and true angle values switch in the program: for ex. angle of 89 reported as 91 degree).

    Thanks.
  • I'll haver a go at answering this...

    When it comes to vectors, PC-Dmis unitises them (that is it gives them a unit length of 1).

    So the vector for 45° is 0.7071, 0.7071, 0 - if you do Pythagoras on that you'll see the hypotenuse is 1 .

    However it will cope with non-unitised vectors. If I want to define a vector point at 45° I can enter the vector as 1,1,0, or 10,10,0 or 100,100,0 - the ratios are the same, so the angle/vector are the same.

    So if you've any two points, the difference between X1 and X2, Y1 and Y2, and Z1 and Z2 is actually the vector of the line between them (easier to picture if you make the first point 0,0,0).


    D'oh. That sounds quite correct. It's not so much PC-DMIS doing this as it is basic trig, PC-DMIS is just taking shortcuts, which is what I missed. JEFMAN does this all before coffee, and apparently I can't function without it. Slight smile

    Thanks