AnimatLab  2
Test
VsMaterialType.cpp
1 // VsMaterialType.cpp: implementation of the VsMaterialType class.
2 //
4 
5 #include "StdAfx.h"
6 #include "VsSimulator.h"
7 
8 namespace VortexAnimatSim
9 {
10  namespace Environment
11  {
12 
14 // Construction/Destruction
16 
17 VsMaterialType::VsMaterialType()
18 {
29  m_fltCompliance = 1e-7f;
30  m_fltDamping = 5e4f;
31  m_fltRestitution = 0;
42  m_fltMaxAdhesive = 0;
43 
44  m_vxMaterialTable = NULL;
45  m_vxMaterial = NULL;
46 }
47 
48 VsMaterialType::~VsMaterialType()
49 {
50 }
51 
52 
62 
72 {
73  Std_IsAboveMin((float) 0, fltVal, true, "FrictionLinearPrimary", true);
74 
76  SetMaterialProperties();
77 }
78 
88 
98 {
99  Std_IsAboveMin((float) 0, fltVal, true, "FrictionLinearSecondary", true);
101  SetMaterialProperties();
102 }
103 
113 
123 {
124  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularNormal", true);
125 
127  SetMaterialProperties();
128 }
129 
139 
149 {
150  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularPrimary", true);
151 
153  SetMaterialProperties();
154 }
155 
165 
175 {
176  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularSecondary", true);
177 
179  SetMaterialProperties();
180 }
181 
191 
201 void VsMaterialType::FrictionLinearPrimaryMax(float fltVal, bool bUseScaling)
202 {
203  Std_IsAboveMin((float) 0, fltVal, true, "FrictionLinearPrimaryMax", true);
204 
205  if(bUseScaling)
206  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
207 
209  SetMaterialProperties();
210 }
211 
221 
231 void VsMaterialType::FrictionLinearSecondaryMax(float fltVal, bool bUseScaling)
232 {
233  Std_IsAboveMin((float) 0, fltVal, true, "FrictionLinearSecondaryMax", true);
234 
235  if(bUseScaling)
236  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
237 
239  SetMaterialProperties();
240 }
241 
251 
261 void VsMaterialType::FrictionAngularNormalMax(float fltVal, bool bUseScaling)
262 {
263  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularNormalMax", true);
264 
265  if(bUseScaling)
266  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
267 
269  SetMaterialProperties();
270 }
271 
281 
291 void VsMaterialType::FrictionAngularPrimaryMax(float fltVal, bool bUseScaling)
292 {
293  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularPrimaryMax", true);
294 
295  if(bUseScaling)
296  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
297 
299  SetMaterialProperties();
300 }
301 
311 
321 void VsMaterialType::FrictionAngularSecondaryMax(float fltVal, bool bUseScaling)
322 {
323  Std_IsAboveMin((float) 0, fltVal, true, "FrictionAngularSecondaryMax", true);
324 
325  if(bUseScaling)
326  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
327 
329  SetMaterialProperties();
330 }
331 
345 
359 void VsMaterialType::SlipLinearPrimary(float fltVal, bool bUseScaling)
360 {
361  Std_IsAboveMin((float) 0, fltVal, true, "SlipLinearPrimary", true);
362 
363  if(bUseScaling)
364  fltVal *= m_lpSim->MassUnits(); //Slip units are s/Kg
365 
366  m_fltSlipLinearPrimary = fltVal;
367  SetMaterialProperties();
368 }
369 
383 
384 
398 void VsMaterialType::SlipLinearSecondary(float fltVal, bool bUseScaling)
399 {
400  Std_IsAboveMin((float) 0, fltVal, true, "SlipLinearSecondary", true);
401 
402  if(bUseScaling)
403  fltVal *= m_lpSim->MassUnits(); //Slip units are s/Kg
404 
405  m_fltSlipLinearSecondary = fltVal;
406  SetMaterialProperties();
407 }
408 
422 
423 
437 void VsMaterialType::SlipAngularNormal(float fltVal, bool bUseScaling)
438 {
439  Std_IsAboveMin((float) 0, fltVal, true, "SlipAngularNormal", true);
440 
441  if(bUseScaling)
442  fltVal *= m_lpSim->MassUnits(); //Slip units are s/Kg
443 
444  m_fltSlipAngularNormal = fltVal;
445  SetMaterialProperties();
446 }
447 
461 
475 void VsMaterialType::SlipAngularPrimary(float fltVal, bool bUseScaling)
476 {
477  Std_IsAboveMin((float) 0, fltVal, true, "SlipAngularPrimary", true);
478 
479  if(bUseScaling)
480  fltVal *= m_lpSim->MassUnits(); //Slip units are s/Kg
481 
482  m_fltSlipAngularPrimary = fltVal;
483  SetMaterialProperties();
484 }
485 
499 
500 
514 void VsMaterialType::SlipAngularSecondary(float fltVal, bool bUseScaling)
515 {
516  Std_IsAboveMin((float) 0, fltVal, true, "SlipAngularSecondary", true);
517 
518  if(bUseScaling)
519  fltVal *= m_lpSim->MassUnits(); //Slip units are s/Kg
520 
521  m_fltSlipAngularSecondary = fltVal;
522  SetMaterialProperties();
523 }
524 
538 
552 void VsMaterialType::SlideLinearPrimary(float fltVal, bool bUseScaling)
553 {
554  Std_IsAboveMin((float) 0, fltVal, true, "SlideLinearPrimary", true);
555 
556  if(bUseScaling)
557  fltVal *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
558 
559  m_fltSlideLinearPrimary = fltVal;
560  SetMaterialProperties();
561 }
562 
563 
577 
578 
592 void VsMaterialType::SlideLinearSecondary(float fltVal, bool bUseScaling)
593 {
594  Std_IsAboveMin((float) 0, fltVal, true, "SlideLinearSecondary", true);
595 
596  if(bUseScaling)
597  fltVal *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
598 
599  m_fltSlideLinearSecondary = fltVal;
600  SetMaterialProperties();
601 }
602 
616 
617 
631 void VsMaterialType::SlideAngularNormal(float fltVal, bool bUseScaling)
632 {
633  Std_IsAboveMin((float) 0, fltVal, true, "SlideAngularNormal", true);
634 
635  if(bUseScaling)
636  fltVal *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
637 
638  m_fltSlideAngularNormal = fltVal;
639  SetMaterialProperties();
640 }
641 
655 
669 void VsMaterialType::SlideAngularPrimary(float fltVal, bool bUseScaling)
670 {
671  Std_IsAboveMin((float) 0, fltVal, true, "SlideAngularPrimary", true);
672 
673  if(bUseScaling)
674  fltVal *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
675 
676  m_fltSlideAngularPrimary = fltVal;
677  SetMaterialProperties();
678 }
679 
680 
694 
695 
709 void VsMaterialType::SlideAngularSecondary(float fltVal, bool bUseScaling)
710 {
711  Std_IsAboveMin((float) 0, fltVal, true, "SlideAngularSecondary", true);
712 
713  if(bUseScaling)
714  fltVal *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
715 
717  SetMaterialProperties();
718 }
719 
729 
739 void VsMaterialType::Compliance(float fltVal, bool bUseScaling)
740 {
741  Std_IsAboveMin((float) 0, fltVal, true, "Compliance", true);
742 
743  if(bUseScaling)
744  fltVal *= m_lpSim->MassUnits(); //Compliance units are m/N or s^2/Kg
745 
746  m_fltCompliance = fltVal;
747  SetMaterialProperties();
748 }
749 
759 
769 void VsMaterialType::Damping(float fltVal, bool bUseScaling)
770 {
771  Std_IsAboveMin((float) 0, fltVal, true, "Damping", true);
772 
773  if(bUseScaling)
774  fltVal = fltVal/m_lpSim->DisplayMassUnits();
775 
776  m_fltDamping = fltVal;
777  SetMaterialProperties();
778 }
779 
797 
814 void VsMaterialType::Restitution(float fltVal)
815 {
816  Std_InValidRange((float) 0, (float) 1, fltVal, true, "Restitution");
817  m_fltRestitution = fltVal;
818  SetMaterialProperties();
819 }
820 
833 
846 void VsMaterialType::MaxAdhesive(float fltVal, bool bUseScaling)
847 {
848  if(bUseScaling)
849  fltVal *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
850 
851  m_fltMaxAdhesive = fltVal;
852  SetMaterialProperties();
853 }
854 
863 {
874  m_fltCompliance = 1e-7f;
875  m_fltDamping = 5e4f;
876  m_fltRestitution = 0;
887  m_fltMaxAdhesive = 0;
888 
889  //scale the varios units to be consistent
890  //Friction coefficients are unitless
893  m_fltCompliance *= m_lpSim->MassUnits(); //Compliance units are m/N or s^2/Kg
895 
896  m_fltSlipLinearPrimary *= m_lpSim->MassUnits(); //Slip units are s/Kg
901 
902  m_fltSlideLinearPrimary *= m_lpSim->InverseDistanceUnits(); //slide is a velocity so units are m/s
907 
908  m_fltMaxAdhesive *= (m_lpSim->InverseMassUnits() * m_lpSim->InverseDistanceUnits()); //This is a force.
909 }
910 
911 bool VsMaterialType::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
912 {
913  std::string strType = Std_CheckString(strDataType);
914 
915  if(MaterialType::SetData(strType, strValue, false))
916  return true;
917 
918  if(strType == "FRICTIONLINEARPRIMARY")
919  {
920  FrictionLinearPrimary((float) atof(strValue.c_str()));
921  return true;
922  }
923 
924  if(strType == "FRICTIONLINEARSECONDARY")
925  {
926  FrictionLinearSecondary((float) atof(strValue.c_str()));
927  return true;
928  }
929 
930  if(strType == "FRICTIONANGULARNORMAL")
931  {
932  FrictionAngularNormal((float) atof(strValue.c_str()));
933  return true;
934  }
935 
936  if(strType == "FRICTIONANGULARPRIMARY")
937  {
938  FrictionAngularPrimary((float) atof(strValue.c_str()));
939  return true;
940  }
941 
942  if(strType == "FRICTIONANGULARSECONDARY")
943  {
944  FrictionAngularSecondary((float) atof(strValue.c_str()));
945  return true;
946  }
947 
948  if(strType == "FRICTIONLINEARPRIMARYMAX")
949  {
950  FrictionLinearPrimaryMax((float) atof(strValue.c_str()));
951  return true;
952  }
953 
954  if(strType == "FRICTIONLINEARSECONDARYMAX")
955  {
956  FrictionLinearSecondaryMax((float) atof(strValue.c_str()));
957  return true;
958  }
959 
960  if(strType == "FRICTIONANGULARNORMALMAX")
961  {
962  FrictionAngularNormalMax((float) atof(strValue.c_str()));
963  return true;
964  }
965 
966  if(strType == "FRICTIONANGULARPRIMARYMAX")
967  {
968  FrictionAngularPrimaryMax((float) atof(strValue.c_str()));
969  return true;
970  }
971 
972  if(strType == "FRICTIONANGULARSECONDARYMAX")
973  {
974  FrictionAngularSecondaryMax((float) atof(strValue.c_str()));
975  return true;
976  }
977 
978  if(strType == "COMPLIANCE")
979  {
980  Compliance((float) atof(strValue.c_str()));
981  return true;
982  }
983 
984  if(strType == "DAMPING")
985  {
986  Damping((float) atof(strValue.c_str()));
987  return true;
988  }
989 
990  if(strType == "RESTITUTION")
991  {
992  Restitution((float) atof(strValue.c_str()));
993  return true;
994  }
995 
996  if(strType == "SLIPLINEARPRIMARY")
997  {
998  SlipLinearPrimary((float) atof(strValue.c_str()));
999  return true;
1000  }
1001 
1002  if(strDataType == "SLIPLINEARSECONDARY")
1003  {
1004  SlipLinearSecondary((float) atof(strValue.c_str()));
1005  return true;
1006  }
1007 
1008  if(strDataType == "SLIPANGULARNORMAL")
1009  {
1010  SlipAngularNormal((float) atof(strValue.c_str()));
1011  return true;
1012  }
1013 
1014  if(strType == "SLIPANGULARPRIMARY")
1015  {
1016  SlipAngularPrimary((float) atof(strValue.c_str()));
1017  return true;
1018  }
1019 
1020  if(strDataType == "SLIPANGULARSECONDARY")
1021  {
1022  SlipAngularSecondary((float) atof(strValue.c_str()));
1023  return true;
1024  }
1025 
1026  if(strType == "SLIDELINEARPRIMARY")
1027  {
1028  SlideLinearPrimary((float) atof(strValue.c_str()));
1029  return true;
1030  }
1031 
1032  if(strDataType == "SLIDELINEARSECONDARY")
1033  {
1034  SlideLinearSecondary((float) atof(strValue.c_str()));
1035  return true;
1036  }
1037 
1038  if(strDataType == "SLIDEANGULARNORMAL")
1039  {
1040  SlideAngularNormal((float) atof(strValue.c_str()));
1041  return true;
1042  }
1043 
1044  if(strType == "SLIDEANGULARPRIMARY")
1045  {
1046  SlideAngularPrimary((float) atof(strValue.c_str()));
1047  return true;
1048  }
1049 
1050  if(strDataType == "SLIDEANGULARSECONDARY")
1051  {
1052  SlideAngularSecondary((float) atof(strValue.c_str()));
1053  return true;
1054  }
1055 
1056  if(strType == "MAXADHESION")
1057  {
1058  MaxAdhesive((float) atof(strValue.c_str()));
1059  return true;
1060  }
1061 
1062  //If it was not one of those above then we have a problem.
1063  if(bThrowError)
1064  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
1065 
1066  return false;
1067 }
1068 
1069 void VsMaterialType::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
1070 {
1071  MaterialType::QueryProperties(aryProperties);
1072 
1073  aryProperties.Add(new TypeProperty("FrictionLinearPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1074  aryProperties.Add(new TypeProperty("FrictionLinearSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1075  aryProperties.Add(new TypeProperty("FrictionAngularNormal", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1076  aryProperties.Add(new TypeProperty("FrictionAngularPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1077  aryProperties.Add(new TypeProperty("FrictionAngularSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1078  aryProperties.Add(new TypeProperty("FrictionLinearPrimaryMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1079  aryProperties.Add(new TypeProperty("FrictionLinearSecondaryMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1080  aryProperties.Add(new TypeProperty("FrictionAngularNormalMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1081  aryProperties.Add(new TypeProperty("FrictionAngularPrimaryMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1082  aryProperties.Add(new TypeProperty("FrictionAngularSecondaryMax", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1083  aryProperties.Add(new TypeProperty("Compliance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1084  aryProperties.Add(new TypeProperty("Damping", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1085  aryProperties.Add(new TypeProperty("Restitution", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1086  aryProperties.Add(new TypeProperty("SlipLinearPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1087  aryProperties.Add(new TypeProperty("SlipLinearSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1088  aryProperties.Add(new TypeProperty("SlipAngularNormal", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1089  aryProperties.Add(new TypeProperty("SlipAngularPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1090  aryProperties.Add(new TypeProperty("SlipAngularSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1091  aryProperties.Add(new TypeProperty("SlideLinearPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1092  aryProperties.Add(new TypeProperty("SlideLinearSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1093  aryProperties.Add(new TypeProperty("SlideAngularNormal", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1094  aryProperties.Add(new TypeProperty("SlideAngularPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1095  aryProperties.Add(new TypeProperty("SlideAngularSecondary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1096  aryProperties.Add(new TypeProperty("MaxAdhesion", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1097 }
1098 
1099 void VsMaterialType::Load(CStdXml &oXml)
1100 {
1101  MaterialType::Load(oXml);
1102 
1103  oXml.IntoElem(); //Into MaterialType Element
1104 
1105  FrictionLinearPrimary(oXml.GetChildFloat("FrictionLinearPrimary", m_fltFrictionLinearPrimary));
1106  FrictionLinearSecondary(oXml.GetChildFloat("FrictionLinearSecondary", m_fltFrictionLinearSecondary));
1107  FrictionAngularNormal(oXml.GetChildFloat("FrictionAngularNormal", m_fltFrictionAngularNormal));
1108  FrictionAngularPrimary(oXml.GetChildFloat("FrictionAngularPrimary", m_fltFrictionAngularPrimary));
1109  FrictionAngularSecondary(oXml.GetChildFloat("FrictionAngularSecondary", m_fltFrictionAngularSecondary));
1110  FrictionLinearPrimaryMax(oXml.GetChildFloat("FrictionLinearPrimaryMax", m_fltFrictionLinearPrimaryMax));
1111  FrictionLinearSecondaryMax(oXml.GetChildFloat("FrictionLinearSecondaryMax", m_fltFrictionLinearSecondaryMax));
1112  FrictionAngularNormalMax(oXml.GetChildFloat("FrictionAngularNormalMax", m_fltFrictionAngularNormalMax));
1113  FrictionAngularPrimaryMax(oXml.GetChildFloat("FrictionAngularPrimaryMax", m_fltFrictionAngularPrimaryMax));
1114  FrictionAngularSecondaryMax(oXml.GetChildFloat("FrictionAngularSecondaryMax", m_fltFrictionAngularSecondaryMax));
1115  Compliance(oXml.GetChildFloat("Compliance", m_fltCompliance));
1116  Damping(oXml.GetChildFloat("Damping", m_fltDamping));
1117  Restitution(oXml.GetChildFloat("Restitution", m_fltRestitution));
1118 
1119  SlipLinearPrimary(oXml.GetChildFloat("SlipLinearPrimary", m_fltSlipLinearPrimary));
1120  SlipLinearSecondary(oXml.GetChildFloat("SlipLinearSecondary", m_fltSlipLinearSecondary));
1121  SlipAngularNormal(oXml.GetChildFloat("SlipAngularNormal", m_fltSlipAngularNormal));
1122  SlipAngularPrimary(oXml.GetChildFloat("SlipAngularPrimary", m_fltSlipAngularPrimary));
1123  SlipAngularSecondary(oXml.GetChildFloat("SlipAngularSecondary", m_fltSlipAngularSecondary));
1124 
1125  SlideLinearPrimary(oXml.GetChildFloat("SlideLinearPrimary", m_fltSlideLinearPrimary));
1126  SlideLinearSecondary(oXml.GetChildFloat("SlideLinearSecondary", m_fltSlideLinearSecondary));
1127  SlideAngularNormal(oXml.GetChildFloat("SlideAngularNormal", m_fltSlideAngularNormal));
1128  SlideAngularPrimary(oXml.GetChildFloat("SlideAngularPrimary", m_fltSlideAngularPrimary));
1129  SlideAngularSecondary(oXml.GetChildFloat("SlideAngularSecondary", m_fltSlideAngularSecondary));
1130 
1131  MaxAdhesive(oXml.GetChildFloat("MaxAdhesive", m_fltMaxAdhesive));
1132 
1133  oXml.OutOfElem(); //OutOf MaterialType Element
1134 
1135 }
1136 
1137 int VsMaterialType::GetMaterialID(std::string strName)
1138 {
1139  if(!m_vxMaterialTable)
1140  THROW_ERROR(Vs_Err_lMaterial_Table_Not_Defined, Vs_Err_strMaterial_Table_Not_Defined);
1141 
1142  return m_vxMaterialTable->getMaterialID(strName.c_str());
1143 }
1144 
1146 {
1147  if(!m_vxMaterial)
1148  {
1149  VsSimulator *lpVsSim = dynamic_cast<VsSimulator *>(m_lpSim);
1150  if(!lpVsSim)
1151  THROW_ERROR(Vs_Err_lUnableToConvertToVsSimulator, Vs_Err_strUnableToConvertToVsSimulator);
1152 
1153  m_vxMaterialTable = lpVsSim->Frame()->getMaterialTable();
1154 
1155  m_vxMaterial = m_vxMaterialTable->registerMaterial(m_strID.c_str());
1156  }
1157 }
1158 
1160 {
1161  MaterialType::Initialize();
1162 
1164  SetMaterialProperties();
1165 }
1166 
1167 void VsMaterialType::SetMaterialProperties()
1168 {
1169  if(m_lpSim && m_vxMaterial)
1170  {
1171  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisLinear, VxContactMaterial::kFrictionModelScaledBox);
1172 
1173  m_vxMaterial->setFrictionCoefficient(VxContactMaterial::kFrictionAxisLinearPrimary, m_fltFrictionLinearPrimary);
1174  m_vxMaterial->setBoxFrictionForce(VxContactMaterial::kFrictionAxisLinearPrimary, m_fltFrictionLinearPrimaryMax);
1175 
1176  m_vxMaterial->setFrictionCoefficient(VxContactMaterial::kFrictionAxisLinearSecondary, m_fltFrictionLinearSecondary);
1177  m_vxMaterial->setBoxFrictionForce(VxContactMaterial::kFrictionAxisLinearSecondary, m_fltFrictionLinearSecondaryMax);
1178 
1180  {
1181  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularNormal, VxContactMaterial::kFrictionModelScaledBox);
1182  m_vxMaterial->setFrictionCoefficient(VxContactMaterial::kFrictionAxisAngularNormal, m_fltFrictionAngularNormal);
1183  m_vxMaterial->setBoxFrictionForce(VxContactMaterial::kFrictionAxisAngularNormal, m_fltFrictionAngularNormalMax);
1184  }
1185  else
1186  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularNormal, VxContactMaterial::kFrictionModelNeutral);
1187 
1189  {
1190  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularPrimary, VxContactMaterial::kFrictionModelScaledBox);
1191  m_vxMaterial->setFrictionCoefficient(VxContactMaterial::kFrictionAxisAngularPrimary, m_fltFrictionAngularPrimary);
1192  m_vxMaterial->setBoxFrictionForce(VxContactMaterial::kFrictionAxisAngularPrimary, m_fltFrictionAngularPrimaryMax);
1193  }
1194  else
1195  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularPrimary, VxContactMaterial::kFrictionModelNeutral);
1196 
1198  {
1199  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularSecondary, VxContactMaterial::kFrictionModelScaledBox);
1200  m_vxMaterial->setFrictionCoefficient(VxContactMaterial::kFrictionAxisAngularSecondary, m_fltFrictionAngularSecondary);
1201  m_vxMaterial->setBoxFrictionForce(VxContactMaterial::kFrictionAxisAngularSecondary, m_fltFrictionAngularSecondaryMax);
1202  }
1203  else
1204  m_vxMaterial->setFrictionModel(VxContactMaterial::kFrictionAxisAngularSecondary, VxContactMaterial::kFrictionModelNeutral);
1205 
1206  m_vxMaterial->setCompliance(m_fltCompliance);
1207  m_vxMaterial->setDamping(m_fltDamping);
1208  m_vxMaterial->setRestitution(m_fltRestitution);
1209 
1210  m_vxMaterial->setSlip(VxContactMaterial::kFrictionAxisLinearPrimary, m_fltSlipLinearPrimary);
1211  m_vxMaterial->setSlip(VxContactMaterial::kFrictionAxisLinearSecondary, m_fltSlipLinearSecondary);
1212  m_vxMaterial->setSlip(VxContactMaterial::kFrictionAxisAngularNormal, m_fltSlipAngularNormal);
1213  m_vxMaterial->setSlip(VxContactMaterial::kFrictionAxisAngularPrimary, m_fltSlipAngularPrimary);
1214  m_vxMaterial->setSlip(VxContactMaterial::kFrictionAxisAngularSecondary, m_fltSlipAngularSecondary);
1215 
1216  m_vxMaterial->setSlide(VxContactMaterial::kFrictionAxisLinearPrimary, m_fltSlideLinearPrimary);
1217  m_vxMaterial->setSlide(VxContactMaterial::kFrictionAxisLinearSecondary, m_fltSlideLinearSecondary);
1218  m_vxMaterial->setSlide(VxContactMaterial::kFrictionAxisAngularNormal, m_fltSlideAngularNormal);
1219  m_vxMaterial->setSlide(VxContactMaterial::kFrictionAxisAngularPrimary, m_fltSlideAngularPrimary);
1220  m_vxMaterial->setSlide(VxContactMaterial::kFrictionAxisAngularSecondary, m_fltSlideAngularSecondary);
1221 
1222  m_vxMaterial->setAdhesiveForce(m_fltMaxAdhesive);
1223  }
1224 }
1225 
1226  } // Visualization
1227 } //VortexAnimatSim
float m_fltFrictionAngularNormal
The angular normal coefficient of friction parameter. (this simulates spinning resistance) ...
virtual float SlipAngularNormal()
Gets the angular normal slip value.
virtual float FrictionLinearSecondaryMax()
Gets the maximum secondary friction allowed.
float m_fltFrictionAngularSecondaryMax
The maximum angular secondary friction that can created.
virtual float FrictionAngularPrimaryMax()
Gets the maximum angular primary friction allowed.
float m_fltFrictionAngularPrimaryMax
The maximum angular primary friction that can created.
virtual float InverseMassUnits()
Gets the inverse mass units.
Definition: Simulator.cpp:1797
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
float m_fltFrictionAngularPrimary
The angular primary coefficient of friction parameter.(this simulates rolling resistance) ...
float m_fltSlipAngularSecondary
The angular secondary slip of the collision between those two materials.
virtual void CreateDefaultUnits()
This takes the default values defined in the constructor and scales them according to the distance an...
virtual float FrictionLinearPrimary()
Gets the primary friction coefficient.
Simulator * m_lpSim
The pointer to a Simulation.
Definition: AnimatBase.h:43
float m_fltCompliance
The compliance of the collision between those two materials.
virtual float Damping()
Gets the damping for collisions between RigidBodies with these two materials.
virtual int GetMaterialID(std::string strName)
Gets a material identifier used by the physics engine.
virtual float SlideLinearSecondary()
Gets the linear secondary slide value.
bool Std_InValidRange(int iMinVal, int iMaxVal, int iVal, bool bThrowError, std::string strParamName)
Tests whether a number is within a valid range.
virtual float FrictionLinearSecondary()
Gets the secondary linear friction coefficient.
virtual float SlipLinearSecondary()
Gets the secondary linear slip value.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
float m_fltMaxAdhesive
The maximum adhesion of the collision between those two materials.
virtual float MaxAdhesive()
Gets the maximum adhesive for collisions between RigidBodies with these two materials.
float m_fltSlipAngularNormal
The angular normal slip of the collision between those two materials.
std::string m_strID
The unique Id for this object.
Definition: AnimatBase.h:55
virtual void MassUnits(std::string strUnits)
Sets the mass units.
Definition: Simulator.cpp:1772
virtual float DisplayMassUnits()
Gets the density mass units.
Definition: Simulator.cpp:1810
float m_fltSlipLinearSecondary
The secondary linear slip of the collision between those two materials.
virtual float FrictionAngularNormalMax()
Gets the maximum angular normal friction allowed.
float m_fltDamping
The damping of the collision between those two materials.
virtual float FrictionAngularSecondary()
Gets the angular secondary friction coefficient.
virtual float SlipAngularSecondary()
Gets the angular secondary slip value.
float m_fltSlipAngularPrimary
The angular primary slip of the collision between those two materials.
virtual float SlideAngularNormal()
Gets the angular normal slide value.
float m_fltSlipLinearPrimary
The primary linear slip of the collision between those two materials.
float m_fltSlideLinearSecondary
The primary linear slide of the collision between those two materials.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
virtual float FrictionAngularSecondaryMax()
Gets the maximum angular secondary friction allowed.
float m_fltFrictionLinearPrimary
The primary linear coefficient of friction parameter.
virtual float FrictionLinearPrimaryMax()
Gets the maximum primary friction allowed.
virtual float SlipAngularPrimary()
Gets the angular primary slip value.
float m_fltFrictionLinearSecondary
The secondary linear coefficient of friction parameter.
virtual float Compliance()
Gets the compliance for collisions between RigidBodies with these two materials.
float m_fltFrictionLinearPrimaryMax
The maximum linear primary friction that can created.
float m_fltSlideAngularNormal
The angular normal slide of the collision between those two materials.
virtual void Initialize()
Initializes this object.
float m_fltFrictionLinearSecondaryMax
The maximum linear secondary friction that can created.
float m_fltSlideAngularPrimary
The angular primary slide of the collision between those two materials.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual float SlideLinearPrimary()
Gets the linear primary slide value.
virtual float FrictionAngularPrimary()
Gets the angular primary friction coefficient.
float m_fltRestitution
The restitution of the collision between those two materials.
float m_fltFrictionAngularNormalMax
The maximum angular normal friction that can created.
virtual float FrictionAngularNormal()
Gets the angular normal friction coefficient.
float m_fltFrictionAngularSecondary
The angular secondary coefficient of friction parameter.(this simulates rolling resistance) ...
virtual float Restitution()
Gets the restitution for collisions between RigidBodies with these two materials. ...
virtual float InverseDistanceUnits()
Gets the inverse distance units.
Definition: Simulator.cpp:1742
virtual float SlideAngularPrimary()
Gets the angular primary slide value.
virtual float SlipLinearPrimary()
Gets the primary linear slip value.
float m_fltSlideLinearPrimary
The primary linear slide of the collision between those two materials.
virtual void RegisterMaterialType()
Registers the material types within the physics engine.
virtual float SlideAngularSecondary()
Gets the angular secondary slide value.
float m_fltSlideAngularSecondary
The angular secondary slide of the collision between those two materials.