[Edu-sig] more chatter re OOP + PolyGeom
Kirby Urner
pdx4d@teleport.com
Tue, 09 May 2000 12:30:10 -0700
At 03:35 PM 05/08/2000 -0700, I wrote:
>The power of object oriented programming seems especially
>clear to me in that I ended up making no changes to my
>Quaternion class, which contains stuff like
>
<<snip>>
Sigh. Not unusually, just when I thought I had it all nailed
down, I found a bug in my coords.py module, which made cross
product asymmetric depending on whether you were doing
Vector.cross(Qvector) or Qvector.cross(Vector).
Note: Qvectors are quadrays, defined as 4-tuples vis-a-vis
the 4 basis vectors of a "home base" tetrahedron defined
by intertangent equi-radius spheres (tetrahedron edges = 1,
tetrahedron volume = 1).
The problem showed up when I got ambitious and decided to
incorporate my quaternions-based rotation method within my
generic shapes.Shape class -- will allow you to rotate any
shape subclass around X,Y or Z axis by theta (degrees).
Well, after so incorporating, I discovered my tetrahedra
were getting all distorted by the rotation method, which
led to backtracking and bug-fixing. So now there's a new
cross product method in coords.Vector that's more explicitly
XYZ-based (to make sure the cross-breeding of hybrid vector
types doesn't create any mutants).
Now I'm feeling confidant again, and have uploaded the new
code, along with a substantial rewrite of
http://www.inetarena.com/~pdx4d/ocn/numeracy1.html
-- which is about my vector algebra implementation, including
the backend into POV-ray (Persistance of Vision Ray Tracer)[1].
I also added a Cube shape, and split off some of the methods
used to study the Jitterbug relationship in a class by
itself, allowing only _some_ shapes to inherit them -- a
multiple inheritance situation, which Python allows.
I've been inviting a pre-college audience to check out this
material, and perhaps get into the nitty gritty at some
point.[2] I think this implementation gives a lot of
insight into object-oriented design i.e. shows the power
of inheritance, late binding, method overriding and so on.
This has been my goal all along: to use spatial geometry,
with the attractive graphics this entails, as a hook into
the mysteries of OOP (object oriented programming), with
polyhedra as paradigm objects.[3]
Also, as it so happens that I'm a Fuller Schooler, my
spatial geometry just takes all that concentric hierarchy
+ sphere packing and jitterbug stuff for granted, with
quadrays fitting rather seamlessly into this context.[4]
Kirby
[1] http://www.povray.org/
[2] http://mathforum.com/epigone/geometry-pre-college/skendsnehgly
[3] http://www.inetarena.com/~pdx4d/ocn/trends2000.html
[4] For more on the concentric hierarchy:
http://www.teleport.com/~pdx4d/volumes.html
http://www.teleport.com/~pdx4d/volumes2.html