Frequently Asked Questions
оглавление | demo party в ex-СССР | infused bytes e-mag | новости от ib/news | другие проекты | письмо | win koi lat

следующий фpагмент (2)
- Usenet echoes (21:200/1) ------------------------------------- COMP.GRAPHICS - Msg : 106 of 229 From : 2:5030/144.99 08 Jun 94 10:48:02 To : All 09 Jun 94 05:14:32 Subj : (1) A SIMPLE AND HIGH SPEED VECTOR TO RASTER TECHNIQUE -------------------------------------------------------------------------------- Hi, all: The high speed vector to raster technique is a result of the using of L2j original data structure. L2j allows to make the precise computing with real numbers without using a fixed-point arithmetic with simple, efficient, obvious and high speed method. To demonstrating of the using of the L2j data structure quotes L2j_DDA vector to raster conversion technique. MODIFIED DDA VECTOR TO RASTER CONVERSION METHOD BACKGROUND OF THE INVENTION The technique for vector to raster conversion what are known as digital difference analysis (DDA) computes the coordinates of the current pixel on the line from the coordinates of the current pixel and the slope M according to: M = (Y2 - Y1)/(X2 - X1); X[i+1] = X[i] + 1; Y[i+1] = Y[i] + M; The pixel at coordinates (X[i+1], ROUND(Y[i+1]) ), where ROUND identifies the rounding operation is then chosen to represent the line. A fixed-point arithmetic must be performed to track the Y coordinate and the rounding operation is time consuming, but with L2j all fixed-point operations changes on the integer operations and rounding operation is complete disappear. In most cases now is used Bresenham algorithm, because DDA too slow. After L2j appearing the DDA algorithm become better than Bresenham. SUMMARY OF THE INVENTION It would therefore be an advantage to provide the data structure what allows to make the precise computing with real numbers without using a fixed-point arithmetic and to provide with it assisting a simple, efficient, and high speed vector to raster conversion technique. L2j is long integer type divided on the two integer parts, "whole" and "fractional", with separated access to both ones. L2j_DDA raster conversion method is a DDA method, but in all cases in it where uses a float type is used L2j type. DESCRIPTION OF THE INVENTION All arithmetic operations with L2j (addition, subtract, division, multiplication) is doing like to long int with du. Initiate L2j is doing through d with int and with clearing u. After all arithmetic operations with L2j we have the whole part in d and fractional part in u. typedef union { long du; /* precise number */ struct { unsigned u; /* fractional part of the precise number */ int d; /* whole part of the precise number */ }dd; } L2j; /* L2j_DDA function: (it is the major-axis algorithm) */ void lineL2j(int startx, int endx, int starty, int endy) { L2j M = {0L,{0,0}}; /* the line slope */ int delta_x = endx - startx; int delta_y = endy - starty; if( delta_x || delta_y ) { /* to ignore 0-lines */ if( abs(delta_x) >= abs(delta_y) ) { L2j py; /* precise Y */ M.dd.d = delta_y; M.du /= delta_x; /* long int dividing */ for(py.dd.d = starty, py.dd.u = 0; startx <= endx; startx++, py.du += M.du) mempoint( startx, py.dd.d); /* put one pixel to bitmap memory */ } else { L2j px; /* precise X */ M.dd.d = delta_x; M.du /= delta_y; /* long int dividing */ for(px.dd.d = startx, px.dd.u = 0; starty <= endy; starty++, px.du += M.du) mempoint( px.dd.d, starty); } } } DDA is short and clean technique. L2j_DDA is short, clean and high speed technique. Restrictions: 1) L2j_DDA technique can be only useful on the processors where integer dividing is realized, 2) if( sizeof(long) = 2*sizeof(int) ) is true in your C compiler then you can direct to use L2j and L2j_DDA without any change, else it requires to put the finishing touches. COMPLETION If you get ready to use L2j or L2j_DDA and you want to have a clean your conscience, please REMIT the registration fee $119 - to business applications, $59 - to other through or through BANKERS TRUST COMPANY VEREINS UND WESTBANK account (USD): 04-094-032 account (DEM): 1/07/90988 (New York branch office) account (USD): 6/01/10/87407 P.O.Box 3688 Aktiengeselshaft: Head Office Church Street Station International Division New York, N.Y. 10015-3688 Alter Wall 22, P.O.Box 110273 US D-2000 Hamburg 11 to Lviv branch office of ZAKB "LISBANK" Naukova 7a, 290060 Lviv, Ukraine for Alexander N. Franchuk, Naukova st., 29-60, Lviv 60, Ukraine and send me a postcard with your address, business/nonbusiness application, [company] to Alexander N. Franchuk, Naukova st., 29-60, 290060 Lviv, Ukraine References: 1. Tile Vector to Raster Conversion Method, U.S. Patent #5,028,848, July 2, 1991 2. Gerbert Shildt, C to professional programmers Alexander N. Franchuk

Всего 1 фpагмент(а/ов) |пpедыдущий фpагмент (1)

Если вы хотите дополнить FAQ - пожалуйста пишите.

design/collection/some content by Frog,
DEMO DESIGN FAQ (C) Realm Of Illusion 1994-2000,
При перепечатке материалов этой страницы пожалуйста ссылайтесь на источник: "DEMO.DESIGN FAQ,".