Friday 3 February 2012

Circle-circle intersection

Intersecting circles can be done in a number ways. One approach is algebraic: take the formulae for the circles and solve them to obtain values for the x and y coordinates. Another approach derives the line that joins the points of intersection then intersects that line with the circle.

But the method I use is more direct, and I think mathematically more robust. By direct I mean it calculates the result directly and does not depend on intermediate results, such as calculating the line or one of x and y first. As such there's much less chance the order of calculation will affect the result.

Thursday 2 February 2012

Perp dot product

I have used the perp dot product in a couple of posts but not explained it. It has a page at Mathworld but no Wikipedia article so I should perhaps explain it here.

The perp dot product is a product between two vectors in two-dimensions, and is obtained by taking the dot product of one vector with the perpendicular of the other. The perpendicular is simply a vector at right angles to the vector it is based on with the same magnitude. It is obtained by rotating through 90° or π/2 radians, or by multiplying by the complex number i in the complex plane.

Wednesday 1 February 2012


One problem that's been touched on in previous posts is how to deal with straight lines. In particular how to represent them efficiently and accurately. Making the wrong choice is not that disastrous but it can cause problems in some situations.

Tuesday 31 January 2012

Angle between two vectors

Another use for inverse trigonometric functions is finding the angle between two vectors. Again there is more than one way to do it, and again the most straightforward approach is often not the best.

Monday 30 January 2012

Inverse trigonometry

The functions asin, acos and atan are together the three principal inverse trigonometric functions; that is they are the inverse of the sine, cosine and tangent functions, the commonest trigonometric functions that describe all the ratios of the sides of a right-angled triangle.