FEM: Implement constraint displacement in C++

This commit is contained in:
vginkeo
2016-02-11 08:55:57 +02:00
parent ff4d7ad365
commit 034e377dd0
30 changed files with 2277 additions and 42 deletions

View File

@@ -395,6 +395,46 @@ void ViewProviderFemConstraint::updateFixed(const SoNode* node, const int idx, c
updateCube(sep, idx+CONE_CHILDREN+PLACEMENT_CHILDREN, width, width, width/4);
}
void ViewProviderFemConstraint::createDisplacement(SoSeparator* sep, const double height, const double width, const bool gap)
{
createCone(sep, height, width);
createPlacement(sep, SbVec3f(0, -(height)/2-width/8 - (gap ? 1.0 : 0.1) * width/8, 0), SbRotation());
}
SoSeparator* ViewProviderFemConstraint::createDisplacement(const double height, const double width, const bool gap)
{
SoSeparator* sep = new SoSeparator();
createDisplacement(sep, height, width, gap);
return sep;
}
void ViewProviderFemConstraint::updateDisplacement(const SoNode* node, const int idx, const double height, const double width, const bool gap)
{
const SoSeparator* sep = static_cast<const SoSeparator*>(node);
updateCone(sep, idx, height, width);
updatePlacement(sep, idx+CONE_CHILDREN, SbVec3f(0, -(height)/2-width/8 - (gap ? 1.0 : 0.0) * width/8, 0), SbRotation());
}
void ViewProviderFemConstraint::createRotation(SoSeparator* sep, const double height, const double width, const bool gap)
{
createCylinder(sep, width/2, height/2);
createPlacement(sep, SbVec3f(0, -(height)*2-width/8 - (gap ? 1.0 : 0.1) * width/8, 0), SbRotation());
}
SoSeparator* ViewProviderFemConstraint::createRotation(const double height, const double width, const bool gap)
{
SoSeparator* sep = new SoSeparator();
createRotation(sep, height, width, gap);
return sep;
}
void ViewProviderFemConstraint::updateRotation(const SoNode* node, const int idx, const double height, const double width, const bool gap)
{
const SoSeparator* sep = static_cast<const SoSeparator*>(node);
updateCylinder(sep, idx, height/2, width/2);
updatePlacement(sep, idx+CYLINDER_CHILDREN, SbVec3f(0, -(height)*2-width/8 - (gap ? 1.0 : 0.0) * width/8, 0), SbRotation());
}
QObject* ViewProviderFemConstraint::findChildByName(const QObject* parent, const QString& name)
{
for (QObjectList::const_iterator o = parent->children().begin(); o != parent->children().end(); o++) {