METHOD FOR HIDDEN LINE REMOVAL

Abstract: A method of removing hidden lines in a two-dimensional surface chart disclosing an image of a three-dimensional surface, includes storing the X, Y and Z co-ordinates of selected points (A, B, C, D, E) of the surface as a first matrix, transforming the first matrix into a second matrix indicating the drawing sequence through the selected points, rotating the points of the second matrix around the Z-axes a first angle α, rotating the second matrix points a second angle β and drawing the two-dimensional surface chart in accord­ ance with the indicated sequence using the X and Y co-ordinate values of the rotated points. The drawing sequence comprises a drawing operation of X-traces, an X-trace being defined as a line passing through points having substantially the same Y values in the first matrix, the drawing operation of one X-trace being followed by a plurality of ΔY-trace drawing operations between the last drawn X-trace and the next to be drawn X-trace, an Y-trace being defined as a line passing through points having substantially the same X values in the first matrix and a ΔY-trace being defined as the part of an Y-trace falling between two adjacent X-traces, said sequential drawing operation proceeding in sequence from low Y value X-traces toward high value X-traces. No lines are drawn inside a forbidden area being defined as an area surrounded by an upper horizon and a lower horizon.

Description: The present invention relates to a method for hidden line removal in a surface chart. The IBM Technical Disclosure Bulletin September 1978, pp 1715-1716, author Appel et al, describes a modified hidden line removal algorithm imparting a sense of depth and orientation to a computer generated graphic image of a three-dimensional object without requiring the complete elimination of all hidden lines, thereby avoiding the large overhead of a complete algorithm. IEEE Computer Graphics Appl. vol.4 no.6, June 1984, pp 11-13, author Fuyimoto et al, describes an algorithm for hidden surface removal using triangles in three dimensional image processing. US patent 4 222 048 relates to a three-dimension graphic generator comprising means for co-ordinate rotation and hidden line removal. EP-A2-151274, filed before but published after the present application, relates to a method for displaying three-dimensional objects with hidden lines removed. An object of the present invention is to provide a simple method for performing hidden line removal on a two-dimensional image of a three-dimensional surface. Another object of the present invention is to provide a method for a high resolution hidden line removal in a two-dimensional image displaying a three-dimensional surface. The present invention can favourably be implemented using an APL (A Programming Language) matrix operation. The present invention is disclosed in the attached claims. The invention will now be described with reference to the attached drawings in which: FIG.1 discloses a two-dimensional surface chart with removed hidden lines according to the present invention. FIG.2 discloses a two-dimensional surface chart including all hidden lines. FIG.3 discloses a surface chart simular to FIG.2 where all the hidden lines have been removed. FIG.4 discloses a two-dimensional surface chart for a 25 point surface with all hidden lines removed according to the present invention. FIG.5 discloses a similar surface chart as FIG.4 with the hidden lines indicated with dotted lines. FIG.6 and FIG.7 discloses a part of the surface chart of FIG.5 indicating upper and lower horizon lines. FIG.8 discloses a detailed picture of the drawing steps used according to the present invention. FIG.1 is an example of a two-dimensional surface chart providing an image of a three-dimensional surface. This chart gives a three-dimensional impression to the viewer because all of the hidden lines have been removed and this chart presents the final result of a drawing method according to the present invention. FIG.2 represent another exampel of a two-dimensional surface chart according to the present invention. However, in this chart all the hidden lines are still in the picture. Therefore the viewer of the picture does not get a tree-dimensional impression of the image. The chart is drawn in a co-ordinate axis system comprising an X-axis, an Y-axis and a Z-axis. The lines parallel to the X-axis are called X-traces and the lines parallel to the Y-axis are called Y-traces. FIG.3 discloses the same surface image as FIG.2, however all the hidden lines are removed according to the present invention. All the X-traces are shown as lines X1, X2...Xn and the Y-traces are shown as lines Y1, Y2...Yn. In this figure n=30. All the X-traces are cutting each Y-trace into n-l segments. The first Y-trace, Y1 is cut into n-1 segments starting at Δ Y11, Δ Y12... Δ Y1N. The second Y-trace, Y2 comprises Δ Y21, Δ Y22... Δ Y2N. Simularily the last Y-trace Yn comprises ΔYn1, ΔYn2... Δ Ynn. The two-dimensional surface chart of FIG.3 is drawn using the method of the present invention as follows: 1. The X, Y, Z co-ordinates of all the crosspoints for all X and Y traces will be stored into a matrix. 2. The stored data in the matrix will first be modified by a co-ordinate rotation round the Z-axes of a selected angle alpha. 3. The modified data in the matrix will be subject to a second modification through a second co-ordinate rotation around the X-axes of a selected second angle beta. 4. The first Y-trace, Y1 will be drawn using the modified data from the matrix. 5. The first X-trace, X1 will be drawn using the modified data in the matrix. 6. Δ Y21, Δ Y31..Δ Yn1 will be drawn. 7. X2 will be drawn. 8. X1 will be defined as a lower horizon and X2 as an upper horizon. The area between the upper and the lower horizon is defined as a forbidden area, no lines shall be drawn in this area. 9. Δ Y22, Δ Y32.... Δ Yn2 will be drawn. 10. X3 will be drawn. X3 will replace X2 as the new horizon. 11. The drawing operation will continue alternating between drawings for a plurality of delta Y values and drawings of an X-trace. Each newly drawn X-trace will modify the forbidden area such that no later drawings are allowed inside this forbidden area. FIF.4 and FIG.5 discloses a 25 point surface chart, FIG.4 with all the hidden lines removed and FIG.5 with the hidden lines shown with dotted lines. In FIG.5 the first X-trace is represented by the points Al, A2, A3, A4 and A5. Simularily the second X-trace is represented by the points B1 - B5, the third X-trace by the point C1 - C5, the fourth X-trace by D1 - D5 and the fifth X-trace by E1 - E5. The first Y-trace comprises the points A1, B1, C1, D1 and E1. The second Y-trace comprises the points A2 - E2, the third Y-trace comprises the points A3 - y3 etc. A cross-point between C2 C3 and B2 B3 is designated C23 and a cross-point between B4 B5 and C4 C5 is designated C45. The co-ordinate values for the points shown in FIG.5 are disclosed in the Z-matrix of TABLE 1 in the Appendix. According to the TABLE 1 point A1 in FIG.5 has the values X=4, Y=1, Z=10 and point A2 X=5, Y=l, Z=10 etc. According to the present invention the Z-matrix of TABEL 1 will be rearranged into a drawing sequence. This is shown in TABLE 2 in the Appendix. In TABLE 2 the first column is a printcode. When the printcode is zero it means that no drawin will accur to the point represented by the corresponding X, Y, Z co-ordinates. When the printcode is 101, it means that a line is drawn from the previous point to the point represented by the corresponding X, Y, Z co-ordinates. The five first lines of TABLE 2 determine that a line will be drawn from point A1 to B1, C1, D1, E1 as discribed previously. Line 6 tells that no drawing will be made when moving from point E1 to point A1 according to FIG.5. The lines 7 - 10 of the TABLE determine the drawing operation of the first X-trace Al - A5. The lines 11 - 18 of the TABLE disclose the drawing of delta Y-lines A2 - B2, A3 - B3, A4 - B4 and A5 - B5. Next the lines 19 - 23 disclose the drawing of the second X-trace B1 - B5. The rest of the TABLE is built up similarily with alternating delta Y-traces and X-traces. It should be noted that no printing or drawing will actually occur during the processing of TABLE 2, only the drawing sequence will be set up when TABLE 2 is assembled. Next an aspect transformation is performed according to the following statements: New X = (X-3) x 0,833 New Y = Y x 0,833 New Z = Z x 0,0938 TABLE 3 in the Appendix. The next step is a rotation round the Z-axes. The TABLE 4 below will disclose the new coordinate values when a rotation of 15 degrees (∝ = 15°) around the Z-axes has been performed. TABLE 4 in the Appendix. Next a 65 degree rotation around the X-axes will be performed (β = 65°). TABLE 5 in the Appendix. The following step is a projection into the X-Y plane that will contain the two-dimensional image of the surface chart. This is a very easy transformation, all Z-values are omitted. TABLE 6 in the Appendix. A final transformation will now be performed including an origo transformation (X0 = 1312,3, Y0 = 370,0) and a magnitude tranformation where M = 414,6. The object of these transformations is to map the image of the surface chart into the coordinate system of the graphics display device. TABLE 7 in the Appendix. TABLE 7 is the final matrix used to draw the two-dimensional surface chart disclosed in FIG.5. It should however be noted that FIG.5 includes all the hidden lines. All the hidden lines should be removed according to the method disclosed in FIG.6 and FIG.7. According to the previous description the drawing operation will start by drawing the first Y-trace, the line A1, B1, C1, D1, E1 and will continue with the first X-trace, the line A1, A2, A3, A4, A5. An upper horizon will then be established along the points U1, U2, E1, D1, C1, B1, Al, A2, A3, A4, A5, U3, U4. In this upper horizon line the points U represent substantially low values. Similarily a lower horizon will be established along the points L1, L2, E1, D1, C1, B1, A1, A2, A3, A4, A5, L3, L4. The lower horizon points L represents substantially high values. It can be seen that in this state of the drawing process, corresponding to the rows 1 - 10 of the various matrices, the upper horizon and the lower horizon are overlapping each other in the area of the 25-point matrix. However, during the processing steps disclosed on the rows 11 - 18 of the tables, see FIG.6, an upper horizon is established along the points U1, U2, E1, D1, C1, B1, A1, A2', B2, A2, A3', B3, A3, A4', B4, A4, A5', B5, A5, U3, U4. The upper horizon includes spikes due to the Δ y drawing steps. During the drawing steps 19 - 23, see FIG.7, the upper horizon is updated to the points U1, U2, E1, D1, C1, B1, B2, B3, B4, B5, A5, U3, U4. The lower horizon is however unchanged along the points L1, L2, E1, D1, C1, B1, A1, A2, A3, A4, A5, L3, L4. The forbidden area is now represented by the area between the upper horizon and the lower horizon, the area surounded by the lines A1, B1, B2, B3, B4, B5, A5, A4, A3, A2, A1. The forbidden area will continuously increase when the drawing operation continues. Turning back to FIG.5 and TABLE 2 it can be seen that the tablerow 25 indicates the drawing of a line from point B2 to point C2. This is not within the forbidden area and hence this line will be drawn. The tablerow 26 indicates a jump from point C2 to point B3. The next tablerow 27 however indicates a drawing operation from point B3 to point C3. According to FIG.5 this line will be within the forbidden area and is hence indicated as a dotted line. Therefore this line is not shown in the final picture of FIG.4. Row 27 in TABLE 2 discloses therefore the first hidden line to be removed. The same is true of course also for tablerow 27 in the final TABLE 7. Returning again to FIG.5 and TABLE 2 it can be seen that the next hidden line to be removed is disclosed on a tablerow 29 representing the dotted line B4 - C4. The next delta y-line represented by the tablerow 31 and shown in FIG.5 as the line B5 - C5 is not within the forbidden area and will be fully drawn. When the next X-trace C1 - C5 will be drawn according to the tablerow 33 - 36 in TABLE 2, the upper horizon will change from B1, B2, B3, B4, B5 to C1, C2, C23, B3, B4, C45, C5, B5. This horizon sector includes two interesting points, i e C23 and C45. This means that the lines C2 - C3 shall be drawn from the point C2 until point C23, but no drawing shall occur from point C23 to C3. simularily the hidden line C4 - C45 shall not be drawn but the line C45 - C5 shall be drawn. The problem of removing partial hidden lines such as the lines C23 - C3 and C4 - C45, is solved according to the present embodiement of the invention as follows: The drawing of a sector line such as the sectorline C1 - C2 is drawn according to a plurality of incremental lines, say in the order of hundered steps between the point C1 and C2. For each such incremental drawing step a check is made wheather the actual position of the drawing step is within or outside the forbidden area. This means that when the drawing process proceeds from point C2 toward the point C23, the checking operation indicates that each incremental drawing step is outside the forbidden area. The contrary will be true after point C23 has been past and the drawing operation continued towards point C3. FIG.8 discloses in more detail the method of drawing a line from the point B2 to the point C2 and similarily from point C2 towards point C3 in FIG.5 In case the angle "a" between the X-axis and the line to be drawn from B2 to C2 is larger than 45°, then the line will be drawn in incremental steps of "s" using X-rasters 10. When, however the corresponding angle "b" for the points C2, C3 is less than 45°, then the line will be drawn in incremental steps of "r" using Y-rasters 11. This is an easy operation when an APL programming language is used. It should be considered that the present invention can favorably be used for various rotational angles ∝ and β In case the angle ∝ for the Z-axes rotation is over 45°, then the drawing rules for the x and y coordinates must be exchanged. This means that the drawing sequence will be as follows: 1. The first X-trace is drawn. 2. The first Y-trace is drawn. 3. The first plurality of Δ X-trace are drawn. 4. The second Y-trace is drawn. 5. The second plurality of Δ X-traces are drawn. 6. The third Y-trace is clockwise etc. It should further be considered that the rotational angles can be over 90° and both positive and negative, whereby the drawing sequences must be adjusted accordingly. It should also be considered that the incremental line drawing operations can be avoided by updating the various table values with cross point co-ordinate values for such cross points as C23, C45 etc. Such an updating operation can preferably be made when the horizon information is updated. Summarizing it can be said that according to one embodiment of the present invention a method is disclosed for producing a first plurality of tables for the coordinate values for various corner points and cross points a second table for the upper horizon and a third table for the lower horizon, whereby the amount of information stored in the second and third table is a magnitude higher than in the first table. The present invention is preferably implemented in a system including a work station having a keyboard and a display attached to a computer and a printer. A stored APL program in the computer controls the drawing operation in the printer based upon initial surface matrix data imputted to the system from the keyboard. APPENDIX

Claims: Method for removing hidden lines in a two-dimensional surface chart disclosing an image of a three-dimensional surface, including storing the X, Y and Z, co-ordinates of sample points (A, B, C, D, E) of the surface as a first matrix, transforming the first matrix into a second matrix forming a sequence table indicating the drawing sequence through the sample points, rotating the points of the second matrix around the Z-axes through a first angle ∝, rotating the said rotated second matrix points around the X-axes through a second angle β and drawing the two-dimensional surface chart in accordance with the indicated sequence using the X and Y co-ordinate values of the rotated points, characterized in that said drawing sequence comprises a drawing operation of X-traces, an X-trace being defined as a line passing through points having substantially the same Y values in said first matrix, the drawing operation of one X-trace being followed by a plurality of Δ Y -trace drawing operations between the last drawn X-trace and the next to be drawn X-trace, an Y-trace being defined as a line passing through points having substantially the same X values in the first matrix and a Δ Y-trace being defined as the part of an Y-trace falling between two adjacent X-traces, said sequential drawing operation proceeding in sequence from low Y value X-traces toward high Y value X-trace. and in that no lines are drawn inside a forbidden area being defined by previously drawn lines. A method according to the claim 1 wherein the forbidden area is defined as an area filling between an upper horizon and a lower horizon. A method according to the claim 2 wherein the forbidden area between the upper and lower horizon is sequentially increased when the drawing operation is proceeding. A method according to the claim 3 wherein the upper horizon in a starting stage of the operation extends from an initial low value (U1, U2) up to the end point (E1) of the first Y-trace (A1, B1, C1, D1, E1), follows said Y-trace, follows the first X-trace (A1, A2, A3, A4, A5) and drops down to said initial low value (U3, U4). A method according to the claim 3 wherein the lower horizon in a starting stage of the operation extends from an initial high value (L1, L2) down to the end point (E1) of the first Y-trace (A1, B1, C1, D1, E1), follows laid Y-trace, follows the first X-trace (A1, A2, A3, A4, A5) and jumps up to said initial high value (L3, L4). A method according to the claims 3 and 4 wherein the upper horizon in a second stage of an operation (FIG.6) follows the second X-trace (B1, B2, B3, B4, B5) instead of the first X-trace, whereas the lower horizon remains unchanged, whereby the forbidden area is formed between the first and second X-traces. A method according to the claim 1" wherein said matrix transformation includes assigning drawn - no drawn parameters to each matrix row. A method according to the claim 1 wherein said matrix transformation includes an origin translation and a magnitude transformation of the co-ordinate values before the rotation step. A method according to the claim 1 wherein an origin translation and a magnitude transformation is executed after the rotation operation but before the drawing operation. A method according to any preceeding claim wherein information defining the upper and lower horizons is stored and continuously updated for each drawing operation outside the present forbidden area. A method according to any proceeding claim wherein each drawing operation between two of said selected points is made by a plurality of incremental steps (s, r, FIG.7) and wherein a check is made for each such step wheather the corresponding line increment falls within the forbidden area and if this is the case, inhibiting the drawing of the following line increments inside that forbidden area. A method according to claims 10 and 11 wherein the horizon information is updated for each incremental drawing step outside the forbidden area. A method according to claim 11 wherein the length of each incremental stop is defined by an X-raster partitioning method depending on wheather the angle (a) between the line to be drawn and the X-axis is more than 45% or less respectively. A method according to any of the preceeding claims wherein the drawing rules for the X and Y co-ordinates are exchanged then the rotation angel ∝ around the Z-axes exceeds a predetermined value. A method according to any of the preceeding claims wherein the number of co-ordinate points stored for the upper and lower horizon is a magnitude higher than the number of co-ordinate points stored for the selected points of the three dimensional surface.

Inventors: KELLY, ROBERT EMMETT, WELCH, PETER DUNBAR
Applicants: INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1986
Main classification: G06F15
IPC codes: G06T15