[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Draft specification



On 17 Dec 2002, Jay Belanger wrote:

> The only question about the draft that I have (and it's only a
> question, not anything else) is why points and vectors will be
> separate entities.  Being able to add points, etc., strikes me as
> being occasionally useful; for example, when you want to find the
> point halfway between them.  (I realize such things can be done using
> vectors, also; I guess it's the difference between
> (1/2)(P+Q) and P + (1/2)vector(P,Q).)
>
An excellent question, of course! :)

Miscellaneous thoughts:

From a differential geometric perspective, points and vectors really are
on different footings. I'm hoping that keeping them distinct as data types
will clarify code that deals with derivatives, tangents, integrals, and
linear transformations (e.g., reflections). If ePiX ever becomes capable
of plotting in non-Euclidean spaces, separation of points and vectors will
be a near necessity. So part of the impetus for separating points and
vectors is "planning for the unforeseeable future".

From an affine geometric perspective, only convex linear combinations of
points ("in which the scalars add to 1", for non-mathematicians:) are
meaningful. It would be easy to provide mnemonically-named functions such
as

  midpoint(point p1, point p2);
  posn(point p, point q, double t); /* (1-t)*p + t*q */

for all coordinate fiddling in which both arguments are points. Of course,
a slew of point-manipulating functions isn't ideal (though the two above
will be implemented in any case), and a program should not be pedantic
about the use of data structures unless some substantial benefit is
gained.

At present, I'm not wholly convinced separate data structures are a good
idea. A "vector"-like class ought to be useful for implementing plot and
transformation routines; however, leaving "vector"s nearly invisible to
the user may be a good idea.

--Andy

Andrew D. Hwang			ahwang at mathcs dot holycross dot edu
Department of Math and CS	http://mathcs.holycross.edu/~ahwang
College of the Holy Cross	(508) 793-2458 (Office: 320 Swords)
Worcester, MA, 01610-2395	(508) 793-3530 (fax)