hexagon logo

Does anyone know an easy way to project all the points in a group to a plane?

I have a group of points (a plane for example) and I want to project them all to a plane (simplest case == WORKPLANE). Is there some smart way to do it all at once (a.k.a. "the JEFMAN way") or is it only possible with a loop? I haven't found anything yet...

The object of this is to create a secondary tangent plane perpendicular to the primary by the following method:

- measure the secondary plane
- project all points up/down to the primary (WORKPLANE)
- construct a tangent plane from the original plane points + the projected points (guaranteed to be perpendicular to the primary as that is our projection direction)

As a follow-up question: How can I use an ARRAY variable in the same way as .HIT[...] in the construction of a tangent plane?
Parents
  • I tested this code offline, with 2 scans of 1000 hits, created under excel with a random.
    I checked the values with excel (minimax algo with the solver), it gives the same results.
    Maybe I've got it ?
    Some checks with real values would be welcome...

    PL1        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0.0005,0,0.02>,<-0.0002001,0.0000008,1>
                ACTL/<0.0005,0,0.02>,<-0.0002001,0.0000008,1>
                CONSTR/PLANE,TANGENT,SCN1,,
                MATH_TYPE/CONSTRAINED_MINMAX,BFRE
    PL2        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0,60.02,0.0005>,<0,1,-0.0002004>
                ACTL/<0,60.02,0.0005>,<0,1,-0.0002004>
                CONSTR/PLANE,TANGENT,SCN2,,
                MATH_TYPE/CONSTRAINED_MINMAX,BFRE
    DIM ANGL1= 3D ANGLE FROM PLANE PL1 TO PLANE PL2 ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    A     269.9886     0.0100     0.0100   269.9886     0.0000     0.0000 ----#----
    LN1        =FEAT/LINE,CARTESIAN,UNBOUNDED,NO
                THEO/<0.0002,60.02,0.0199>,<-1,-0.0000001,-0.0002001>
                ACTL/<0.0002,60.02,0.0199>,<-1,-0.0000001,-0.0002001>
                CONSTR/LINE,INTOF,PL1,PL2
    REF1       =ALIGNMENT/START,RECALL[emoticon:6D505171FAA4497C85C5CA27290C555D]ÉMARRAGE,LIST=YES
                  ALIGNMENT/LEVEL,ZPLUS,PL1
                  ALIGNMENT/ROTATE,XPLUS,TO,LN1,ABOUT,ZPLUS
                ALIGNMENT/END
                ASSIGN/V1=SCN2.HIT[1..SCN2.NUMHITS].XYZ*MPOINT(1,1,0)
                ASSIGN/V2=CROSS(PL1.IJK,LN1.IJK)
                ASSIGN/V3=MAXINDICES(DOT(V1,V2))
                ASSIGN/V4=V3[1]
                ASSIGN/V5=V3[2]
                ASSIGN/V6=SCN2.HIT[V4].XYZ*MPOINT(1,1,0)
                ASSIGN/V7=SCN2.HIT[V5].XYZ*MPOINT(1,1,0)
                ASSIGN/V8=SCN2.HIT[V4].XYZ
    F1         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V6.X,V6.Y,V6.Z>,$
                MEAS/XYZ,<V6.X,V6.Y,V6.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    F2         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V7.X,V7.Y,V7.Z>,$
                MEAS/XYZ,<V7.X,V7.Y,V7.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    F3         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V8.X,V8.Y,V8.Z>,$
                MEAS/XYZ,<V8.X,V8.Y,V8.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    PL3        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<1.5677,-59.9903,-16.6549>,<0.0000061,1,0>
                ACTL/<1.5677,-59.9903,-16.6549>,<0.0000061,1,0>
                CONSTR/PLANE,BF,F1,F2,F3,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
                ASSIGN/V9=MAX(DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-PL3.XYZ,PL3.IJK))
                ASSIGN/V10=MIN(DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-PL3.XYZ,PL3.IJK))


    The plane PL3 is constructed fom the min distance between SCN2.hits and the intersection line (I used MAXINDICES because the cross product V2 is along Y minus ; here there's an enhancement to provide !).
    I construct a generic point with this hit and with its projection on the plane + the second hit the closer of the line.
    V9 is 0, V10 is negative, so the plane is tangent, and PL3.K is 0, so the plane is perp to PL1.
    Excel gives the min distance = V10.

    No loop here Wink

    , even if it's not THE solution, I hope it's close to it...
Reply
  • I tested this code offline, with 2 scans of 1000 hits, created under excel with a random.
    I checked the values with excel (minimax algo with the solver), it gives the same results.
    Maybe I've got it ?
    Some checks with real values would be welcome...

    PL1        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0.0005,0,0.02>,<-0.0002001,0.0000008,1>
                ACTL/<0.0005,0,0.02>,<-0.0002001,0.0000008,1>
                CONSTR/PLANE,TANGENT,SCN1,,
                MATH_TYPE/CONSTRAINED_MINMAX,BFRE
    PL2        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0,60.02,0.0005>,<0,1,-0.0002004>
                ACTL/<0,60.02,0.0005>,<0,1,-0.0002004>
                CONSTR/PLANE,TANGENT,SCN2,,
                MATH_TYPE/CONSTRAINED_MINMAX,BFRE
    DIM ANGL1= 3D ANGLE FROM PLANE PL1 TO PLANE PL2 ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    A     269.9886     0.0100     0.0100   269.9886     0.0000     0.0000 ----#----
    LN1        =FEAT/LINE,CARTESIAN,UNBOUNDED,NO
                THEO/<0.0002,60.02,0.0199>,<-1,-0.0000001,-0.0002001>
                ACTL/<0.0002,60.02,0.0199>,<-1,-0.0000001,-0.0002001>
                CONSTR/LINE,INTOF,PL1,PL2
    REF1       =ALIGNMENT/START,RECALL[emoticon:6D505171FAA4497C85C5CA27290C555D]ÉMARRAGE,LIST=YES
                  ALIGNMENT/LEVEL,ZPLUS,PL1
                  ALIGNMENT/ROTATE,XPLUS,TO,LN1,ABOUT,ZPLUS
                ALIGNMENT/END
                ASSIGN/V1=SCN2.HIT[1..SCN2.NUMHITS].XYZ*MPOINT(1,1,0)
                ASSIGN/V2=CROSS(PL1.IJK,LN1.IJK)
                ASSIGN/V3=MAXINDICES(DOT(V1,V2))
                ASSIGN/V4=V3[1]
                ASSIGN/V5=V3[2]
                ASSIGN/V6=SCN2.HIT[V4].XYZ*MPOINT(1,1,0)
                ASSIGN/V7=SCN2.HIT[V5].XYZ*MPOINT(1,1,0)
                ASSIGN/V8=SCN2.HIT[V4].XYZ
    F1         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V6.X,V6.Y,V6.Z>,$
                MEAS/XYZ,<V6.X,V6.Y,V6.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    F2         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V7.X,V7.Y,V7.Z>,$
                MEAS/XYZ,<V7.X,V7.Y,V7.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    F3         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V8.X,V8.Y,V8.Z>,$
                MEAS/XYZ,<V8.X,V8.Y,V8.Z>,$
                NOM/IJK,<0,1,0>,$
                MEAS/IJK,<0,1,0>
    PL3        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<1.5677,-59.9903,-16.6549>,<0.0000061,1,0>
                ACTL/<1.5677,-59.9903,-16.6549>,<0.0000061,1,0>
                CONSTR/PLANE,BF,F1,F2,F3,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
                ASSIGN/V9=MAX(DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-PL3.XYZ,PL3.IJK))
                ASSIGN/V10=MIN(DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-PL3.XYZ,PL3.IJK))


    The plane PL3 is constructed fom the min distance between SCN2.hits and the intersection line (I used MAXINDICES because the cross product V2 is along Y minus ; here there's an enhancement to provide !).
    I construct a generic point with this hit and with its projection on the plane + the second hit the closer of the line.
    V9 is 0, V10 is negative, so the plane is tangent, and PL3.K is 0, so the plane is perp to PL1.
    Excel gives the min distance = V10.

    No loop here Wink

    , even if it's not THE solution, I hope it's close to it...
Children