Beispiel #1
0
bool ON_NurbsSurface::Morph( const ON_SpaceMorph& morph )
{
  DestroySurfaceTree();
  ON_BOOL32 bIsClosed[2];
  ON_BOOL32 bIsPeriodic[2];
  ON_BOOL32 bIsSingular[4];

  int i;
  for ( i = 0; i < 2; i++ )
  {
    bIsClosed[i] = IsClosed(i);
    bIsPeriodic[i] = IsPeriodic(i);
  }

  for ( i = 0; i < 4; i++ )
    bIsSingular[i] = IsSingular(i);

  for ( i = 0; i < m_cv_count[0]; i++ )
  {
    morph.MorphPointList( m_dim, m_is_rat, 
                          m_cv_count[1], m_cv_stride[1], 
                          CV(i,0) );
  }

  for ( i = 0; i < 4; i++ )
  {
    if ( bIsSingular[i] )
      CollapseSide(i);
  }

  // TODO - if input was closed/periodic make output the same

  return true;
}
u32 CDWHCITransferStageData::GetStatusMask (void) const
{
	u32 nMask =   DWHCI_HOST_CHAN_INT_XFER_COMPLETE
		    | DWHCI_HOST_CHAN_INT_HALTED
		    | DWHCI_HOST_CHAN_INT_ERROR_MASK;
		    
	if (   m_bSplitTransaction
	    || IsPeriodic ())
	{
		nMask |=   DWHCI_HOST_CHAN_INT_ACK
			 | DWHCI_HOST_CHAN_INT_NAK
			 | DWHCI_HOST_CHAN_INT_NYET;
	}
	
	return	nMask;
}
Beispiel #3
0
bool ON_NurbsCurve::Morph( const ON_SpaceMorph& morph )
{
  DestroyCurveTree();
  ON_BOOL32 bIsClosed = IsClosed();
  ON_BOOL32 bIsPeriodic = IsPeriodic();
  morph.MorphPointList( m_dim, m_is_rat, m_cv_count, m_cv_stride, m_cv );
  if ( bIsPeriodic )
  {
    int i, deg = m_order-1;
    for ( i = 0; i < deg; i++ )
      SetCV( m_cv_count-deg+i, ON::intrinsic_point_style, CV(i) );
  }
  else if ( bIsClosed )
  {
    SetCV( m_cv_count-1, ON::intrinsic_point_style, CV(0) );
  }
  return true;
}
void PolyFunc::Print(ostream& os, double x) const {
	const char* const T = "true";
	const char* const F = "false";

	os << "name = " << GetName() << endl
		<< "is periodic = " << (IsPeriodic()? T: F) << endl
		<< "value at " << x << " = ";
		if(fabs(EvaluateAt(x)-DBL_MAX)<0.000001)
            os << F<<endl;
        else
            os << EvaluateAt(x) << endl;
	os << "is differentiable at " << x << " = "
		<< (IsDifferentiable(x)? T: F) << endl;

	if (IsDifferentiable(x)) {
		os << "derivative at " << x << " = " << DerivativeAt(x) << endl;
	}
}
CDWHCITransferStageData::CDWHCITransferStageData (unsigned	 nChannel,
						  CUSBRequest	*pURB,
						  boolean	 bIn,
						  boolean	 bStatusStage)
:	m_nChannel (nChannel),
	m_pURB (pURB),
	m_bIn (bIn),
	m_bStatusStage (bStatusStage),
	m_bSplitComplete (FALSE),
	m_nTotalBytesTransfered (0),
	m_nState (0),
	m_nSubState (0),
	m_nTransactionStatus (0),
	m_pTempBuffer (0),
	m_pFrameScheduler (0)
{
	assert (m_pURB != 0);

	m_pEndpoint = pURB->GetEndpoint ();
	assert (m_pEndpoint != 0);
	m_pDevice = m_pEndpoint->GetDevice ();
	assert (m_pDevice != 0);

	m_Speed = m_pDevice->GetSpeed ();
	m_nMaxPacketSize = m_pEndpoint->GetMaxPacketSize ();
	
	m_bSplitTransaction =    m_pDevice->GetHubAddress () != 0
			      && m_Speed != USBSpeedHigh;

	if (!bStatusStage)
	{
		if (m_pEndpoint->GetNextPID (bStatusStage) == USBPIDSetup)
		{
			m_pBufferPointer = pURB->GetSetupData ();
			m_nTransferSize = sizeof (TSetupData);
		}
		else
		{
			m_pBufferPointer = pURB->GetBuffer ();
			m_nTransferSize = pURB->GetBufLen ();
		}

		m_nPackets = (m_nTransferSize + m_nMaxPacketSize - 1) / m_nMaxPacketSize;
		
		if (m_bSplitTransaction)
		{
			if (m_nTransferSize > m_nMaxPacketSize)
			{
				m_nBytesPerTransaction = m_nMaxPacketSize;
			}
			else
			{
				m_nBytesPerTransaction = m_nTransferSize;
			}
			
			m_nPacketsPerTransaction = 1;
		}
		else
		{
			m_nBytesPerTransaction = m_nTransferSize;
			m_nPacketsPerTransaction = m_nPackets;
		}
	}
	else
	{
		assert (m_pTempBuffer == 0);
		m_pTempBuffer = new u32[1];
		assert (m_pTempBuffer != 0);
		m_pBufferPointer = m_pTempBuffer;

		m_nTransferSize = 0;
		m_nBytesPerTransaction = 0;
		m_nPackets = 1;
		m_nPacketsPerTransaction = 1;
	}

	assert (m_pBufferPointer != 0);
	assert (((u32) m_pBufferPointer & 3) == 0);

	if (m_bSplitTransaction)
	{
		if (IsPeriodic ())
		{
			m_pFrameScheduler = new CDWHCIFrameSchedulerPeriodic;
		}
		else
		{
			m_pFrameScheduler = new CDWHCIFrameSchedulerNonPeriodic;
		}

		assert (m_pFrameScheduler != 0);
	}
	else
	{
		if (   m_pDevice->GetHubAddress () == 0
		    && m_Speed != USBSpeedHigh)
		{
			m_pFrameScheduler = new CDWHCIFrameSchedulerNoSplit (IsPeriodic ());
			assert (m_pFrameScheduler != 0);
		}
	}
}