Computer fundamental book in pdf




















Download Computer Fundamentals by Anita Goel pdf Free from direct download link given below in this post. Here you can download the Computer Fundamentals book pdf by Anita Goel.

You can download this pdf from download link given below. IN this book, the author explained every basic of computer in details so if you are new in the field of computer learning then this book would play a best role in the journey of your learning. You will get every basic topic of computer in easy language so then anyone can understand and learn about computer. This problem is avoided by restricting the range of standard inverse functions, and this is done in a standard way in almost all modern math libraries e.

It takes an s value proportional to sin A and a c value that scales cos A by the same factor and returns A. The Figure 2. The func- factor is assumed to be positive. One way to think of this is that it returns the tion atan2 s,c returns the an- gle A and is often very useful angle of a 2D Cartesian point s, c in polar coordinates Figure 2.

Vectors It can be usefully represented by an arrow. Two vectors are equal if they have the same length and direction even if we think of them as being located in different places Figure 2. As much as pos- sible, you should think of a vector as an arrow and not as coordinates or numbers. At some point we will have to represent vectors as numbers in our programs, but even in code they should be manipulated as objects and only the low-level vector operations should know about their numeric representation DeRose, Vec- tors will be represented as bold characters, e.

A unit vector is any vector whose length is one. The zero vector is the vector of zero length. The direction of the zero vector is undefined.

Vectors can be used to represent many different things. For example, they can Figure 2. These two vec- be used to store an offset, also called a displacement. Vectors can also be used to store a location, another word for position or point.

Locations can be represented as a displacement from another location. Usually there is some understood origin location from which all other locations are stored as offsets. Note that locations are not vectors.

As we shall discuss, you can add two vectors. However, it usually does not make sense to add two locations unless it is an intermediate operation when computing weighted averages of a location Goldman, Adding two offsets does make sense, so that is one reason why offsets are vectors. But this emphasizes that a location is not an offset; it is an offset from a specific origin location.

The offset by itself is not the location. Two vectors are equal if and only if they have the same length and direc- a tion. Two vectors are added according to the parallelogram rule. This rule states that the sum of two vectors is found by placing the tail of either vector against the Figure 2.

Two vectors head of the other Figure 2. The parallelogram is formed by taking the in either order. This emphasizes that vector addition is commutative:. Note that the parallelogram rule just formalizes our intuition about displacements. Think of walking along one vector, tail to head, and then walking along the other. The net displacement is just the parallelogram diagonal. Figure 2. The vector —a has the same length but opposite direction of the vec- You can visualize vector subtraction with a parallelogram Figure 2.

We can tor a. Vectors can also be multiplied. In fact, there are several kinds of products involv- b a ing vectors. First, we can scale the vector by multiplying it by a real number k. For exam- b—a ple, 3. We discuss two products involving two vectors, the dot product and the cross prod- Figure 2. Vector sub- uct, later in this section, and a product involving three vectors, the determinant, in traction is just vector addition with a reversal of the second Chapter 5.

This property of the two vectors is called linear independence. Two c linearly independent vectors form a 2D basis, and the vectors are thus referred to as basis vectors. For example, a vector c may be expressed as a combination of two basis vectors a and b Figure 2.

Bases are especially useful if the two vectors are orthogonal, i. It is even Figure 2. Any 2D vec- more useful if they are also unit vectors in which case they are orthonormal. Note that this is not really any different conceptually from Equa-. We can also represent 3D, 4D, etc. For the 3D case, we use a basis vector z that is orthogonal to both x and y. The simplest way to multiply two vectors is the dot product. The dot prod- The dot product can also be used to find the projection of one vector onto uct is related to length and an- gle and is one of the most im- another.

Similarly in 3D we can find. The cross product returns a 3D vector that is perpendicular to the two arguments of the cross product. Note Figure 2. The cross that there are only two possible directions for such a vector.

The choice is somewhat arbitrary, but it is standard to assume that. All possible permutations of the three Cartesian unit vectors are. Note that the cross product is not commuta- tive, i. More specifically, if we put x and y on a sidewalk, with x pointing east and y pointing north, then does z point up to the sky or into the ground? The usual b convention is to have z point to the sky. This is known as a right-handed coor- dinate system.

The vector z should align with your thumb. This is illustrated in Figure 2. So, in coordinate form,. Managing coordinate systems is one of the core tasks of almost any graphics program; the key to this is managing orthonormal bases. Any set of two 2D vectors u and v form an orthonormal basis provided that they are orthogonal at right angles and are each of unit length.

In 3D, three vectors u, v, and w form an orthonormal basis if. This orthonormal basis is right-handed provided. Note that the Cartesian canonical orthonormal basis is just one of infinitely many possible orthonormal bases. What makes it special is that it and its implicit origin location are used for low-level representation within a program. Thus, the vectors x, y, and z are never explicitly stored and neither is the canonical origin location o.

The global model is typically stored in this canonical coordinate system, and it is thus often called the global coordinate system. However, if we want to use another coordinate system with origin p and orthonormal basis vectors. This origin and basis vectors are never stored explicitly. All other vectors and locations are stored with coordinates that relate them to the global frame.

The coordinate system associated with the plane are explicitly stored in terms of global coordinates. Such a system is called a frame of reference or coordinate frame. For example, in a flight simulator, we might want to maintain a coordinate system with the origin at the nose of the plane, and the orthonormal basis aligned with the airplane.

Simultaneously, we would have the master canonical coordinate system Figure 2. The coordinate system associated with a particular object, such as the plane, is usually called a local coordinate system. At a low level, the local frame is stored in canonical coordinates. For example, if u has coordinates xu , yu , zu ,.

Note that if we store a vector a with respect to the u-v-w frame, we store a triple ua , va , wa which we can interpret geometrically as.

To get the u-v-w coordinates of a vector b stored in the canonical coordinate system, we can use dot products:. This works because u, v, and w are orthonormal. Using matrices to manage changes of coordinate systems is discussed in Sec- tions 6. Often we need an orthonormal basis that is aligned with a given vector. This can be done using cross products as follows. If t is collinear with w the denominator will vanish, and if they are nearly collinear the results will have low precision.

An example of a situation where this construction is used is surface shading, where a basis aligned to the surface normal is needed but the rotation around the normal is often unimportant.

The procedure in the previous section can also be used in situations where the rotation of the basis around the given vector is important. Once the orientation is pinned down, the basis is completely determined.

If the two vectors are known to be per- left-handed. In fact, this procedure works just fine when a and b are not perpendicular. In this case, w will be constructed exactly in the direction of a, and v is chosen to be the If you want me to set w and v to two nonperpendicular closest vector to b among all vectors perpendicular to w. Occasionally you may find problems caused in your computations by a basis that is supposed to be orthonormal but where error has crept in—due to rounding error in computation, or to the basis having been stored in a file with low precision, for instance.

The procedure of the previous section can be used; simply constructing the basis anew using the existing w and v vectors will produce a new basis that is orthonormal and is close to the old one. This approach is good for many applications, but it is not the best available. It does produce accurately orthogonal vectors, and for nearly orthogonal starting bases the result will not stray far from the starting point.

It chooses a basis close to the starting basis but has no guarantee of choosing the closest orthonormal basis. When this is not good enough, the SVD Section 5. A common way to describe a curve is using an implicit equation. Points x, y where this value is zero y are on the curve, and points where the value is nonzero are not on the curve. A on the curve cannot be immediately calculated from the equation and instead must path where the height is zero is be determined by solving the equation.

Thus, the points on the curve are not gen- the implicit curve bottom. It is interesting to note that f does have values for all x, y. The shore is the implicit curve. A This equation, if expanded algebraically, will yield Equation 2. Curves and Surfaces This illustrates that the vector form of an equation often suggests more geometry and intuition than the equivalent full-blown Cartesian form with x and y.

For this reason, it is usually advisable to use vector forms when possible. In addition, you can support a vector class in your code; the code is cleaner when vector forms are used. The vector-oriented equations are also less error prone in implementation: once you implement and debug vector types in your code, the cut-and-paste errors involving x, y, and z will go away.

It takes a little while to get used to vectors in these equations, but once you get the hang of it, the payoff is large. Suppose that near the point a, b , f x, y is a plane Figure 2. There is a specific uphill and downhill direction. At right Figure 2. A surface angles to this direction is a direction that is level with respect to the plane.

To see why the partial derivative has something to do 0 plane. The partial derivative is a generalization of the 1D derivative. Again, there is more obvious insight in the geometry than in the algebra. In Figure 2. The hollow points show other val- angle between them is 90 degrees, and thus their dot product equals zero recall ues of f that do not hold y con- that the dot product is proportional to the cosine of the angle between the two stant.

Note that the length of the gradient vector can be different depending on the multiplier in the implicit equation. The gradient for this curve is 2Ax, 2Ay. This will be normal y perpendicular to the circle, but will have a length determined by A. The direction Figure 2. The length of the a points in a direction where f has no change and is thus per- gradient reflects this change in degree of the slope. This can be converted easily to implicit form Figure 2.

This allows several implicit forms for the same line, for example,. Suppose we know two points on the line, x0 , y0 and x1 , y1. What A, B, and C describe the line through these two points? Because these points lie on the line, they must both satisfy Equation 2.

Unfortunately we have two equations and three unknowns: A, B, and C. This problem arises because of the arbitrary multiplier we can have with an implicit equation. This vector is perpendicular to the line Figure 2.

Recall that there are an infinite number of A, B, C that describe the line because of the arbitrary scaling property of implicits. We want any one of the valid A, B, C. Because x0 , y0 and x1 , y1 are on the line, they must satisfy Equation 2. We can plug either value in and solve for C. Again, this is one of infinitely many valid implicit equations for the line through two points, but this form has no division operation and thus no numerically de- generate cases for points with finite Cartesian coordinates.

A nice thing about Equation 2. As shown in Figure 2. From Equations 2. The vec- negative. Note that if A, B is a unit vector, then f a, b is the signed The distance is proportional distance.

We can multiply Equation 2. Implicit lines will turn out to be very useful for triangle rasterization Section 8. Other forms for 2D lines are discussed in Chapter Two-dimensional quadric curves Figure 2. The ellipse include ellipses and hyperbolas, as well as the special cases of parabolas, circles, with center xc , yc and semi- and lines.

Just as implicit equations can be used to define curves in 2D, they can be used to define surfaces in 3D. Any point x, y, z that is on the surface results in zero when given as an argument to f. Any point not on the surface results in some number other than zero.

You can check whether a point is on the surface by evaluating f , or you can check which side of the surface the point lies on by looking at the sign of f , but you cannot always explicitly construct points on the surface.

A surface normal which is needed for lighting computations, among other things is a vector perpendicular to the surface.

The reasoning is the same as for the 2D case: the gradient points in the direction of fastest increase in f , which is perpendicular to all directions tangent to the surface, in which f remains constant.

As an example, consider the infinite plane through point a with surface normal n. The implicit equation to describe this plane is given by. Note that a and n are known quantities. The point p is any unknown point that satisfies the equation. Sometimes we want the implicit equation for a plane through points a, b, Figure 2.

Any of the and c. The normal to this plane can be found by taking the cross product of any points p shown are in the plane with normal vector n two vectors in the plane.

One such cross product is that includes point a if Equa- tion 2. This can only be true if p is in the same plane as a, b, and c. The determinant can be expanded see Section 5.

Equations 2. Equation 2. In addition, it is relatively easy to avoid a typographic error that compiles into incorrect code if it takes advantage of debugged cross and dot product code. It is also easy to implement without a typo if a function determinant a, b, c is available. It will be especially easy for others to read your code if you rename the determinant func- tion volume.

So both Equations 2. The full expansion of either equation into x-, y-, and z-components is likely to generate typos. Such typos are likely to compile and, thus, to be especially pesky. This is an excellent example of clean math generating clean code and bloated math generating bloated code. However, all such curves are just degenerate surfaces and are rarely useful in practice. A 3D curve can be constructed from the intersection of two simultaneous implicit equations:.

For example, a 3D line can be formed from the intersection of two implicit planes. Typically, it is more convenient to use parametric curves instead; they are dis- cussed in the following sections. A parametric curve is controlled by a single parameter that can be considered a sort of index that moves continuously along the curve.

Here x, y is a point on the curve, and t is the parameter that influences the curve. For a given t, there will be some point determined by the functions g and h. For continuous g and h, a small change in t will yield a small change in x and y.

Thus, as t continuously changes, points are swept out in a continuous curve. This is a nice feature because we can use the parameter t to explicitly construct points on the curve. Often we can write a parametric curve in vector form,.

Such vector functions can generate very clean code, so they should be used when possible. We can think of the curve with a position as a function of time. The curve can go anywhere and could loop and cross itself. We can also think of the curve p —1. Because the formulas for x and y have such similar structure, we can use the Figure 2.

Since the point changes linearly with t, the value of t between p0 and p1 measures the fractional distance between the points. Parametric lines can also be described as just a point o and a vector d:. When the vector d has unit length, the line is arc-length parameterized.

This means t is an exact measure of distance along the line. Any parametric curve can be arc-length parameterized, which is obviously a very convenient form, but not all can be converted analytically. In this chapter we only discuss 3D parametric lines in detail. General 3D The parametric curve is the parametric curves are discussed more extensively in Chapter A 3D parametric line can be written as a straightforward extension of the 2D parametric line, e.

Note that this is very similar to the 2D case. The way to visualize this is to imagine that the line passes through o and is parallel to d. Given any value of t, you get some point p t on the line. This general concept is the same as for two dimensions Figure 2. The parametric approach can be used to define surfaces in 3D space in much the same way we define curves, except that there are two parameters to address the two-dimensional area of the surface.

Pretend for the sake of ar- Example. For example, a point on the surface of the Earth can be described by the gument that the Earth is ex- two parameters longitude and latitude.

If we define the origin to be at the center of actly spherical. With parametric surfaces, the derivatives of p also give information about the surface geometry.

This function defines a parametric x curve obtained by varying u while holding v fixed at the value v0. The geometry for spherical coordinates. A similar argument shows that the partial derivative pv gives the tangent to the isoparametric curves for constant u, which is a second tangent vector to the surface.

The derivative of p, then, gives two tangent vectors at any point on the sur- face. The normal to the surface may be found by taking the cross product of these vectors: since both are tangent to the surface, their cross product, which is perpendicular to both tangents, is normal to the surface. The right-hand rule for cross products provides a way to decide which side is the front, or outside, of the surface; we will use the convention that the vector.

For implicit curves and surfaces, the normal vector is given by the derivative of f the gradient , and the tangent vector for a curve or vectors for a surface can be derived from the normal by constructing a basis.

For parametric curves and surfaces, the derivative of p gives the tangent vector for a curve or vectors for a surface , and the normal vector can be derived from the tangents by constructing a basis. Another common linear interpolation is among a set of positions on the x- axis: x0 , x1 ,. For linear interpolation, the points xi , yi are connected by straight line segments. It is natural to use parametric line equations for these segments.

Because the weighting functions are linear polynomials of x, this is linear inter- polation. The two examples above have the common form of linear interpolation. We create a variable t that varies from 0 to 1 as we move from data item A to data item B.

Notice that Equation 2. Often information such as color is tagged onto triangle ver- tices, and this information is interpolated across the triangle. The coordinate sys- tem that makes such interpolation straightforward is called barycentric coordi- nates; we will develop these from scratch.

We will also discuss 2D triangles, which must be understood before we can draw their pictures on 2D screens. Triangles The derivation of this formula can be found in Section 5. This area will have a positive sign if the points a, b, and c are in counterclockwise order and a negative sign, otherwise. Often in graphics, we wish to assign a property, such as color, at each trian- gle vertex and smoothly interpolate the value of that property across the triangle.

There are a variety of ways to do this, but the simplest is to use barycentric co- ordinates. One way to think of barycentric coordinates is as a nonorthogonal coordinate system as was discussed briefly in Section 2. Such a coordinate system is shown in Figure 2.

With that origin and those basis vectors,. A 2D triangle with vertices a, b, c can be used to set up a nonorthogo- nal coordinate system with origin a and basis vectors b — a and c — a. You may find it useful to think of how street addresses would work in a city where there are two sets of parallel streets, but where those sets are not at right angles. The natural system would essentially be barycentric coordinates, and you would quickly get used to them. Barycentric coordinates are defined for all points on the plane.

A particularly nice feature of barycentric coordinates is that a point p is inside the triangle formed by a, b, and c if and only if. If one of the coordinates is zero and the other two are between zero and one, then you are on an edge. If two of the coordinates are zero, then the other is one, and you are at a vertex. Another nice property of barycentric coordinates is that Equation 2. Given a point p, how do we compute its barycentric coordinates? One way is to write Equation 2.

Although it is straightforward to solve Equation 2. Recall from Section 2. Changing k scales the distance and controls which side of the. We would like to choose. For efficiency, it is usually wise the line through a and c. Note that fab xc , yc probably does not equal one, so it is probably not the ideal form we seek. By dividing through by fab xc , yc we get. The bary- centric coordinates are propor- Another way to compute barycentric coordinates is to compute the areas Aa , Ab , tional to the areas of the three and Ac , of subtriangles as shown in Figure 2.

Barycentric coordinates obey subtriangles shown. The reason for this is shown in Figure 2. Note that these are signed areas and will be b computed correctly as long as the same signed area computation is used for both a A and the subtriangles Aa , Ab , and Ac. The area of the two triangles shown is base times height and are thus the 2. If we assume the points a, b, and c are 3D, then we can still use the representation. The normal vector to a triangle can be found by taking the cross product of n any two vectors in the plane of the triangle Figure 2.

Note that this normal vector is not necessarily of unit length, and it obeys the b right-hand rule of cross products. Note that this is not a signed area, so it cannot be used directly to evaluate barycen- tric coordinates. This, along with Equations 2. Unfortunately there is not. Even convex quadrilaterals are much more compli- cated.

This is one reason triangles are such a common geometric primitive in graphics. However, the intersection of two 3D planes defines a 3D line, so a 3D line can be described by two simultaneous implicit 3D equations. Notes The history of vector analysis is particularly interesting.

It was largely invented by Grassman in the mids but was ignored and reinvented later Crowe, Readers interested in why the particular scalar and vector products are in some sense the right ones, and why we do not have a commonly used vector division, will find enlightenment in the concise About Vectors Hoffmann, Another important geometric tool is the quaternion invented by Hamilton in the mids.

Quaternions are useful in many situations, but especially where ori- entations are concerned Hanson, Exercises 1. The cardinality of a set is the number of elements it contains.

Is it possible to implement a function that maps bit integers to bit in- tegers that has a well-defined inverse? Do all functions from bit integers to bit integers have well-defined inverses? Specify the unit cube x-, y-, and z-coordinates all between 0 and 1 inclu- sive in terms of the Cartesian product of three intervals.

If you have access to the natural log function ln x , specify how you could use it to implement a log b, x function where b is the base of the log. What should the function do for negative b values? Assume an IEEE floating point implementation.

Have the function return the number of valid not NaN solutions and fill in the return arguments so the smaller of the two solutions is first. Given the nonparallel 3D vectors a and b, compute a right-handed or- thonormal basis such that u is parallel to a and v is in the the plane defined by a and b.

What is the implicit equation of the plane through 3D points 1, 0, 0 , 0, 1, 0 , and 0, 0, 1? What is the parametric equation? What is the nor- mal vector to this plane? Given four 2D points a0 , a1 , b0 , and b1 , design a robust procedure to determine whether the line segments a0 a1 and b0 b1 intersect.

Design a robust procedure to compute the barycentric coordinates of a 2D point with respect to three 2D non-collinear points. Most computer graphics images are presented to the user on some kind of raster display. Raster displays show images as rectangular arrays of pixels. Different colors are achieved by mixing varying intensities of red, green, and blue light.

Most printers, such as laser printers and ink-jet printers, are also raster devices. They are based on scanning: there is no physical grid of pixels, but the image is laid down sequentially by depositing ink at selected points on a grid. Rasters are also prevalent in input devices for images. A digital camera con- Color in printers is more complicated, involving tains an image sensor comprising a grid of light-sensitive pixels, each of which mixtures of at least four records the color and intensity of light falling on it.

A desktop scanner contains a pigments. Because rasters are so prevalent in devices, raster images are the most com- mon way to store and process images. A raster image stored in memory can be displayed by using prevalent. We might want to change the size or orientation of the image, correct the colors, or even show the image pasted on a moving three-dimensional surface. Even in televisions, the dis-. Raster Images. Consid- erations like these break the direct link between image pixels and display pixels.

There are other ways of describing images besides using arrays of pixels. A vector image is described by storing descriptions of shapes—areas of color bounded by lines or curves—with no reference to any particular pixel grid. In essence this amounts to storing the instructions for displaying the image rather than the pixels needed to display it.

The main advantage of vector images is that they are resolution independent and can be displayed well on very high resolution devices. The corresponding disadvantage is that they must be rasterized before they can be displayed. In this chapter, we discuss the basics of raster images and displays, paying Or: you have to know what particular attention to the nonlinearities of standard displays. The details of how those numbers in your im- age actually mean.

Raster Devices They can be separated into emissive displays, which use pixels that directly emit controllable amounts of light, and transmissive displays, in which Figure 3. Transmissive displays require a light source to illuminate them: in a direct-viewed display this is a backlight behind the array; in a projector it is a lamp that emits light that is projected onto the screen after passing through the array.

An emissive display is its own light source. Light-emitting diode LED displays are an example of the emissive type. Each pixel is composed of one or more LEDs, which are semiconductor devices based on inorganic or organic semiconductors that emit light with intensity de- pending on the electrical current passing through them see Figure 3. Pixel Subpixels The pixels in a color display are divided into three independently controlled subpixels—one red, one green, and one blue—each with its own LED made using Figure 3.

The red, green, and blue subpixels within a different materials so that they emit light of different colors Figure 3. When pixel of a flat-panel display.

Horizontal polarization filter Grooved alignment layers Vertical polarization filter Unpolarized backlight. Polarized light Liquid crystals. Horizontal polarization filter Grooved Vertical alignment layers polarization filter Unpolarized backlight. Figure 3. One pixel of an LCD display in the off state bottom , in which the front polarizer blocks all the light that passes the back polarizer, and the on state top , in which the liquid crystal cell rotates the polarization of the light so that it can pass through the front polarizer.

Liquid crystal displays LCDs are an example of the transmissive type. A liquid crystal is a material whose molecular structure enables it to rotate the po- larization of light that passes through it, and the degree of rotation can be adjusted by an applied voltage.

An LCD pixel Figure 3. If the voltage is set so that Figure 3. The opera- the liquid crystal rotates the polarization by 90 degrees, then all the light that en- tion of a liquid crystal display tered through the back of the pixel will escape through the front, and the pixel LCD. Intermediate voltages will partly rotate the polarization so that the front polarizer partly blocks the light, result- ing in intensities between the minimum and maximum Figure 3. Like color LED displays, color LCDs have red, green, and blue subpixels within each pixel, which are three independent pixels with red, green, and blue color filters over them.

Any type of display with a fixed pixel grid, including these and other tech- nologies, has a fundamentally fixed resolution determined by the size of the grid. The book has covered some major topics like number systems, computer codes, binary arithmetic, boolean algebra, and logic circuits.

Introductions to new concepts in computing, new topics, and classifications have been added. Illustrative diagrams and lecture notes have been updated and included.

Computer fundamentals was published by bpb publications in and is available in paperback. Key features: the unified cyber olympiad committee recommends this book as a useful read when appearing for olympiads.

Introduction to programming in c is covered in this book. Computer material in Hindi free download.



0コメント

  • 1000 / 1000