Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::HomCoord Class Reference

Homogeneous coordinate vector. More...

#include <HomXform.hpp>

+ Collaboration diagram for moab::HomCoord:

Public Member Functions

 HomCoord ()
 constructors More...
 
 HomCoord (const int coords[], const int num_coords=4)
 
 HomCoord (const int coord0, const int coord1, const int coord2, const int coord3)
 
 HomCoord (const int coord0, const int coord1, const int coord2)
 
 HomCoord (const HomCoord &coord)
 
void set (const int coords[])
 set function More...
 
void set (const int i, const int j, const int k, const int h=1)
 
const int * hom_coord () const
 get function More...
 
int i () const
 parameter-based access functions More...
 
int j () const
 
int k () const
 
int h () const
 
int length_squared () const
 squared length More...
 
int length () const
 length More...
 
void normalize ()
 normalize More...
 
HomCoordoperator*= (const HomXform &rhs2)
 operators More...
 
HomCoord operator* (const HomXform &rhs2) const
 
HomCoordoperator*= (const int mult)
 
HomCoord operator* (const int mult) const
 
HomCoordoperator/= (const HomXform &rhs2)
 
HomCoord operator/ (const HomXform &rhs2) const
 
HomCoordoperator/= (const int mult)
 
HomCoord operator/ (const int mult) const
 
HomCoordoperator+= (const HomCoord &rhs1)
 
HomCoord operator+ (const HomCoord &rhs1) const
 
HomCoordoperator-= (const HomCoord &rhs1)
 
HomCoord operator- (const HomCoord &rhs1) const
 
HomCoordoperator= (const HomCoord &rhs)
 
int operator% (const HomCoord &rhs) const
 
HomCoord operator* (const HomCoord &rhs) const
 
HomCoordoperator*= (const HomCoord &rhs)
 
bool operator== (const HomCoord &rhs1) const
 
bool operator!= (const HomCoord &rhs1) const
 
bool operator>= (const HomCoord &rhs1) const
 
bool operator<= (const HomCoord &rhs1) const
 
bool operator> (const HomCoord &rhs1) const
 
bool operator< (const HomCoord &rhs1) const
 
int operator[] (const int &param) const
 
int & operator[] (const int &param)
 

Static Public Member Functions

static HomCoordgetUnitv (int c)
 

Static Public Attributes

static MOAB_EXPORT HomCoord unitv [3] = { HomCoord( 1, 0, 0 ), HomCoord( 0, 1, 0 ), HomCoord( 0, 0, 1 ) }
 
static MOAB_EXPORT HomCoord IDENTITY
 

Private Attributes

int homCoord [4]
 coordinate data More...
 

Friends

class HomXform
 

Detailed Description

Homogeneous coordinate vector.

Definition at line 48 of file HomXform.hpp.

Constructor & Destructor Documentation

◆ HomCoord() [1/5]

moab::HomCoord::HomCoord ( )
inline

constructors

Definition at line 215 of file HomXform.hpp.

216 {
217  homCoord[0] = 0;
218  homCoord[1] = 0;
219  homCoord[2] = 0;
220  homCoord[3] = 0;
221 }

References homCoord.

Referenced by operator*(), operator*=(), operator+(), operator-(), and operator/().

◆ HomCoord() [2/5]

moab::HomCoord::HomCoord ( const int  coords[],
const int  num_coords = 4 
)
inline

Definition at line 223 of file HomXform.hpp.

224 {
225  for( int tmpj = 0; tmpj < num_coords; tmpj++ )
226  homCoord[tmpj] = coords[tmpj];
227  if( num_coords != 4 ) homCoord[3] = 1;
228 }

References homCoord.

◆ HomCoord() [3/5]

moab::HomCoord::HomCoord ( const int  coord0,
const int  coord1,
const int  coord2,
const int  coord3 
)
inline

Definition at line 230 of file HomXform.hpp.

231 {
232  homCoord[0] = coord0;
233  homCoord[1] = coord1;
234  homCoord[2] = coord2;
235  homCoord[3] = coord3;
236 }

References homCoord.

◆ HomCoord() [4/5]

moab::HomCoord::HomCoord ( const int  coord0,
const int  coord1,
const int  coord2 
)
inline

Definition at line 238 of file HomXform.hpp.

239 {
240  homCoord[0] = coord0;
241  homCoord[1] = coord1;
242  homCoord[2] = coord2;
243  homCoord[3] = 1;
244 }

References homCoord.

◆ HomCoord() [5/5]

moab::HomCoord::HomCoord ( const HomCoord coord)
inline

Definition at line 246 of file HomXform.hpp.

247 {
248 #if defined( __INTEL_COMPILER ) && ( __INTEL_COMPILER < 1310 )
249  // Hack Intel compiler 12 issues with -O2 optimization
250  int coord0 = coords[0];
251  int coord1 = coords[1];
252  int coord2 = coords[2];
253  int coord3 = coords[3];
254  homCoord[0] = coord0;
255  homCoord[1] = coord1;
256  homCoord[2] = coord2;
257  homCoord[3] = coord3;
258 #else
259  homCoord[0] = coords[0];
260  homCoord[1] = coords[1];
261  homCoord[2] = coords[2];
262  homCoord[3] = coords[3];
263 #endif
264 }

References homCoord.

Member Function Documentation

◆ getUnitv()

HomCoord & moab::HomCoord::getUnitv ( int  c)
static

Definition at line 25 of file HomXform.cpp.

26 {
27  return unitv[c];
28 }

References unitv.

◆ h()

int moab::HomCoord::h ( ) const
inline

Definition at line 98 of file HomXform.hpp.

99  {
100  return homCoord[3];
101  }

References homCoord.

◆ hom_coord()

◆ i()

◆ j()

◆ k()

◆ length()

int moab::HomCoord::length ( ) const
inline

length

Definition at line 298 of file HomXform.hpp.

299 {
300  return (int)std::sqrt( (float)length_squared() );
301 }

References length_squared().

Referenced by normalize().

◆ length_squared()

int moab::HomCoord::length_squared ( ) const
inline

squared length

Definition at line 292 of file HomXform.hpp.

293 {
294  return homCoord[0] * homCoord[0] + homCoord[1] * homCoord[1] + homCoord[2] * homCoord[2];
295 }

References homCoord.

Referenced by length(), and moab::HomXform::three_pt_xform().

◆ normalize()

void moab::HomCoord::normalize ( )
inline

normalize

Definition at line 304 of file HomXform.hpp.

305 {
306  *this /= length();
307 }

References length().

Referenced by moab::HomXform::three_pt_xform().

◆ operator!=()

bool moab::HomCoord::operator!= ( const HomCoord rhs1) const
inline

Definition at line 338 of file HomXform.hpp.

339 {
340  return ( homCoord[0] != rhs1.homCoord[0] || homCoord[1] != rhs1.homCoord[1] || homCoord[2] != rhs1.homCoord[2] ||
341  homCoord[3] != rhs1.homCoord[3] );
342 }

References homCoord.

◆ operator%()

int moab::HomCoord::operator% ( const HomCoord rhs) const
inline

Definition at line 310 of file HomXform.hpp.

311 {
312  return homCoord[0] * rhs.homCoord[0] + homCoord[1] * rhs.homCoord[1] + homCoord[2] * rhs.homCoord[2];
313 }

References homCoord.

◆ operator*() [1/3]

HomCoord moab::HomCoord::operator* ( const HomCoord rhs) const
inline

Definition at line 316 of file HomXform.hpp.

317 {
318  return HomCoord( homCoord[1] * rhs.homCoord[2] - homCoord[2] * rhs.homCoord[1],
319  homCoord[2] * rhs.homCoord[0] - homCoord[0] * rhs.homCoord[2],
320  homCoord[0] * rhs.homCoord[1] - homCoord[1] * rhs.homCoord[0] );
321 }

References HomCoord(), and homCoord.

◆ operator*() [2/3]

HomCoord moab::HomCoord::operator* ( const HomXform rhs2) const
inline

Definition at line 368 of file HomXform.hpp.

369 {
370  return HomCoord(
371  // homCoord[0]*rhs2[4*0+0] + homCoord[1]*rhs2[4*1+0] +
372  // homCoord[2]*rhs2[4*2+0] + homCoord[3]*rhs2[4*3+0],
373  homCoord[0] * rhs2.xForm[0] + homCoord[1] * rhs2.xForm[4] + homCoord[2] * rhs2.xForm[8] +
374  homCoord[3] * rhs2.xForm[12],
375 
376  // homCoord[0]*rhs2.xForm[4*0+1] + homCoord[1]*rhs2.xForm[4*1+1] +
377  // homCoord[2]*rhs2.xForm[4*2+1] + homCoord[3]*rhs2.xForm[4*3+1],
378  homCoord[0] * rhs2.xForm[1] + homCoord[1] * rhs2.xForm[5] + homCoord[2] * rhs2.xForm[9] +
379  homCoord[3] * rhs2.xForm[13],
380 
381  // homCoord[0]*rhs2.xForm[4*0+2] + homCoord[1]*rhs2.xForm[4*1+2] +
382  // homCoord[2]*rhs2.xForm[4*2+2] + homCoord[3]*rhs2.xForm[4*3+2],
383  homCoord[0] * rhs2.xForm[2] + homCoord[1] * rhs2.xForm[6] + homCoord[2] * rhs2.xForm[10] +
384  homCoord[3] * rhs2.xForm[14],
385 
386  // homCoord[0]*rhs2.xForm[4*0+3] + homCoord[1]*rhs2.xForm[4*1+3] +
387  // homCoord[2]*rhs2.xForm[4*2+3] + homCoord[3]*rhs2.xForm[4*3+3]
388  homCoord[0] * rhs2.xForm[3] + homCoord[1] * rhs2.xForm[7] + homCoord[2] * rhs2.xForm[11] +
389  homCoord[3] * rhs2.xForm[15] );
390 }

References HomCoord(), homCoord, and moab::HomXform::xForm.

◆ operator*() [3/3]

HomCoord moab::HomCoord::operator* ( const int  mult) const
inline

Definition at line 417 of file HomXform.hpp.

418 {
419  return HomCoord( mult * homCoord[0], mult * homCoord[1], mult * homCoord[2] );
420 }

References HomCoord(), and homCoord.

◆ operator*=() [1/3]

HomCoord & moab::HomCoord::operator*= ( const HomCoord rhs)
inline

Definition at line 323 of file HomXform.hpp.

324 {
325  *this = HomCoord( homCoord[1] * rhs.homCoord[2] - homCoord[2] * rhs.homCoord[1],
326  homCoord[2] * rhs.homCoord[0] - homCoord[0] * rhs.homCoord[2],
327  homCoord[0] * rhs.homCoord[1] - homCoord[1] * rhs.homCoord[0] );
328 
329  return *this;
330 }

References HomCoord(), and homCoord.

◆ operator*=() [2/3]

HomCoord & moab::HomCoord::operator*= ( const HomXform rhs2)
inline

operators

Definition at line 392 of file HomXform.hpp.

393 {
394  *this = HomCoord(
395  // homCoord[0]*rhs2.xForm[4*0+0] + homCoord[1]*rhs2.xForm[4*1+0] +
396  // homCoord[2]*rhs2.xForm[4*2+0] + homCoord[3]*rhs2.xForm[4*3+0],
397  homCoord[0] * rhs2.xForm[0] + homCoord[1] * rhs2.xForm[4] + homCoord[2] * rhs2.xForm[8] +
398  homCoord[3] * rhs2.xForm[12],
399 
400  // homCoord[0]*rhs2.xForm[4*0+1] + homCoord[1]*rhs2.xForm[4*1+1] +
401  // homCoord[2]*rhs2.xForm[4*2+1] + homCoord[3]*rhs2.xForm[4*3+1],
402  homCoord[0] * rhs2.xForm[1] + homCoord[1] * rhs2.xForm[5] + homCoord[2] * rhs2.xForm[9] +
403  homCoord[3] * rhs2.xForm[13],
404 
405  // homCoord[0]*rhs2.xForm[4*0+2] + homCoord[1]*rhs2.xForm[4*1+2] +
406  // homCoord[2]*rhs2.xForm[4*2+2] + homCoord[3]*rhs2.xForm[4*3+2],
407  homCoord[0] * rhs2.xForm[2] + homCoord[1] * rhs2.xForm[6] + homCoord[2] * rhs2.xForm[10] +
408  homCoord[3] * rhs2.xForm[14],
409 
410  // homCoord[0]*rhs2.xForm[4*0+3] + homCoord[1]*rhs2.xForm[4*1+3] +
411  // homCoord[2]*rhs2.xForm[4*2+3] + homCoord[3]*rhs2.xForm[4*3+3]
412  homCoord[0] * rhs2.xForm[3] + homCoord[1] * rhs2.xForm[7] + homCoord[2] * rhs2.xForm[11] +
413  homCoord[3] * rhs2.xForm[15] );
414  return *this;
415 }

References HomCoord(), homCoord, and moab::HomXform::xForm.

◆ operator*=() [3/3]

HomCoord & moab::HomCoord::operator*= ( const int  mult)
inline

Definition at line 422 of file HomXform.hpp.

423 {
424  homCoord[0] *= mult;
425  homCoord[1] *= mult;
426  homCoord[2] *= mult;
427  return *this;
428 }

References homCoord.

◆ operator+()

HomCoord moab::HomCoord::operator+ ( const HomCoord rhs1) const
inline

Definition at line 456 of file HomXform.hpp.

457 {
458  return HomCoord( *this ) += rhs2;
459 }

References HomCoord().

◆ operator+=()

HomCoord & moab::HomCoord::operator+= ( const HomCoord rhs1)
inline

Definition at line 461 of file HomXform.hpp.

462 {
463  homCoord[0] += rhs2[0];
464  homCoord[1] += rhs2[1];
465  homCoord[2] += rhs2[2];
466  return *this;
467 }

References homCoord.

◆ operator-()

HomCoord moab::HomCoord::operator- ( const HomCoord rhs1) const
inline

Definition at line 443 of file HomXform.hpp.

444 {
445  return HomCoord( *this ) -= rhs2;
446 }

References HomCoord().

◆ operator-=()

HomCoord & moab::HomCoord::operator-= ( const HomCoord rhs1)
inline

Definition at line 448 of file HomXform.hpp.

449 {
450  homCoord[0] -= rhs2[0];
451  homCoord[1] -= rhs2[1];
452  homCoord[2] -= rhs2[2];
453  return *this;
454 }

References homCoord.

◆ operator/() [1/2]

HomCoord moab::HomCoord::operator/ ( const HomXform rhs2) const
inline

Definition at line 469 of file HomXform.hpp.

470 {
471  return HomCoord( *this ) /= rhs2;
472 }

References HomCoord().

◆ operator/() [2/2]

HomCoord moab::HomCoord::operator/ ( const int  mult) const
inline

Definition at line 430 of file HomXform.hpp.

431 {
432  return HomCoord( homCoord[0] / div, homCoord[1] / div, homCoord[2] / div );
433 }

References HomCoord(), and homCoord.

◆ operator/=() [1/2]

HomCoord & moab::HomCoord::operator/= ( const HomXform rhs2)
inline

Definition at line 474 of file HomXform.hpp.

475 {
476  HomXform inv = rhs2.inverse();
477  *this *= inv;
478  return *this;
479 }

References moab::HomXform::inverse().

◆ operator/=() [2/2]

HomCoord & moab::HomCoord::operator/= ( const int  mult)
inline

Definition at line 435 of file HomXform.hpp.

436 {
437  homCoord[0] /= div;
438  homCoord[1] /= div;
439  homCoord[2] /= div;
440  return *this;
441 }

References homCoord.

◆ operator<()

bool moab::HomCoord::operator< ( const HomCoord rhs1) const
inline

Definition at line 356 of file HomXform.hpp.

357 {
358  return ( homCoord[0] < rhs1.homCoord[0] && homCoord[1] < rhs1.homCoord[1] && homCoord[2] < rhs1.homCoord[2] &&
359  homCoord[3] == rhs1.homCoord[3] );
360 }

References homCoord.

◆ operator<=()

bool moab::HomCoord::operator<= ( const HomCoord rhs1) const
inline

Definition at line 350 of file HomXform.hpp.

351 {
352  return ( homCoord[0] <= rhs1.homCoord[0] && homCoord[1] <= rhs1.homCoord[1] && homCoord[2] <= rhs1.homCoord[2] &&
353  homCoord[3] == rhs1.homCoord[3] );
354 }

References homCoord.

◆ operator=()

HomCoord & moab::HomCoord::operator= ( const HomCoord rhs)
inline

Definition at line 282 of file HomXform.hpp.

283 {
284  homCoord[0] = rhs1.homCoord[0];
285  homCoord[1] = rhs1.homCoord[1];
286  homCoord[2] = rhs1.homCoord[2];
287  homCoord[3] = rhs1.homCoord[3];
288  return *this;
289 }

References homCoord.

◆ operator==()

bool moab::HomCoord::operator== ( const HomCoord rhs1) const
inline

Definition at line 332 of file HomXform.hpp.

333 {
334  return ( homCoord[0] == rhs1.homCoord[0] && homCoord[1] == rhs1.homCoord[1] && homCoord[2] == rhs1.homCoord[2] &&
335  homCoord[3] == rhs1.homCoord[3] );
336 }

References homCoord.

◆ operator>()

bool moab::HomCoord::operator> ( const HomCoord rhs1) const
inline

Definition at line 362 of file HomXform.hpp.

363 {
364  return ( homCoord[0] > rhs1.homCoord[0] && homCoord[1] > rhs1.homCoord[1] && homCoord[2] > rhs1.homCoord[2] &&
365  homCoord[3] == rhs1.homCoord[3] );
366 }

References homCoord.

◆ operator>=()

bool moab::HomCoord::operator>= ( const HomCoord rhs1) const
inline

Definition at line 344 of file HomXform.hpp.

345 {
346  return ( homCoord[0] >= rhs1.homCoord[0] && homCoord[1] >= rhs1.homCoord[1] && homCoord[2] >= rhs1.homCoord[2] &&
347  homCoord[3] == rhs1.homCoord[3] );
348 }

References homCoord.

◆ operator[]() [1/2]

int & moab::HomCoord::operator[] ( const int &  param)
inline

Definition at line 486 of file HomXform.hpp.

487 {
488  return homCoord[param];
489 }

References homCoord.

◆ operator[]() [2/2]

int moab::HomCoord::operator[] ( const int &  param) const
inline

Definition at line 481 of file HomXform.hpp.

482 {
483  return homCoord[param];
484 }

References homCoord.

◆ set() [1/2]

void moab::HomCoord::set ( const int  coords[])
inline

set function

Definition at line 266 of file HomXform.hpp.

267 {
268  homCoord[0] = coords[0];
269  homCoord[1] = coords[1];
270  homCoord[2] = coords[2];
271  homCoord[3] = coords[3];
272 }

References homCoord.

Referenced by moab::ScdInterface::construct_box(), and moab::HomXform::three_pt_xform().

◆ set() [2/2]

void moab::HomCoord::set ( const int  i,
const int  j,
const int  k,
const int  h = 1 
)
inline

Definition at line 274 of file HomXform.hpp.

275 {
276  homCoord[0] = ip;
277  homCoord[1] = jp;
278  homCoord[2] = kp;
279  homCoord[3] = hp;
280 }

References homCoord.

Friends And Related Function Documentation

◆ HomXform

friend class HomXform
friend

Definition at line 60 of file HomXform.hpp.

Member Data Documentation

◆ homCoord

◆ IDENTITY

HomCoord moab::HomCoord::IDENTITY
static

Definition at line 63 of file HomXform.hpp.

◆ unitv

HomCoord moab::HomCoord::unitv = { HomCoord( 1, 0, 0 ), HomCoord( 0, 1, 0 ), HomCoord( 0, 0, 1 ) }
static

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