Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VerdictVector Class Reference

#include <VerdictVector.hpp>

Public Member Functions

 VerdictVector ()
 
 VerdictVector (const double x, const double y, const double z)
 
 VerdictVector (const double xyz[3])
 
 VerdictVector (const VerdictVector &tail, const VerdictVector &head)
 
 VerdictVector (const VerdictVector &copy_from)
 
void set (const double xv, const double yv, const double zv)
 
void set (const double xyz[3])
 
void set (const VerdictVector &tail, const VerdictVector &head)
 
void set (const VerdictVector &to_copy)
 
double x () const
 
double y () const
 
double z () const
 
void get_xyz (double &x, double &y, double &z)
 
void get_xyz (double xyz[3])
 
double & r ()
 
double & theta ()
 
void x (const double xv)
 
void y (const double yv)
 
void z (const double zv)
 
void r (const double xv)
 
void theta (const double yv)
 
void xy_to_rtheta ()
 
void rtheta_to_xy ()
 
void scale_angle (double gamma, double)
 
void blow_out (double gamma, double gamma2=0.0)
 
void rotate (double angle, double)
 
void reflect_about_xaxis (double dummy, double)
 
double normalize ()
 
VerdictVectorlength (const double new_length)
 
double length () const
 
double distance_between (const VerdictVector &test_vector)
 
double length_squared () const
 
double interior_angle (const VerdictVector &otherVector)
 
double vector_angle_quick (const VerdictVector &vec1, const VerdictVector &vec2)
 
double vector_angle (const VerdictVector &vector1, const VerdictVector &vector2) const
 
void perpendicular_z ()
 
void print_me ()
 
void orthogonal_vectors (VerdictVector &vector2, VerdictVector &vector3)
 
void next_point (const VerdictVector &direction, double distance, VerdictVector &out_point)
 
bool within_tolerance (const VerdictVector &vectorPtr2, double tolerance) const
 
VerdictVectoroperator+= (const VerdictVector &vec)
 
VerdictVectoroperator-= (const VerdictVector &vec)
 
VerdictVectoroperator*= (const VerdictVector &vec)
 
VerdictVectoroperator*= (const double scalar)
 
VerdictVectoroperator/= (const double scalar)
 
VerdictVector operator- () const
 
VerdictVectoroperator= (const VerdictVector &from)
 

Private Attributes

double xVal
 
double yVal
 
double zVal
 

Friends

VerdictVector operator~ (const VerdictVector &vec)
 
VerdictVector operator+ (const VerdictVector &v1, const VerdictVector &v2)
 
VerdictVector operator- (const VerdictVector &v1, const VerdictVector &v2)
 
VerdictVector operator* (const VerdictVector &v1, const VerdictVector &v2)
 
VerdictVector operator* (const VerdictVector &v1, const double sclr)
 
VerdictVector operator* (const double sclr, const VerdictVector &v1)
 
double operator% (const VerdictVector &v1, const VerdictVector &v2)
 
VerdictVector operator/ (const VerdictVector &v1, const double sclr)
 
int operator== (const VerdictVector &v1, const VerdictVector &v2)
 
int operator!= (const VerdictVector &v1, const VerdictVector &v2)
 
VerdictVector interpolate (const double param, const VerdictVector &v1, const VerdictVector &v2)
 

Detailed Description

Definition at line 35 of file VerdictVector.hpp.

Constructor & Destructor Documentation

◆ VerdictVector() [1/5]

VerdictVector::VerdictVector ( )
inline

Definition at line 325 of file VerdictVector.hpp.

325 : xVal( 0 ), yVal( 0 ), zVal( 0 ) {}

Referenced by operator-().

◆ VerdictVector() [2/5]

VerdictVector::VerdictVector ( const double  x,
const double  y,
const double  z 
)
inline

Definition at line 332 of file VerdictVector.hpp.

333  : xVal( xIn ), yVal( yIn ), zVal( zIn ) 334 { 335 }

◆ VerdictVector() [3/5]

VerdictVector::VerdictVector ( const double  xyz[3])

Definition at line 438 of file VerdictVector.cpp.

438 : xVal( xyz[0] ), yVal( xyz[1] ), zVal( xyz[2] ) {}

◆ VerdictVector() [4/5]

VerdictVector::VerdictVector ( const VerdictVector tail,
const VerdictVector head 
)
inline

Definition at line 327 of file VerdictVector.hpp.

328  : xVal( head.xVal - tail.xVal ), yVal( head.yVal - tail.yVal ), zVal( head.zVal - tail.zVal ) 329 { 330 }

◆ VerdictVector() [5/5]

VerdictVector::VerdictVector ( const VerdictVector copy_from)
inline

Definition at line 320 of file VerdictVector.hpp.

321  : xVal( copy_from.xVal ), yVal( copy_from.yVal ), zVal( copy_from.zVal ) 322 { 323 }

Member Function Documentation

◆ blow_out()

void VerdictVector::blow_out ( double  gamma,
double  gamma2 = 0.0 
)

Definition at line 133 of file VerdictVector.cpp.

134 { 135  // if gamma == 1, then 136  // map on a circle : r'^2 = sqrt( 1 - (1-r)^2 ) 137  // if gamma ==0, then map back to itself 138  // in between, linearly interpolate 139  xy_to_rtheta(); 140  // r() = sqrt( (2. - r()) * r() ) * gamma + r() * (1-gamma); 141  assert( gamma > 0.0 ); 142  // the following limits should really be roundoff-based 143  if( r() > rmin * 1.001 && r() < 1.001 ) 144  { 145  r() = rmin + pow( r(), gamma ) * ( 1.0 - rmin ); 146  } 147  rtheta_to_xy(); 148 }

References r(), rtheta_to_xy(), and xy_to_rtheta().

◆ distance_between()

double VerdictVector::distance_between ( const VerdictVector test_vector)

Definition at line 45 of file VerdictVector.cpp.

46 { 47  double xv = xVal - test_vector.x(); 48  double yv = yVal - test_vector.y(); 49  double zv = zVal - test_vector.z(); 50  51  return ( sqrt( xv * xv + yv * yv + zv * zv ) ); 52 }

References x(), xVal, y(), yVal, z(), and zVal.

◆ get_xyz() [1/2]

void VerdictVector::get_xyz ( double &  x,
double &  y,
double &  z 
)
inline

Definition at line 258 of file VerdictVector.hpp.

259 { 260  xv = xVal; 261  yv = yVal; 262  zv = zVal; 263 }

References xVal, yVal, and zVal.

Referenced by orthogonal_vectors(), and v_tet_aspect_frobenius().

◆ get_xyz() [2/2]

void VerdictVector::get_xyz ( double  xyz[3])
inline

Definition at line 252 of file VerdictVector.hpp.

253 { 254  xyz[0] = xVal; 255  xyz[1] = yVal; 256  xyz[2] = zVal; 257 }

References xVal, yVal, and zVal.

◆ interior_angle()

double VerdictVector::interior_angle ( const VerdictVector otherVector)

Definition at line 64 of file VerdictVector.cpp.

65 { 66  double cosAngle = 0., angleRad = 0., len1, len2 = 0.; 67  68  if( ( ( len1 = this->length() ) > 0 ) && ( ( len2 = otherVector.length() ) > 0 ) ) 69  cosAngle = ( *this % otherVector ) / ( len1 * len2 ); 70  else 71  { 72  assert( len1 > 0 ); 73  assert( len2 > 0 ); 74  } 75  76  if( ( cosAngle > 1.0 ) && ( cosAngle < 1.0001 ) ) 77  { 78  cosAngle = 1.0; 79  angleRad = acos( cosAngle ); 80  } 81  else if( cosAngle < -1.0 && cosAngle > -1.0001 ) 82  { 83  cosAngle = -1.0; 84  angleRad = acos( cosAngle ); 85  } 86  else if( cosAngle >= -1.0 && cosAngle <= 1.0 ) 87  angleRad = acos( cosAngle ); 88  else 89  { 90  assert( cosAngle < 1.0001 && cosAngle > -1.0001 ); 91  } 92  93  return ( ( angleRad * 180. ) / VERDICT_PI ); 94 }

References length(), and VERDICT_PI.

Referenced by v_tri_maximum_angle(), and v_tri_minimum_angle().

◆ length() [1/2]

double VerdictVector::length ( ) const
inline

Definition at line 477 of file VerdictVector.hpp.

478 { 479  return ( sqrt( xVal * xVal + yVal * yVal + zVal * zVal ) ); 480 }

References xVal, yVal, and zVal.

Referenced by interior_angle(), length(), normalize(), and xy_to_rtheta().

◆ length() [2/2]

◆ length_squared()

◆ next_point()

void VerdictVector::next_point ( const VerdictVector direction,
double  distance,
VerdictVector out_point 
)

Definition at line 425 of file VerdictVector.cpp.

426 { 427  VerdictVector my_direction = direction; 428  my_direction.normalize(); 429  430  // Determine next point in space 431  out_point.x( xVal + ( distance * my_direction.x() ) ); 432  out_point.y( yVal + ( distance * my_direction.y() ) ); 433  out_point.z( zVal + ( distance * my_direction.z() ) ); 434  435  return; 436 }

References normalize(), x(), xVal, y(), yVal, z(), and zVal.

◆ normalize()

double VerdictVector::normalize ( )
inline

Definition at line 482 of file VerdictVector.hpp.

483 { 484  double mag = length(); 485  if( mag != 0 ) 486  { 487  xVal = xVal / mag; 488  yVal = yVal / mag; 489  zVal = zVal / mag; 490  } 491  return mag; 492 }

References length(), xVal, yVal, and zVal.

Referenced by localize_quad_coordinates(), localize_quad_for_ef(), next_point(), orthogonal_vectors(), quad_normal(), signed_corner_areas(), v_hex_quality(), v_hex_skew(), v_quad_distortion(), v_tri_distortion(), vector_angle(), and vectorRotate().

◆ operator*=() [1/2]

VerdictVector & VerdictVector::operator*= ( const double  scalar)
inline

Definition at line 382 of file VerdictVector.hpp.

383 { 384  xVal *= scalar; 385  yVal *= scalar; 386  zVal *= scalar; 387  return *this; 388 }

References xVal, yVal, and zVal.

◆ operator*=() [2/2]

VerdictVector & VerdictVector::operator*= ( const VerdictVector vec)
inline

Definition at line 308 of file VerdictVector.hpp.

309 { 310  double xcross, ycross, zcross; 311  xcross = yVal * vector.z() - zVal * vector.y(); 312  ycross = zVal * vector.x() - xVal * vector.z(); 313  zcross = xVal * vector.y() - yVal * vector.x(); 314  xVal = xcross; 315  yVal = ycross; 316  zVal = zcross; 317  return *this; 318 }

References x(), xVal, y(), yVal, z(), and zVal.

◆ operator+=()

VerdictVector & VerdictVector::operator+= ( const VerdictVector vec)
inline

Definition at line 292 of file VerdictVector.hpp.

293 { 294  xVal += vector.x(); 295  yVal += vector.y(); 296  zVal += vector.z(); 297  return *this; 298 }

References x(), xVal, y(), yVal, z(), and zVal.

◆ operator-()

VerdictVector VerdictVector::operator- ( ) const
inline

Definition at line 414 of file VerdictVector.hpp.

415 { 416  return VerdictVector( -xVal, -yVal, -zVal ); 417 }

References VerdictVector(), xVal, yVal, and zVal.

◆ operator-=()

VerdictVector & VerdictVector::operator-= ( const VerdictVector vec)
inline

Definition at line 300 of file VerdictVector.hpp.

301 { 302  xVal -= vector.x(); 303  yVal -= vector.y(); 304  zVal -= vector.z(); 305  return *this; 306 }

References x(), xVal, y(), yVal, z(), and zVal.

◆ operator/=()

VerdictVector & VerdictVector::operator/= ( const double  scalar)
inline

Definition at line 391 of file VerdictVector.hpp.

392 { 393  assert( scalar != 0 ); 394  xVal /= scalar; 395  yVal /= scalar; 396  zVal /= scalar; 397  return *this; 398 }

References xVal, yVal, and zVal.

◆ operator=()

VerdictVector & VerdictVector::operator= ( const VerdictVector from)
inline

Definition at line 368 of file VerdictVector.hpp.

369 { 370  xVal = from.xVal; 371  yVal = from.yVal; 372  zVal = from.zVal; 373  return *this; 374 }

References xVal, yVal, and zVal.

◆ orthogonal_vectors()

void VerdictVector::orthogonal_vectors ( VerdictVector vector2,
VerdictVector vector3 
)

Definition at line 354 of file VerdictVector.cpp.

355 { 356  double xv[3]; 357  unsigned short i = 0; 358  unsigned short imin = 0; 359  double rmin = 1.0E20; 360  unsigned short iperm1[3]; 361  unsigned short iperm2[3]; 362  unsigned short cont_flag = 1; 363  double vec1[3], vec2[3]; 364  double rmag; 365  366  // Copy the input vector and normalize it 367  VerdictVector vector1 = *this; 368  vector1.normalize(); 369  370  // Initialize perm flags 371  iperm1[0] = 1; 372  iperm1[1] = 2; 373  iperm1[2] = 0; 374  iperm2[0] = 2; 375  iperm2[1] = 0; 376  iperm2[2] = 1; 377  378  // Get into the array format we can work with 379  vector1.get_xyz( vec1 ); 380  381  while( i < 3 && cont_flag ) 382  { 383  if( fabs( vec1[i] ) < 1e-6 ) 384  { 385  vec2[i] = 1.0; 386  vec2[iperm1[i]] = 0.0; 387  vec2[iperm2[i]] = 0.0; 388  cont_flag = 0; 389  } 390  391  if( fabs( vec1[i] ) < rmin ) 392  { 393  imin = i; 394  rmin = fabs( vec1[i] ); 395  } 396  ++i; 397  } 398  399  if( cont_flag ) 400  { 401  xv[imin] = 1.0; 402  xv[iperm1[imin]] = 0.0; 403  xv[iperm2[imin]] = 0.0; 404  405  // Determine cross product 406  vec2[0] = vec1[1] * xv[2] - vec1[2] * xv[1]; 407  vec2[1] = vec1[2] * xv[0] - vec1[0] * xv[2]; 408  vec2[2] = vec1[0] * xv[1] - vec1[1] * xv[0]; 409  410  // Unitize 411  rmag = sqrt( vec2[0] * vec2[0] + vec2[1] * vec2[1] + vec2[2] * vec2[2] ); 412  vec2[0] /= rmag; 413  vec2[1] /= rmag; 414  vec2[2] /= rmag; 415  } 416  417  // Copy 1st orthogonal vector into VerdictVector vector2 418  vector2.set( vec2 ); 419  420  // Cross vectors to determine last orthogonal vector 421  vector3 = vector1 * vector2; 422 }

References get_xyz(), normalize(), and set().

◆ perpendicular_z()

void VerdictVector::perpendicular_z ( )
inline

Definition at line 340 of file VerdictVector.hpp.

341 { 342  double temp = x(); 343  x( y() ); 344  y( -temp ); 345 }

References x(), and y().

◆ print_me()

void VerdictVector::print_me ( )

◆ r() [1/2]

double & VerdictVector::r ( )
inline

Definition at line 264 of file VerdictVector.hpp.

265 { 266  return xVal; 267 }

References xVal.

Referenced by blow_out(), rtheta_to_xy(), scale_angle(), and xy_to_rtheta().

◆ r() [2/2]

void VerdictVector::r ( const double  xv)
inline

Definition at line 284 of file VerdictVector.hpp.

285 { 286  xVal = xv; 287 }

References xVal.

◆ reflect_about_xaxis()

void VerdictVector::reflect_about_xaxis ( double  dummy,
double   
)

Definition at line 150 of file VerdictVector.cpp.

151 { 152  yVal = -yVal; 153 }

References yVal.

◆ rotate()

void VerdictVector::rotate ( double  angle,
double   
)

Definition at line 126 of file VerdictVector.cpp.

127 { 128  xy_to_rtheta(); 129  theta() += angle; 130  rtheta_to_xy(); 131 }

References moab::angle(), rtheta_to_xy(), theta(), and xy_to_rtheta().

◆ rtheta_to_xy()

void VerdictVector::rtheta_to_xy ( )

Definition at line 116 of file VerdictVector.cpp.

117 { 118  // careful about overwriting 119  double x_ = r() * cos( theta() ); 120  double y_ = r() * sin( theta() ); 121  122  x( x_ ); 123  y( y_ ); 124 }

References r(), theta(), x(), and y().

Referenced by blow_out(), rotate(), and scale_angle().

◆ scale_angle()

void VerdictVector::scale_angle ( double  gamma,
double   
)

Definition at line 155 of file VerdictVector.cpp.

156 { 157  const double r_factor = 0.3; 158  const double theta_factor = 0.6; 159  160  xy_to_rtheta(); 161  162  // if neary 2pi, treat as zero 163  // some near zero stuff strays due to roundoff 164  if( theta() > TWO_VERDICT_PI - 0.02 ) theta() = 0; 165  // the above screws up on big sheets - need to overhaul at the sheet level 166  167  if( gamma < 1 ) 168  { 169  // squeeze together points of short radius so that 170  // long chords won't cross them 171  theta() += ( VERDICT_PI - theta() ) * ( 1 - gamma ) * theta_factor * ( 1 - r() ); 172  173  // push away from center of circle, again so long chords won't cross 174  r( ( r_factor + r() ) / ( 1 + r_factor ) ); 175  176  // scale angle by gamma 177  theta() *= gamma; 178  } 179  else 180  { 181  // scale angle by gamma, making sure points nearly 2pi are treated as zero 182  double new_theta = theta() * gamma; 183  if( new_theta < 2.5 * VERDICT_PI || r() < 0.2 ) theta( new_theta ); 184  } 185  rtheta_to_xy(); 186 }

References r(), rtheta_to_xy(), theta(), TWO_VERDICT_PI, VERDICT_PI, and xy_to_rtheta().

◆ set() [1/4]

◆ set() [2/4]

void VerdictVector::set ( const double  xyz[3])
inline

Definition at line 354 of file VerdictVector.hpp.

355 { 356  xVal = xyz[0]; 357  yVal = xyz[1]; 358  zVal = xyz[2]; 359 }

References xVal, yVal, and zVal.

◆ set() [3/4]

void VerdictVector::set ( const VerdictVector tail,
const VerdictVector head 
)
inline

Definition at line 361 of file VerdictVector.hpp.

362 { 363  xVal = head.xVal - tail.xVal; 364  yVal = head.yVal - tail.yVal; 365  zVal = head.zVal - tail.zVal; 366 }

References xVal, yVal, and zVal.

◆ set() [4/4]

void VerdictVector::set ( const VerdictVector to_copy)
inline

Definition at line 376 of file VerdictVector.hpp.

377 { 378  *this = to_copy; 379 }

◆ theta() [1/2]

double & VerdictVector::theta ( )
inline

Definition at line 268 of file VerdictVector.hpp.

269 { 270  return yVal; 271 }

References yVal.

Referenced by rotate(), rtheta_to_xy(), scale_angle(), and xy_to_rtheta().

◆ theta() [2/2]

void VerdictVector::theta ( const double  yv)
inline

Definition at line 288 of file VerdictVector.hpp.

289 { 290  yVal = yv; 291 }

References yVal.

◆ vector_angle()

double VerdictVector::vector_angle ( const VerdictVector vector1,
const VerdictVector vector2 
) const

Definition at line 252 of file VerdictVector.cpp.

253 { 254  // This routine does not assume that any of the input vectors are of unit 255  // length. This routine does not normalize the input vectors. 256  // Special cases: 257  // If the normal vector is zero length: 258  // If a new one can be computed from vectors 1 & 2: 259  // the normal is replaced with the vector cross product 260  // else the two vectors are colinear and zero or 2PI is returned. 261  // If the normal is colinear with either (or both) vectors 262  // a new one is computed with the cross products 263  // (and checked again). 264  265  // Check for zero length normal vector 266  VerdictVector normal = *this; 267  double normal_lensq = normal.length_squared(); 268  double len_tol = 0.0000001; 269  if( normal_lensq <= len_tol ) 270  { 271  // null normal - make it the normal to the plane defined by vector1 272  // and vector2. If still null, the vectors are colinear so check 273  // for zero or 180 angle. 274  normal = vector1 * vector2; 275  normal_lensq = normal.length_squared(); 276  if( normal_lensq <= len_tol ) 277  { 278  double cosine = vector1 % vector2; 279  if( cosine > 0.0 ) 280  return 0.0; 281  else 282  return VERDICT_PI; 283  } 284  } 285  286  // Trap for normal vector colinear to one of the other vectors. If so, 287  // use a normal defined by the two vectors. 288  double dot_tol = 0.985; 289  double dot = vector1 % normal; 290  if( dot * dot >= vector1.length_squared() * normal_lensq * dot_tol ) 291  { 292  normal = vector1 * vector2; 293  normal_lensq = normal.length_squared(); 294  295  // Still problems if all three vectors were colinear 296  if( normal_lensq <= len_tol ) 297  { 298  double cosine = vector1 % vector2; 299  if( cosine >= 0.0 ) 300  return 0.0; 301  else 302  return VERDICT_PI; 303  } 304  } 305  else 306  { 307  // The normal and vector1 are not colinear, now check for vector2 308  dot = vector2 % normal; 309  if( dot * dot >= vector2.length_squared() * normal_lensq * dot_tol ) 310  { 311  normal = vector1 * vector2; 312  } 313  } 314  315  // Assume a plane such that the normal vector is the plane's normal. 316  // Create yAxis perpendicular to both the normal and vector1. yAxis is 317  // now in the plane. Create xAxis as the perpendicular to both yAxis and 318  // the normal. xAxis is in the plane and is the projection of vector1 319  // into the plane. 320  321  normal.normalize(); 322  VerdictVector yAxis = normal; 323  yAxis *= vector1; 324  double yv = vector2 % yAxis; 325  // yAxis memory slot will now be used for xAxis 326  yAxis *= normal; 327  double xv = vector2 % yAxis; 328  329  // assert(x != 0.0 || y != 0.0); 330  if( xv == 0.0 && yv == 0.0 ) 331  { 332  return 0.0; 333  } 334  double angle = atan2( yv, xv ); 335  336  if( angle < 0.0 ) 337  { 338  angle += TWO_VERDICT_PI; 339  } 340  return angle; 341 }

References moab::angle(), moab::dot(), length_squared(), normalize(), TWO_VERDICT_PI, and VERDICT_PI.

◆ vector_angle_quick()

double VerdictVector::vector_angle_quick ( const VerdictVector vec1,
const VerdictVector vec2 
)

Definition at line 188 of file VerdictVector.cpp.

189 { 190  //- compute the angle between two vectors in the plane defined by this vector 191  // build yAxis and xAxis such that xAxis is the projection of 192  // vec1 onto the normal plane of this vector 193  194  // NOTE: vec1 and vec2 are Vectors from the vertex of the angle along 195  // the two sides of the angle. 196  // The angle returned is the right-handed angle around this vector 197  // from vec1 to vec2. 198  199  // NOTE: vector_angle_quick gives exactly the same answer as vector_angle below 200  // providing this vector is normalized. It does so with two fewer 201  // cross-product evaluations and two fewer vector normalizations. 202  // This can be a substantial time savings if the function is called 203  // a significant number of times (e.g Hexer) ... (jrh 11/28/94) 204  // NOTE: vector_angle() is much more robust. Do not use vector_angle_quick() 205  // unless you are very sure of the safety of your input vectors. 206  207  VerdictVector ry = ( *this ) * vec1; 208  VerdictVector rx = ry * ( *this ); 209  210  double xv = vec2 % rx; 211  double yv = vec2 % ry; 212  213  double angle; 214  assert( xv != 0.0 || yv != 0.0 ); 215  216  angle = atan2( yv, xv ); 217  218  if( angle < 0.0 ) 219  { 220  angle += TWO_VERDICT_PI; 221  } 222  return angle; 223 }

References moab::angle(), and TWO_VERDICT_PI.

◆ within_tolerance()

bool VerdictVector::within_tolerance ( const VerdictVector vectorPtr2,
double  tolerance 
) const

Definition at line 343 of file VerdictVector.cpp.

344 { 345  if( ( fabs( this->x() - vectorPtr2.x() ) < tolerance ) && ( fabs( this->y() - vectorPtr2.y() ) < tolerance ) && 346  ( fabs( this->z() - vectorPtr2.z() ) < tolerance ) ) 347  { 348  return true; 349  } 350  351  return false; 352 }

References moab::tolerance, x(), y(), and z().

◆ x() [1/2]

◆ x() [2/2]

void VerdictVector::x ( const double  xv)
inline

Definition at line 272 of file VerdictVector.hpp.

273 { 274  xVal = xv; 275 }

References xVal.

◆ xy_to_rtheta()

void VerdictVector::xy_to_rtheta ( )

Definition at line 105 of file VerdictVector.cpp.

106 { 107  // careful about overwriting 108  double r_ = length(); 109  double theta_ = atan2( y(), x() ); 110  if( theta_ < 0.0 ) theta_ += TWO_VERDICT_PI; 111  112  r( r_ ); 113  theta( theta_ ); 114 }

References length(), r(), theta(), TWO_VERDICT_PI, x(), and y().

Referenced by blow_out(), rotate(), and scale_angle().

◆ y() [1/2]

◆ y() [2/2]

void VerdictVector::y ( const double  yv)
inline

Definition at line 276 of file VerdictVector.hpp.

277 { 278  yVal = yv; 279 }

References yVal.

◆ z() [1/2]

double VerdictVector::z ( ) const
inline

◆ z() [2/2]

void VerdictVector::z ( const double  zv)
inline

Definition at line 280 of file VerdictVector.hpp.

281 { 282  zVal = zv; 283 }

References zVal.

Friends And Related Function Documentation

◆ interpolate

VerdictVector interpolate ( const double  param,
const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 98 of file VerdictVector.cpp.

99 { 100  VerdictVector temp = ( 1.0 - param ) * v1; 101  temp += param * v2; 102  return temp; 103 }

◆ operator!=

int operator!= ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 467 of file VerdictVector.hpp.

468 { 469  return ( v1.xVal != v2.xVal || v1.yVal != v2.yVal || v1.zVal != v2.zVal ); 470 }

◆ operator%

double operator% ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 495 of file VerdictVector.hpp.

496 { 497  return ( vector1.x() * vector2.x() + vector1.y() * vector2.y() + vector1.z() * vector2.z() ); 498 }

◆ operator* [1/3]

VerdictVector operator* ( const double  sclr,
const VerdictVector v1 
)
friend

Definition at line 451 of file VerdictVector.hpp.

452 { 453  return VerdictVector( vector1 ) *= scalar; 454 }

◆ operator* [2/3]

VerdictVector operator* ( const VerdictVector v1,
const double  sclr 
)
friend

Definition at line 445 of file VerdictVector.hpp.

446 { 447  return VerdictVector( vector1 ) *= scalar; 448 }

◆ operator* [3/3]

VerdictVector operator* ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 439 of file VerdictVector.hpp.

440 { 441  return VerdictVector( vector1 ) *= vector2; 442 }

◆ operator+

VerdictVector operator+ ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 419 of file VerdictVector.hpp.

420 { 421  double xv = vector1.x() + vector2.x(); 422  double yv = vector1.y() + vector2.y(); 423  double zv = vector1.z() + vector2.z(); 424  return VerdictVector( xv, yv, zv ); 425  // return VerdictVector(vector1) += vector2; 426 }

◆ operator-

VerdictVector operator- ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 428 of file VerdictVector.hpp.

429 { 430  double xv = vector1.x() - vector2.x(); 431  double yv = vector1.y() - vector2.y(); 432  double zv = vector1.z() - vector2.z(); 433  return VerdictVector( xv, yv, zv ); 434  // return VerdictVector(vector1) -= vector2; 435 }

◆ operator/

VerdictVector operator/ ( const VerdictVector v1,
const double  sclr 
)
friend

Definition at line 457 of file VerdictVector.hpp.

458 { 459  return VerdictVector( vector1 ) /= scalar; 460 }

◆ operator==

int operator== ( const VerdictVector v1,
const VerdictVector v2 
)
friend

Definition at line 462 of file VerdictVector.hpp.

463 { 464  return ( v1.xVal == v2.xVal && v1.yVal == v2.yVal && v1.zVal == v2.zVal ); 465 }

◆ operator~

VerdictVector operator~ ( const VerdictVector vec)
friend

Definition at line 401 of file VerdictVector.hpp.

402 { 403  double mag = sqrt( vec.xVal * vec.xVal + vec.yVal * vec.yVal + vec.zVal * vec.zVal ); 404  405  VerdictVector temp = vec; 406  if( mag != 0.0 ) 407  { 408  temp /= mag; 409  } 410  return temp; 411 }

Member Data Documentation

◆ xVal

◆ yVal

◆ zVal


The documentation for this class was generated from the following files: