User:Paullusmagnus~enwikibooks

Paul Stansifer

See en:User:Paullusmagnus

Installing Linux (outline)
Intro
 * Oftentimes, installing Linux is hard because you want to keep you data/OS
 * If not, (new computer, don't care about old OS + data backup), it's easier.
 * Depending on what hardware the computer has and your experience level, the ease of installation varies greatly

Do you want to install Linux?

 * Software
 * (usually) compatible and equivalent for most purposes, and (almost always) free (table of equivalents) (include narrower, deeper list)
 * Performance
 * Good idea!
 * Price
 * Not free but close
 * Ease-of-use
 * mixed ... getting better
 * Stability
 * Good ... unless you get so hooked you start using nightly builds and unstable releases

Which of these goals apply?
 * keeping data
 * ...without restoring a backup
 * coexistence with another OS
 * sharing data with that OS
 * both ways?

Can it be done?

 * Low-end systems are almost always fine (unless you have a 286 lying around)
 * Can you backup? (do you need to?)
 * Does the hardware work? (see )

Trying Linux

 * Floppy distros
 * Knoppix/Gnoppix
 * Very useful later on as well; if it provides an Internet connection while you're trying to set up the main one, it can save you a great deal of trouble.
 * Running Linux from another OS's partition.

Choosing a Linux
(or do you want a BSD instead?)
 * Desktop environment (GNOME/KDE/blackbox/wm/console)


 * Distros: ease-of-use vs. power, package management. A visit to http://www.distrowatch.com/ should be mandantory.
 * Debian
 * Don't use the stable release (as of 2004, it is over three years old)! (unstable is better)
 * For a quick&easy install, get Knoppix 3.3 or later and install that.
 * Otherwise, be sure to have an Internet connection and be prepared to learn a lot.

Stuff you should learn

 * Basic command line manipulation
 * Text editor: vi/EMACS
 * Recompiling the kernel (not that hard, may be necessary).
 * Using Lynx

Getting Linux

 * Download
 * CD
 * Spare partition
 * Network install
 * CD
 * Floppies
 * Spare partition
 * Buy a CD/DVD
 * price/donations
 * Buy a computer with Linux on it
 * Skip to Using Linux

Dual-booting

 * Nodestructive repartitioning
 * defragment first!
 * FAT - FIPS
 * NTFS - ntfsresize
 * Backup and reinstall
 * writable CD/DVD
 * network
 * tape

(Re)partitioning

 * unnessecary sometimes, with FAT partitions
 * but you probably want to do it anyways
 * what partions you'll need to make
 * ext3? ReiserFS? XFS?
 * how much space per partition

Installing

 * You ought to already know enough about the hardware at this point.
 * This has become a lot easier.
 * But, know about your hardware, and be sure to have Internet access, in case something doesn't work.

After the install

 * Data transfer/conversion
 * Configuration
 * security
 * environment
 * Proceed to Using Linux

Computer Graphics: 3D
Because computers are millions of times as fast at arithmetic than humans, they can be used to generate the 2-dimensional view of a 3-dimensional scene algorithmically.

Raytracing describes the process of simulating the straight lines that light follows as it bounces off objects into the viewer's eye. Because determining the path of millions of photons is incredibly difficult, backwards raytracing traces the path from the eye to the object to the light source, so only one ray needs to be sent out per pixel in the finished product.

Here, the Persistance of Vision Raytracer, or POV-Ray, will be used to demonstrate raytracing for the following reasons: It may be downloaded from http://www.povray.org for Linux, Microsoft Windows, or MacOS. The help files are extensive and can serve as indrotuction to ray-tracing on their own.
 * It is free software, and availible on virtually all platforms, so it is accessible to everyone.
 * Scenes are defined by means of text files, so examples are easy to follow and the underlying aspects of raytracing are more evident.
 * The scene files are also modular as in a programming language, so it is easy to build off the work of others.
 *  [plus, the author hasn't used anything else] 

Sanity check
We will now render the original computer graphics clich&eacute;: a mirrored sphere hovering over a checkered plane. Enter the following text into "lesson01-test.pov" (Windows users can enter it into POV-Ray for Windows's internal text editor and save it as this when prompted)

/*Test scene*/ global_settings{ assumed_gamma 1.0 //make sure that this looks the same on all monitors }
 * 1) version 3.5; //this code will work in POV-Ray version 3.5

background{ color rgb <0,0,1> } //Objects plane{ y, 0 /*normal vector, position along that vector*/ texture{ pigment{ checker color rgb <0,1,0> /*green*/ color rgb <1,1,1> /*white*/ }   } } sphere{ <0,2,0>, 1 /*location, radius*/ texture{ pigment{ color rgb <0,0,0> }      finish{ reflection{0.9} ambient 0.0 specular 0.5 }   } } //light light_source{ <0,0,0> /*location*/ color rgb <1,1,1> /*colored white*/ } //camera camera{ location <-4,2.5,0> look_at <0,2,0> } What's antialiasing?

The pixels on your computer screen are large enough for you to see individually. Since the real world isn't made up of tiny squares like pictures on a computer screen are, diagonal lines and curves tend to come out looking jagged. Antialiasing counteracts this by making pixels that cover an edge border an average of the two colors. This looks better, but takes more time, as multiple rays must be sent out per pixel. Render this with the command line parameters "+W320 +H240 +A0.3 +FN" to output a PNG file called "lesson01-test.png" that is 320x240 pixels and is antialiased. If it goes too slowly, use "-A" instead of "+A0.3" next time to turn off antialiasing. If you can see the preview window and don't want to save the image file, next time, use "-F" instead of "+FN".

If all goes well, you will see a mirrored sphere hovering over a green and white checkered floor against a blue sky.

POV-Ray's syntax
Programmers will feel right at home with POV-Ray's syntax, because it is inspired by the C programming language. Whitespace and ends of lines are ignored (camera{location<-4,2.5,0> look_at<0,2,0>} is perfectly legal), comments surrounded by <tt> /*...*/</tt> are ignored, as are comments coming after <tt>//</tt> on a line. The scene file should consist of sequence of "scene items" (their order doesn't matter), where scene items are usually the camera, lights, and objects.

A page about setting up POV-Ray belongs here.

How to use objects
There are two objects in the test scene, the plane and the sphere. Let's look at the sphere. sphere{ <0,2,0>, 1 /*location, radius*/ texture{ pigment{ color rgb <0,0,0> }        finish{ reflection{0.9} ambient 0.0 specular 0.5 }     }   } Change the <tt><0,2,0></tt> to <tt><0,0,0></tt> and rerender. What happens?

[....]

Objects
Objects are made of primitives, simple and not-so-simple constructs like "plane", "sphere", "isosurface". They can be combined by means of Constructive Solid Geometry or CSG. CSG works by adding and subtracting primitives and is very useful for the creation of objects with a large number of simple surfaces, such as floppy disks and furniture.

POV-Ray primitives are seperated into categories:


 * finite solid primitives :These are most like real objects. The simple finite solid primitives include <tt>box, sphere, cone, cylinder, lathe, torus,</tt> and <tt>text</tt>.
 * finite patch primitives :These don't have any thickness. They are <tt>polygon, disc, triangle,</tt> and <tt>bicubic_patch.</tt>  Triangles can be efficiently grouped in very large numbers with <tt>mesh</tt> and <tt>mesh2</tt>.  Usually, this is used for files imported from other formats.
 * infinite solid primitives :<tt>plane</tt> is the only common one, the others create surfaces defined by polynomial equations
 * special math objects :<tt>parametric</tt> and <tt>isosurface</tt> can be used to mathematically define complex surfaces.

The CSG operations are
 * <tt>union</tt>/<tt>merge</tt> :Combine multiple objects into one. <tt>merge</tt> removes internal surfaces for use in, for example, glass.
 * <tt>difference</tt> :Cut out the shape of one object from another.
 * <tt>intersection</tt> :Remove all the shape that isn't in both (all) objects.

The <tt>inverse</tt> keyword turns an object inside-out. The difference is not visible with a plain object (because objects consist only of their surfaces and the surface is in the same place), but is very useful in CSG. <tt>intersection{object{A} object{B}}</tt> is the same as <tt>difference{object{A} object{B inverse}}</tt>. (The <tt>object{}</tt> syntax will be explained later).

For example, here is a coffee cup scene. Try this out in "<tt>lesson02-csg.pov</tt>"

#version 3.5; background{color rgb <0,0,1>} /*objects*/ plane{ y, 0 pigment{checker color rgb <0,1,0> color rgb <1,1,1>}} union{ difference{ cylinder{ <0,0,0>, <0,2,0>, 1 /*bottom, top, radius of cylinder*/ pigment{ color rgb <1,0,0> //red }        }         cylinder{ <0,.1,0>,           <0,2.0001,0> /*results are unpredictable when this is <0,2,0> because it creates "coincident surfaces"*/ 0.9           pigment{ color rgb <0,1,0> //green }        }      }      torus{ .5, .15        rotate x*90 translate x*1.5+y*1 pigment{ color rgb <0,0,1> //blue }     }      translate z*1 }  /*light*/ light_source{<2,5,-4> /*location*/ color rgb <1,1,1> /*colored white*/} /*camera*/ camera{location <0,3.5,-4> look_at <0,2,0> right x*image_width/image_height } Notice that the parts that we are not currently concerned with have been compressed onto their own lines.

Standard practice
But you've been leaving "<tt>texture</tt>" out!

<tt>texture</tt> blocks can contain <tt>pigment</tt>, <tt>normal</tt>, and <tt>finish</tt> blocks for objects with complicated surfaces. It becomes inconvenient to write "<tt>texture{ pigment{ color rgb <0,1,0> }}</tt>" if a pigment is all that's needed, so POV-Ray allows you to leave that. "<tt>texture</tt>" should be used if more than one of the above blocks are included, or if that object has layered textures (more on them later).

As in programming, POV-Ray files can become unreadable and hard to modify if not written well. The code structure is hiearchial &mdash; you could have a <tt>sphere</tt> which contains a <tt>texture</tt> block, which contains a <tt>pigment</tt> block, which contains a <tt>color_map</tt> block, for example. The general rule is that each level of hiearchy is indented one level further than the previous:

sphere{ <0,1,0>, .5  texture{ pigment{ /*don't worry about the unusualness of this section for now*/ bozo scale .4 color_map{ [0.0 color rgb <1.0,0.4,0.4>] [1.0 color rgb <0.1,0.4,0.9>] }      }       finish{ specular 1.0 diffuse 0.4} } } Notice that the rule was violated in the above example - the <tt>finish</tt> block was squished onto one line. Well, this <tt>finish</tt> statement us very short (they almost always are), and one can save space and make the code more legible by violating the rule for simple statements, especially those deep in the hiearchy.

Colors
How does one represent colors in text? Simple names like "red" and "magenta" aren't good enough for duplicating that <font style="background-color:#F5E3E9;">subtle purple-pinkish color on the main page. Any color can be described as a combination of red, green and blue because of the way the human eye works. POV-Ray represents colors as vectors of numbers between 0 and 1. <tt>color rgb <1.0, 0.4, 0.4></tt> is a red color with extra green and blue added &mdash; this makes it a light-red color.

Sometimes, a partially-transparent color is needed, like for defining colored cellophane. In this case something like <tt>color rgbft <0.5, 0.2, 0.2, 0.4, 0.6> </tt> would be used, adding two numbers to describe the transparencey. But good-looking transparent objects require more than that, so we'll save that for later.

Needed/needs consideration

 * standardized code formats
 * should we introduce so many things at once? (copy&pasting text files could be annoying, so maybe we should keep the number of things introduced low)
 * how about a .zip or .tar.bz2 with all the files needed: one download, and instructions are of the form "open Chapter07/specular.pov"?
 * standard sidebars? ("what's antialiasing?" "why'd <tt>texture</tt> disappear?" "How do I do this?")