Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
SMF_State.cpp
Go to the documentation of this file.
1 #include "SMF_State.hpp"
2 #include <cstring>
3 #include <cstdlib>
4 
5 // static inline int streq(const char *a,const char *b) { return std::strcmp(a,b)==0; }
6 
7 namespace moab
8 {
9 
11 {
13  if( next )
14  {
16  xform = next->xform;
17  }
18  else
19  {
21  AffineXform identity;
22  xform = identity;
23  }
24 }
25 
26 void SMF_State::vertex( double v[3] )
27 {
28  xform.xform_point( v );
29 }
30 
31 void SMF_State::normal( double nrm[3] )
32 {
33  xform.xform_vector( nrm );
34 }
35 
36 void SMF_State::face( int* verts, const SMF_ivars& ivar )
37 {
38  for( int i = 0; i < 3; i++ )
39  {
40  if( verts[i] < 0 )
41  verts[i] += ivar.next_vertex;
42  else
43  verts[i] += vertex_correction + ( first_vertex - 1 );
44  }
45 }
46 
48 {
50 }
51 
52 void SMF_State::mmult( const AffineXform& M )
53 {
54  // initially, we tried this:
55  // xform.accumulate(M);
56  // maybe we should do M.accumulate(xform)
57  AffineXform tmp = M;
58  tmp.accumulate( xform );
59  xform = tmp;
60 }
61 
62 void SMF_State::mload( const AffineXform& M )
63 {
64  xform = M;
65 }
66 
67 } // namespace moab