Dear list,

in an attemt to project a point onto a plane I have this code:

  /**
   * Projects the given point onto the given plane, offset by the given
   * distance in planes normal direction. The point parameters
   * values are modified (projected) on return.
   *
   * @param point  the point to project and to be modified
   * @param plane  the plane to project on
   * @param off    the distance to offset the point
   */
  public void project(Point3d point, Plane plane, double off) {
    Vector3d vNormal = plane.getNormal();
    double dDot = vNormal.x * point.x +
                  vNormal.y * point.y +
                  vNormal.z * point.z;
    pTmp.scale(dDot + plane.getDistance() + off, vNormal);
    point.sub(pTmp);
  }

You see, I have to calc the dot product myself, I can _not_ use
  dDot = vNormal.dot(point);
as the parameter to Vector3d.dot() must be another vector.

>From 'Computer Graphics, Principles ...; (Foley et al)' I read:
| Chapter A.3  Dot Products and Distances
| ...
| A critical feature of distance measure and angle measure is
| that they make sense for vectors, not points: To measure the
| distance between points in affine space, we take the difference
| vector and measure it's length.

So, in some aspects, J3D seems to follow the 'affine space'
concept, and in most places I'm happy with that.

But in this case (and several other places) I have to code either
some work myself (as above) or to hold in parallel point and
vector instances, synchronizing them all the time via an expensive
copy operation (Tuple.set() method), just to call some methods.

It is impossibe to cast a Point into a Vector and vice versa,
�r is it possible?

As far as I can see, it's common practice in other libraries to
just have a vector class around, if it is meant to be a point,
then it simply is assumed 'the point given by the vector from
the origin of the coordinate system'.

And in my feeling J3D is inconsistent: e.g. the add/sub operations
are defined in the Tuple classes (incarnated as both, a Point
and a Vector), but what is the difference of 2 Points ... a
Vector (beeing a Tuple, ok), what is the addition of a Point
and a Vector ... a new Point. So in many places one can use
the semantic 'it is just a vector, if neccessary, interpret it
as a point from the origin'.

Any thoughts, solutions or am I simply confused and doing
something wrong?

regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to