Abstract:
A numerical controller controls a five-axis machine which machines a workpiece mounted on a table by means of at least three linear axes and two rotation axes. The numerical controller calculates a tool direction relative to the workpiece as a tool direction vector, roll-pitch-yaw angles, or Euler angles, based on respective positions of the two rotation axes, and displays the tool direction relative to the workpiece on a display, based on the result of the calculation.

Description:
RELATED APPLICATION DATA 
     This application claims priority under 35 U.S.C. §119 and/or §365 to Japanese Application No. 2013-090340 filed Apr. 23, 2013, the entire contents is incorporated herein by reference. 
     BACKGROUND OF THE INVENTION 
     Field of the Invention 
     The present invention relates to a numerical controller for controlling a five-axis machine having at least three linear axes and two rotation axes, and more specifically, to a numerical controller capable of displaying and inputting a tool direction relative to a workpiece. In particular, this numerical controller commands a tool center point position based on command linear axis positions on a designated program coordinate system and issues a tool direction command, thereby controlling the machine for machining. Further, the numerical controller can add a linear or rotation axis movement amount based on a manual command (by manual hand feed, jog feed, etc.) to an interpolated tool center point position, tool length compensation vector, or rotation axis positions. 
     Description of the Related Art 
     Japanese Patent Application Laid-Open No. 2003-195917 discloses a technique comprising a first interpolation unit configured to interpolate linear axes in a coordinate system defined on a table and a second interpolation unit configured to interpolate rotation axes. According to this technique, interpolation positions of the linear axes are compensated based on those of the rotation axes. In the field of five-axis machines, this technique is generally referred to as tool center point control. In five-axis machining based on the tool center point control or the like, the tool direction is designated by a rotation axis command or vector command and represented by the end point positions of the rotation axes. 
     Japanese Patent Application Laid-Open No. 57-75309 discloses a technique in which X-, Y-, and Z-axes are operated so that the positional relationship between a tool center point and a workpiece can be maintained as two rotation axes are operated in response to a manual command. In the field of five-axis machines, this technique is generally referred to as three-dimensional manual feed. In the three-dimensional manual feed, actual rotation axis positions are manually input, and a tool direction is represented by the end point positions of the rotation axes. 
     According to the techniques disclosed in Japanese Patent Applications Laid-Open Nos. 2003-195917 and 57-75309 described above, it is necessary to calculate the tool direction (rotation axis end point positions) relative to the workpiece (or table) based on the rotation axis positions and the rotation axis configuration of each machine. Thus, the tool direction relative to the workpiece cannot be obtained from information on the rotation axis positions only. 
     Let us assume a rotary-table five-axis machine (with A- and C-axes as master and slave axes, respectively), such as that shown in  FIG. 1 . A C-axis table  5  is mounted on an A-axis table  4 , and a workpiece  3  is placed on the C-axis table  5 . An XYZ-coordinate system is secured to the workpiece  3 . If the respective angles of the two rotation axes (A- and C-axes) are both 0°, a tool direction vector as viewed from the tables is (0, 0, 1). 
     If the respective angles of the A- and C-axes are −30° and 20°, as shown in  FIG. 2 , however, the tool direction vector as viewed from the C-axis table  5  is (−0.171, 0.470, 0.866), which cannot be easily intuitively understood from angle information for the rotation axes (A- and C-axes). To locate the tool direction vector as viewed from the C-axis table  5 , therefore, it is necessary to calculate a tool direction vector based on the rotation axis positions and the machine configuration. In calculating the tool direction (rotation axis end point positions) in a machine with an inclined rotation axis, as shown in  FIGS. 4A and 4B , the inclination of the inclined rotation axis must be taken into consideration. 
     In the three-dimensional manual feed disclosed in Japanese Patent Application Laid-Open No. 57-75309 described above, the rotation axes can be moved so that the positional relationship between the workpiece (or table) and the tool center point is maintained. Since only one of the rotation axes can be commanded to move, however, it is necessary to change the rotation axis to be operated. Further, in the case of the machine with the inclined rotation axis, as shown in  FIGS. 4A and 4B , the behavior of the workpiece (or table) caused by the rotation cannot be easily predicted. 
     SUMMARY OF THE INVENTION 
     Accordingly, in view of the problems of the prior art described above, an object of the present invention is to provide a numerical controller for controlling a five-axis machine configured to machine a workpiece mounted on a table by means of a mechanism that rotates the table or a tool head about at least three linear axes and two rotation axes, in which tool directions relative to the workpiece are displayed using a vector, roll-pitch-yaw angles, or Euler angles. 
     In view of the problems of the prior art described above, moreover, another object of the present invention is to provide a numerical controller for controlling a five-axis machine configured to machine a workpiece mounted on a table by means of a mechanism that rotates the table or a tool head about at least three linear axes and two rotation axes, in which a manual movement command for rotation axis movement can be issued using roll-pitch-yaw angles. 
     A numerical controller according to the present invention controls a five-axis machine configured to machine a workpiece mounted on a table by means of at least three linear axes and two rotation axes. 
     A first aspect of the numerical controller comprises a tool direction computation unit configured to calculate a tool direction relative to the workpiece as a tool direction vector, roll-pitch-yaw angles, or Euler angles, based on respective positions of the two rotation axes, and a tool direction display unit configured to display the tool direction relative to the workpiece on a display, based on the tool direction vector, the roll-pitch-yaw angles, or the Euler angles. 
     A second aspect of the numerical controller comprises a manual tool direction movement amount input unit, configured to input an amount of manual tool direction movement relative to the workpiece as a roll-pitch-yaw angle movement amount, and a rotation axis movement amount conversion unit configured to convert the roll-pitch-yaw angle movement amount to respective movement amounts of the two rotation axes. And the two rotation axes are driven based on the movement amounts converted by the rotation axis movement amount conversion unit. 
     Both the two rotation axes may be configured to serve for table rotation and the five-axis machine may be a rotary-table five-axis machine. 
     Both the two rotation axes may be configured to serve for tool head rotation and the five-axis machine may be a rotary-tool-head five-axis machine. 
     The two rotation axes may be configured to serve for table rotation and tool head rotation, individually, and the five-axis machine may be a hybrid five-axis machine having one rotation axis for table rotation and the other for tool head rotation. 
     One of the two rotation axes may be an inclined rotation axis not parallel to the three linear axes. 
     According to the present invention, there can be provided a numerical controller for controlling a five-axis machine configured to machine a workpiece mounted on a table by means of a mechanism that rotates the table or a tool head about at least three linear axes and two rotation axes, in which tool directions relative to the workpiece are displayed using a vector, roll-pitch-yaw angles, or Euler angles. 
     According to the present invention, moreover, there can be provided a numerical controller for controlling a five-axis machine configured to machine a workpiece mounted on a table by means of a mechanism that rotates the table or a tool head about at least three linear axes and two rotation axes, in which a manual movement command for rotation axis movement can be issued using roll-pitch-yaw angles. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The above and other objects and features of the present invention will be obvious from the ensuing description of embodiments with reference to the accompanying drawings, in which: 
         FIG. 1  is a view illustrating configurations of individual axes of a rotary-table five-axis machine; 
         FIG. 2  is a view illustrating how A- and C-axes of the rotary-table five-axis machine are rotated; 
         FIG. 3  is a diagram illustrating data for individual axes of the rotary-table five-axis machine; 
         FIGS. 4A and 4B  are views illustrating a machine with an inclined rotation axis, in which a C-axis table is mounted on a B-axis table, and a workpiece is placed on the C-axis table; 
         FIGS. 5A and 5B  are views illustrating a tool direction vector as viewed from above a coordinate system on each table, which is movable together with the table; 
         FIG. 6  is a diagram illustrating a first example of a tool direction vector for the workpiece; 
         FIG. 7  is a diagram illustrating a second example of the tool direction vector for the workpiece; 
         FIG. 8  is a diagram illustrating a third example of the tool direction vector for the workpiece; 
         FIG. 9  is a view illustrating a tool direction vector as viewed from above a coordinate system on each table, which is movable together with the table; 
         FIG. 10  is a view illustrating a hybrid five-axis machine; 
         FIG. 11  is a block diagram of a numerical controller for controlling the machine; 
         FIG. 12  is a flowchart showing processing by a tool direction computation unit according to Embodiment 1; 
         FIG. 13  is a flowchart showing processing by a rotation axis movement amount conversion unit according to Embodiment 2; 
         FIG. 14  is a flowchart showing processing by a tool direction computation unit according to Embodiment 3; and 
         FIG. 15  is a flowchart showing processing by a tool direction computation unit according to Embodiment 4. 
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     First Embodiment 
     A: Method of Calculating Tool Direction Vector, Roll-Pitch-Yaw Angles, and Euler Angles of Rotary-Table Five-Axis Machine with Inclined Rotation Axis 
       FIGS. 4A and 4B  show a rotary-table five-axis machine with an inclined rotation axis, in which a C-axis table  7  is mounted on a B-axis table  6 , and a workpiece  3  is placed on the C-axis table  7 . The workpiece  3  is machined by a tool  2 . In the case of the rotary-table five-axis machine with an inclined rotation axis, as shown in  FIGS. 4A and 4B , a tool direction vector, roll-pitch-yaw angles, and Euler angles are calculated. 
     Specifically, a B-axis as a first rotation axis is assumed to be an axis rotatable about the direction of a Y-axis that is rotated minus 45 degrees about an X-axis, while a C-axis as a second rotation axis is assumed to be an axis rotatable about a Z-axis with the B-axis at 0°. The tool direction vector as viewed from above a coordinate system on each table, which is movable together with the table, is given by Tv((Xt, Yt, Zt) T ) (see  FIGS. 5A and 5B ). A tool direction vector, roll-pitch-yaw angles, or Euler angles that are separately set are selected, and the following processing steps A-1, A-2 and A-3 are performed. 
     A-1: Method of Calculating Tool Direction Vector 
     When the B- and C-axes, rotation axes, are in positions B and C, respectively, in this machine configuration, the tool direction vector Tv((Xt, Yt, Zt) T ) can be given by equation (1) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rc 
                       * 
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             
                               - 
                               45 
                             
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       * 
                       Rb 
                       * 
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             45 
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       Rb 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               1 
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       Rc 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               0 
                             
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             
                               ± 
                               45 
                             
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       = 
                       
                         [ 
                         
                           
                             
                               1 
                             
                             
                               0 
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                             
                               
                                 - 
                                 
                                   sin 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         ± 
                                         45 
                                       
                                       ⁢ 
                                       ° 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 sin 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                             
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         ] 
                       
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     The tool direction relative to the workpiece can be more easily intuitively understood by displaying the X, Y and Z components of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table.  FIG. 6  indicates that the tool direction vector for the workpiece with B=20.0 and C=−30.0 is Tv(0.194, −0.147, 0.970). 
     A-2: Method of Calculating Roll-Pitch-Yaw Angles 
     A roll angle I, pitch angle J, and yaw angle K represent, respectively, rotations about the X-, Y-, and Z-axes of the coordinate system movable together with each table. Here the rotations about the X-, Y-, and Z-axes are expected to be made in this order. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the roll-pitch-yaw angles is given by equation (2) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rk 
                       * 
                       Rj 
                       * 
                       Ri 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Ri 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rj 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             1 
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rk 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
     The roll, pitch, and yaw angles are individually obtained by comparing and solving the components of equations (1) and (2) given above. Since there are a plurality of combinations of the roll-pitch-yaw angles that implement the tool direction vector Tv, the roll angle may be fixed at 0° for the calculation. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the roll-pitch-yaw angles of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table. 
       FIG. 7  shows the tool direction vector for the workpiece with B=20.0 and C=−30.0, as in the case of the calculation of the tool direction vector, and indicates that the roll, pitch, and yaw angles are given by 0°, −37.107°, and 14.106°, respectively.  FIG. 7  also illustrates the degree to which the tool direction vector rotates based on the pitch and yaw angles. 
     A-3: Method of Calculating Euler Angles 
     Conversion of Euler angles (P, Q, R) is defined in the following manner. 
     A coordinate system  2  is assumed to be obtained by rotating a certain coordinate system  1  by P about the Z-axis. A coordinate system  3  is assumed to be obtained by rotating the coordinate system  2  by Q about the X-axis. A coordinate system  4  is assumed to be obtained by rotating the coordinate system  3  by R about the Z-axis. Conversion of the certain coordinate system  1  to the coordinate system  4  based on this definition is referred to as Euler angle conversion. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the Euler angle is given by equation (3) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rp 
                       * 
                       Rq 
                       * 
                       Rr 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rp 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rq 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rr 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
     The Euler angles (P, Q, R) are individually obtained by comparing and solving the components of equations (1) and (3) given above. Since the Euler angle R does not affect the tool direction vector, it can be assumed to be 0°. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the Euler angles (P, Q, R) of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table.  FIG. 8  shows the tool direction vector for the workpiece with B=20.0 and C=−30.0, as in the case of the calculation of the tool direction vector, and indicates that the Euler angles P, Q and R are given by 52.893°, 14.106°, and 0°, respectively.  FIG. 8  also illustrates the degree to which the tool direction vector rotates based on the Euler angles P and Q. 
     In the case of a machine configuration without an inclined rotation axis, as shown in  FIG. 1 , it is necessary only that a matrix Ra (±45°) of equation (1) be omitted. 
     Second Embodiment 
     B: Roll-Pitch-Yaw Angle Commands for Manual Operation of Rotary-Table Five-Axis Machine with Inclined Rotation Axis 
     B-1: Machine Configuration and Method of Calculating Rotation Axis Position 
     A calculation is performed for the case of a rotary-table five-axis machine with an inclined rotation axis, as shown in  FIGS. 4A and 4B . Specifically, a B-axis as a first rotation axis is assumed to be an axis rotatable about the direction of a Y-axis that is rotated at −45° about an X-axis, while a C-axis as a second rotation axis is assumed to be an axis rotatable about a Z-axis with the B-axis at 0°. A tool direction vector as viewed from above a coordinate system on each table, which is movable together with the table, is given by Tv((Xt, Yt, Zt) T ). Tv is calculated using equation (1) (see  FIGS. 5A and 5B ). 
     The tool is manually rotated in a selected one of the directions about the X-axis (for rolling), Y-axis (for pitching), and Z-axis (for yawing) of the machine coordinate system. If the tool direction vector after rotation is T′v((X′t, Y′t, Z′t) T ), tool direction vectors T′v based on rotations by ΔI, ΔJ or ΔK about the X-, Y- and Z-axes can be given individually by equations (4), (5) and (6) as follows: 
     
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             
                               X 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Y 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Z 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             
                               X 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Y 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Z 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             1 
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             
                               X 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Y 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                       
                         
                           
                             
                               Z 
                               ′ 
                             
                             ⁢ 
                             t 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Δ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
     To implement the tool direction vector T′v calculated in this manner, the respective positions of the rotary B- and C-axes are obtained by solving equation (7) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 X 
                                 ′ 
                               
                               ⁢ 
                               t 
                             
                           
                         
                         
                           
                             
                               
                                 Y 
                                 ′ 
                               
                               ⁢ 
                               t 
                             
                           
                         
                         
                           
                             
                               
                                 Z 
                                 ′ 
                               
                               ⁢ 
                               t 
                             
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rc 
                       * 
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             
                               - 
                               45 
                             
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       * 
                       Rb 
                       * 
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             45 
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       Rb 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               1 
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       Rc 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               0 
                             
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       
                         Ra 
                         ⁡ 
                         
                           ( 
                           
                             
                               ± 
                               45 
                             
                             ⁢ 
                             ° 
                           
                           ) 
                         
                       
                       = 
                       
                         [ 
                         
                           
                             
                               1 
                             
                             
                               0 
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                             
                               
                                 - 
                                 
                                   sin 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         ± 
                                         45 
                                       
                                       ⁢ 
                                       ° 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 sin 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                             
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ± 
                                       45 
                                     
                                     ⁢ 
                                     ° 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         ] 
                       
                     
                   
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
           
         
       
     
     Thus, the operation for ΔI, ΔJ or ΔK can be achieved by moving the B- and C-axes to their respective obtained positions. 
     Equation (1) is calculated in the same manner as in the first embodiment, and equations (1) and (7) share the same right side. Thus, the first and second embodiments are inseparable techniques with many common parts. 
     Third Embodiment 
     C: Method of Calculating Tool Direction Vector, Roll-Pitch-Yaw Angles, and Euler Angles of Rotary-Tool-Head Five-Axis Machine 
     A calculation is performed for the case of a rotary-tool-head five-axis machine. Specifically, a C-axis as a first rotation axis is assumed to be an axis rotatable about a Z-axis, while an A-axis as a second rotation axis is assumed to be an axis rotatable about an X-axis with the C-axis at 0°. A tool direction vector of a tool  8  as viewed from above a coordinate system on each table, which is movable together with the table, is given by Tv((Xt, Yt, Zt) T ) ( FIG. 9 ). A tool direction vector, roll-pitch-yaw angles, or Euler angles that are separately set are selected, and the following processing steps C-1, C-2 and C-3 are performed. 
     C-1: Method of Calculating Tool Direction Vector 
     When the C- and A-axes, rotation axes, are in positions C and A, respectively, in this machine configuration, the tool direction vector Tv((Xt, Yt, Zt) T ) can be given by equation (8) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rc 
                       * 
                       Ra 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       Ra 
                       = 
                       
                         [ 
                         
                           
                             
                               1 
                             
                             
                               0 
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 A 
                               
                             
                             
                               
                                 
                                   - 
                                   cos 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 A 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 A 
                               
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 A 
                               
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       Rc 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               0 
                             
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
           
         
       
     
     The tool direction relative to the workpiece can be more easily intuitively understood by displaying the X, Y and Z components of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table (see  FIG. 6 ). 
     C-2: Method of Calculating Roll-Pitch-Yaw Angles 
     A roll angle I, pitch angle J, and yaw angle K represent, respectively, rotations about X-, Y-, and Z-axes of the machine coordinate system, which are expected to be made in this order. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the roll-pitch-yaw angles is given by equation (9) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rk 
                       * 
                       Rj 
                       * 
                       Ri 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Ri 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rj 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             1 
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rk 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   9 
                   ) 
                 
               
             
           
         
       
     
     The roll, pitch, and yaw angles are individually obtained by comparing and solving the components of equations (8) and (9) given above. Since there are a plurality of combinations of the roll-pitch-yaw angles that implement the tool direction vector Tv, the roll angle may be fixed at 0° for the calculation. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the roll-pitch-yaw angles of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table (see  FIG. 7 ). 
     C-3: Method of Calculating Euler Angles 
     Conversion of Euler angles (P, Q, R) is defined in the following manner. 
     A coordinate system  2  is assumed to be obtained by rotating a certain coordinate system  1  by P about the Z-axis. A coordinate system  3  is assumed to be obtained by rotating the coordinate system  2  by Q about the X-axis. A coordinate system  4  is assumed to be obtained by rotating the coordinate system  3  by R about the Z-axis. Conversion of the certain coordinate system  1  to the coordinate system  4  based on this definition is referred to as Euler angle conversion. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the Euler angle is given by equation (10) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rp 
                       * 
                       Rq 
                       * 
                       Rr 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rp 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rq 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     Rr 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
           
         
       
     
     The Euler angles (P, Q, R) are individually obtained by comparing and solving the components of equations (8) and (10) given above. Since the Euler angle R does not affect the tool direction vector, it can be assumed to be 0°. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the Euler angles (P, Q, R) of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table (see  FIG. 8 ). 
     Fourth Embodiment 
     D: Method of Calculating Tool Direction Vector, Roll-Pitch-Yaw Angles, and Euler Angles of Hybrid Five-Axis Machine 
     A calculation is performed for the case of a hybrid five-axis machine. Specifically, a B-axis as a tool rotation axis is assumed to be an axis rotatable about a Y-axis, while a C-axis as a table rotation axis is assumed to be an axis rotatable about a Z-axis. A tool direction vector as viewed from above a coordinate system on each table, which is movable together with the table, is given by Tv((Xt, Yt, Zt) T ) ( FIG. 10 ). A C-axis table  10  is mounted on a table  9 , and a workpiece (not shown) is secured to the C-axis table  10 . A Z-axis head  11  is attached to a column  13 , and a B-axis  12  mounted with a tool  8  is attached to the Z-axis head  11 . A tool direction vector, roll-pitch-yaw angles, or Euler angles that are separately set are selected, and the following processing steps D-1, D-2 and D-3 are performed. 
     D-1: Method of Calculating Tool Direction Vector 
     When the B- and C-axes, rotation axes, are in positions B and C, respectively, in this machine configuration, the tool direction vector Tv((Xt, Yt, Zt) T ) can be given by equation (11) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rc 
                       * 
                       Rb 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       Rb 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                           
                             
                               0 
                             
                             
                               1 
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                             
                               0 
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 B 
                               
                             
                           
                         
                         ] 
                       
                     
                     , 
                     
                       
 
                     
                     ⁢ 
                     
                       Rc 
                       = 
                       
                         [ 
                         
                           
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 
                                   - 
                                   sin 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               
                                 sin 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               
                                 cos 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 C 
                               
                             
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                             
                               0 
                             
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
     The tool direction relative to the workpiece can be more easily intuitively understood by displaying the X, Y and Z components of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table ( FIG. 6 ). 
     D-2: Method of Calculating Roll-Pitch-Yaw Angles 
     A roll angle I, pitch angle J, and yaw angle K represent, respectively, rotations about X-, Y-, and Z-axes of the machine coordinate system, which are expected to be made in this order. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the roll-pitch-yaw angles is given by equation (12) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rk 
                       * 
                       Rj 
                       * 
                       Ri 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Ri 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               I 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rj 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             1 
                           
                           
                             0 
                           
                         
                         
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               J 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rk 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               K 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   12 
                   ) 
                 
               
             
           
         
       
     
     The roll, pitch, and yaw angles are individually obtained by comparing and solving the components of equations (11) and (12) given above. Since there are a plurality of combinations of the roll-pitch-yaw angles that implement the tool direction vector Tv, the roll angle may be fixed at 0° for the calculation. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the roll-pitch-yaw angles of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table (see  FIG. 7 ). 
     D-3: Method of Calculating Euler Angles 
     Conversion of Euler angles (P, Q, R) is defined in the following manner. 
     A coordinate system  2  is assumed to be obtained by rotating a certain coordinate system  1  by P about the Z-axis. A coordinate system  3  is assumed to be obtained by rotating the coordinate system  2  by Q about the X-axis. A coordinate system  4  is assumed to be obtained by rotating the coordinate system  3  by R about the Z-axis. Conversion of the certain coordinate system  1  to the coordinate system  4  based on this definition is referred to as Euler angle conversion. The tool direction vector Tv((Xt, Yt, Zt) T ) based on the Euler angle is given by equation (13) as follows: 
     
       
         
           
             
               
                 
                   
                     
                       [ 
                       
                         
                           
                             Xt 
                           
                         
                         
                           
                             Yt 
                           
                         
                         
                           
                             Zt 
                           
                         
                       
                       ] 
                     
                     = 
                     
                       Rp 
                       * 
                       Rq 
                       * 
                       Rr 
                       * 
                       
                         [ 
                         
                           
                             
                               0 
                             
                           
                           
                             
                               0 
                             
                           
                           
                             
                               1 
                             
                           
                         
                         ] 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rp 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               P 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rq 
                     = 
                     
                       [ 
                       
                         
                           
                             1 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               Q 
                             
                           
                         
                       
                       ] 
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     Rr 
                     = 
                     
                       [ 
                       
                         
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               
                                 - 
                                 sin 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               R 
                             
                           
                           
                             0 
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   13 
                   ) 
                 
               
             
           
         
       
     
     The Euler angles (P, Q, R) are individually obtained by comparing and solving the components of equations (11) and (13) given above. Since the Euler angle R does not affect the tool direction vector, it can be assumed to be 0°. 
     The tool direction relative to the workpiece  3  can be more easily intuitively understood by displaying the Euler angles (P, Q, R) of the tool direction vector calculated in this manner and the tool direction vector on the coordinate system movable together with each table ( FIG. 8 ). 
     A numerical controller according to the present invention will now be described with reference to  FIG. 11 . 
     A numerical controller  30  analyzes and interpolates a command program  20  in an analysis unit  21  and an interpolation unit  22 , respectively, and drives servomotors for the individual axes (X-axis servomotor  29 X, Y-axis servomotor  29 Y, Z-axis servomotor  29 Z, B-axis servomotor  29 B, and C-axis servomotor  29 C). This configuration is a conventional one for a numerical controller. 
     In the numerical controller  30  according to the present invention, a tool direction computation unit  23  and a tool direction display unit  24  are connected to the interpolation unit  22 . Generally, in the case of manual operation, a manual operation interpolation unit  27  receives a command for handle feed or jog feed from a manual operation input unit  25  and activates the servomotors  29 X,  29 Y,  29 Z,  29 B and  29 C for each interpolation cycle. A manual tool direction movement amount input unit  26  and a rotation axis movement amount conversion unit  28  are connected to the manual operation input unit  25  and the manual operation interpolation unit  27 , respectively. As mentioned before, the tool direction computation unit  23  and the rotation axis movement amount conversion unit  28  share parts in common and are inseparable. 
     Processing according to the individual embodiments will now be described with reference to flowcharts.  FIG. 12  is a flowchart showing processing by a tool direction computation unit  23  according to Embodiment 1. The processing is explained below according to respective steps. 
     [Step SA 01 ] The positions (rotation axis positions) B and C of the rotary B- and C-axes are acquired. 
     [Step SA 02 ] The tool direction vector as viewed from the workpiece is calculated based on the rotation axis positions B and C and equation (1). 
     [Step SA 03 ] It is determined whether or not to display the tool direction relative to the workpiece in vector representation on the display unit. If the tool direction is displayed in vector representation (YES), this processing ends. If not (NO), the program proceeds to Step SA 04 . 
     [Step SA 04 ] It is determined whether or not to display the tool direction relative to the workpiece in roll-pitch-yaw angle representation on the display unit. If the tool direction is displayed in roll-pitch-yaw angle representation (YES), the program proceeds to Step SA 05 . If not (NO), the program proceeds to Step SA 06 . 
     [Step SA 05 ] A method of displaying the tool direction relative to the workpiece in roll-pitch-yaw angle representation is calculated by equation (2), whereupon this processing ends. 
     [Step SA 06 ] A method of displaying the tool direction relative to the workpiece in Euler angle representation is calculated by equation (3), whereupon this processing ends. 
       FIG. 13  is a flowchart showing processing by a rotation axis movement amount conversion unit  28  according to Embodiment 2. The processing is explained below according to respective steps. 
     [Step SB 01 ] The tool direction vector as viewed from the workpiece is calculated based on the positions (rotation axis positions) B and C of the rotary B- and C-axes and equation (1). 
     [Step SB 02 ] Whether the direction of rotation is about the X-axis, Y-axis, or Z-axis is determined. If the direction of rotation is about the X-axis, the program proceeds to Step SB 03 . If the direction of rotation is about the Y-axis, the program proceeds to Step SB 04 . If the direction of rotation is about the Z-axis, the program proceeds to Step SB 05 . 
     [Step SB 03 ] The tool is manually rotated by ΔI about the X-axis (roll) according to equation (4), whereupon the program proceeds to Step SB 06 . 
     [Step SB 04 ] The tool is manually rotated by ΔJ about the Y-axis (pitch) according to equation (5), whereupon the program proceeds to Step SB 06 . 
     [Step SB 05 ] The tool is manually rotated by ΔK about the Z-axis (to yaw) according to equation (6), whereupon the program proceeds to Step SB 06 . 
     [Step SB 06 ] The rotation axis positions B and C are calculated by equation (7), whereupon the processing ends. 
       FIG. 14  is a flowchart showing processing by a tool direction computation unit  23  according to Embodiment 3. The processing is explained below according to respective steps. 
     [Step SC 01 ] The positions (rotation axis positions) A and C of the rotary A- and C-axes are acquired. 
     [Step SC 02 ] The tool direction vector as viewed from the workpiece is calculated based on the rotation axis positions A and C and equation (8). 
     [Step SC 03 ] It is determined whether or not to display the tool direction relative to the workpiece in vector representation on the display unit. If the tool direction is displayed in vector representation (YES), this processing ends. If not (NO), the program proceeds to Step SC 04 . 
     [Step SC 04 ] It is determined whether or not to display the tool direction relative to the workpiece in roll-pitch-yaw angle representation on the display unit. If the tool direction is displayed in roll-pitch-yaw angle representation (YES), the program proceeds to Step SC 05 . If not (NO), the program proceeds to Step SC 06 . 
     [Step SC 05 ] A method of displaying the tool direction relative to the workpiece in roll-pitch-yaw angle representation is calculated by equation (9), whereupon this processing ends. 
     [Step SC 06 ] A method of displaying the tool direction relative to the workpiece in Euler angle representation is calculated by equation (10), whereupon this processing ends. 
       FIG. 15  is a flowchart showing processing by a tool direction computation unit  23  according to Embodiment 4. The processing is explained below according to respective steps. 
     [Step SD 01 ] The positions (rotation axis positions) B and C of the rotary B- and C-axes are obtained. 
     [Step SD 02 ] The tool direction vector as viewed from the workpiece is calculated based on the rotation axis positions B and C and equation (11). 
     [Step SD 03 ] It is determined whether or not to display the tool direction relative to the workpiece in vector representation on the display unit. If the tool direction is displayed in vector representation (YES), this processing ends. If not (NO), the program proceeds to Step SD 04 . 
     [Step SD 04 ] It is determined whether or not to display the tool direction relative to the workpiece in roll-pitch-yaw angle representation on the display unit. If the tool direction is displayed in roll-pitch-yaw angle representation (YES), the program proceeds to Step SD 05 . If not (NO), the program proceeds to Step SD 06 . 
     [Step SD 05 ] A method of displaying the tool direction relative to the workpiece in roll-pitch-yaw angle representation is calculated by equation (12), whereupon this processing ends. 
     [Step SD 06 ] A method of displaying the tool direction relative to the workpiece in Euler angle representation is calculated by equation (13), whereupon this processing ends.