Back to index

PHFrame.C

 
//--------------------------------------------------------------------------------------- 
//  
// Purpose:  member functions of PHFrame.h 
// 
// Created by:  Jane M. Burward-Hoy and Federica Messer 
// 
// Purpose: Reference frame class. 
//  
// Last update:  10/19/99 
// 
// 
// Adapted from Jeff Mitchell's luxFrame.hh and luxFrame.cc 
//---------------------------------------------------------------------------------------- 
 
#include "PHFrame.h" 
 
PHFrame::PHFrame() 
{ 
  u.setX(1.0);  
  v.setY(1.0);  
  getWfromUV(); 
} 
 
PHFrame::~PHFrame() {} 
 
PHFrame::PHFrame(PHPoint p, PHVector v1, PHVector v2) 
{ 
   
 v1.normalize(); 
 v2.normalize(); 
 
 origin = p; 
 u = v1; 
 v = v2; 
 getWfromUV(); 
 
} 
 
PHFrame& PHFrame::operator=(const PHFrame &F) 
 { 
   origin = F.origin; 
   u = F.u; 
   v = F.v; 
   w = F.w; 
 } 
 
void PHFrame::print() const  
{ 
  cout << "Origin: " << origin << endl;  
  cout << "Axes:  u =  " << u << ", v =  " << v << ", w =  " << w << endl; 
} 
 
PHBoolean PHFrame::checkOrthogonal() const 
{ 
  PHBoolean orthogonal = True; 
 
  if (u.dot(v) != 0.0){ 
    orthogonal = False; 
    cout << "ERROR: u and v axes are not orthogonal in PHFrame::checkOrthogonal()" << endl; } 
  if (u.dot(w) != 0.0) { 
    orthogonal = False; 
    cout << "ERROR: u and w axes are not orthogonal in PHFrame::checkOrthogonal()" << endl; } 
  if (v.dot(w) != 0.0) { 
    orthogonal = False; 
    cout << "ERROR: v and w axes are not orthogonal in PHFrame::checkOrthogonal()" << endl; } 
 
  return orthogonal; 
} 
 
 
void PHFrame::setU(PHVector vector) 
{ 
  vector.normalize(); 
  u = vector; 
} 
 
void PHFrame::setV(PHVector vector) 
{ 
  vector.normalize(); 
  v = vector; 
} 
 
void PHFrame::setW(PHVector vector) 
{ 
  vector.normalize(); 
  w = vector; 
} 
 
 

Back to index