Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
moab::HomCoord Class Reference

Homogeneous coordinate vector. More...

#include <HomXform.hpp>

+ Collaboration diagram for moab::HomCoord:

Public Member Functions

 HomCoord ()
 constructors
 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
void set (const int i, const int j, const int k, const int h=1)
const int * hom_coord () const
 get function
int i () const
 parameter-based access functions
int j () const
int k () const
int h () const
int length_squared () const
 squared length
int length () const
 length
void normalize ()
 normalize
HomCoordoperator*= (const HomXform &rhs2)
 operators
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

Friends

class HomXform

Detailed Description

Homogeneous coordinate vector.

Examples:
StructuredMeshSimple.cpp.

Definition at line 48 of file HomXform.hpp.


Constructor & Destructor Documentation

constructors

Definition at line 215 of file HomXform.hpp.

References homCoord.

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

{
    homCoord[0] = 0;
    homCoord[1] = 0;
    homCoord[2] = 0;
    homCoord[3] = 0;
}
moab::HomCoord::HomCoord ( const int  coords[],
const int  num_coords = 4 
) [inline]

Definition at line 223 of file HomXform.hpp.

References homCoord.

{
    for( int tmpj = 0; tmpj < num_coords; tmpj++ )
        homCoord[tmpj] = coords[tmpj];
    if( num_coords != 4 ) homCoord[3] = 1;
}
moab::HomCoord::HomCoord ( const int  coord0,
const int  coord1,
const int  coord2,
const int  coord3 
) [inline]

Definition at line 230 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] = coord0;
    homCoord[1] = coord1;
    homCoord[2] = coord2;
    homCoord[3] = coord3;
}
moab::HomCoord::HomCoord ( const int  coord0,
const int  coord1,
const int  coord2 
) [inline]

Definition at line 238 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] = coord0;
    homCoord[1] = coord1;
    homCoord[2] = coord2;
    homCoord[3] = 1;
}
moab::HomCoord::HomCoord ( const HomCoord coord) [inline]

Definition at line 246 of file HomXform.hpp.

References homCoord.

{
#if defined( __INTEL_COMPILER ) && ( __INTEL_COMPILER < 1310 )
    // Hack Intel compiler 12 issues with -O2 optimization
    int coord0  = coords[0];
    int coord1  = coords[1];
    int coord2  = coords[2];
    int coord3  = coords[3];
    homCoord[0] = coord0;
    homCoord[1] = coord1;
    homCoord[2] = coord2;
    homCoord[3] = coord3;
#else
    homCoord[0] = coords[0];
    homCoord[1] = coords[1];
    homCoord[2] = coords[2];
    homCoord[3] = coords[3];
#endif
}

Member Function Documentation

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

Definition at line 25 of file HomXform.cpp.

References unitv.

{
    return unitv[c];
}
int moab::HomCoord::h ( ) const [inline]

Definition at line 98 of file HomXform.hpp.

References homCoord.

    {
        return homCoord[3];
    }
int moab::HomCoord::length ( ) const [inline]

length

Definition at line 298 of file HomXform.hpp.

References length_squared().

Referenced by normalize().

{
    return (int)std::sqrt( (float)length_squared() );
}
int moab::HomCoord::length_squared ( ) const [inline]

squared length

Definition at line 292 of file HomXform.hpp.

References homCoord.

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

{
    return homCoord[0] * homCoord[0] + homCoord[1] * homCoord[1] + homCoord[2] * homCoord[2];
}
void moab::HomCoord::normalize ( ) [inline]

normalize

Definition at line 304 of file HomXform.hpp.

References length().

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

{
    *this /= length();
}
bool moab::HomCoord::operator!= ( const HomCoord rhs1) const [inline]

Definition at line 338 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] != rhs1.homCoord[0] || homCoord[1] != rhs1.homCoord[1] || homCoord[2] != rhs1.homCoord[2] ||
             homCoord[3] != rhs1.homCoord[3] );
}
int moab::HomCoord::operator% ( const HomCoord rhs) const [inline]

Definition at line 310 of file HomXform.hpp.

References homCoord.

{
    return homCoord[0] * rhs.homCoord[0] + homCoord[1] * rhs.homCoord[1] + homCoord[2] * rhs.homCoord[2];
}
HomCoord moab::HomCoord::operator* ( const HomXform rhs2) const [inline]

Definition at line 368 of file HomXform.hpp.

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

{
    return HomCoord(
        //    homCoord[0]*rhs2[4*0+0] + homCoord[1]*rhs2[4*1+0] +
        //    homCoord[2]*rhs2[4*2+0] + homCoord[3]*rhs2[4*3+0],
        homCoord[0] * rhs2.xForm[0] + homCoord[1] * rhs2.xForm[4] + homCoord[2] * rhs2.xForm[8] +
            homCoord[3] * rhs2.xForm[12],

        //    homCoord[0]*rhs2.xForm[4*0+1] + homCoord[1]*rhs2.xForm[4*1+1] +
        //    homCoord[2]*rhs2.xForm[4*2+1] + homCoord[3]*rhs2.xForm[4*3+1],
        homCoord[0] * rhs2.xForm[1] + homCoord[1] * rhs2.xForm[5] + homCoord[2] * rhs2.xForm[9] +
            homCoord[3] * rhs2.xForm[13],

        //    homCoord[0]*rhs2.xForm[4*0+2] + homCoord[1]*rhs2.xForm[4*1+2] +
        //    homCoord[2]*rhs2.xForm[4*2+2] + homCoord[3]*rhs2.xForm[4*3+2],
        homCoord[0] * rhs2.xForm[2] + homCoord[1] * rhs2.xForm[6] + homCoord[2] * rhs2.xForm[10] +
            homCoord[3] * rhs2.xForm[14],

        //    homCoord[0]*rhs2.xForm[4*0+3] + homCoord[1]*rhs2.xForm[4*1+3] +
        //    homCoord[2]*rhs2.xForm[4*2+3] + homCoord[3]*rhs2.xForm[4*3+3]
        homCoord[0] * rhs2.xForm[3] + homCoord[1] * rhs2.xForm[7] + homCoord[2] * rhs2.xForm[11] +
            homCoord[3] * rhs2.xForm[15] );
}
HomCoord moab::HomCoord::operator* ( const int  mult) const [inline]

Definition at line 417 of file HomXform.hpp.

References homCoord, and HomCoord().

{
    return HomCoord( mult * homCoord[0], mult * homCoord[1], mult * homCoord[2] );
}
HomCoord moab::HomCoord::operator* ( const HomCoord rhs) const [inline]

Definition at line 316 of file HomXform.hpp.

References homCoord, and HomCoord().

{
    return HomCoord( homCoord[1] * rhs.homCoord[2] - homCoord[2] * rhs.homCoord[1],
                     homCoord[2] * rhs.homCoord[0] - homCoord[0] * rhs.homCoord[2],
                     homCoord[0] * rhs.homCoord[1] - homCoord[1] * rhs.homCoord[0] );
}
HomCoord & moab::HomCoord::operator*= ( const HomXform rhs2) [inline]

operators

Definition at line 392 of file HomXform.hpp.

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

{
    *this = HomCoord(
        //    homCoord[0]*rhs2.xForm[4*0+0] + homCoord[1]*rhs2.xForm[4*1+0] +
        //    homCoord[2]*rhs2.xForm[4*2+0] + homCoord[3]*rhs2.xForm[4*3+0],
        homCoord[0] * rhs2.xForm[0] + homCoord[1] * rhs2.xForm[4] + homCoord[2] * rhs2.xForm[8] +
            homCoord[3] * rhs2.xForm[12],

        //    homCoord[0]*rhs2.xForm[4*0+1] + homCoord[1]*rhs2.xForm[4*1+1] +
        //    homCoord[2]*rhs2.xForm[4*2+1] + homCoord[3]*rhs2.xForm[4*3+1],
        homCoord[0] * rhs2.xForm[1] + homCoord[1] * rhs2.xForm[5] + homCoord[2] * rhs2.xForm[9] +
            homCoord[3] * rhs2.xForm[13],

        //    homCoord[0]*rhs2.xForm[4*0+2] + homCoord[1]*rhs2.xForm[4*1+2] +
        //    homCoord[2]*rhs2.xForm[4*2+2] + homCoord[3]*rhs2.xForm[4*3+2],
        homCoord[0] * rhs2.xForm[2] + homCoord[1] * rhs2.xForm[6] + homCoord[2] * rhs2.xForm[10] +
            homCoord[3] * rhs2.xForm[14],

        //    homCoord[0]*rhs2.xForm[4*0+3] + homCoord[1]*rhs2.xForm[4*1+3] +
        //    homCoord[2]*rhs2.xForm[4*2+3] + homCoord[3]*rhs2.xForm[4*3+3]
        homCoord[0] * rhs2.xForm[3] + homCoord[1] * rhs2.xForm[7] + homCoord[2] * rhs2.xForm[11] +
            homCoord[3] * rhs2.xForm[15] );
    return *this;
}
HomCoord & moab::HomCoord::operator*= ( const int  mult) [inline]

Definition at line 422 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] *= mult;
    homCoord[1] *= mult;
    homCoord[2] *= mult;
    return *this;
}
HomCoord & moab::HomCoord::operator*= ( const HomCoord rhs) [inline]

Definition at line 323 of file HomXform.hpp.

References homCoord, and HomCoord().

{
    *this = HomCoord( homCoord[1] * rhs.homCoord[2] - homCoord[2] * rhs.homCoord[1],
                      homCoord[2] * rhs.homCoord[0] - homCoord[0] * rhs.homCoord[2],
                      homCoord[0] * rhs.homCoord[1] - homCoord[1] * rhs.homCoord[0] );

    return *this;
}
HomCoord moab::HomCoord::operator+ ( const HomCoord rhs1) const [inline]

Definition at line 456 of file HomXform.hpp.

References HomCoord().

{
    return HomCoord( *this ) += rhs2;
}
HomCoord & moab::HomCoord::operator+= ( const HomCoord rhs1) [inline]

Definition at line 461 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] += rhs2[0];
    homCoord[1] += rhs2[1];
    homCoord[2] += rhs2[2];
    return *this;
}
HomCoord moab::HomCoord::operator- ( const HomCoord rhs1) const [inline]

Definition at line 443 of file HomXform.hpp.

References HomCoord().

{
    return HomCoord( *this ) -= rhs2;
}
HomCoord & moab::HomCoord::operator-= ( const HomCoord rhs1) [inline]

Definition at line 448 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] -= rhs2[0];
    homCoord[1] -= rhs2[1];
    homCoord[2] -= rhs2[2];
    return *this;
}
HomCoord moab::HomCoord::operator/ ( const HomXform rhs2) const [inline]

Definition at line 469 of file HomXform.hpp.

References HomCoord().

{
    return HomCoord( *this ) /= rhs2;
}
HomCoord moab::HomCoord::operator/ ( const int  mult) const [inline]

Definition at line 430 of file HomXform.hpp.

References homCoord, and HomCoord().

{
    return HomCoord( homCoord[0] / div, homCoord[1] / div, homCoord[2] / div );
}
HomCoord & moab::HomCoord::operator/= ( const HomXform rhs2) [inline]

Definition at line 474 of file HomXform.hpp.

References moab::HomXform::inverse().

{
    HomXform inv = rhs2.inverse();
    *this *= inv;
    return *this;
}
HomCoord & moab::HomCoord::operator/= ( const int  mult) [inline]

Definition at line 435 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] /= div;
    homCoord[1] /= div;
    homCoord[2] /= div;
    return *this;
}
bool moab::HomCoord::operator< ( const HomCoord rhs1) const [inline]

Definition at line 356 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] < rhs1.homCoord[0] && homCoord[1] < rhs1.homCoord[1] && homCoord[2] < rhs1.homCoord[2] &&
             homCoord[3] == rhs1.homCoord[3] );
}
bool moab::HomCoord::operator<= ( const HomCoord rhs1) const [inline]

Definition at line 350 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] <= rhs1.homCoord[0] && homCoord[1] <= rhs1.homCoord[1] && homCoord[2] <= rhs1.homCoord[2] &&
             homCoord[3] == rhs1.homCoord[3] );
}
HomCoord & moab::HomCoord::operator= ( const HomCoord rhs) [inline]

Definition at line 282 of file HomXform.hpp.

References homCoord.

{
    homCoord[0] = rhs1.homCoord[0];
    homCoord[1] = rhs1.homCoord[1];
    homCoord[2] = rhs1.homCoord[2];
    homCoord[3] = rhs1.homCoord[3];
    return *this;
}
bool moab::HomCoord::operator== ( const HomCoord rhs1) const [inline]

Definition at line 332 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] == rhs1.homCoord[0] && homCoord[1] == rhs1.homCoord[1] && homCoord[2] == rhs1.homCoord[2] &&
             homCoord[3] == rhs1.homCoord[3] );
}
bool moab::HomCoord::operator> ( const HomCoord rhs1) const [inline]

Definition at line 362 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] > rhs1.homCoord[0] && homCoord[1] > rhs1.homCoord[1] && homCoord[2] > rhs1.homCoord[2] &&
             homCoord[3] == rhs1.homCoord[3] );
}
bool moab::HomCoord::operator>= ( const HomCoord rhs1) const [inline]

Definition at line 344 of file HomXform.hpp.

References homCoord.

{
    return ( homCoord[0] >= rhs1.homCoord[0] && homCoord[1] >= rhs1.homCoord[1] && homCoord[2] >= rhs1.homCoord[2] &&
             homCoord[3] == rhs1.homCoord[3] );
}
int moab::HomCoord::operator[] ( const int &  param) const [inline]

Definition at line 481 of file HomXform.hpp.

References homCoord.

{
    return homCoord[param];
}
int & moab::HomCoord::operator[] ( const int &  param) [inline]

Definition at line 486 of file HomXform.hpp.

References homCoord.

{
    return homCoord[param];
}
void moab::HomCoord::set ( const int  coords[]) [inline]

set function

Definition at line 266 of file HomXform.hpp.

References homCoord.

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

{
    homCoord[0] = coords[0];
    homCoord[1] = coords[1];
    homCoord[2] = coords[2];
    homCoord[3] = coords[3];
}
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.

References homCoord.

{
    homCoord[0] = ip;
    homCoord[1] = jp;
    homCoord[2] = kp;
    homCoord[3] = hp;
}

Friends And Related Function Documentation

friend class HomXform [friend]

Definition at line 60 of file HomXform.hpp.


Member Data Documentation

Definition at line 63 of file HomXform.hpp.

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines