Beispiel #1
0
//==============================================================================
void LineSegmentShapeNode::extractData(bool firstTime)
{
  if(mShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_TRANSFORM)
     || firstTime)
    setMatrix(eigToOsgMatrix(mShape->getLocalTransform()));

  if(nullptr == mGeode)
  {
    mGeode = new LineSegmentShapeGeode(mLineSegmentShape, mParentEntity);
    addChild(mGeode);
    return;
  }

  mGeode->refresh();
}
//==============================================================================
void EllipsoidShapeNode::extractData(bool firstTime)
{
  if(   mShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_TRANSFORM)
     || mShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_PRIMITIVE)
     || firstTime )
  {
    Eigen::Matrix4d S(Eigen::Matrix4d::Zero());
    const Eigen::Vector3d& s =
       mEllipsoidShape->getSize()/smallestComponent(mEllipsoidShape->getSize());
    S(0,0) = s[0]; S(1,1) = s[1]; S(2,2) = s[2]; S(3,3) = 1.0;
    setMatrix(eigToOsgMatrix(S));
  }

  if(nullptr == mGeode)
  {
    mGeode = new EllipsoidShapeGeode(mEllipsoidShape.get(), mParentShapeFrameNode, this);
    addChild(mGeode);
    return;
  }

  mGeode->refresh();
}