// Implement generateDecorations by WrapCylinder to replace the previous out of place implementation // in ModelVisualizer void WrapCylinder::generateDecorations(bool fixed, const ModelDisplayHints& hints, const SimTK::State& state, SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const { Super::generateDecorations(fixed, hints, state, appendToThis); if (fixed) return; if (hints.get_show_wrap_geometry()) { const Appearance& defaultAppearance = get_Appearance(); if (!defaultAppearance.get_visible()) return; const Vec3 color = defaultAppearance.get_color(); SimTK::Transform ztoy; // Make transform that takes z axis to y axis due to different // assumptions between DecorativeCylinder aligned with y and // WrapCylinder aligned with z ztoy.updR().setRotationFromAngleAboutX(SimTK_PI / 2); const SimTK::Transform& X_GB = getFrame().getTransformInGround(state); SimTK::Transform X_GW = X_GB*getTransform()*ztoy; appendToThis.push_back( SimTK::DecorativeCylinder(get_radius(), get_length() / 2) .setTransform(X_GW).setResolution(2.0) .setColor(color).setOpacity(defaultAppearance.get_opacity()) .setScale(1).setRepresentation(defaultAppearance.get_representation())); } }
// Implement generateDecorations by WrapEllipsoid to replace the previous out of place implementation // in ModelVisualizer void WrapEllipsoid::generateDecorations(bool fixed, const ModelDisplayHints& hints, const SimTK::State& state, SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const { Super::generateDecorations(fixed, hints, state, appendToThis); if (fixed) return; if (hints.get_show_wrap_geometry()) { const Vec3 color(SimTK::Cyan); const SimTK::Transform& X_GB = getFrame().getTransformInGround(state); SimTK::Transform X_GW = X_GB*getTransform(); appendToThis.push_back( SimTK::DecorativeEllipsoid(getRadii()) .setTransform(X_GW).setResolution(2.0) .setColor(color).setOpacity(0.5)); } }
// Implement generateDecorations by WrapTorus to replace the previous out of place implementation // in ModelVisualizer, not implemented yet in API visualizer void WrapTorus::generateDecorations(bool fixed, const ModelDisplayHints& hints, const SimTK::State& state, SimTK::Array_<SimTK::DecorativeGeometry>& appendToThis) const { Super::generateDecorations(fixed, hints, state, appendToThis); if (fixed) return; if (hints.get_show_wrap_geometry()) { const Appearance& defaultAppearance = get_Appearance(); if (!defaultAppearance.get_visible()) return; const Vec3 color = defaultAppearance.get_color(); const SimTK::Transform& X_GB = getFrame().getTransformInGround(state); SimTK::Transform X_GW = X_GB*getTransform(); appendToThis.push_back( SimTK::DecorativeTorus(getOuterRadius(), getInnerRadius()) .setTransform(X_GW).setResolution(2.0) .setColor(color).setOpacity(defaultAppearance.get_opacity()) .setScale(1).setRepresentation(defaultAppearance.get_representation())); } }