Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7597 in orxonox.OLD for branches/cd/src/lib/math


Ignore:
Timestamp:
May 11, 2006, 5:34:14 PM (19 years ago)
Author:
patrick
Message:

cd: plane forumula reformulated since there was a small bug in it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cd/src/lib/math/plane.cc

    r7589 r7597  
    268268{
    269269  n = (a-b).cross(c-b);
    270   k = -(n.x*b.x+n.y*b.y+n.z*b.z);
     270  k = n.dot(a) / n.len();
    271271}
    272272
     
    279279{
    280280  n = norm;
    281   k = -(n.x*p.x+n.y*p.y+n.z*p.z);
     281  k = n.dot(p) / n.len();
    282282}
    283283
     
    292292  Vector p(g[0], g[1], g[2]);
    293293  n = norm;
    294   k = -(n.x*p.x+n.y*p.y+n.z*p.z);
     294  k = n.dot(p) / n.len();
    295295}
    296296
     
    316316  float l = n.len();
    317317  if( l == 0.0) return 0.0;
    318   return (n.dot(p) + k) / n.len();
     318  return (n.dot(p) / n.len() - k);
    319319}
    320320
     
    342342{
    343343  Vector s(p[0], p[1], p[2]);
     344
    344345  float l = n.len();
    345346  if( l == 0.0) return 0.0;
    346   return (n.dot(s) /*+ k*/) / n.len();
     347  return (n.dot(s) / n.len() - k);
    347348}
    348349
Note: See TracChangeset for help on using the changeset viewer.