Skip to content
Jim Pivarski edited this page Mar 3, 2021 · 8 revisions

Design plans, as they evolve

This is a follow-up on Discussion #30 with a general outline of what I'm implementing and why.

The basic objects are:

  • Vectors: 2D, 3D, and 4D "directions (with magnitude)" in space. This is essentially a 2, 3, or 4 component object.
  • Points: 2D, 3D, and 4D "positions" in space. This is also a 2, 3, or 4 component object, differentiated only in how Transforms and FrameTransforms act on it.
  • Transforms: 2D → 2D, 3D → 3D, and 4D → 4D changes in direction and magnitude. The General2DTransform, General3DTransform, and General4DTransform have 2², 3², or 4² components, but PlanarTransform, SpatialTransform, and LorentzTransform (see below) have only 1, 3, and 6 components, generating the rest of the matrix algorithmically. The mathematical functions only assume that xx, xy, yx, yy, etc. exist and call them, be they attributes or properties.
  • FrameTransforms: 2D → 2D, 3D → 3D, and 4D → 4D changes in position, direction, and magnitude. This is a Transform and a Vector for rotation/boost and displacement.

There are two forms for each of the above:

  • a single object, representing a single Vector, Point, Transform, or FrameTransform
  • an array of such objects, named VectorArray, PointArray, TransformArray, or FrameTransformArray.

The names for each number of dimensions are:

  • 2D: Planar, as in PlanarVector, PlanarPoint, PlanarTransform (1 component), PlanarFrameTransform (3 components), General2DTransform (4 components), General2DFrameTransform (6 components)
  • 3D: Spatial (like the above)
  • 4D: Lorentz (I know that the Lorentz-ness is defined by how it's transformed, not in the vector itself, but we'll use this word because Minkowski space is more important than 4D Euclidean space, just as 2D and 3D Euclidean spaces are more important than any other metrics).

Vectors and Points are distinguished as classes so that they can have different __add__ and __sub__ methods (etc.). Initially, only Vectors will actually be implemented (and hence no FrameTransforms, either). We just want to establish that the name exists, so that we know what to call this generalization later, and how it fits into a class hierarchy (i.e. we'll create a mixin class named "Vector", rather than just assuming that everything is a vector, so that "Point" can be added without changing the existing interface for vector-users).

Clone this wiki locally