Posts

Showing posts from February, 2012

Bresenham's line drawing algorithm

A line segment is defined by an infinite set of points which lie between two points; these points have no area. A problem occurs, however, when drawing lines on a computer screen, namely that we have to approximate the line with pixels which are not infinitely small, and which are limited to fixed positions based on the screen resolution. A simple line drawing algorithm can be implemented as, filename dda.py from Tkinter import * import math #defining main function def main(): #reading end points of line x0 = int(raw_input("ENTER THE Xo : ")) y0 = int(raw_input("ENTER THE Yo : ")) x1 = int(raw_input("ENTER THE Xn : ")) y1 = int(raw_input("ENTER THE Yn : ")) root = Tk() pic = PhotoImage(width=800,height=800) lb = Label(root,image=pic) lb.pack() color = "blue" dx = x2 – x1; dy = y2 – y1; m = dy/dx for x in range(x1,x2) y = m*x + y1 + 0.5; pic.put(color(x, y))...

The linux networking commands

In this article i share a list of essential networking commands So upon reading you will be a small network administrator. You want it!!! ,then go ahead.. 1.ping This command is used to check the connectivity of a system to a network.Whenever there is problem in network connectivity we use ping to ensure the system is connected to network. shuhaib@ubuntu:~$ ping 172.16.0.254 PING 172.16.0.254 (172.16.0.254) 56(84) bytes of data. 64 bytes from 172.16.0.254: icmp_req=1 ttl=64 time=51.9 ms 64 bytes from 172.16.0.254: icmp_req=2 ttl=64 time=78.2 ms 64 bytes from 172.16.0.254: icmp_req=3 ttl=64 time=54.2 ms 64 bytes from 172.16.0.254: icmp_req=4 ttl=64 time=31.4 ms or shuhaib@ubuntu:~$ ping yahoo.com PING yahoo.com (98.139.127.62) 56(84) bytes of data. 64 bytes from ir2.fp.vip.sp2.yahoo.com (98.139.127.62): icmp_req=2 ttl=49 time=1605 ms 64 bytes from ir2.fp.vip.sp2.yahoo.com (98.139.127.62): icmp_req=4 ttl=49 time=462 ms 64 bytes from ir2.fp.vip.sp2.yahoo.com (98.139.127.62): icmp_req=5 tt...