[Edu-sig] re: Does edu-sig extend to Jython

Patrick K. O'Brien pobrien@orbtech.com
Mon, 19 Aug 2002 23:33:54 -0500


[Arthur]
>
> Since there is no *geometric* reason for plane, line to be
> preferable over line, plane in finding an intersection, I would
> like there not to be an artificially imposed way it needs to
> be done. Basically just trying to get out of the way.

I may be off target here, but I keep thinking that maybe overloading an
operator is a cleaner solution for what you are describing. For example, can
an intersection be represented by some mathematical operation on the two
objects?

    intersection = someLine % somePlane

Then each object would just have to define the special methods __mod__(self,
other) and __rmod__(self, other). If the order of the operands is
insignificant then the following line would yield an equivalent result as
the example above:

  intersection = somePlane % someLine

Thoughts?

--
Patrick K. O'Brien
Orbtech
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------
Web:  http://www.orbtech.com/web/pobrien/
Blog: http://www.orbtech.com/blog/pobrien/
Wiki: http://www.orbtech.com/wiki/PatrickOBrien
-----------------------------------------------