Method Set(off, dir) now correctly normalizes direction and offset if template parameter NORM is set.

This commit is contained in:
Marco Di Benedetto 2005-09-26 19:49:30 +00:00
parent fefa8ab4c3
commit 9163d261f7
1 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.7 2005/03/18 16:34:42 fiorin
minor changes to comply gcc compiler
Revision 1.6 2004/10/09 13:48:02 ponchio Revision 1.6 2004/10/09 13:48:02 ponchio
Fixed bug in init. Fixed bug in init.
@ -109,8 +112,15 @@ public:
} }
/// sets origin and direction. /// sets origin and direction.
void Set( const ScalarType & off, const PointType & dir ) { void Set( const ScalarType & off, const PointType & dir ) {
SetOffset(off); if (NORM) {
SetDirection(dir); const ScalarType normFactor = dir.Norm();
this->_dir = dir / normFactor;
this->_offset = off / normFactor;
}
else {
this->_offset = off;
this->_dir = dir;
}
} }
void Set( const PointType & dir, const ScalarType & off) {Set(off,dir);} void Set( const PointType & dir, const ScalarType & off) {Set(off,dir);}