Tuesday, March 1, 2011

CG-Bresenham’s circle drawing algorithm.

Bresenham's circle algorithm calculates the locations of the pixels in the first 45 degrees. It assumes that the circle is centered on the origin. So for every pixel (x,y) it calculates we draw a pixel in each of the 8 octants of the circle :

PutPixel(Center X + X, Center Y + Y)
PutPixel(Center X + X, Center Y - Y)
PutPixel(Center X - X, Center Y + Y)
PutPixel(Center X - X, Center Y - Y)
PutPixel(Center X + Y, Center Y + X)
PutPixel(Center X + Y, Center Y - X)
PutPixel(Center X - Y, Center Y + X)
PutPixel(Center X - Y, Center Y - X)

So let's get into the actual algorithm. Given a radius for the circle we perform this initialisation:

d := 3 - (2 * RADIUS)
x := 0
y := RADIUS
 Now for each pixel we do the following operations:

Draw the 8 circle pixels
if d < 0 then
    d := d + (4 * x) + 6
else
  begin
    d := d + 4 * (x - y) + 10
    y := y - 1;
  end;
 And we keep doing this until x = y. Note that the values added to the decision variable in this algorithm (x and y) are constantly changing, so we cannot precalculate them. The muliplications however are by 4, and we can accomplish this by shifting left twice.

Thursday, February 24, 2011

Graphics Workstation

A workstation is a high-end microcomputer designed for technical or scientific applications. Intended primarily to be used by one person at a time, they are commonly connected to a local area network and run multi-user operating systems. The term workstation has also been used to refer to a mainframe computer terminal or a PC connected to a network.


Computer intended for use by one person, but with a much faster processor and more memory than an ordinary personal computer. Workstations are designed for powerful business applications that do large numbers of calculations or require high-speed graphical displays.


Historically, workstations had offered higher performance than personal computers, especially with respect to CPU and graphics, memory capacity and multitasking capability. They are optimized for the visualization and manipulation of different types of complex data such as 3D mechanical design, engineering simulation (e.g. computational fluid dynamics), animation and rendering of images, and mathematical plots. Consoles consist of a high resolution display, a keyboard and a mouse at a minimum, but also offer multiple displays, graphics tablets, 3D mice (devices for manipulating and navigating 3D objects and scenes), etc. Workstations are the first segment of the computer market to present advanced accessories and collaboration tools.

 The term workstation is also sometimes used to mean a personal computer connected to a mainframe computer, to distinguish it from “dumb” display terminals with limited applications.

Workstation class graphics include:
  • Advanced technology including full floating point precision for superior image quality, high performance for large datasets and dual display/ultra-high resolution support.
  • Application certification for OpenGL and DirectX support on Windows® and Linux® .
  • Robust software and hardware compatibility testing to maximize uptime and productivity.
  • Support for workstation users with direct links to engineering resources.
refer : http://www.dell.com/content/topics/global.aspx/solutions/en/precision_graphics?c=us&l=en&cs=18


SHORT NOTE: INPUT DEVICES

Input Devices

  Any hardware device that sends data to the
computer, without any input devices, a
computer would only be a display device
and not allow users to interact with it,
much like a TV. To the right is a
Logitech trackball mouse, an example of an
input device. Below is a full listing of
all the different computer input devices
found on a computer.

Midpoint circle algorithm (explanation)

The midpoint circle algorithm is an algorithm used to determine the points needed for drawing a circle. The algorithm is a variant of  Bresenham's line algorithm, and is thus sometimes known as Bresenham's circle algorithm, although not actually invented by Bresenham.

 Advantages:
The midpoint method is used for deriving efficient scan-conversion algorithms to draw geometric curves on raster displays.
 The method is general and is used to transform the nonparametric equation f(x,y) = 0, which describes the curve, into an algorithms that draws the curve.


Disadvantages:
-time consumption is high
-the distance between the pixels is not equal so we wont get smooth circle.

The algorithm starts accordingly with the circle equation x2 + y2 = r2. So, the center of the circle is located at (0,0). We consider first only the first octant and draw a curve which starts at point (r,0) and proceeds upwards and to the left, reaching the angle of 45°.
The "fast" direction here is the y direction. The algorithm always does a step in the positive y direction (upwards), and every now and then also has to do a step in the "slow" direction, the negative x direction.





refer : http://en.wikipedia.org/wiki/Midpoint_circle_algorithm

Tuesday, February 22, 2011

OS-ASSEMBLER

Definition -

An assembler is a program that takes basic computer instructions and converts them into a pattern of  bits that the computer's processor can use to perform its basic operations.
It is a computer program to translate between lower-level representations of computer programs.


Typically a modern assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities.
The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications. Most assemblers also include macro facilities for performing textual substitution—e.g., to generate common short sequences of instructions as inline, instead of called subroutines.
Assemblers are generally simpler to write than compilers for high-level languages, and have been available since the 1950s. Modern assemblers, especially for RISC architectures, such as SPARC or POWER, as well as x86 and x86-64, optimize Instruction scheduling to exploit the CPU pipeline efficiently.

A program written in assembly language consists of a series of mnemonic statements and meta-statements (known variously as directives, pseudo-instructions and pseudo-ops), comments and data. These are translated by an assembler to a stream of executable instructions that can be loaded into memory and executed. Assemblers can also be used to produce blocks of data, from formatted and commented source code, to be used by other code.

OS-COMPILER

A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).



refer:     http://www.personal.kent.edu/~rmuhamma/Compilers/MyCompiler/compilerIntro.htm
             http://www.webopedia.com/TERM/C/compiler.html
             http://whatis.techtarget.com/definition/0,,sid9_gci211824,00.html


OS-LOADER

LOADER:

 A loader is the part of an operating system that is responsible for loading programs, one of the essential stages in the process of starting a program, it means loader is a program that places programs into memory and prepares them for execution. Loading a program involves reading the contents of executable file, the file containing the program text, into memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing control to the loaded program code.

LOADER is an operating system utility that copies programs from a storage device to main memory, where they can be executed. In addition to copying a program into main memory, the loader can also replace virtual addresses with physical addresses.
Most loaders are transparent, i.e., you cannot directly execute them, but the operating system uses them when necessary.

In a computer operating system , a loader is a component that locates a given program (which can be an application or, in some cases, part of the operating system itself) in offline storage (such as a hard disk ), loads it into main storage (in a personal computer, it's called random access memory ), and gives that program control of the computer (allows it to execute its instructions).
A program that is loaded may itself contain components that are not initially loaded into main storage, but can be loaded if and when their logic is needed. In a multitasking operating system, a program that is sometimes called a dispatcher juggles the computer processor's time among different tasks and calls the loader when a program associated with a task is not already in main storage. (By program here, we mean a binary file that is the result of a programming language compilation, linkage editing, or some other program preparation process.)