Posts

Showing posts with the label Graphics

Best Way To Describe Vector Vs Raster

Answer : I always say Raster records the pixels in the picture. Vector records the steps it took to draw the picture. So if you enlarge Raster you get a big picture with big pixels. If you enlarge Vector the computer follows the steps to redraw at higher resolution. If you have a chance to demo it for them, load up Word and put in 1 small (raster) image and 1 clip art. Then drag the corners to show what happens. You could even print out the before/after and hang it on your cube so you have something to point to. In layman's terms. Raster (I usually just say "bitmap" though) images record the colors in order. Blue, blue, blue, light blue, light blue, light blue... (At this point i'm pointing at a nearby object and reading colors on the top, left to right). Vector image is a description about an image. "A light blue circle 12cm across. A solid blue background. Then I explain how Rasters are better for photographs because that's h...

Calculating A LookAt Matrix

Answer : Note the example given is a left-handed, row major matrix . So the operation is: Translate to the origin first (move by - eye ), then rotate so that the vector from eye to At lines up with +z: Basically you get the same result if you pre-multiply the rotation matrix by a translation - eye : [ 1 0 0 0 ] [ xaxis.x yaxis.x zaxis.x 0 ] [ 0 1 0 0 ] * [ xaxis.y yaxis.y zaxis.y 0 ] [ 0 0 1 0 ] [ xaxis.z yaxis.z zaxis.z 0 ] [ -eye.x -eye.y -eye.z 1 ] [ 0 0 0 1 ] [ xaxis.x yaxis.x zaxis.x 0 ] = [ xaxis.y yaxis.y zaxis.y 0 ] [ xaxis.z yaxis.z zaxis.z 0 ] [ dot(xaxis,-eye) dot(yaxis,-eye) dot(zaxis,-eye) 1 ] Additional notes: Note that a viewing transformation is (intentionally) inverted : you multiply every vertex by this matrix to "move the world" so that the portion you want to s...

Automatizing PSfrag Export

Image
Answer : Let me try to give you some hints. Problem 1. When you look at a specific tick in a Graphics it usually looks similar to the following {200., 200., {0.00625, 0.}, {GrayLevel[0.], AbsoluteThickness[0.25]}} it means, at position 200 draw the number 200. The next list is the specification of the tick-length and then follows a list of graphic-directives to use. I assume if you convert the label into another form, like a string, you may have more luck with your approach. Let's try something transformTick[{pos_, label_, length_List, spec_List}] := {pos, ToString[label, TraditionalForm], length, spec} p1 = Plot[x^2, {x, 0, 1000}, Frame -> True] p2 = Show[p1, FrameTicks -> Map[transformTick, FrameTicks /. AbsoluteOptions[p, FrameTicks], {2}]] It seems the Ticks are a bit smaller and the dot after the number does not appear in the original but otherwise it looks OK for me. If you now compare ImportString[ExportString[#, "EPS"], "EPS...