On this web page you find various mathematical results that I found useful and whose proofs I gathered in one place initially for my convenience.

- Locus of points seeing a segment under a constant angle
- Fourier Transform of an impulsion train
- Non-Distributivity of bounding spheres over union
- Number of tuples whose sum is fixed
- Homogeneous matrix of projection from a point on a plane
- Homogeneous matrix of affine transformation mapping a segment to another
- Manhattan distance of a point and a line

## Locus of points seeing a segment under a constant angle

Given two points A and B, you search for the set of points P such that
the angle APB is equal to a given constant α. It is a classical
result that it is a *eight shape* if α is less than
90°, a *circle* of a diameter [AB] if α=90° and
a *lens* if α is greater than 90°. The figure belows
details the eight shape construction.

Starting from two points A and B, trace the line joining these two points... | ..then build the right bissector of [AB], | Next, build the line L passing through A and making and angle of α with (AB). Build the perpendicular to it. | This perpendicular line and the right bissector intersect at O. Trace the circle of center O and passing through A and B. | Repeat from step 3, placing L on the "other side" of AB and you will get another circle (symmetric around [AB] of the first one). The set of points you are looking for is the boundary of the union of the two disks if α<90° and the boundary of the intersection if α>90°. |

In french, it is called the theorem of "the Angle inscrit". See http://ilemaths.net/maths_capes_lecon36.php for more details. You can also play with the java applet below:

- move point A,B or C;
- see the locus of point change;
- slide D on the locus to check the angles are good;

That Java applet is powered by the excellent free software GeoNext.

### Adding third dimension

In 3D, the locus of a point is known as a *biali* or (bialy)
and looks like the image on the right.It is obtained by rotating the
eight shape around the AB line. It is a torus (or doughnut) without
inner hole. A way to see it is to sweep a circle around another
circle. Hence, the biali have a very simple equation in spherical
coordinates in a local frame.

## Fourier Transform of an impulsion train

As I cannot yet find a good way of transforming a LaTeX document to a nice webpage, you have to visualize this document as a PDF.

## Non-Distributivity of bounding spheres over union

If you have two set of points A and B, the bounding sphere (i.e. minimum enclosing sphere) of their union only is contained in but its not equal to the bounding sphere of their bounding spheres as illustrated on the images below.

## Number of tuples whose sum is fixed

The simple version is How many triplets of (positive) integers sum to a given number?

Let's fix n and search for (p,q,r) such that p+q+r=0. We have n choices for p and then we must choose two integers whose sum is n-p. There are exactly n+1-p such pairs since the first one can be any of 0...n-p, and the second is then fixed. So the number of triplets is sum(p=0,p=n,n+1-p) that is (n+1)(n+2)/2.

By recurrence we can then generalize to the number of t-uples which sum to a given number. Gilles Robert gave on fr.sci.maths the general formula together with a better proof~:

To each ordered partition (a_1,a_2,...,a_k) of n with a_i>0 we can associate the k-1 integers in range [1,n+k-1] given in increasing order (a_1+1,a_1+a_2+2,...,a_1+a_2+...+a_(k-1)+k-1<=a_1+...+a_k+k-1=n+k-1). This map is a bijection so the number of partitions is simply C(n+k-1,k-1).## Homogeneous matrix of projection from a point on a plane

This result is often needed in OpenGL and I cannot find a standard reference for this. The basic result is given below. If you want the proof (or derivation), please read the complete note.

The homogeneous matrix of a projection from a point of homogeneous coordinates [p q r s] on a plane of equation ax+by+cz+d=0 is given by the formula :
M = [a b c d]
^{T}X [p q r s] - (ap+bq+cr+ds) I
where I is the identity matrix. For OpenGL users, beware that this matrix "works" only if the point is on negative side of the plane. Otherwise, you must take the opposite matrix -M. This is because OpenGL clips vertices with a negative w component. |

Below is a piece of C code that you can use to compute that matrix.