Copyright © Philip M. Parker, INSEAD. Terms of Use.

C CODE

Specialty Definition: Bresenham's line algorithm C code

(From Wikipedia, the free Encyclopedia)

An example of Bresenham's line algorithm in C follows. The plotting function is not shown.

void drawline2d(int x0, int y0, int x1, int y1, int color)
{
       int i;
       int steep = 1;
       int sx, sy;  /* step positive or negative (1 or -1) */
       int dx, dy;  /* delta (difference in X and Y between points) */
       int e;

/* * inline swap. On some architectures, the XOR trick may be faster */ int tmpswap; #define SWAP(a,b) tmpswap = a; a = b; b = tmpswap;

/* * optimize for vertical and horizontal lines here */ dx = abs(x1 - x0); sx = ((x1 - x0) > 0) ? 1 : -1; dy = abs(y1 - y0); sy = ((y1 - y0) > 0) ? 1 : -1; if (dy > dx) { steep = 0; SWAP(x0, y0); SWAP(dx, dy); SWAP(sx, sy); } e = (dy << 1) - dx; for (i = 0; i < dx; i++) { if (steep) { plot(x0,y0,color); } else { plot(y0,x0,color); } while (e >= 0) { y0 += sy; e -= (dx << 1); } x0 += sx; e += (dy << 1); } }

Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Bresenham's line algorithm C code."

Top     

Crosswords: C CODE

Specialty definitions using "C CODE": CLiCCEquelGlasgow Haskell CompilerJavaScriptPurdue Compiler-Construction Tool SetSather. (references)

Source: compiled by the editor from various references; see credits.

Top     

Commercial Usage: C CODE

DomainTitle

Books

  • Writing Bug-Free C Code for Windows: a Programming Style That Automatically Detects Bugs in C Code (Prentice Hall Series on Programming Tools and M) (reference)

    (more book examples)

Source: compiled by the editor from various references; see credits.

Top     

Anagrams: C CODE

Scrabble® Enable2K-Verified Anagrams

Direct Anagrams: codec.

Words within the letters "c-c-d-e-o"

-1 letter: code, coed, deco.

-2 letters: cod, doc, doe, ode.

-3 letters: de, do, ed, od, oe.

 Words containing the letters "c-c-d-e-o"
 

+1 letter: cocked, codecs, decoct.

 

+2 letters: chocked, clocked, coached, coacted, cockade, cockled, codices, coerced, comedic, concede, conduce, couched, crocked, decocts, docetic, ecocide, flocced, occlude, sconced.

 

+3 letters: accolade, accorded, accorder, accosted, caboched, cleidoic, cockaded, cockades, cockered, cockeyed, cocooned, codirect, codpiece, coincide, concaved, conceded, conceder, concedes, conclude, conduced, conducer, conduces, coppiced, corniced, crotched, crouched, cuckooed, decocted, ecocidal, ecocides, occident, occluded, occludes, occulted, occupied, occurred, recocked, scorched, scotched, stuccoed, succored, uncocked.

Source: compiled by the editor from various references; see credits.

SCRABBLE® is a registered trademark. All intellectual property rights in and to the game are owned in the U.S.A and Canada by Hasbro Inc., and throughout the rest of the world by J.W. Spear & Sons Limited of Maidenhead, Berkshire, England, a subsidiary of Mattel Inc. Mattel and Spear are not affiliated with Hasbro.

Top     

Alternative Orthography: C CODE


Hexadecimal (or equivalents, 770AD-1900s) (references)

43      43 4F 44 45

Leonardo da Vinci (1452-1519; backwards) (references)

    

Binary Code (1918-1938, probably earlier) (references)

01000011 00100000 01000011 01001111 01000100 01000101

HTML Code (1990) (references)

&#67; &#32; &#67; &#79; &#68; &#69;

ISO 10646 (1991-1993) (references)

0043      0043 004F 0044 0045

Encryption (beginner's substitution cypher): (references)

37237493839

Top     



INDEX

1. Crosswords
2. Usage: Commercial
3. Anagrams
4. Orthography
5. Bibliography


  

Copyright © Philip M. Parker, INSEAD. Terms of Use.