~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMRigidConstraint.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of MayaDataModel.
 
5
 
 
6
    Licensed under the MIT Open Source License,
 
7
    for details please see LICENSE file or the website
 
8
    http://www.opensource.org/licenses/mit-license.php
 
9
*/
 
10
#ifndef __MayaDM_RIGIDCONSTRAINT_H__
 
11
#define __MayaDM_RIGIDCONSTRAINT_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMTransform.h"
 
15
namespace MayaDM
 
16
{
 
17
class RigidConstraint : public Transform
 
18
{
 
19
public:
 
20
public:
 
21
 
 
22
        RigidConstraint():Transform(){}
 
23
        RigidConstraint(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
24
                :Transform(file, name, parent, "rigidConstraint", shared, create){}
 
25
        virtual ~RigidConstraint(){}
 
26
 
 
27
        void setConstraintType(unsigned int typ)
 
28
        {
 
29
                if(typ == 1) return;
 
30
                fprintf(mFile,"\tsetAttr \".typ\" %i;\n", typ);
 
31
        }
 
32
        void setInitialPosition(const double3& ip)
 
33
        {
 
34
                if(ip == double3(0, 0, 0)) return;
 
35
                fprintf(mFile,"\tsetAttr \".ip\" -type \"double3\" ");
 
36
                ip.write(mFile);
 
37
                fprintf(mFile,";\n");
 
38
        }
 
39
        void setInitialPositionX(double ipx)
 
40
        {
 
41
                if(ipx == 0.0) return;
 
42
                fprintf(mFile,"\tsetAttr \".ip.ipx\" %f;\n", ipx);
 
43
        }
 
44
        void setInitialPositionY(double ipy)
 
45
        {
 
46
                if(ipy == 0.0) return;
 
47
                fprintf(mFile,"\tsetAttr \".ip.ipy\" %f;\n", ipy);
 
48
        }
 
49
        void setInitialPositionZ(double ipz)
 
50
        {
 
51
                if(ipz == 0.0) return;
 
52
                fprintf(mFile,"\tsetAttr \".ip.ipz\" %f;\n", ipz);
 
53
        }
 
54
        void setInitialOrientation(const double3& ino)
 
55
        {
 
56
                if(ino == double3(0, 0, 0)) return;
 
57
                fprintf(mFile,"\tsetAttr \".ino\" -type \"double3\" ");
 
58
                ino.write(mFile);
 
59
                fprintf(mFile,";\n");
 
60
        }
 
61
        void setInitialOrientationX(double iox)
 
62
        {
 
63
                if(iox == 0) return;
 
64
                fprintf(mFile,"\tsetAttr \".ino.iox\" %f;\n", iox);
 
65
        }
 
66
        void setInitialOrientationY(double ioy)
 
67
        {
 
68
                if(ioy == 0) return;
 
69
                fprintf(mFile,"\tsetAttr \".ino.ioy\" %f;\n", ioy);
 
70
        }
 
71
        void setInitialOrientationZ(double ioz)
 
72
        {
 
73
                if(ioz == 0) return;
 
74
                fprintf(mFile,"\tsetAttr \".ino.ioz\" %f;\n", ioz);
 
75
        }
 
76
        void setSpringStiffness(double sst)
 
77
        {
 
78
                if(sst == 5.0) return;
 
79
                fprintf(mFile,"\tsetAttr \".sst\" %f;\n", sst);
 
80
        }
 
81
        void setSpringDamping(double dmp)
 
82
        {
 
83
                if(dmp == 0.1) return;
 
84
                fprintf(mFile,"\tsetAttr \".dmp\" %f;\n", dmp);
 
85
        }
 
86
        void setSpringRestLength(double srl)
 
87
        {
 
88
                if(srl == 1.0) return;
 
89
                fprintf(mFile,"\tsetAttr \".srl\" %f;\n", srl);
 
90
        }
 
91
        void setInterpenetrate(bool int_)
 
92
        {
 
93
                if(int_ == false) return;
 
94
                fprintf(mFile,"\tsetAttr \".int\" %i;\n", int_);
 
95
        }
 
96
        void setIsParented(bool par)
 
97
        {
 
98
                if(par == false) return;
 
99
                fprintf(mFile,"\tsetAttr \".par\" %i;\n", par);
 
100
        }
 
101
        void setSolverId(int sid)
 
102
        {
 
103
                if(sid == -1) return;
 
104
                fprintf(mFile,"\tsetAttr \".sid\" %i;\n", sid);
 
105
        }
 
106
        void setConstrain(bool con)
 
107
        {
 
108
                if(con == true) return;
 
109
                fprintf(mFile,"\tsetAttr \".con\" %i;\n", con);
 
110
        }
 
111
        void setRelativeTo(unsigned int rlt)
 
112
        {
 
113
                if(rlt == 0) return;
 
114
                fprintf(mFile,"\tsetAttr \".rlt\" %i;\n", rlt);
 
115
        }
 
116
        void setUserDefinedPosition(const double3& udp)
 
117
        {
 
118
                if(udp == double3(0, 0, 0)) return;
 
119
                fprintf(mFile,"\tsetAttr \".udp\" -type \"double3\" ");
 
120
                udp.write(mFile);
 
121
                fprintf(mFile,";\n");
 
122
        }
 
123
        void setUserDefinedPositionX(double upx)
 
124
        {
 
125
                if(upx == 0.0) return;
 
126
                fprintf(mFile,"\tsetAttr \".udp.upx\" %f;\n", upx);
 
127
        }
 
128
        void setUserDefinedPositionY(double upy)
 
129
        {
 
130
                if(upy == 0.0) return;
 
131
                fprintf(mFile,"\tsetAttr \".udp.upy\" %f;\n", upy);
 
132
        }
 
133
        void setUserDefinedPositionZ(double upz)
 
134
        {
 
135
                if(upz == 0.0) return;
 
136
                fprintf(mFile,"\tsetAttr \".udp.upz\" %f;\n", upz);
 
137
        }
 
138
        void getRigidBody1()const
 
139
        {
 
140
                fprintf(mFile,"\"%s.rb1\"",mName.c_str());
 
141
        }
 
142
        void getRigidBody2()const
 
143
        {
 
144
                fprintf(mFile,"\"%s.rb2\"",mName.c_str());
 
145
        }
 
146
        void getConstraintType()const
 
147
        {
 
148
                fprintf(mFile,"\"%s.typ\"",mName.c_str());
 
149
        }
 
150
        void getInitialPositionX()const
 
151
        {
 
152
                fprintf(mFile,"\"%s.ip.ipx\"",mName.c_str());
 
153
        }
 
154
        void getInitialPositionY()const
 
155
        {
 
156
                fprintf(mFile,"\"%s.ip.ipy\"",mName.c_str());
 
157
        }
 
158
        void getInitialPositionZ()const
 
159
        {
 
160
                fprintf(mFile,"\"%s.ip.ipz\"",mName.c_str());
 
161
        }
 
162
        void getVelocity()const
 
163
        {
 
164
                fprintf(mFile,"\"%s.vel\"",mName.c_str());
 
165
        }
 
166
        void getVelocityX()const
 
167
        {
 
168
                fprintf(mFile,"\"%s.vel.vlx\"",mName.c_str());
 
169
        }
 
170
        void getVelocityY()const
 
171
        {
 
172
                fprintf(mFile,"\"%s.vel.vly\"",mName.c_str());
 
173
        }
 
174
        void getVelocityZ()const
 
175
        {
 
176
                fprintf(mFile,"\"%s.vel.vlz\"",mName.c_str());
 
177
        }
 
178
        void getAngularVelocity()const
 
179
        {
 
180
                fprintf(mFile,"\"%s.avl\"",mName.c_str());
 
181
        }
 
182
        void getAngularVelocityX()const
 
183
        {
 
184
                fprintf(mFile,"\"%s.avl.avx\"",mName.c_str());
 
185
        }
 
186
        void getAngularVelocityY()const
 
187
        {
 
188
                fprintf(mFile,"\"%s.avl.avy\"",mName.c_str());
 
189
        }
 
190
        void getAngularVelocityZ()const
 
191
        {
 
192
                fprintf(mFile,"\"%s.avl.avz\"",mName.c_str());
 
193
        }
 
194
        void getInitialOrientationX()const
 
195
        {
 
196
                fprintf(mFile,"\"%s.ino.iox\"",mName.c_str());
 
197
        }
 
198
        void getInitialOrientationY()const
 
199
        {
 
200
                fprintf(mFile,"\"%s.ino.ioy\"",mName.c_str());
 
201
        }
 
202
        void getInitialOrientationZ()const
 
203
        {
 
204
                fprintf(mFile,"\"%s.ino.ioz\"",mName.c_str());
 
205
        }
 
206
        void getSpringStiffness()const
 
207
        {
 
208
                fprintf(mFile,"\"%s.sst\"",mName.c_str());
 
209
        }
 
210
        void getSpringDamping()const
 
211
        {
 
212
                fprintf(mFile,"\"%s.dmp\"",mName.c_str());
 
213
        }
 
214
        void getSpringRestLength()const
 
215
        {
 
216
                fprintf(mFile,"\"%s.srl\"",mName.c_str());
 
217
        }
 
218
        void getInterpenetrate()const
 
219
        {
 
220
                fprintf(mFile,"\"%s.int\"",mName.c_str());
 
221
        }
 
222
        void getIsParented()const
 
223
        {
 
224
                fprintf(mFile,"\"%s.par\"",mName.c_str());
 
225
        }
 
226
        void getIsBounded()const
 
227
        {
 
228
                fprintf(mFile,"\"%s.bon\"",mName.c_str());
 
229
        }
 
230
        void getSolverId()const
 
231
        {
 
232
                fprintf(mFile,"\"%s.sid\"",mName.c_str());
 
233
        }
 
234
        void getConstrain()const
 
235
        {
 
236
                fprintf(mFile,"\"%s.con\"",mName.c_str());
 
237
        }
 
238
        void getRelativeTo()const
 
239
        {
 
240
                fprintf(mFile,"\"%s.rlt\"",mName.c_str());
 
241
        }
 
242
        void getUserDefinedPositionX()const
 
243
        {
 
244
                fprintf(mFile,"\"%s.udp.upx\"",mName.c_str());
 
245
        }
 
246
        void getUserDefinedPositionY()const
 
247
        {
 
248
                fprintf(mFile,"\"%s.udp.upy\"",mName.c_str());
 
249
        }
 
250
        void getUserDefinedPositionZ()const
 
251
        {
 
252
                fprintf(mFile,"\"%s.udp.upz\"",mName.c_str());
 
253
        }
 
254
protected:
 
255
        RigidConstraint(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
256
                :Transform(file, name, parent, nodeType, shared, create) {}
 
257
 
 
258
};
 
259
}//namespace MayaDM
 
260
#endif//__MayaDM_RIGIDCONSTRAINT_H__