home *** CD-ROM | disk | FTP | other *** search
/ ftp.hitl.washington.edu / ftp.hitl.washington.edu.tar / ftp.hitl.washington.edu / pub / people / peter / ER / ThickObject.cxx < prev    next >
C/C++ Source or Header  |  1998-07-07  |  1KB  |  51 lines

  1. /*
  2.     ThickObject.cxx
  3. */
  4.  
  5. #include "ThickObject.h"
  6.  
  7. ThickObject::ThickObject(v3dObject *thin_object, float thickness)
  8.     : v3dObject(), thin_object_ (thin_object)
  9. {
  10.     initialize(thickness);
  11. }
  12.  
  13. ThickObject::~ThickObject()
  14. {
  15. }
  16.  
  17. void
  18. ThickObject::initialize(float thickness)
  19. {
  20.     // Create a larger object around the thin object to give
  21.     // it some thickness.
  22.     v3dDim thin_obj_size = thin_object_->GetSize(), target_size;
  23.  
  24.     target_size.x(thin_obj_size.x() < thickness ? thickness : thin_obj_size.x());
  25.     target_size.y(thin_obj_size.y() < thickness ? thickness : thin_obj_size.y());
  26.     target_size.z(thin_obj_size.z() < thickness ? thickness : thin_obj_size.z());
  27.  
  28.     imp_->CreateBlock(target_size.x(), target_size.y(), target_size.z(),
  29.         false);
  30.  
  31.     // Stick the thin object to the thick object.
  32.     v3dObject::SetAbsoluteOrientation(thin_object_->GetAbsoluteOrientation());
  33.     thin_object_->MoveAbsolute(v3dPos(0,0,0));
  34.     v3dObject::MoveAbsolute(v3dPos(0,0,0));
  35.     Add(thin_object_);
  36.     v3dObject::Hide();
  37.  
  38. }
  39.  
  40. /////////////////////
  41. // Object scaling //
  42. ///////////////////
  43.  
  44. void
  45. ThickObject::Scale (const v3dVector &factors, const v3dPos& point)
  46. {
  47.     thin_object_->Scale(factors, point);
  48.     v3dObject::Scale(factors, point);
  49. }
  50.  
  51.