QuOc

 

Public Types | Public Member Functions | Private Attributes

om::TriMeshWithEdgeNormals< RealType > Class Template Reference

#include <triMesh.h>

Inheritance diagram for om::TriMeshWithEdgeNormals< RealType >:
om::TriMeshWithGeomProps< RealType, TriMeshWithEdgeNormals< RealType > > om::TriMesh< RealType > TriMesh_ArrayKernelT

List of all members.

Public Types

typedef TriMesh< RealType >
::FaceHandle 
FaceHandle
typedef TriMesh< RealType >
::EdgeHandle 
EdgeHandle

Public Member Functions

 TriMeshWithEdgeNormals ()
void getSecondFundForm (const FaceHandle &fh, aol::Matrix22< RealType > &h) const
 returns second fundamental form (needed by base class!)
void getSecondFundFormFast (const FaceHandle &fh, aol::Matrix22< RealType > &h) const
void getShapeOperatorFast (const FaceHandle &fh, aol::Matrix22< RealType > &S) const
void requestEdgeNormals ()
void releaseEdgeNormals ()
int updateEdgeNormals ()
bool hasEdgeNormals () const
void getEdgeNormal (const FaceHandle &fh, int localCoord, aol::Vec3< RealType > &wn, bool normalized=true) const
void getEdgeNormal (const EdgeHandle &eh, aol::Vec3< RealType > &wn, bool normalized=true) const

Private Attributes

bool _edgeNormalProp
int _edgeNormalCount
OpenMesh::EPropHandleT
< aol::Vec3< RealType > > 
_edgeNormals

Detailed Description

template<typename RealType>
class om::TriMeshWithEdgeNormals< RealType >

Definition at line 776 of file triMesh.h.


Member Typedef Documentation

template<typename RealType >
typedef TriMesh<RealType>::EdgeHandle om::TriMeshWithEdgeNormals< RealType >::EdgeHandle

Definition at line 780 of file triMesh.h.


Constructor & Destructor Documentation

template<typename RealType >
om::TriMeshWithEdgeNormals< RealType >::TriMeshWithEdgeNormals (  )  [inline]

Definition at line 783 of file triMesh.h.

References om::TriMeshWithEdgeNormals< RealType >::_edgeNormalCount, and om::TriMeshWithEdgeNormals< RealType >::_edgeNormalProp.

: TriMeshWithGeomProps<RealType, TriMeshWithEdgeNormals<RealType> >( ){ _edgeNormalProp = false; _edgeNormalCount = 0;}


Member Function Documentation

template<typename RealType >
void om::TriMeshWithEdgeNormals< RealType >::getEdgeNormal ( const FaceHandle fh,
int  localCoord,
aol::Vec3< RealType > &  wn,
bool  normalized = true 
) const

Definition at line 317 of file triMesh.cpp.

References om::TriMesh< RealType >::getFaceNormal(), om::TriMesh< RealType >::getOpenMeshObject(), and aol::Vec< dimension, _DataType >::normalize().

Referenced by om::TriMeshWithEdgeNormals< RealType >::getSecondFundForm(), and om::TriMeshWithEdgeNormals< RealType >::getSecondFundFormFast().

                                                                                                                                         {
  if( localCoord > 2 )
    throw aol::Exception ( "unvalid local coordinate (must be 0,1,2)!", __FILE__, __LINE__ );

  getFaceNormal( fh, wn );

  typename TriMesh<RealType>::ConstFaceFaceIter ffIter = this->getOpenMeshObject().cff_iter( fh );
  for(int i = 0; i < localCoord; i++)
    ++ffIter;

  // edge on boundary?
  if(ffIter.handle().idx() != -1 ){
    aol::Vec3<RealType> temp;
    getFaceNormal( ffIter.handle(), temp );
    wn += temp;
  }

  if( normalized )
    wn.normalize();
}

template<typename RealType >
void om::TriMeshWithEdgeNormals< RealType >::getEdgeNormal ( const EdgeHandle eh,
aol::Vec3< RealType > &  wn,
bool  normalized = true 
) const

Definition at line 340 of file triMesh.cpp.

References om::TriMeshWithEdgeNormals< RealType >::_edgeNormalProp, om::TriMeshWithEdgeNormals< RealType >::_edgeNormals, om::TriMesh< RealType >::getOpenMeshObject(), and aol::Vec< dimension, _DataType >::normalize().

                                                                                                                         {
  if(!_edgeNormalProp)
    throw aol::Exception ( "edge normal property has not been set yet!", __FILE__, __LINE__ );
  wn = this->getOpenMeshObject().property( _edgeNormals, eh );
  if( normalized )
    wn.normalize();
}

template<typename RealType >
void om::TriMeshWithEdgeNormals< RealType >::getSecondFundForm ( const FaceHandle fh,
aol::Matrix22< RealType > &  h 
) const

returns second fundamental form (needed by base class!)

Definition at line 396 of file triMesh.cpp.

References om::TriMeshWithEdgeNormals< RealType >::getEdgeNormal(), om::TriMesh< RealType >::getOpenMeshObject(), and aol::Mat< numRows, numCols, _DataType >::set().

                                                                                                              {

  // c = 1/(2|\omega|^2) where \omega represents the unit reference element in \R^2 having vertices at (0,0), (1,0), (0,1)
  RealType c = 2.;

  // get edges e_i
  aol::Vec3<RealType> edges[3];
  typename TriMesh<RealType>::Point points[3];
  int i = 0;
  for( typename TriMesh<RealType>::ConstFaceVertexIter fv_it = this->getOpenMeshObject().cfv_iter(fh); fv_it; ++fv_it )
    points[i++] = this->getOpenMeshObject().point ( fv_it.handle() );

  // in Openmesh vertex i has e_i as incoming edge and e_{(i+1)%3} as outgoing edge
  for( int j = 0; j<3; j++ )
   for( int k = 0; k<3; k++ )
     edges[j][k] = points[j][k] - points[ (j+2)%3 ][k];

  // edge normals
  aol::Vec3<RealType> normals[3];
  i = 0;
  for( typename TriMesh<RealType>::ConstFaceEdgeIter fe_it = this->getOpenMeshObject().cfe_iter(fh); fe_it; ++fe_it ){
    getEdgeNormal ( fh, i, normals[i] );
    i++;
  }

  // h = c \sum_{i=0}^2 ( N_i, e_{\pi(i)} ) B_i, where N_i is the normal on edge e_i, \pi(i):= (i+2)%3, i is the local coordinate
  // rotation of e_i by 90 degrees leads to t_i; set B_i := t_i t_i^T
  // t_0 = (-1, 0) => B_0 = (1 0; 0 0), t_1 = (0 , -1) =>  B_1 = (0 0; 0 1), t_2 = (1, 1) => B_2 = (1 1; 1 1)
  RealType aux = normals[2]*edges[1];
  h.set (0, 0, aux + normals[0]*edges[2]);
  h.set (0, 1, aux);
  h.set (1, 0, aux);
  h.set (1, 1, aux + normals[1]*edges[0]);
  h *= c;

}

template<typename RealType >
void om::TriMeshWithEdgeNormals< RealType >::getSecondFundFormFast ( const FaceHandle fh,
aol::Matrix22< RealType > &  h 
) const

Definition at line 434 of file triMesh.cpp.

References om::TriMeshWithEdgeNormals< RealType >::_edgeNormalProp, om::TriMeshWithEdgeNormals< RealType >::getEdgeNormal(), om::TriMesh< RealType >::getOpenMeshObject(), and aol::Mat< numRows, numCols, _DataType >::set().

Referenced by om::TriMeshWithEdgeNormals< RealType >::getShapeOperatorFast().

                                                                                                                  {
  if(!_edgeNormalProp)
    throw aol::Exception ( "edge normal property has not been set yet!", __FILE__, __LINE__ );

  // c = 1/(2|\omega|^2) where \omega represents the unit reference element in \R^2 having vertices at (0,0), (1,0), (0,1)
  RealType c = 2.;

  // get edges e_i
  aol::Vec3<RealType> edges[3];
  typename TriMesh<RealType>::Point points[3];
  int i = 0;
  for( typename TriMesh<RealType>::ConstFaceVertexIter fv_it = this->getOpenMeshObject().cfv_iter(fh); fv_it; ++fv_it )
    points[i++] = this->getOpenMeshObject().point ( fv_it.handle() );

  // in Openmesh vertex i has e_i as incoming edge and e_{(i+1)%3} as outgoing edge
  for( int j = 0; j<3; j++ )
   for( int k = 0; k<3; k++ )
     edges[j][k] = points[j][k] - points[ (j+2)%3 ][k];

  // edge normals
  aol::Vec3<RealType> normals[3];
  i = 0;
  for( typename TriMesh<RealType>::ConstFaceEdgeIter fe_it = this->getOpenMeshObject().cfe_iter(fh); fe_it; ++fe_it )
    getEdgeNormal ( fe_it.handle(), normals[i++] );

  // h = c \sum_{i=0}^2 ( N_i, e_{\pi(i)} ) B_i, where N_i is the normal on edge e_i, \pi(i):= (i+2)%3, i is the local coordinate
  // rotation of e_i by 90 degrees leads to t_i; set B_i := t_i t_i^T
  // t_0 = (0, -1) => B_0 = (1 0; 0 0), t_1 = (1 , 1) =>  B_1 = (1 1; 1 1), t_2 = (-1, 0) => B_2 = (0 0; 0 1)
  RealType aux = normals[1]*edges[0];
  h.set (0, 0, aux + normals[0]*edges[2]);
  h.set (0, 1, aux);
  h.set (1, 0, aux);
  h.set (1, 1, aux + normals[2]*edges[1]);
  h *= c;
}

template<typename RealType >
bool om::TriMeshWithEdgeNormals< RealType >::hasEdgeNormals (  )  const

Definition at line 360 of file triMesh.cpp.

References om::TriMeshWithEdgeNormals< RealType >::_edgeNormalProp.

                                                            {
  return _edgeNormalProp;
}

template<typename RealType >
void om::TriMeshWithEdgeNormals< RealType >::requestEdgeNormals (  ) 

Definition at line 372 of file triMesh.cpp.

References om::TriMeshWithEdgeNormals< RealType >::_edgeNormalCount, om::TriMeshWithEdgeNormals< RealType >::_edgeNormalProp, om::TriMeshWithEdgeNormals< RealType >::_edgeNormals, om::TriMesh< RealType >::getFaceNormal(), and om::TriMesh< RealType >::getOpenMeshObject().

Referenced by om::TriMeshWithEdgeNormals< RealType >::updateEdgeNormals().

                                                            {

  if(_edgeNormalProp==false)
    this->add_property(_edgeNormals);

  // iterate over all faces
  for ( typename TriMesh<RealType>::ElementIteratorType fIter = *this; fIter.notAtEnd(); ++fIter ) {

    // get face normal
    aol::Vec3<RealType> faceNormal;
    this->getFaceNormal ( fIter.faceHandle(), faceNormal );

    // iterate over edges
    typename TriMesh<RealType>::ConstFaceEdgeIter feIter = this->getOpenMeshObject().cfe_iter( fIter.faceHandle() );
    for(; feIter; ++feIter)
      this->getOpenMeshObject().property( _edgeNormals, feIter.handle() ) += faceNormal;

  }

  _edgeNormalProp = true;
  _edgeNormalCount++;
}


Member Data Documentation


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

Generated on Fri Sep 9 2011 21:09:24 for QuocMesh by doxygen 1.7.1