2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of MayaDataModel.
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
10
#ifndef __MayaDM_RIGIDCONSTRAINT_H__
11
#define __MayaDM_RIGIDCONSTRAINT_H__
12
#include "MayaDMTypes.h"
13
#include "MayaDMConnectables.h"
14
#include "MayaDMTransform.h"
17
class RigidConstraint : public Transform
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(){}
27
void setConstraintType(unsigned int typ)
30
fprintf(mFile,"\tsetAttr \".typ\" %i;\n", typ);
32
void setInitialPosition(const double3& ip)
34
if(ip == double3(0, 0, 0)) return;
35
fprintf(mFile,"\tsetAttr \".ip\" -type \"double3\" ");
39
void setInitialPositionX(double ipx)
41
if(ipx == 0.0) return;
42
fprintf(mFile,"\tsetAttr \".ip.ipx\" %f;\n", ipx);
44
void setInitialPositionY(double ipy)
46
if(ipy == 0.0) return;
47
fprintf(mFile,"\tsetAttr \".ip.ipy\" %f;\n", ipy);
49
void setInitialPositionZ(double ipz)
51
if(ipz == 0.0) return;
52
fprintf(mFile,"\tsetAttr \".ip.ipz\" %f;\n", ipz);
54
void setInitialOrientation(const double3& ino)
56
if(ino == double3(0, 0, 0)) return;
57
fprintf(mFile,"\tsetAttr \".ino\" -type \"double3\" ");
61
void setInitialOrientationX(double iox)
64
fprintf(mFile,"\tsetAttr \".ino.iox\" %f;\n", iox);
66
void setInitialOrientationY(double ioy)
69
fprintf(mFile,"\tsetAttr \".ino.ioy\" %f;\n", ioy);
71
void setInitialOrientationZ(double ioz)
74
fprintf(mFile,"\tsetAttr \".ino.ioz\" %f;\n", ioz);
76
void setSpringStiffness(double sst)
78
if(sst == 5.0) return;
79
fprintf(mFile,"\tsetAttr \".sst\" %f;\n", sst);
81
void setSpringDamping(double dmp)
83
if(dmp == 0.1) return;
84
fprintf(mFile,"\tsetAttr \".dmp\" %f;\n", dmp);
86
void setSpringRestLength(double srl)
88
if(srl == 1.0) return;
89
fprintf(mFile,"\tsetAttr \".srl\" %f;\n", srl);
91
void setInterpenetrate(bool int_)
93
if(int_ == false) return;
94
fprintf(mFile,"\tsetAttr \".int\" %i;\n", int_);
96
void setIsParented(bool par)
98
if(par == false) return;
99
fprintf(mFile,"\tsetAttr \".par\" %i;\n", par);
101
void setSolverId(int sid)
103
if(sid == -1) return;
104
fprintf(mFile,"\tsetAttr \".sid\" %i;\n", sid);
106
void setConstrain(bool con)
108
if(con == true) return;
109
fprintf(mFile,"\tsetAttr \".con\" %i;\n", con);
111
void setRelativeTo(unsigned int rlt)
114
fprintf(mFile,"\tsetAttr \".rlt\" %i;\n", rlt);
116
void setUserDefinedPosition(const double3& udp)
118
if(udp == double3(0, 0, 0)) return;
119
fprintf(mFile,"\tsetAttr \".udp\" -type \"double3\" ");
121
fprintf(mFile,";\n");
123
void setUserDefinedPositionX(double upx)
125
if(upx == 0.0) return;
126
fprintf(mFile,"\tsetAttr \".udp.upx\" %f;\n", upx);
128
void setUserDefinedPositionY(double upy)
130
if(upy == 0.0) return;
131
fprintf(mFile,"\tsetAttr \".udp.upy\" %f;\n", upy);
133
void setUserDefinedPositionZ(double upz)
135
if(upz == 0.0) return;
136
fprintf(mFile,"\tsetAttr \".udp.upz\" %f;\n", upz);
138
void getRigidBody1()const
140
fprintf(mFile,"\"%s.rb1\"",mName.c_str());
142
void getRigidBody2()const
144
fprintf(mFile,"\"%s.rb2\"",mName.c_str());
146
void getConstraintType()const
148
fprintf(mFile,"\"%s.typ\"",mName.c_str());
150
void getInitialPositionX()const
152
fprintf(mFile,"\"%s.ip.ipx\"",mName.c_str());
154
void getInitialPositionY()const
156
fprintf(mFile,"\"%s.ip.ipy\"",mName.c_str());
158
void getInitialPositionZ()const
160
fprintf(mFile,"\"%s.ip.ipz\"",mName.c_str());
162
void getVelocity()const
164
fprintf(mFile,"\"%s.vel\"",mName.c_str());
166
void getVelocityX()const
168
fprintf(mFile,"\"%s.vel.vlx\"",mName.c_str());
170
void getVelocityY()const
172
fprintf(mFile,"\"%s.vel.vly\"",mName.c_str());
174
void getVelocityZ()const
176
fprintf(mFile,"\"%s.vel.vlz\"",mName.c_str());
178
void getAngularVelocity()const
180
fprintf(mFile,"\"%s.avl\"",mName.c_str());
182
void getAngularVelocityX()const
184
fprintf(mFile,"\"%s.avl.avx\"",mName.c_str());
186
void getAngularVelocityY()const
188
fprintf(mFile,"\"%s.avl.avy\"",mName.c_str());
190
void getAngularVelocityZ()const
192
fprintf(mFile,"\"%s.avl.avz\"",mName.c_str());
194
void getInitialOrientationX()const
196
fprintf(mFile,"\"%s.ino.iox\"",mName.c_str());
198
void getInitialOrientationY()const
200
fprintf(mFile,"\"%s.ino.ioy\"",mName.c_str());
202
void getInitialOrientationZ()const
204
fprintf(mFile,"\"%s.ino.ioz\"",mName.c_str());
206
void getSpringStiffness()const
208
fprintf(mFile,"\"%s.sst\"",mName.c_str());
210
void getSpringDamping()const
212
fprintf(mFile,"\"%s.dmp\"",mName.c_str());
214
void getSpringRestLength()const
216
fprintf(mFile,"\"%s.srl\"",mName.c_str());
218
void getInterpenetrate()const
220
fprintf(mFile,"\"%s.int\"",mName.c_str());
222
void getIsParented()const
224
fprintf(mFile,"\"%s.par\"",mName.c_str());
226
void getIsBounded()const
228
fprintf(mFile,"\"%s.bon\"",mName.c_str());
230
void getSolverId()const
232
fprintf(mFile,"\"%s.sid\"",mName.c_str());
234
void getConstrain()const
236
fprintf(mFile,"\"%s.con\"",mName.c_str());
238
void getRelativeTo()const
240
fprintf(mFile,"\"%s.rlt\"",mName.c_str());
242
void getUserDefinedPositionX()const
244
fprintf(mFile,"\"%s.udp.upx\"",mName.c_str());
246
void getUserDefinedPositionY()const
248
fprintf(mFile,"\"%s.udp.upy\"",mName.c_str());
250
void getUserDefinedPositionZ()const
252
fprintf(mFile,"\"%s.udp.upz\"",mName.c_str());
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) {}
260
#endif//__MayaDM_RIGIDCONSTRAINT_H__