Projective Geometry - MathMorphs

By Javier de Sa Souza (sasouza@sinectis.com) and Luciano Notarfrancesco (luciano@core-sdi.com)

Keywords: Squeak, MathMorphs, Projective Geometry, Linear Algebra, Geometry.

Abstract: We propose a Projective Geometry framework. Our project lies over the Linear Algebra objects that were constructed during the MathMorphs course.

Objetives: We want to represent projective spaces, in particular the ones that are constructed over linear spaces, such as P(R^n). Finally, we devised a quite straight forward way to do this.

Specification: With the purpose of modeling projective spaces, we have added two methods in the linear ambients, one for getting the projective point associated to a vector (projectiveOf: anObject), and another one for getting some vector associated a given projective point (vectorWithProjective: anObject).

Also, we created some classes for projective geometry objects, such as ProjectiveTuple (homogeneous tuples), ProjectiveSubspace, ProjectiveChart, ProjectiveBasis and ProjectiveAmbient.

A ProjectiveTuple is a just an homogeneous tuple, i.e. the equivalence class of a tuple with the following relation: a = b if and only if a is a non null multiple of b.

A ProjectiveSubspace understands basically the following protocol: dimension, codimension, basis, asLinearSubspace, includes: anObject, isEmpty, < aProjectiveSubspace, <= aProjectiveSubspace, = aProjectiveSubspace, > aProjectiveSubspace, >= aProjectiveSubspace, intersect: aProjectiveSubapce, + aProjectiveSubspace, collinear: aProjectiveSubspace, coplanar: aProjectiveSubspace, skew: aProjectiveSubspace.

A ProjectiveBasis knows some (ordered) projective points, which are called frame of reference, and a distinguished one which is called unit point. Once you fix the frame of reference and the unit point of a ProjectiveBasis, you get a system of coordinates over a projective space. A ProjectiveBasis understands: frame, unit, coordinatesOf: anObject, pointWithCoordinates: aProjectiveTuple.

A ProjectiveChart is an object that implements canonic afine coordinate systems for projective spaces.

A ProjectiveAmbient represents a projective space it self, knows the linear ambient related to it. Its protocol includes: basis, unit, chart: anInteger, vectorFromPoint: anObject, pointFromVector: anObject, coordinatesOf: anObject, pointWithCoordinates: aProjectiveTuple. There is also an algebra of projective ambients, so a ProjectiveAmbient can give you its dual, or the space of projective transforms to another space.

Implementation: The default implementation of projectiveOf: anObject, answers the LinearSubspace generated by anObject, but you can redefine this method (and vectorWithProjective: too) in concrete subclasses of LinearAmbient. This is the default implementation done in LinearAmbient:

projectiveOf: anObject
"Answer the homogenization of the argument."
^LinearSubspace
basis: (LinearBasis new
ambient: self;
yourself)

vectorWithProjective: aLinearSubspace
"Answer a vector whose homogenization is the argument."
^aLinearSubspace basis at: 1

In most of cases, this implementation is enough but in some particular situations it could be insuficent. For example, two projective matrices should know how to multiply themselves. In these cases you must ceate a new class for the projective points and redefine the two methods above in the respective linear ambient. Following with the example of matrices, we created the ProjectiveMatrix class and redefined the methods projectiveOf: aMatrix and vectorWithProjective: aProjectiveMatrix in MatricesAmbient. This is all you have to do in order to add new projective geometry examples. Itīs pretty simple, isnīt it?

Another example we have done are the ProjectiveTransformations. A ProjectiveTransformation understands the following protocol: valueAt: anObject, domain, codomain, image, matrix, inverse, leftInverse, @ (composition), restrictTo: aProjectiveSubspace, corestrictTo: aProjectiveSubspace, isCollineation, isProjectivity; and the nice class method hyperplane: aProjectiveSubspace center: anObject.

If you are looking for implementation details, file in the change set and use a browser.