help how to make polygon

This is a discussion on help how to make polygon within the C++ Programming forums, part of the General Programming Boards category; plz tell how to write the program for filling a polygon in electronic fashion and u may fill it with ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    13

    help how to make polygon

    plz tell how to write the program for filling a polygon in electronic fashion and u may fill it with pixel and first generate a polygon as shown below then fill the polygon, all slope lines are 45 degrees.


    __________________
    | |
    | |
    | |
    | |
    | |
    | |
    | /\ |
    | / \ |
    | / \ |
    | / \ |
    | / \ |
    | / \ |
    |/ \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \ |
    \|

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    > how to write the program for filling a polygon
    goto www.google.com

    type in
    polygon fill algorithm

    Start reading
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Sorry hun, this belongs more to the world of OpenGL.

  4. #4
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Using Win32 primitive drawing, you could use this function:

    BOOL Polygon(HDC, hDC, CONST POINT* pt, int iCount);

    All you have to do, is to fill an array with points.. and it will connect them for you.

    Code:
    void GamePaint(HDC hDC)
    {
         POINT points[3];
         points[0] = { 5, 10};
         points[1] = {25, 30};
         points[2] = {15, 20};
         Polygon(hDC, points, 3);
    }
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Point in polygon test - spherical coords
    By bhdz in forum C Programming
    Replies: 1
    Last Post: 11-07-2007, 12:25 PM
  2. "Cannot make pipe"
    By crepincdotcom in forum C Programming
    Replies: 5
    Last Post: 08-16-2004, 12:43 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21