Go to the documentation of this file. 1 #include "SMF_State.hpp"
2 #include <cstring>
3 #include <cstdlib>
4
5
6
7 namespace moab
8 {
9
10 SMF_State::SMF_State( const SMF_ivars& ivar, SMF_State* next )
11 {
12 first_vertex = ivar.next_vertex;
13 if( next )
14 {
15 vertex_correction = next->vertex_correction;
16 xform = next->xform;
17 }
18 else
19 {
20 vertex_correction = 0;
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
47 void SMF_State::set_vertex_correction( int i )
48 {
49 vertex_correction = i;
50 }
51
52 void SMF_State::mmult( const AffineXform& M )
53 {
54
55
56
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 }