# Assignment 1: Cubic Choreography

Due date:  Friday, 01.11.2013 at 12 pm (Berlin).  The decision to extend deadline until midnight represents a compromise between wanting to preserve the weekend for recovering from the work-week, and wanting to make sure that teams can find time to get together, which can be a problem when team members attend different tutorials.  If you want to work on the extra credit assignment (see below) you have until one week later to complete that work, as I have promised some new code to assist and we won’t learn how to pull this new code until next week’s gitorious tutorials.)

Goals of assignment: This assignment is designed to develop the following skills:

• Use of the MatrixBuilder class to construct arbitrary euclidean (or other interesting) matrices,
• Practice in controlling and creating simple animations,  and
• Acquaintance with the Assignment class, in particular, ability to add a slider or other GUI element to the inspector panel.

The first step in completing the assignment is to copy the assignment to a package of your own making “parallel” to the template package.  Use the “New->Package” menu item in eclipse to do say.  Please use the format studentxx where “xx” is the 2-digit number assigned to you on the latest version of the signup sheet I have circulated in class.  If you don’t know this number, send me e-mail or take a look at the sheet at the next class meeting.  Leave the name of the copy as Assignment1. Follow the directions in the JavaDoc for the class Assignment1 to complete the assignment.  In the interests of stimulating your creativity I give some ideas here for how you can fulfill the first part of the exercise, to change the matrix applied to the scene graph components in the method setValueAtTime(). Ideas for generating matrices. The calculation of the matrix depends on two helper functions:  getGeometryParameter(i,j) and scalingFactor().  The default (“template”) versions of these functions and the construction via MatrixBuilder is very simple — all cubes rotate a full turn around the y-axis, and the animation delay depends only on column of the cube array where the cube is. Both functions contain optional code which you can un-comment to obtain somewhat more interesting behavior.   Some possible further changes include:

• getGeometryParameter(i,j):  Make the level sets of this function more interesting: diagonal lines through the array (as in the commented-code), or concentric circles or hyperbolae.  Or some completely different ordering such that each cube receives a different value based on some walk through the array.
• scalingFactor():  The commented-out code returns an “inverted tent” function of its input.  One could smooth this out — use the method AnimationUtility.hermiteInterpolation instead of AnimationUtllity.linearInterpolation. Or redefine this function to depend directly on the (i,j) indices of the cube to obtain location-dependent scaling (now it’s only time-dependent).
• Use other types of basic transformations in the MatrixBuilder method call.  For example:
• Non-uniform scaling — 3 different values instead of identical values, as in the template code.  These values can also depend on the (i,j) location of the cube in the array.
• Rotations whose axes depend on the (i,j) position of the cube in the array, or rotations through an axis which doesn’t go through the origin.
• Translations.  One natural choice would be vertical translations (in the z-direction) which depend on time and/or position of the cube in the array. This could be used to simulate the motion of a wave through the array.
• One can also consider changing the way the cubes are arranged, for example, replace the square with a cylinder or a torus.  To do so, one has to adjust the call the MatrixBuilder in the method setupArray().  In the template this method arranges the cubes by translating them to positions in a square array.
• Extra credit assignment  Change setupArray() so that the (bottom faces of the) cubes are arranged without gaps or overlap on the surface of a torus with minor radius 1 and major radius R. Note: Doing this requires going beyond the capabilities of the MatrixBuilder class, since it requires mapping a square onto a non-parallelogram. As discussed in class, this can be solved using a general projectivity mapping 5 points onto 5 points (in $\mathbf{P}^3$);  I have added the corresponding method to the class Pn and you can fetch the new version next week when we learn how to do that.

I hope these suggestions stimulate you to further brain-storming. An image of a version incorporating some of these suggestions is shown below: # Using gitorious.org, Part II

In this followup post to the original posting on this subject, we  deal with how to work with changes in the source code.  There are various sorts of situations we need to handle:

1. You want to push your work from your local repository to your gitorious repository, either to make it available to your team members, or to turn it in to me.
2. You need to update your version of my repositories.  This can happen in two ways:
1. the jReality clone which you used to set up your workspace has  been changed — typically to add a feature or fix a bug which is relevant to our class work.
2. the course repository has been updated with a new assignment which you need to integrate into your workflow.

The solutions presented below — in contrast to the original post for gitorious — are based on the git command-line interface.  So to use them, you need to have a shell open.  Commands in this shell will be indicated by a leading ‘%’ to indicate a shell prompt.

Preliminary repair work. Before beginning we need to do a little repair work.  Change directory to where your local git repository for the course is, and then change directory into the .git subdirectory.  Use a text editor to edit the file config, to replace any occurrences of the string “assg1” with “master” (this reflects the fact that I have changed the course repository on gitorious to have only a single branch named “master”; having more was just going to be too complicated for everyone).  If you have any questions, wait until the next tutorial meeting to carry this out.

Push your work up to your gitorious repository. The solution to 1. above is simple.

1. First we give the commands, then we explain them:
• % cd my_local_git_repository
• % git commit -m “My version of Assignment1”
• % git push
2. The ‘add’ command adds any files you’ve created to the list of changes to be committed to your local repository.  The ‘commit’ command commits these changes to your local repository.  The ‘push’ command propagates them to your gitorious repository.
3. If you have your ssh keys properly installed, this should propagate your changes to your gitorious repository.
4. Now you can notify your team member of the changes, or if the changes represent something that I should see, send me an e-mail notifying me.  Be sure to paste the string for your gitorious repository into the e-mail, so I can install it into my eclipse workspace in case I don’t already have it or identify it (if I have installed it).
5. If you want to update from your repository (either because you’ve updated it from another computer or a collaborator has done so), use the command
• % git pull
• or, in eclipse, “Team->pull”

1. Issue the following commands in a shell:
• % cd my_local_jreality_repository
• % git status
• % git checkout origin/develop -b develop
2. If the last command complains that the branch “develop” already exists, then just omit the “-b develop”.
3. From now on, to update jReality you can issue the command
• % git pull
• or, inside of eclipse, “Team->pull”

In the course of the semester there will be new assignments that you need to “download” from the course repository.  They do not immediately show up on your cloned gitorious repository.  This is the most complicated procedure since it represents an independent branch of the repository which has to be merged into your working version. Here is how you can update using the git command line.

1.  Then issue the following commands in a shell:
• % cd my_local_tu-mathvis-ws13_repository
• % git status
• % git remote add teacher git://gitorious.org/tu-mathvis-ws13/tu-mathvis-ws13.git
• % git fetch teacher
• % git checkout teacher/master -b teacher
• % git checkout master
• % git merge teacher
2. Explanation: The “status” command should show a “clean” branch — one with no changes that need to be committed.  If there are un-committed changes, commit them first.  The “remote” command adds a new remote reference to your git repository with the name “teacher”.  This is my original repository that you cloned on gitorious. The “fetch” command brings over the current version of this “teacher” repository into your local repository. The first “checkout” command checks out the “master” branch of this “teacher” repository, and creates a new local branch named “teacher” for it.  The second “checkout” command reverts the current working directory to the “master” branch of your local repository.  The “merge” command merges the “teacher” branch into this local “master” branch.  If you have been following the rules for development, then the changes from teacher and the changes you makes should be mutually exclusive and the merge should be trivial.
3.  You can then commit the changes and push the result onto your gitorious repository following the instructions at the beginning of this document.

# 22-24.10 Matrices and Motions

The lecture on 22.10 began with a repetition of the “guided visualization” from the first meeting on 15.10.  Then Dr. Gunn demo-ed a couple of dynamic geometry applets demonstrating two theorems from the “early days” of projective geometry (circa 1640): Desargues Theorem and Pascal’s Theorem, emphasizing the qualities of mobility and variety which both theorems exhibit. Links can be found on the previous post.

Coordinates for projective geometry. When projective geometry was rediscovered in the 1820’s, the mathematics was available to introduce coordinates.  In modern form, this can be expressed as the projectivization of $\mathbb{R}^n$ introduced in the previous lecture:   $\mathbf{P}^2(\mathbb{R}) := \mathbb{R}^3~/~\sim \text{ where } \mathbf{P} \sim \mathbf{Q} \iff \mathbf{P} = \lambda \mathbf{Q} \text{ for } \lambda \neq 0$.

Note: the following discussion focuses on the case of the projective plane $\mathbf{P}^2(\mathbb{R})$.  Everything said here generalizes easily to general dimension $n$, in particular to $n=3$ which is the case we are really interested in.

Projective transformations and the projective group.  A projective transformation, or projectivity for short, is defined as an invertible self-map of $\mathbf{P}^n(\mathbb{R})$ which preserves lines.  Here, a line is the set of points spanned by two points: $\alpha \mathbf{P} + \beta \mathbf{Q}$ for $\alpha, \beta \in \mathbb{R}$.  It’s not hard to see that this corresponds to a plane through the origin in $\mathbb{R}^{n+1}$.   An invertible self-map of $\mathbb{R}^{n+1}$ which maps planes to planes is what is called a linear map, and satisfies $f(\alpha \mathbf{P} + \beta \mathbf{Q}) = \alpha f(\mathbf{P})+\beta f(\mathbf{Q})$.  The set of all such self-maps forms a group, called the general linear group of dimension $n+1$, and written $GL(n, \mathbb{R})$.  Once a basis has been chosen one has a representation as matrices, hence $GL(n+1,\mathbb{R})$ is sometimes called a matrix group.

Exercise: Show that an element of $GL(n+1,\mathbb{R})$ induces a self-map of $\mathbf{P}^n(\mathbb{R})$ which maps lines to lines, that is, is projective.  And conversely, a projective transformation comes from some element of  $GL(n+1,\mathbb{R})$.  Two matrices give rise to the same projective transformation $\iff$ they are non-zero multiples of each other.

Hence the group of projectivities is the quotient of $GL(n+1)/ \mathbb{R}$.  It is written $PGL(n+1,\mathbb{R})$ to indicate that it results from projectivizing $GL(n+1,\mathbb{R})$. It has one less dimension than $GL(n+1)/ \mathbb{R}$.  Hence $PGL(3,\mathbb{R})$ has dimension $9-1=8$.

The group PGL(n+1,\mathbb{R})$includes a huge range of possible transformations. A basic result which characterizes this group is: a projectivity is uniquely determined by choosing any$n+2$points to be mapped to any other$n+2$points (of course the points must be in general position). The study of possible projective transformations is an interesting subject in its own right but one which we have to pass by right now. Often one is interested only in the affine subgroup, that is, the transformations that map the ideal elements to themselves. Exercise: An affine transformation has last row$(0,0, ….,0,1$). Among the affine transformations, one is interested particularly in isotropic scaling by the factor$\lambda$. Such a transformation has a diagonal matrix all of whose diagonal entries are$\lambda \neq 0$, except the last one which is, as noted, 1. For this course we will be particularly interested in the subgoup of the affine group that preserves distance and angle: Euclidean Isometries. Recall that a euclidean transformation is a self-map of euclidean space that preserves euclidean distances and angles. Exercise: A euclidean isometry is a projectivity. Hence we can identify the euclidean group with a subgroup of$PGL(n+1, \mathbb{R})$. Furthermore, the set of orientation-preserving isometries$\mathbf{E}^+(n)$is a subgroup of the full euclidean group$\mathbf{E}(n)$. Exercise: An isometry is orientation-preserving$\iff$its determinant is positive. Exercises. All these exercises refer to the euclidean plane. 1. A euclidean translation by the vector$\mathbf{u} = (x_u, y_u)$is given by the matrix$\mathbf{T}_{\mathbf{u}} = \left( \begin{array}{ccc} 1 & 0 & x_u \\ 0 & 1 & y_u \\ 0 & 0 & 1 \end{array} \right)$ 2. A euclidean rotation around the origin by angle$\alpha$is given by the matrix $\mathbf{R}_{O,\alpha} = \left ( \begin{array}{ccc} \cos{\alpha} & -\sin{\alpha} & 0 \\ \sin{\alpha} & \cos{\alpha} & 0 \\ 0 & 0 & 1 \end{array} \right)$ 3. Write the matrix form for a rotation$\mathbf{R}_{\mathbf{C},\alpha}$around the point$\mathbf{C} = (x_c, y_c)$through angle$\alpha$. [Hint:$\mathbf{R}_{\mathbf{C},\alpha} = \mathbf{T}_{\mathbf{C}} \circ \mathbf{R}_{O,\alpha} \circ \mathbf{T}_{\mathbf{-C}}$.] How translations and really a kind of rotation [optional]. One of the unusual aspects of euclidean geometry is that translations and rotations seem so different, yet both are isometries. Using the projective model we have developed, it’s possible to argue that a translation is really a kind of rotation. Consider the translation$\mathbf{T}_{(1,0)}$with translation vector$(1,0)$. Imagine the series of rotations$R_n$indexed by$n$with center$(0,n)$through an angle$\dfrac{1}{2 \pi n}$. Exercise: For any bounded region$D$of the plane, I can find an$n_0$such that$R_n -\mathbf{T}_{(1,0)}$for$n> n_0$is arbitrarily small for any point in$D$. Taking this to the limit, one arrives at the conclusion that the translation$\mathbf{T}_{(1,0)}$can be thought of as a rotation around the ideal point$(0,1,0)$through a distance (not angle!) 1. Similar results apply for any translation; the “center point” is then the ideal point in the direction perpendicular to the translation. Conclusion. This concludes the theoretical introduction to how euclidean isometries can be expressed as matrices. The next step is to study the jReality classes: 1. de.jreality.math.Rn This class provides general report for the euclidean vector space$\mathbb{R}^n$. This includes multiplying matrices times vectors and other operations from linear algebra. 2. de.jreality.math.MatrixBuilder This is the primary class for constructing euclidean isometries. Equipped with this knowledge, you should then be prepared to go to work on Assignment1. For details consult the Javadoc for the Java class in eclipse. # 17.10 To Infinity and Back: Introducing Projective Geometry The Renaissance was a time of great innovation in all areas of European life. Science, art, and religion all received powerful new impulses. I focused on the development of painting, where the invention of perspective painting had important consequences for mathematics. The first perspective paintings appeared around 1420 (Masaccio). The slides containing the paintings discussed in the lecture can be found here. From Art to Geometry. Around 100 years later the process had been mechanized (Dürer), and finally, after another 100 years, the French architect and mathematician Rene Desargues published a book (1642) which provided a new geometry to represent perspective painting. This new geometry is called projective geometry. The name comes directly from its roots in perspective painting, as follows. Central Projection. The essential operation of perspective painting was identified as a central projection, in which points in the world are projected onto points of an image plane by means of lines passing through the center point of the projection (think of the eye of the painter, and the image plane as a plane standing between the painter and the world — which he transfers to his canvas). The essential problem in terms of describing such a projection geometrically was the existence of vanishing points: points in the image where parallel lines in the world appear to meet. It was awkward to have a pairing of points in which some points did not have a partner: the vanishing points on the image had no real partner point in the world since parallel lines, by definition, do not meet. Ideal elements. Desargues innovation was to suppose that parallel lines in fact do meet, in a special sort of point, an ideal point. All lines parallel to a given line share the same ideal point. All the ideal points of all the lines in a plane go together to form a line, the ideal line of the plane. (You might think they would form a circle, but since it’s “infinitely” far away, it can’t be curved, so is a line.) And all the ideal points of all the lines in space form a plane, the ideal plane. (These ideal points bear a strong resemblance to free vectors, see Exercise 3 below.) The first flower. Desargues developed his new geometry, based on the addition of these ideal elements to the ordinary elements, purely synthetically, that is, without coordinates. He discovered beautiful theorems (for example, Desargues Theorem). His younger colleague, Blaise Pascal, contributed other remarkable theorems, such as Pascal’s Theorem. But the new geometry was too far ahead of its time. The geometry of Desargues’ friend Rene Descartes was better suited to new impulses in natural science which remained within the framework of euclidean geometry. Cartesian geometry spread rapidly, while Desargues’ work was forgotten and disappeared. It was rediscovered, independently, in 1822 by another Frenchman, Jean-Victor Poncelet, and has since then developed into a broad and deep branch of mathematics. There is reason to believe that it may yet prove useful to the further development of natural science just as Cartesian geometry has been useful during the past 400 years. When it was rediscovered, projective geometry was outfitted with coordinates, it is these coordinates which I want now to describe, since they are important to the field of mathematical visualization. Mathematical definitions. The real projective plane$\mathbf{P}^2(\mathbb{R})$is defined by applying an equivalence relation to the euclidean vector space$\mathbb{R}^3$. Two points with coordinates$(x,y,z)$and$(x’,y’,z’)$are defined to be equivalent$\iff(x’,y’,z’)=(\lambda x, \lambda y, \lambda z)$for some$\lambda \neq 0$. This equivalence relation can be expressed geometrically by saying, “the points of the projective plane are the lines of$\mathbb{R}^3$}”. Each projective points has many possible representatives$(\lambda x, \lambda y, \lambda z)$from$\mathbb{R}^3$. We write$(x,y,z)$(a bit sloppily) to mean the equivalence class of$(x,y,z)$. The connection to Desargues. In this definition of the projective plane, where are the “ordinary” points and where are the “ideal” points discussed above? The simplest answer is to define a point$(x,y,z)$to be ordinary if$z \neq 0$, and to be ideal if$z = 0$. In the former case, we can choose$\lambda = \dfrac{1}{z}$to obtain an equivalent representative point$(\dfrac{x}{z}, \dfrac{y}{z}, 1)$. Hence we can assume the ordinary points are of the form$(x,y.1)$while, as we show below, the ideal points appear in the form$(x,y,0)$. We call these coordinates affine coordinates for the projective plane. Intersection of parallel lines. Let’s apply this framework to the problem of representing the intersection of parallel lines. If we represent a line by its line equation in ordinary coordinates, it has the form$ax+by+c=0$where not both$a$and$b$are zero. Using affine coordinates, this takes the form$ax+by+cz=0$. In this form the expression is symmetric in$(a,b,c)$and$(x,y,z)$hence$(x,y,z)$coordinates for the projective plane are sometimes called homogeneous coordinates. It’s clear that if$(x,y,z)$satisfies the line equation, then so does$(\lambda x, \lambda y, \lambda z)$for$\lambda \neq 0$, hence the line equation is well-defined for points of the projective plane, and our choice of$z=1$is not essential. Exercises 1. Intersection of two lines. 1. Show that the intersection of the two lines$l : ax+by+cz=0$and$m : dx+ey+fz=0$is the projective point$(bf-ce, -af+cd, ae-bd)$. [Hint: show this expression satisfies both equations.] 2. Show that$l$and$m$are parallel$\iffae-bc = 0$, hence the intersection point$(x_i, y_i, z_i)$is ideal$\iffz_i = 0$. Hence the ideal line of the plane is given by the equation$z = 0$. 3. The ideal point of the line with equation$ax+by+cz=0$is$(b, -a, 0)$. [Hint: apply A + B above.] Conclude that all lines of the form$ax+by+cz=0$for fixed$a$and$b$have the same ideal point$(b,-a,0)$. 2. Joining line of two points. 1. Show that the joining line of two points$P : (x_0,y_0,z_0)$and$Q: (x_1,y_1,z_1)$is the line with line equation$ax + by + cz = 0$where$(a,b,c) = (y_0 z_1 – y_1 z_0, x_1z_0 – x_0 z_1, x_0 y_1 – x_1 y_0)$. [Hint: show that both points satisfy this equation.] 2. In high school, using traditional Cartesian coordinates, perhaps you learned that the line through the point$P := (x_0,y_0)$with direction vector$V := (u,v)$has line equation$-vx +uy + x_0v-uy_0 = 0$. Show that you obtain the same line equation in the projective setting by joining the point$(x,y,1)$with the ideal point$(u,v,0)$using the formula in part A above. 3. Result B) above implies that a free vector in Cartesian geometry is similar to an ideal point in projective geometry. Consider other properties of free vectors and test whether and how they carry over to ideal points. For example, a vector is often defined as the difference of two points. (For this exercise, assume that we are using affine coordinates for the ordinary points in$\mathbf{P}^2(\mathbb{R})$, i.e., points have the form$(x,y,1)\$.)  On the basis of this, discuss the following statement:  “An ideal point is a direction.”

Hopefully these exercises have convinced you that projective geometry in fact solves the problem posed by vanishing points, and provides a  representation with which we can compute practical problems.

Eye and hand:   There are in good reasons to deny the existence of the ideal points of projective geometry, as well as to assert their existence.  How can one resolve this contradiction? One way is to understand the two positions as representing two different human sense organs.  The euclidean view, that parallel lines do not meet,  is derived from the evidence provided by the sense of touch.  I can never hope to touch an ideal point since if I try to move towards it, the parallel lines remain the same distance apart.  On the other hand, the sense of sight sees the parallel sides of a train track intersect at the horizon as clearly as the sense of touch knows they stay the same distance apart forever.  The different senses give rise to different geometries.  Neither one is right or wrong, just different.

Exercise. It’s only been around 600 years, since the early Renaissance, that human beings (first just a few, now everyone) have been conscious of seeing parallel lines intersect in a “realistic” perspective picture. Why do you think this development took so long to occur?

Resources: For more detailed treatments of projective geometry see the resources listed on the webpage for the course Geometrie I, such as these lecture notes by Boris Springborn.

Coming next: Using projective geometry to represent geometric transformations, such as translations, rotations, scaling, and more.

# 15.10 Tutorial: Getting Started with the Tools

Dr. Gunn spent the first 10 minutes setting up the beamer he brought with him, overlooking the beamer installed on the ceiling.  Next time!

Dr. Gunn introduced Benjamin Kutschan, an experienced student who has volunteered to assist with the tutorial. After discussion with students, Dr. Gunn decided to offer the tutorial on both Tuesday 12-14 and Thursday 12-14 in MA 313.  Students should choose one of these two days to attend.  These times will be mostly open consulting times where Dr. Gunn and Benjamin will circulate among the students teams and answer questions, etc.  Please bring your laptops.

Dr. Gunn introduced the jReality web-site.  He showed how to access and experiment with the jReality Developer tutorial:

• If you have problems with the “Run as Java Webstart” button on the tutorial pages please activate the Java console (on recent Mac OS, open System Preferences, click on the Java icon on the last row, and in the Control Panel that opens, click on the rightmost tab “Advanced”.  There,  under the heading “Java console”, click the radio-button labeled “Show console”. Then copy and paste to gunn at math.tu-berlin.de any error messages that shows up in the Java console.)

Dr. Gunn talked about git, a system of distributing and sharing code which will be used for this course. He showed a nifty “Git workflow” chart made by Stefan Sechelmann and promised that Stefan would come soon to talk about the git part of things.  There is now a post on this blog describing this process.

Dr. Gunn demonstrated a student project from WS12: OrbiTrain by Katharine Hoffmann and Michael Reinke, which “trains” the user to recognize the exact symmetry group of a wallpaper pattern.  He lavished praise on the user interface.

Dr. Gunn wrote on the board  four things students can do to prepare for the rest of the course:

1. Get an account on gitorious.org if you don’t already have one.
2. Get and install eclipse if you haven’t already done so.
3. Play with the jReality developer tutorial.
4. Play with the webstart projects from last years course (WS12).

Finally, Dr. Gunn mentioned the evaluation process as an area he hopes can be an ongoing and mutually beneficial part of the course.

# 15.10 Apps, Animations, Artifacts: An Overview of Mathematical Visualization

We start out on our expedition.  We began by doing some “guided mathematical visualization” with our eyes closed, led by Dr. Gunn.  At the other extreme Dr. Gunn asked whether a crystal he brought with him represents “mathematical visualization”. We chose to leave unanswered the question of whether some being could have thought the crystal into existence as a kind of “mathematical visualization”.  In any case we decided that neither example qualified as a mathematical visualization (MV) in the sense of this course.  To be a MV in the sense of this course means to combine something of the thought quality of pure mathematics with the sense-perceptible, material nature of the crystal.  It must be an “embodiment” of mathematics.

Next, Dr. Gunn introduced 3 types of “product” that qualify as mathematical visualization:

1. 3D prints (the ones he passed around he had made in the last 6 years at the 3D Lab at TU Berlin.) Please also check out this blog post from Franziska Lippoldt — a student in last year’s course — describing her experience making a 3D print from her semester project.
2. Mathematical movies, where the content was generated directly from mathematical models in the computer.
1. Outside In: A movie from the Geometry Center on turning the sphere inside out.
2. The Borromean Rings: A movie from TU Berlin introducing the new logo (new in 2006!) of the International Mathematical Union.
3. Interactive applications which allow the user to explore and experience a mathematical domain.  Example of the Archimedean solids app.

We noted that these three categories fit in sequence between the crystal and pure math, as they progress from more “thing-like” to more “mind-like”, the latter being characterized by pure freedom, the former by pure necessity — in philosophical terms.

We established that most if not all of the course participants plan to go into some “applied” area when they graduate from the TU.  Hence they will not be working in “pure math” mode but in a mode in which mathematics is brought into some “embodied” form in the real world.  Hopefully the visualization course can be a preparation for this direction of work and will develop relevant non-mathematical skills  such as design, communication, and teamwork.

# Using gitorious.org, Part I

In this post I want to introduce you to git, a source control system which we will be using this semester to distribute and exchange software.  We will furthermore be using the site gitorious.org as the home for our repositories.

Set up a gitorious account.  Go to  gitorious.org and register if you don’t already have an account.  Login.

Overview of git workflow. Before proceeding to the details, take a look at this diagram  showing how the workflow for the course will be organized. (Ideally it would be embedded on this page so you could look and read at the same time but … alas …) Since using gitorious requires the use of ssh security, we begin with describing how to setup ssh keys.

Setting up ssh keys. We first need to install some encryption keys on your local machine which will allow you to use the ssh protocol to “push” your changes back onto the gitorious repository in a secure way.   You’ll need to install these keys on every machine you use to communicate with gitorious.

1. Go to your home directory and check if the directory .ssh exists.  If it doesn’t, create it with the shell command:  “mkdir .ssh”.
2. Execute the shell command “cd .ssh”.
3. If the files id_rsa and id_rsa.pub already exist, you can skip the next step.
4. Execute the shell command “ssh-keygen -C name@address”.  The last argument should be your email address.  If the program asks for input, simply hit return or enter (except on Windows — see below). This will generate the files id_rsa (the private key) and id_rsa.pub (the public key) without extra password protection.
1. On Windows if the command ssh-keygen does not exist, download git for windows form the official git page and look for a shell called git-bash.  With this shell you can do all the steps of the tutorial.
2. Warning: on Windows, it appears you must give a name for the key file.  Give the string “id_rsa”.
5. Copy the contents of id_rsa.pub into the clipboard, for example, by executing “cat id_rsa.pub”, selecting the resulting text, and copying it into the clipboard with Cmd-c.
6. Login to your gitorious account.  Select “Settings” on your dashboard, and then click on the button “Manage SSH keys”
7. On the resulting page, click on the button “Add SSH key”.
8. Paste the contents of id_rsa.pub (from step 4) into the large text field which is displayed, and click on the “Save” button.
9. Back on the list of SSH keys on your gitorious account, the new SSH key should immediately appear.  There will be an “x” under the “Ready?” field; this should change to a check after a few minutes.  Once it does, you are ready to roll.
10. If you use more than one machine for the course work for this course, you’ll need to install these keys on each such machine.  The simplest way is to copy the two key files from .ssh directory onto the .ssh directory on the other machines.  This way you avoid having to add other SSH keys to your gitorious account.

Cloning repositories. The next step is to clone the git repository for this course into your gitorious account.  First make sure you are logged in to your gitorious account.

1. To clone the repository for this course,  enter “https://gitorious.org/tu-mathvis-ws13” in your browser window.  The home page for the gitorious repository for this course should appear, (owned by gitorious user “gunn”).
2. On the right-hand side, there should be a heading “Repositories”. Click on the single entry there “tu-mathvis-ws13/tu-mathvis-ws13”.
3. On the right side of the resulting page you should see a “Clone” button.  Click this button. A window should appear, informing you that the repository is being created.
4. Once the cloned repository is created, its content is shown.
5. Return to the dashboard view of your own gitorious account, and refresh the browser view.  You should now see the tu-mathvis-ws13 repository listed on the right side under the heading “Your repositories”.

Adding collaborators to a gitorious project. Each team needs to create one clone as above.  Other group members can then be added to the cloned repository as collaborators.  Assume the first student’s account name is wingthor and the second is loki.  wingthor has cloned the tu-mathvis-ws13 repository and wants to add loki as a collaborator.  Here’s how to do this:

1. On the gitorious page for wingthor’s cloned repository, there should be a tab (on the right end) entitled “Admin”.
2. Select the menu item “Manage collaborators”.  Select this.
3. In the text field next to the blue button labeled “Add as Collaborator”, enter the team member’s gitorious name, for example, “loki”, and make sure he has full permissions (“review”, “commit” and “administer”).
4. Then click the “Add as Collaborator” button.  He/She should then appear in the list of collaborators.

Accessing your cloned repository in eclipse.

The final step is to access the cloned repository in eclipse.  I recommend that you create a separate workspace for the course, let’s say it’s a folder called myws.  The following directions use eclipse as an interface to git; it’s also possible to use git directly via command-line or shell as was shown in the tutorial.

1. Start up eclipse, open this empty workspace, and go to the “Git Repository Exploring” perspective.
2. Cloning jReality
1. Select the menu item (also available as icon on top toolbar) “Clone a repository”.
2. Enter git@gitorious.org:jreality/gunns-jreality.git in the window that pops up.  It should automatically fill in other fields of this window.
3. Click “Next” twice to move to the final dialog window.
4. Edit the “Directory:” field to be “…/myws/jreality” (or whatever you named your workspace.)
5. Choose “Initial branch:” to be “develop”  (not “master”!).
6. Click “Finish”.
7. It takes a bit of time, but eventually it should copy all repository entries and report success.
8. Switch to the “Package Explorer” perspective.  Select menu item “Import…->General Project->Existing Project Into Workspace…”.
9. Give the directory given in point D.) above as the location of the project, and click “Finish”.
10. You should now see the project “jreality” in the Package Explorer.
11. To check that it works, you can navigate to the src-tutorial directory and try running some of the tutorial examples. (Using right-click then “Run As…->Java Application”.
3. Cloning the course repository tu-mathvis-ws13.
1. Logged in to your gitorious account, find the label “Your repositories” and click on the entry corresponding to the tu-mathvis-ws13 repository you cloned.
2. In the window that appears, make sure the “ssh” button is selected and then select the text in the text field that should look something like: “git@gitorious.org:tu-mathvis-ws13/wingthors-tu-mathvis-ws13.git” (instead of wingthor you should see your gitorious account name).
4. Select either the “clone repository” icon in the upper tool bar, or simply right click and choose the entry “Paste repository path or URL”.  The result should be a filled-in dialog window entitled “Source Git Repository” (filled-in with the contents of the clipboard).  Make sure that protocol: “ssh” is selected, then click “Next” at the bottom of the window.
5. If the ssh keys have been successfully installed, it should then produce a window entitled “Branch selection”.  Since there’s only one, all you have to do is click “Next”.
6. Now you should see a window entitled “Local destination”. Edit this text field to be a folder in your workspace with an appropriate name, like tu-mathvis-ws13.  Then click “Finish”.
7. Switch to the Package Explorer perspective in eclipse.
8. Follow the same directions as above to add the eclipse project to the Package Explorer.
9. You should see two projects now: jReality and “tu-mathvis-ws13”, or whatever you named it.
10. Open up the course project and find the Java file src/template/Assignment1.java.  Select it, right click, and select “Run as Java application”.   You should see a window that looks something like: That concludes the installation process.

For further information about using git, see this follow-up post.

Using the git command-line interface instead:

1.

# Course Log

This post contains a running “table of contents” of the lectures and tutorial meetings of the course.

The student projects can now be accessed on the homepage of the course, scroll down to the images.

# 15.10  Tutorial: Getting started with the tools.

15.10 Apps, Animations, Artifacts … : An Overview of Mathematical Visualization

## Mathematical Visualization WS13 — Opening Words

### Featured

[You can access the course log here, to get an overview of what happened during the course.]

Welcome to the blog for the course Mathematical Visualization at TU Berlin for winter semester 2013-2014. I’ve decided to continue to use the blog from last year, so please keep that in mind when examining the entries: you’re welcome to read all the old posts but new content naturally overrides anything from previous years.

There is still a web-site for the course but the main focus will be here.  In this first post I want to give students an impression of what to expect and if you’re interested give you some pointers on what you can do before the course officially begins on Oct. 15.

First, you can find out a bit about me by looking at my home page here at the TU. As a glance at that reveals, my interests and skills are centered on geometry and on visualization.  I consider myself to be lucky to be at the TU Berlin, since there is a strong community of others here and at the other Berlin universities that share this interest and provide a supportive and interested working environment.

The course will be hands-on and project-oriented, directed at creating software to visualize a mathematical theme.  Choice of theme is not rigidly determined but I have some directions which I’d like to concentrate on — based on what I know and can do.  These include symmetry groups in 2 and 3 dimensions in euclidean and non-euclidean geometry.  Having attended Geometrie I course at the TU will be useful but not necessary for participating in the course. The main prerequisite is to have Java  programming experience.  Students work in groups of 2 (in rare cases 3) to carry out the assignments and to complete a final project.  We will be using eclipse as a development environment and the Java project jReality (from the visualization group at the TU) as a 3D visualization package.

Until the lectures start, if you want to learn more and get a taste for what awaits you, here are some suggestions:

• Play with the semester projects from last year’s course.  This will give you an idea what is expected regarding the student project. Also see this blog for an account by one of last year’s students, Franziska Lippoldt, of her experience making a 3D print related to her semester project.
• Visit the jReality developer tutorial and work through the tutorial examples presented there.  Almost all have a “Run as Java webstart” button which should cause the example to run as an Java application on your machine.  You’ll be asked to allow access to your machine before it can run — I recommend accepting, the code is safe.
• If you have problems running the webstarts, please contact Andre Heydt (mongo at schwarzbu.ch) — despite the address he’s at the TU and is responsible for the jReality website.

That’s about all for now.  I’m looking forward to the course and meeting and working with you should you decide to attend.  I’m going on vacation on Sunday (Sept. 22) and will be back shortly before the beginning of classes, so my response to emails may be sometimes slow.

# Tutorial: Student projects page

I have added a table to the web-site for our course, where each student project will be listed.  There are two completed entries for the projects which were presented last week.  There are six other entries for remaining projects.  If you don’t see your project there, it’s because you haven’t created a project file of the form ProjectLastName1LastName2 as instructed in the previous blog.  Please do that (by renaming your current project class, for example) and send me an e-mail so I can create an entry for your project too.

In order to complete the entry for your project, I will need the following information for your project.  You can provide it to me via e-mail as soon as you have it, you don´t need to wait until after your presentation.

• A screen shot of your application at work.  Optimal size: 250×190, but any image with aspect ratio 4:3 will do.
• A short text describing your project.  It should fit in the space shown in the table.
• The slides of your presentation [optional].  The best form is a pdf file.

Online documentation. The above entry also contains a link to a web-start version of your application.    This is a Java technology that allows a Java application to be run anywhere on the web by downloading the necessary resources.  This is all contained in a .jnlp file — the details don’t need to concern you, I will take responsibility for generating this file. First of all, please test it out to make sure it works.

Furthermore, there are some details regarding the on-line documentation file which have to be observed when getting the webstart to work. Here’s the situation:

When you run your application in Eclipse and hit the ‘h’ key, a browser pops up and displays the on-line documentation file associated with your application (its name is returned by the getDocumentationFile() method in the class util.Assignment). (Be sure to implement this method in your project file if you haven’t already done so, or your on-line documentation won’t be found!)

However, as a webstart, it’s not possible to use this approach since the documentation files are not available as URL’s for the browser.  Instead, the documentation file can be opened in a Java browser by clicking on the small question mark on the upper right of the GUI panel to the left of the graphics panel.  This “browser” is very rudimentary and has limitations which you need to be aware of:

• All the html files associated to your application need to be in the same package as your project class, or in a sub-package of that class.  That means, you cannot use the symbol “../” in the definition of the path of the documentation file.
• If you include images in your html file using the <img> … </img> command, do not use the symbol “./” when specifying the position of the image file.  For example if the file is named “foo.png”, write src=”foo.png”, not src=”./foo.png”.  Furthermore, you must explicitly specify the size of the image to guarantee that it will be displayed, using the width=”” and height=”” directives.  For example, if the image is 400×300, write width=”400″ and height=”300″.