วันอังคารที่ 27 สิงหาคม พ.ศ. 2556

COMPUTER ANIMATION


Computer animation is the process used for generating animated images by using computer graphics. The more general termcomputer generated imagery encompasses both static scenes and dynamic images, while computer animation only refers to moving images.
Modern computer animation usually uses 3D computer graphics, although 2D computer graphics are still used for stylistic, low bandwidth, and faster real-time renderings. Sometimes the target of the animation is the computer itself, but sometimes the target is another medium, such as film.
Computer animation is essentially a digital successor to the stop motion techniques used in traditional animation with 3D models and frame-by-frame animation of 2D illustrations. Computer generated animations are more controllable than other more physically based processes, such as constructing miniatures for effects shots or hiring extras for crowd scenes, and because it allows the creation of images that would not be feasible using any other technology. It can also allow a single graphic artist to produce such content without the use of actors, expensive set pieces, or props.
To create the illusion of movement, an image is displayed on the computer screen and repeatedly replaced by a new image that is similar to it, but advanced slightly in time (usually at a rate of 24 or 30 frames/second). This technique is identical to how the illusion of movement is achieved with television and motion pictures.
For 3D animations, objects (models) are built on the computer monitor (modeled) and 3D figures are rigged with a virtual skeleton. For 2D figure animations, separate objects (illustrations) and separate transparent layers are used, with or without a virtual skeleton. Then the limbs, eyes, mouth, clothes, etc. of the figure are moved by the animator onkey frames. The differences in appearance between key frames are automatically calculated by the computer in a process known as tweening or morphing. Finally, the animation is rendered.
For 3D animations, all frames must be rendered after modeling is complete. For 2D vector animations, the rendering process is the key frame illustration process, while tweened frames are rendered as needed. For pre-recorded presentations, the rendered frames are transferred to a different format or medium such as film or digital video. The frames may also be rendered in real time as they are presented to the end-user audience. Low bandwidth animations transmitted via the internet (e.g. 2D Flash, X3D) often use software on the end-users computer to render in real time as an alternative to streaming or pre-loaded high bandwidth animations.

A simple example

The screen is blanked to a background color, such as black. Then, a goat is drawn on the right of the screen. Next, the screen is blanked, but the goat is re-drawn or duplicated slightly to the left of its original position. This process is repeated, each time moving the goat a bit to the left. If this process is repeated fast enough, the goat will appear to move smoothly to the left. This basic procedure is used for all moving pictures in films and television.
The moving goat is an example of shifting the location of an object. More complex transformations of object properties such as size, shape, lighting effects often require calculations and computer rendering instead of simple re-drawing or duplication.

Explanation

To trick the eye and brain into thinking they are seeing a smoothly moving object, the pictures should be drawn at around 12 frames per second (frame/s) or faster (a frame is one complete image). With rates above 70 frames/s no improvement in realism or smoothness is perceivable due to the way the eye and brain process images. At rates below 12 frame/s most people can detect jerkiness associated with the drawing of new images which detracts from the illusion of realistic movement. Conventional hand-drawn cartoon animation often uses 15 frames/s in order to save on the number of drawings needed, but this is usually accepted because of the stylized nature of cartoons. Because it produces more realistic imagery computer animation demands higher frame rates to reinforce this realism.
Movie film seen in theaters in the United States runs at 24 frames per second, which is sufficient to create the illusion of continuous movement. For high resolution, adapters are used.

Methods of animating virtual characters

In most 3D computer animation systems, an animator creates a simplified representation of a character's anatomy, analogous to a skeleton or stick figure. The position of each segment of the skeletal model is defined by animation variables, or Avars. In human and animal characters, many parts of the skeletal model correspond to actual bones, but skeletal animation is also used to animate other things, such as facial features (though other methods for facial animation exist). The character "Woody" in Toy Story, for example, uses 700 Avars, including 100 Avars in the face. The computer does not usually render the skeletal model directly (it is invisible), but uses the skeletal model to compute the exact position and orientation of the character, which is eventually rendered into an image. Thus by changing the values of Avars over time, the animator creates motion by making the character move from frame to frame.
There are several methods for generating the Avar values to obtain realistic motion. Traditionally, animators manipulate the Avars directly. Rather than set Avars for every frame, they usually set Avars at strategic points (frames) in time and let the computer interpolate or 'tween' between them, a process called keyframing. Keyframing puts control in the hands of the animator, and has roots in hand-drawn traditional animation.
In contrast, a newer method called motion capture makes use of live action. When computer animation is driven by motion capture, a real performer acts out the scene as if they were the character to be animated. His or her motion is recorded to a computer using video cameras and markers, and that performance is then applied to the animated character.
Each method has its advantages, and as of 2007, games and films are using either or both of these methods in productions. Keyframe animation can produce motions that would be difficult or impossible to act out, while motion capture can reproduce the subtleties of a particular actor. For example, in the 2006 film Pirates of the Caribbean: Dead Man's Chest, actor Bill Nighy provided the performance for the character Davy Jones. Even though Nighy himself doesn't appear in the film, the movie benefited from his performance by recording the nuances of his body language, posture, facial expressions, etc. Thus motion capture is appropriate in situations where believable, realistic behavior and action is required, but the types of characters required exceed what can be done through conventional costuming.

Computer animation development equipment

Computer animation can be created with a computer and animation software. Some impressive animation can be achieved even with basic programs; however, therendering can take a lot of time on an ordinary home computer. Because of this, video game animators tend to use low resolution, low polygon count renders, such that the graphics can be rendered in real time on a home computer. Photorealistic animation would be impractical in this context.
Professional animators of movies, television, and video sequences on computer games make photorealistic animation with high detail. This level of quality for movie animation would take tens to hundreds of years to create on a home computer. Many powerful workstation computers are used instead. Graphics workstation computers use two to four processors, and thus are a lot more powerful than a home computer, and are specialized for rendering. 

Detailed examples and pseudocode

In 2D computer animation, moving objects are often referred to as “sprites.” A sprite is an image that has a location associated with it. The location of the sprite is changed slightly, between each displayed frame, to make the sprite appear to move. The following pseudocode makes a sprite move from left to right:
var int x := 0, y := screenHeight / 2;
while x < screenWidth
drawBackground()
drawSpriteAtXY (x, y) // draw on top of the background
x := x + 5 // move to the right
Computer animation uses different techniques to produce animations. Most frequently, sophisticated mathematics is used to manipulate complex three dimensional polygons, apply “textures”, lighting and other effects to the polygons and finally rendering the complete image. A sophisticated graphical user interface may be used to create the animation and arrange its choreography. Another technique called constructive solid geometry defines objects by conducting boolean operations on regular shapes, and has the advantage that animations may be accurately produced at any resolution.
Let's step through the rendering of a simple image of a room with flat wood walls with a grey pyramid in the center of the room. The pyramid will have a spotlight shining on it. Each wall, the floor and the ceiling is a simple polygon, in this case, a rectangle. Each corner of the rectangles is defined by three values referred to as X, Y and Z. X is how far left and right the point is. Y is how far up and down the point is, and Z is far in and out of the screen the point is. The wall nearest us would be defined by four points: (in the order x, y, z). Below is a representation of how the wall is defined

วันอังคารที่ 6 สิงหาคม พ.ศ. 2556

PROTECTION FROM MEMORY ERRORS


Some random access memory (RAM) chips have built-in error-checking functions that use a process called parity. Chips that use parity have an extra bit for every eight bits of data. In the parity process, as the eight bits receive binary data (data represented by 1s and 0s), the chip adds all the 1s, and if that total is odd, t
he extra bit is set to 1. If the total is even, the extra bit is set to 0. When the computer tries to read each byte of data back from the RAM, it calculates the total number of 1s again and compares its findings to the parity bit. If the findings match up, the data is ruled error-free and can be sent to the CPU. If the findings don't match up, the chip assumes the data is erroneous and dumps it. This is called even parity. Odd parity is the same process, except that the extra bit setting is 1 when the sum of all the 1s in the byte is even.
The computer checks a bit for parity each time a byte is transferred or transmitted. The process of parity uses simple arithmetic to determine whether stored data values are the same when they are read as they were when they were written. This is fine for detecting errors, but it doesn't do anything to correct them. If parity proves data to be faulty, the memory system simply rejects the data and starts over.
High-end computer servers need a more effective form of error-checking, such as error-correcting code (ECC). ECC uses more memory than parity, but with its special algorithm, it can actually fix most errors it finds. Amazingly, many computers operate with nonparty memory and manage to continue working despite lacking this check. The good news is that memory components used in PCs today have improved and checking the integrity of memory and data is less necessary than it once was for the average home computer

FLASH MEMORY


\

Flash Memory (sometimes called "flash RAM") is a type of constantly powered nonvolatile memory that can be erased and reprogrammed in units of memory called blocks.
It is a variation of electrically erasable programmable read-only memory (EEPROM) which, unlike flash memory, is erased and rewritten at the byte level, which is slower than flash memory updating. Flash memory is often used to hold control code such as the basic input/output system (BIOS) in a personal computer. When BIOS needs to be changed (rewritten), the flash memory can be written to in block (rather than byte) sizes, making it easy to
update. On the other hand, flash memory is not useful as random access memory (RAM) because RAM needs to be addressable at the byte (not the block) level.

Flash Memory gets its name because the microchip is so organized that a section of memory cells are erased in a single action or "flash." The erasure is caused by tunneling in which electrons pierce through a thin dielectric material to remove an electronic charge from a floating gate associated with each memory cell. Intel offers a form of flash memory that holds two bits (rather than one) in each memory cell, thus doubling the capacity of memory without a corresponding increase in price. Flash memory is used in digital cellular phones, digital cameras, LAN switches, PC Cards for notebook computers, digital set-up boxes, embedded controllers, and other devices.

CREATE PROGRAM IN C LANGUAGE



There are many "languages" like, for example C, Fortran, PASCAL etc., that help us to convert an algorithm in to something that a computer can understand. We will focus here only on C programming

So. let us start looking at how do we create a "C program".There are basically three steps involved in converting your ideas into what is to be done to make it a working program.  There are three steps involved in converting your idea of what is to be done to a working program

1. Creating a source code in the form of the text file acceptable to the compiler.
2. Invoking the compiler to process the source code and produce an object file.
3. Linking all the object files and libraries to produce an executable 16

We will look at these parts in some more detail here.

The source code is where you express the the whole computation you want to do into a series of instructions.

The tradition is to use the C source code with an extension .c For example myfile.c . Some compilers insist on this extension. This is an acsii file that you can create using any one of the editors that you are familiar with. We will look at the detailed structure of this code in a little while .

We may have different parts of the code in different files. We then compile them separately or together to form object files. During this operation the compiler checks and convert your source code to a language understandable to the particular processor that is used in the computer. These object files that comes with an extension .o, for example myfile.o , are in binary format.

The next step is to link these object files and other libraries and header files etc., to produce an executable. This executable file contains a set of instruction in a language that the processor can understand and is the one which we run on the computer. We will see the use of header files and system libraries in the examples given below.

Before proceed let us summarize the steps that takes us to run a program in the form of a flow chart.

     Structure of C Programme
As we said earlier it is the tradition to write a C program file name ending with the extension .C.

Example: Below we give a program that computes the square root of a number and prints it on the scree. Since it is a C program we name it as "myfile.c" , that is with an extension ".c".

1 #include
2 #include
3 main()
{
4 float x,y;
5 scanf("%f\n",&x);
6 y=sqrt(x); 7 printf("%f\n",y); }

Before we proceed to the compilation of this program let us take a minute to see what does each of the lines mean?
Lines 1 and 2 are header files. These files contain the math library functions and the input output command functions. We need the math function library to use functions like "sqrt", "log", "power" etc. We need the stdio library to use functions like "scanf" and "printf" which reads and prints the data from the screen. More on this a little later.

The program given above just has a main body. Line 3 is declares the starting on this part. The lines inside the { } following this are the part of the main program.
Line 4 is the declaration of the variables. Again we will see more on the variable types later in this course. In this particular example we declare variables "x,y" as floating points.
Line 5 reads the value of the variable from the screen.
Line 6 computes the square root of the variable "x" and put the value into variable "y".
Line 7 prints out this value of y.
We first compile this code to produce an object code using the command cc -c myfile.c or an equivalent command available at your machine.
The object file produced by this, myfile.o is then linked with the system math library using the command, cc -lm myfile.o -o myfile.exe , to produce the executable myfile.exe.

(the second term in the command above "-lm" links the object file to the math library. The file name that comes just after -o is the name of the executable).
We can combine compile and link into one step as will see in later part of the course.
Example: Let us now look at a C program that uses the library and another function.
#include
#include
main()
{
float x,y;
("%f\n",&x); y=sqrt(x); printf("%f\n",y); printit(); printf()
{
printf("The program is Over");
}
This simple C code adds an additional component to the one we saw earlier, it calls a function "printit". As before you can see the "include" files, or what are called header files. Then we will see the main part of the program. This program is basically computing square root of the variable x and it is printing it out on the screen. Then it is calling some function, which prints out a statement.Here we see on of the main feature of a C program. The main part does some of the calculations and it calls another function. The function we called, named printit, which simply prints the sentence "the program is over." can be put it a separate file. Let is call it "print.c". We will see that how it can be compiled and how it can be executed.There are two ways to compile this program.To compile these programs we could type cc -c sample.c and cc -c print.c separately.This commands will create sample.o and print.o files. We can create the executable by typing the command.cc sample.o print.o -lm -o a.out In this linking command we have put together the two files and also included the math library file m.a We can now execute the program by typing a.out.You could try variations of these commands and programs to figure out why we need the math.h file and why we need to include -lm in the linker etc. Also try it for different math functions, for example calculating the logarithm or trigonometric functions etc.Another way to compile and generate an executable from this is to simply type cc sample.c print.c -lm -o a.out In this the compilation and linking is put together.Let us try another program to illustrate the use of math library and the compilation and linking procedure

History of Computer

History of Computer


          The first computers were people! That is, electronic computers (and the earlier mechanical computers) were given this name because they performed the work that had previously been assigned to people. "Computer" was originally a job title: it was used to describe those human beings (predominantly women) whose job it was to perform the repetitive calculations required to compute such things as navigational tables, tide charts, and planetary positions for astronomical almanacs. Imagine you had a job where hour after hour, day after day, you were to do nothing but compute multiplications. Boredom would quickly set in, leading to carelessness, leading to mistakes. And even on your best days you wouldn't be producing answers very fast. Therefore, inventors have been searching for hundreds of years for a way to mechanize (that is, find a mechanism that can perform) this task.


This picture shows what were known as "counting tables" [photo courtesy IBM]


A typical computer operation back when computers were people.
The abacus was an early aid for mathematical computations. Its only value is that it aids the memory of the human performing the calculation. A skilled abacus operator can work on addition and subtraction problems at the speed of a person equipped with a hand calculator (multiplication and division are slower). The abacus is often wrongly attributed to China. In fact, the oldest surviving abacus was used in 300 B.C. by the Babylonians. The abacus is still in use today, principally in the far east. A modern abacus consists of rings that slide over rods, but the older one pictured below dates from the time when pebbles were used for counting (the word "calculus" comes from the Latin word for pebble).


A very old abacus


A more modern abacus. Note how the abacus is really just a representation of the human fingers: the 5 lower rings on each rod represent the 5 fingers and the 2 upper rings represent the 2 hands.
In 1617 an eccentric (some say mad) Scotsman named John Napier invented logarithms, which are a technology that allows multiplication to be performed via addition. The magic ingredient is the logarithm of each operand, which was originally obtained from a printed table. But Napier also invented an alternative to tables, where the logarithm values were carved on ivory sticks which are now called Napier's Bones.


An original set of Napier's Bones [photo courtesy IBM]


A more modern set of Napier's Bones
Napier's invention led directly to the slide rule, first built in England in 1632 and still in use in the 1960's by the NASA engineers of the Mercury, Gemini, and Apollo programs which landed men on the moon.


A slide rule
Leonardo da Vinci (1452-1519) made drawings of gear-driven calculating machines but apparently never built any.


A Leonardo da Vinci drawing showing gears arranged for computing
The first gear-driven calculating machine to actually be built was probably the calculating clock, so named by its inventor, the German professor Wilhelm Schickard in 1623. This device got little publicity because Schickard died soon afterward in the bubonic plague.


Schickard's Calculating Clock
In 1642 Blaise Pascal, at age 19, invented the Pascaline as an aid for his father who was a tax collector. Pascal built 50 of this gear-driven one-function calculator (it could only add) but couldn't sell many because of their exorbitant cost and because they really weren't that accurate (at that time it was not possible to fabricate gears with the required precision). Up until the present age when car dashboards went digital, the odometer portion of a car's speedometer used the very same mechanism as the Pascaline to increment the next wheel after each full revolution of the prior wheel. Pascal was a child prodigy. At the age of 12, he was discovered doing his version of Euclid's thirty-second proposition on the kitchen floor. Pascal went on to invent probability theory, the hydraulic press, and the syringe. Shown below is an 8 digit version of the Pascaline, and two views of a 6 digit version:


Pascal's Pascaline [photo © 2002 IEEE]


A 6 digit model for those who couldn't afford the 8 digit model


A Pascaline opened up so you can observe the gears and cylinders which rotated to display the numerical result
Click on the "Next" hyperlink below to read about the punched card system that was developed for looms for later applied to the U.S. census and then to computers...


วันจันทร์ที่ 5 สิงหาคม พ.ศ. 2556

Home network

A home network or home area network (HAN) is a residential local area network (LAN) for communication between digital devices typically deployed in the home, usually a small number of personal computers and accessories, such as printers and mobile computing devices. An important function is the sharing of Internet access, often a broadband service provisioned by fiber-to-the-home or via Cable Internet access, Digital Subscriber Line (DSL) or mobile broadband by Internet service providers (ISPs). If an ISP only provides one IP address, a router including network address translation (NAT), proxy server software and typically a network firewall, allows several computers to share the external IP address. The router function may be assumed by a PC with several network interfaces, but a dedicated router device is more common, often including a wireless accesspoint, providing WiFi access.


Computer network

Computer  network

Computer Network คืออะไร คอมพิวเตอร์ เน็ตเวิร์ค คือระบบเครือข่ายคอมพิวเตอร์

What is a computer network ?

              A computer network (or data network) is a telecommunications network that allows computers to exchange data. The physical connection between networked computing devices is established using either cable media or wireless media. The best-known computer network is the Internet.


History

Before the advent of computer networks, communication between calculation machines and early computers was performed by human users by carrying instructions between them. Today, in spite of the wide use of email and other networking applications, people do continue to transfer information to another person's computer by hand-carrying removable storage media (such as flash drives) — a method jokingly known as "sneakernet".
                Today, computer networks are the core of modern communication. All modern aspects of the public switched telephone network (PSTN) are computer-controlled. Telephony increasingly runs over the Internet Protocol, although not necessarily the public Internet. The scope of communication has increased significantly in the past decade. This boom in communications would not have been possible without the progressively advancing computer network. Computer networks, and the technologies that make communication between networked computers possible, continue to drive computer hardware, software, and peripherals industries. The expansion of related industries is mirrored by growth in the numbers and types of people using networks, from the researcher to the home user. 
Type of network

      Local area network (LAN)

                   - is a small computer network that usually using in short connection.
                   - Connection in same or near area.
                   - Connection from 2 computers and tools or more.
                   - If want far connection, must use repeater together.

      Metropolitan area network

                   - is a large computer network or aggregation of LAN.
                   - Cover wide areas in citys.
                   -  must use Backbone which serves as a connection main line.

      Wide area network

                    - is a computer network that covers a large geographic area.
                    - uses a communications channel that combines many types of media such as telephone lines, cables, and air waves.

Network topology


              Network topology is the layout or organizational hierarchy of interconnected nodes of a computer network.
  • A bus network: all nodes are connected to a common medium along this medium. This was the layout used in the originalEthernet, called 10BASE5 and 10BASE2.
  • A star network: all nodes are connected to a special central node. This is the typical layout found in a Wireless LAN, where each wireless client connects to the central Wireless access point.
  • A ring network: each node is connected to its left and right neighbour node, such that all nodes are connected and that each node can reach each other node by traversing nodes left- or rightwards. The Fiber Distributed Data Interface (FDDI) made use of such a topology.
  • A mesh network: each node is connected to an arbitrary number of neighbours in such a way that there is at least one traversal from any node to any other.
  • A fully connected network: each node is connected to every other node in the network.

 Style of using computer network

                1.Client/Server

                                  - consist with sever and client.
                                  - Server officiate to control working of network,accessing Hardware and Softwere   
                                     tools.
                                  - Client is caller of want to server.

                2.Peer to Peer

                                  - All computers is sever and client.
                                  - Can resource together, low cost,low safety.