Changeset fca6e7


Ignore:
Timestamp:
Oct 2, 2009, 3:18:43 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
daf956
Parents:
60cbe5
Message:

FIX of Vector::GetIntersectionWithPlane()

  • Direction was not normalized.
  • simple case of origin is in-plane not immediately returned.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/vector.cpp

    r60cbe5 rfca6e7  
    224224  Direction.CopyVector(LineVector);
    225225  Direction.SubtractVector(Origin);
     226  Direction.Normalize();
    226227  //*out << Verbose(4) << "INFO: Direction is " << Direction << "." << endl;
    227228  factor = Direction.ScalarProduct(PlaneNormal);
     
    233234  helper.SubtractVector(Origin);
    234235  factor = helper.ScalarProduct(PlaneNormal)/factor;
     236  if (factor < MYEPSILON) { // Origin is in-plane
     237    //*out << Verbose(2) << "Origin of line is in-plane, simple." << endl;
     238    CopyVector(Origin);
     239    return true;
     240  }
    235241  //factor = Origin->ScalarProduct(PlaneNormal)*(-PlaneOffset->ScalarProduct(PlaneNormal))/(Direction.ScalarProduct(PlaneNormal));
    236242  Direction.Scale(factor);
Note: See TracChangeset for help on using the changeset viewer.