Ejemplo n.º 1
0
ON_3dVector ON_SpaceMorph::MorphVector( 
          ON_3dPoint tail_point, 
          ON_3dVector vector 
          ) const
{
  return (MorphPoint(tail_point+vector) - MorphPoint(tail_point));
}
Ejemplo n.º 2
0
void cbHintAnimTimer::Notify(void)
{
    // FIXME:: "clean" implementation should use mutex to sync
    //         between GUI and animation threads

    if ( mpPl->mStopPending )
    {
        Stop(); // top timer

        mpPl->FinishTracking();

        mpPl->mStopPending = false;
        mpPl->mpAnimTimer  = NULL;
        mpPl->mAnimStarted = false;

        mPrevMorphed.x = POS_UNDEFINED;

        delete this;

        return;
    }

    wxPoint origin( mpPl->mCurRect.x, mpPl->mCurRect.y );

    wxPoint curUpper, curLower;

    MorphPoint( origin, mUpperLeft,  curUpper  );
    MorphPoint( origin, mLowerRight, curLower );

    if ( mPrevMorphed.x != POS_UNDEFINED )

        // erase previous rect
        mpPl->DoDrawHintRect( mPrevMorphed, mpPl->mPrevInClient );

    wxRect morphed( curUpper.x,  curUpper.y,
                    curLower.x - curUpper.x,
                    curLower.y - curUpper.y );

    // draw rect of current iteration
    mpPl->DoDrawHintRect( morphed,
                          ( mCurIter != mpPl->mMaxFrames - 1 )
                          ? mpPl->mPrevInClient : mpPl->mCurInClient );

    mPrevMorphed = morphed;

    if ( mCurIter == mpPl->mMaxFrames - 1 )
    {
        Stop(); // top timer

        mpPl->FinishTracking();
        mpPl->mpAnimTimer  = NULL;
        mpPl->mAnimStarted = false;

        mPrevMorphed.x = POS_UNDEFINED;

        delete this;
    }
    else
        ++mCurIter;
}
Ejemplo n.º 3
0
void ON_SpaceMorph::MorphPointList(
        int dim, 
        int is_rat,
        int count, 
        int stride,
        float* point
        ) const
{
  if ( dim > 0 && stride >= (dim+(is_rat)?1:0) && count > 0 && point != 0 )
  {
    int i;
    if ( is_rat )
    {
      ON_4dPoint p(0.0,0.0,0.0,1.0), q;
      for ( i = 0; i < count; i++ )
      {
        p.x = point[0];
        if ( dim > 1 )
          p.y = point[1];
        if ( dim > 2 )
          p.z = point[2];
        p.w = point[dim];
        q = MorphPoint(p);
        point[0] = (float)q.x;
        if ( dim > 1 )
          point[1] = (float)q.y;
        if ( dim > 2 )
          point[2] = (float)q.z;
        point[dim] = (float)q.w;
        point += stride;
      }
    }
    else
    {
      ON_3dPoint p(0.0,0.0,0.0), q;
      for ( i = 0; i < count; i++ )
      {
        p.x = point[0];
        if ( dim > 1 )
          p.y = point[1];
        if ( dim > 2 )
          p.z = point[2];
        q = MorphPoint(p);
        point[0] = (float)q.x;
        if ( dim > 1 )
          point[1] = (float)q.y;
        if ( dim > 2 )
          point[2] = (float)q.z;
        point += stride;
      }
    }
  }
}
Ejemplo n.º 4
0
bool cbHintAnimTimer::Init( cbHintAnimationPlugin* pAnimPl, bool reinit )
{

    mpPl = pAnimPl;

    // morph-points are set up relatively to the upper-left corner
    // of the current hint-rectangle

    if ( !reinit )
    {
        mUpperLeft.mFrom.x = mpPl->mPrevRect.x - mpPl->mCurRect.x;
        mUpperLeft.mFrom.y = mpPl->mPrevRect.y - mpPl->mCurRect.y;

        mLowerRight.mFrom.x = ( mUpperLeft.mFrom.x + mpPl->mPrevRect.width  );
        mLowerRight.mFrom.y = ( mUpperLeft.mFrom.y + mpPl->mPrevRect.height );
    }
    else
    {
        wxPoint origin( mpPl->mPrevRect.x, mpPl->mPrevRect.y );

        wxPoint curUpper, curLower;

        MorphPoint( origin, mUpperLeft,  curUpper  );
        MorphPoint( origin, mLowerRight, curLower );

        mUpperLeft.mFrom.x = curUpper.x - mpPl->mCurRect.x;
        mUpperLeft.mFrom.y = curUpper.y - mpPl->mCurRect.y;

        mLowerRight.mFrom.x = ( mUpperLeft.mFrom.x + curLower.x - curUpper.x );
        mLowerRight.mFrom.y = ( mUpperLeft.mFrom.y + curLower.y - curUpper.y );
    }

    mUpperLeft.mTill.x = 0;
    mUpperLeft.mTill.y = 0;

    mLowerRight.mTill.x = mpPl->mCurRect.width;
    mLowerRight.mTill.y = mpPl->mCurRect.height;

    mCurIter = 1;

    if ( !reinit )

        Start( mpPl->mMorphDelay );

    return true;
}
Ejemplo n.º 5
0
ON_4dPoint ON_SpaceMorph::MorphPoint( 
          ON_4dPoint point
          ) const
{
  ON_4dPoint q = MorphPoint(ON_3dPoint(point));
  q.w = point.w;
  q.x *= q.w;
  q.y *= q.w;
  q.z *= q.w;
  return q;
}
Ejemplo n.º 6
0
bool ON_SpaceMorph::Ev1Der(
          ON_3dPoint rst,
          ON_3dPoint& xyz,
          ON_3dVector& Dr,
          ON_3dVector& Ds,
          ON_3dVector& Dt
          ) const
{
  // This is a quick estimate of the derivative.
  // Space morphs that are used to deform smooth breps
  // should override this function.
  double d = 1.0e-6;
  double e = 1.0/d;
  ON_3dPoint P;
  ON_3dPoint dr(rst.x+d,rst.y,rst.z);
  ON_3dPoint ds(rst.x,rst.y+d,rst.z);
  ON_3dPoint dt(rst.x,rst.y,rst.z+d);
  P = MorphPoint(rst);
  Dr = e*(MorphPoint(dr) - P);
  Ds = e*(MorphPoint(ds) - P);
  Dt = e*(MorphPoint(dt) - P);
  return true;
}