<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dos | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/dos/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Fri, 02 Oct 2009 10:34:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C Program to fill any given polygon using scan-line area filling algorithm</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-fill-any-given-polygon-using-scan-line-area-filling-algorithm/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-fill-any-given-polygon-using-scan-line-area-filling-algorithm/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 10:34:38 +0000</pubDate>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[c graphics]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[Data structure]]></category>
		<category><![CDATA[polygon]]></category>
		<category><![CDATA[filling algorithm]]></category>
		<category><![CDATA[filcolor]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=841</guid>

					<description><![CDATA[<p>setcolor (WHITE);<br />
    line (pt[0][0], pt[0][1], pt[1][0], pt[1][1]);<br />
    line (pt[1][0], pt[1][1], pt[2][0], pt[2][1]);<br />
    line (pt[2][0], pt[2][1], pt[0][0], pt[0][1]);<br />
    getch();</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-fill-any-given-polygon-using-scan-line-area-filling-algorithm/">C Program to fill any given polygon using scan-line area filling algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="c" escaped="true" line="1">
#include <graphics.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

struct Node
{
    int x;
    int y;
    struct Node* next;
};

void fill (int pt[][2], int clr);
void floodfill4 (int x, int y, int oldclr, int newclr);
void insert (int x, int y, struct Node** last);

void main()
{
    int i, j;
    int pt[3][2];
    int clr;

    printf ("This program demonstrates filling a polygon.\n");
    printf ("Enter the x- and y-coordinates for three points:\n");
    for (i=0; i<3; i++)
	for (j=0; j<2; j++)
	    scanf ("%d", &#038;pt[i][j]);

    printf ("Enter the fill-colour: (Any number from 1 to 14) ");
    scanf ("%d", &#038;clr);
    fill (pt, clr);
}

void fill (int pt[][2], int clr)
{
    int gd = DETECT, gm;
    int seedx, seedy;

    initgraph (&#038;gd, &#038;gm, "..\\bgi");

    setcolor (WHITE);
    line (pt[0][0], pt[0][1], pt[1][0], pt[1][1]);
    line (pt[1][0], pt[1][1], pt[2][0], pt[2][1]);
    line (pt[2][0], pt[2][1], pt[0][0], pt[0][1]);
    getch();

    seedx = (pt[0][0] + pt[1][0] + pt[2][0]) / 3;
    seedy = (pt[0][1] + pt[1][1] + pt[2][1]) / 3;

    floodfill4 (seedx, seedy, BLACK, clr);
    getch();

    closegraph();
    return;
}

void floodfill4 (int x, int y, int oldclr, int newclr)
{
    struct Node* first, *last, *tmp;

    first = (struct Node*) malloc (sizeof (struct Node));
    if (first == NULL)
    {
	closegraph();
	fprintf (stderr, "floodfill4: Out of memory.\n");
	exit (2);
    }
    if (oldclr == newclr)
    {
	free (first);
	return;
    }
   
    first->x = x;
    first->y = y;
    first->next = NULL;
    last = first;

    while (first != NULL)
    {
	putpixel (x, y, newclr);
	
	if (getpixel (x, y-1) == oldclr)
	{
	    putpixel (x, y-1, newclr);
	    insert (x, y-1, &last);
	}
	

	if (getpixel (x, y+1) == oldclr)
	{
	    putpixel (x, y+1, newclr);
	    insert (x, y+1, &last);
	}
	
	if (getpixel (x-1, y) == oldclr)
	{
	    putpixel (x-1, y, newclr);
	    insert (x-1, y, &last);
	}
	
	if (getpixel (x+1, y) == oldclr)
	{
	    putpixel (x+1, y, newclr);
	    insert (x+1, y, &last);
	}
	
	tmp = first;
	first = first->next;
	x = first->x;
	y = first->y;
	free (tmp);
    }
}

void insert (int x, int y, struct Node** last)
{
    struct Node* p;
    p = (struct Node*) malloc (sizeof (struct Node));
    if (p == NULL)
    {
	closegraph();
	fprintf (stderr, "\n insert: Out of memory.\n");
	exit (2);
    }
    
    p->x = x;
    p->y = y;
    p->next = NULL;
    (*last)->next = p;
    *last = (*last)->next;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-fill-any-given-polygon-using-scan-line-area-filling-algorithm/">C Program to fill any given polygon using scan-line area filling algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-fill-any-given-polygon-using-scan-line-area-filling-algorithm/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>C Program to implement Bezier curves for a given set of control points.</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-implement-bezier-curves-for-a-given-set-of-control-points/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-implement-bezier-curves-for-a-given-set-of-control-points/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 10:26:58 +0000</pubDate>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[c graphics]]></category>
		<category><![CDATA[bgi]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[Bezier curves]]></category>
		<category><![CDATA[control points]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=835</guid>

					<description><![CDATA[<p>double xt = pow (1-t, 3) * x[0] + 3 * t * pow (1-t, 2) * x[1] +<br />
    3 * pow (t, 2) * (1-t) * x[2] + pow (t, 3) * x[3];</p>
<p>double yt = pow (1-t, 3) * y[0] + 3 * t * pow (1-t, 2) * y[1] +<br />
    3 * pow (t, 2) * (1-t) * y[2] + pow (t, 3) * y[3];</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-implement-bezier-curves-for-a-given-set-of-control-points/">C Program to implement Bezier curves for a given set of control points.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="c" escaped="true" line="1">
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <math.h>

void bezier (int x[4], int y[4])
{
    int gd = DETECT, gm;
    int i;
    double t;

    initgraph (&gd, &gm, "..\\bgi");

    for (t = 0.0; t < 1.0; t += 0.0005)
    {
	double xt = pow (1-t, 3) * x[0] + 3 * t * pow (1-t, 2) * x[1] +
		    3 * pow (t, 2) * (1-t) * x[2] + pow (t, 3) * x[3];

	double yt = pow (1-t, 3) * y[0] + 3 * t * pow (1-t, 2) * y[1] +
		    3 * pow (t, 2) * (1-t) * y[2] + pow (t, 3) * y[3];

	putpixel (xt, yt, WHITE);
    }

    for (i=0; i<4; i++)
	putpixel (x[i], y[i], YELLOW);

    getch();
    closegraph();
    return;
}

void main()
{
    int x[4], y[4];
    int i;

    printf ("Enter the x- and y-coordinates of the four control points.\n");
    for (i=0; i<4; i++)
	scanf ("%d%d", &#038;x[i], &#038;y[i]);

    bezier (x, y);
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-implement-bezier-curves-for-a-given-set-of-control-points/">C Program to implement Bezier curves for a given set of control points.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/graphics/c-program-to-implement-bezier-curves-for-a-given-set-of-control-points/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
