public static double [ ] CalculateAcadExtrusion ( double [ ] coord_in , double [ ] xtru ) { double [ ] coord_out ; double dxt0 = 0D , dyt0 = 0D , dzt0 = 0D ; double dvx1 , dvx2 , dvx3 ; double dvy1 , dvy2 , dvy3 ; double dmod , dxt , dyt , dzt ; double aux = 1D / 64D ; double aux1 = Math . abs ( xtru [ 0 ] ) ; double aux2 = Math . abs ( xtru [ 1 ] ) ; dxt0 = coord_in [ 0 ] ; dyt0 = coord_in [ 1 ] ; dzt0 = coord_in [ 2 ] ; double xtruX , xtruY , xtruZ ; xtruX = xtru [ 0 ] ; xtruY = xtru [ 1 ] ; xtruZ = xtru [ 2 ] ; if ( ( aux1 < aux ) && ( aux2 < aux ) ) { dmod = Math . sqrt ( xtruZ * xtruZ + xtruX * xtruX ) ; dvx1 = xtruZ / dmod ; dvx2 = 0 ; dvx3 = - xtruX / dmod ; } else { dmod = Math . sqrt ( xtruY * xtruY + xtruX * xtruX ) ; dvx1 = - xtruY / dmod ; dvx2 = xtruX / dmod ; dvx3 = 0 ; } dvy1 = xtruY * dvx3 - xtruZ * dvx2 ; dvy2 = xtruZ * dvx1 - xtruX * dvx3 ; dvy3 = xtruX * dvx2 - xtruY * dvx1 ; dmod = Math . sqrt ( dvy1 * dvy1 + dvy2 * dvy2 + dvy3 * dvy3 ) ; dvy1 = dvy1 / dmod ; dvy2 = dvy2 / dmod ; dvy3 = dvy3 / dmod ; dxt = dvx1 * dxt0 + dvy1 * dyt0 + xtruX * dzt0 ; dyt = dvx2 * dxt0 + dvy2 * dyt0 + xtruY * dzt0 ; dzt = dvx3 * dxt0 + dvy3 * dyt0 + xtruZ * dzt0 ; coord_out = new double [ ] { dxt , dyt , dzt } ; dxt0 = 0 ; dyt0 = 0 ; dzt0 = 0 ; return coord_out ; }
Method that allows to apply the extrusion transformation of Autocad