From: Daniel Pitts on
This is almost an English question, rather than a programming question,
because I'm searching for the suitable name of a class.

I'm creating some value types for a simulation that I'm working on.

In the past, I've used a vector as a representation of a point, but I've
realized that they have subtle differences in properties. A vector
represents a delta, or a change, where a Point represents a fixed
location.

From this realization, I've determined:

1. A vector can be multiplied or divided by a scalar; A point can not.
2. A vector has a unit value; A points does not.
3. Two vectors can be added or subtracted. Two points can be only
subtracted (which results in a vector)
4. A vector can be added to and subtracted from a point, resulting in
a point.

Among other things.

So, for my implementation, vectors are implemented in terms of a
rectangular coordinate and points are implemented in terms of a vector.
The vector value of a point is the delta from the origin.

Now, I have also figured out that there is the same difference between
an "Angle" and a "____", but I don't know what to call "____" (and I'm
not sure which one is the vector analogue vs the point analogue).

I'm thinking that maybe angles are the fixed (point analague) value.
The vector analogue, eg the delta, might be called "rotation", but I'm
not sure. An angle would be implemented in terms of a "rotation" from
some determined origin (east for example), and rotation will be defined
as a scalar value (probably using radian units).

Does this all make sense, or am I too sleep deprived :-)

So, what should my class names be? I'm thinking of calling them Vector,
Point, Rotation, Angle, but Rotation seems to not quit fit. FixedAngle
vs RelativeAngle is a bit too wordy, and there is probably a more
concise and exact concept that I'm missing.

Thanks,
Daniel.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: Ben Bacarisse on
Daniel Pitts <newsgroup.spamfilter(a)virtualinfinity.net> writes:

> This is almost an English question, rather than a programming
> question, because I'm searching for the suitable name of a class.
>
> I'm creating some value types for a simulation that I'm working on.
>
> In the past, I've used a vector as a representation of a point, but
> I've realized that they have subtle differences in properties. A
> vector represents a delta, or a change, where a Point represents a
> fixed location.
>
> From this realization, I've determined:
>
> 1. A vector can be multiplied or divided by a scalar; A point can not.
> 2. A vector has a unit value; A points does not.
> 3. Two vectors can be added or subtracted. Two points can be only
> subtracted (which results in a vector)
> 4. A vector can be added to and subtracted from a point, resulting
> in a point.

Why can't these be done to points? Take the first. Give P a sequence
of points, P' = x * P (multiply the points in P by a scalar x) has a
well-defined geometric meaning.

I suppose my point (sorry) is why would you want to complicate matters
by making this distinction? Does it pay off for the programmer?

<snip>
--
Ben.
From: Pascal J. Bourguignon on
Daniel Pitts <newsgroup.spamfilter(a)virtualinfinity.net> writes:

> This is almost an English question, rather than a programming
> question, because I'm searching for the suitable name of a class.
>
> I'm creating some value types for a simulation that I'm working on.
>
> In the past, I've used a vector as a representation of a point, but
> I've realized that they have subtle differences in properties. A
> vector represents a delta, or a change, where a Point represents a
> fixed location.
>
> From this realization, I've determined:
>
> 1. A vector can be multiplied or divided by a scalar; A point can not.
> 2. A vector has a unit value; A points does not.
> 3. Two vectors can be added or subtracted. Two points can be only
> subtracted (which results in a vector)
> 4. A vector can be added to and subtracted from a point, resulting
> in a point.
>
> Among other things.
>
> So, for my implementation, vectors are implemented in terms of a
> rectangular coordinate and points are implemented in terms of a
> vector. The vector value of a point is the delta from the origin.
>
> Now, I have also figured out that there is the same difference between
> an "Angle" and a "____", but I don't know what to call "____" (and I'm
> not sure which one is the vector analogue vs the point analogue).
>
> I'm thinking that maybe angles are the fixed (point analague)
> value.
> The vector analogue, eg the delta, might be called "rotation",
> but I'm not sure.
> An angle would be implemented in terms of a
> "rotation" from some determined origin (east for example), and
> rotation will be defined as a scalar value (probably using radian
> units).
>
> Does this all make sense, or am I too sleep deprived :-)
>
> So, what should my class names be? I'm thinking of calling them
> Vector, Point, Rotation, Angle, but Rotation seems to not quit fit.
> FixedAngle vs RelativeAngle is a bit too wordy, and there is probably
> a more concise and exact concept that I'm missing.


I would have had direction <-> point and angle <-> vector, but one
problem is that we don't in general give directions (or angles) from
an absolute origin, but from a relative one, so it is more difficult
to characterize an angular equivalent to a point. (What makes a point
particular with respect to a vector, is that it is usually given
relative to an origin). Also, this is the reason why "angle" might be
somewhat ambiguous, and you're right that "rotation" would be clearer
in this context. Another term that could be used for an absolute
direction is "quadrant", but it is rather coarse.

But in a program, you get to choose and define your terminology, so I
would use "Direction" (from the origin).

Vector <-> Rotation
^ ^
| |
v v
Point <-> Direction


--
__Pascal Bourguignon__
From: Daniel Pitts on
Ben Bacarisse wrote:
> Daniel Pitts <newsgroup.spamfilter(a)virtualinfinity.net> writes:
>
>> This is almost an English question, rather than a programming
>> question, because I'm searching for the suitable name of a class.
>>
>> I'm creating some value types for a simulation that I'm working on.
>>
>> In the past, I've used a vector as a representation of a point, but
>> I've realized that they have subtle differences in properties. A
>> vector represents a delta, or a change, where a Point represents a
>> fixed location.
>>
>> From this realization, I've determined:
>>
>> 1. A vector can be multiplied or divided by a scalar; A point can not.
>> 2. A vector has a unit value; A points does not.
>> 3. Two vectors can be added or subtracted. Two points can be only
>> subtracted (which results in a vector)
>> 4. A vector can be added to and subtracted from a point, resulting
>> in a point.
>
> Why can't these be done to points? Take the first. Give P a sequence
> of points, P' = x * P (multiply the points in P by a scalar x) has a
> well-defined geometric meaning.
Scaling a point has a meaning based on the origin, but the origin is
itself an arbitrary point, so the geometric meaning of scaling a point
is dependent on the origin. Yes, the origin is most commonly (0,0), but
that doesn't mean it must be. Vectors, since they have a direction and
magnitude, but no location, can be scaled regardless of origin choice.

>
> I suppose my point (sorry) is why would you want to complicate matters
> by making this distinction? Does it pay off for the programmer?
>
> <snip>

It does pay off. Even if the operations were exactly the same, the
semantics of a point are very specific. A point is slightly less
primitive than a vector, and avoiding primitive obsession leads to
cleaner code. The distinction becomes even *more* important with
angles, particularly in my case. I'm going to be using two different
types of angle units, which have different scales and origins. Keeping
the concept of fixed vs delta makes it easier to manage the difference
between scales and origins.


--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: Vaclav Haisman on
If you consider different coordinate systems like cylindrical or spherical
then angle is vector, IMHO.

--
VH