Ejemplo n.º 1
0
WP_Matrix2D::WP_Matrix2D(const byte type, scalar x, scalar y)
{
  switch(type)
    {
    case TRANSLATION_MATRIX:
      data[0][0] = 1.0;
      data[0][1] = 0.0;
      data[0][2] = x;
      
      data[1][0] = 0.0;
      data[1][1] = 1.0;
      data[1][2] = y;
      
      data[2][0] = 0.0;
      data[2][1] = 0.0;
      data[2][2] = 1.0;
      break;
    case SCALING_MATRIX:
      data[0][0] = x;
      data[0][1] = 0.0;
      data[0][2] = 0.0;
      
      data[1][0] = 0.0;
      data[1][1] = y;
      data[1][2] = 0.0;
      
      data[2][0] = 0.0;
      data[2][1] = 0.0;
      data[2][2] = 1.0;
      break;
    default:
      createIdentity();
      break;
    }
}
Ejemplo n.º 2
0
NEWMAT::Matrix rspfMatrix3x3::createScaleMatrix(double x, double y, double z)
{
    NEWMAT::Matrix m = createIdentity();

    m[0][0] = x;
    m[1][1] = y;
    m[2][2] = z;

    return m;
}
Ejemplo n.º 3
0
pqe::Matrix pqe::Matrix3x3::createScaleMatrix(pqe_float64 x, pqe_float64 y, pqe_float64 z)
{
    pqe::Matrix m = createIdentity();

    m[0][0] = x;
    m[1][1] = y;
    m[2][2] = z;

    return m;
}
Ejemplo n.º 4
0
model::Element* createTree(glow::Dispatcher* dispatcher)
{
   auto root = model::Element::createRoot();
   auto router = new model::Node(1, root, "router");
   createIdentity(router, 0);
   createOneToN(router, 1, dispatcher);
   createNToN(router, 2, dispatcher);
   createDynamic(router, 3, dispatcher);
   createFunctions(router, 4, dispatcher);

   return root;
}
Ejemplo n.º 5
0
/**
 * \return The inverse matrix of this matrix \f$A^{-1}\f$ or
 * an empty matrix if this matrix is not invertible.
 */
RMatrix RMatrix::getInverse() const {
    if (cols != rows) {
        return RMatrix();
    }

    RMatrix a = getAppended(createIdentity(cols));
    if (!a.rref()) {
        return RMatrix();
    }

    RMatrix ret(rows, cols);
    for (int r = 0; r < rows; r++) {
        for (int c = 0; c < cols; c++) {
            ret.set(r, c, a.get(r, c + cols));
        }
    }

    return ret;
}
Ejemplo n.º 6
0
WP_Matrix2D::WP_Matrix2D(scalar angle)
{
  if (angle != 0.0)
    {
      WP_Math* m = WP_Math::getInstance();
      
      data[0][0] = cos(m->fDegreeToRad(angle));
      data[0][1] = -sin(m->fDegreeToRad(angle));
      data[0][2] = 0.0;
      
      data[1][0] = sin(m->fDegreeToRad(angle));
      data[1][1] = cos(m->fDegreeToRad(angle));
      data[1][2] = 0.0;
      
      data[2][0] = 0.0;
      data[2][1] = 0.0;
      data[2][2] = 1.0;
    }
  else
    {
      createIdentity();
    }
}
Ejemplo n.º 7
0
/**
 * \return An identity matrix with 2 rows and 2 columns:
 * \f$
 *   \left( \begin{array}{ccc}
 *     1 & 0 \\
 *     0 & 1
 *   \end{array} \right)
 * \f$
 */
RMatrix RMatrix::createIdentity2x2() {
    return createIdentity(2);
}
Ejemplo n.º 8
0
/**
 * \return An identity matrix with 3 rows and 3 columns:
 * \f$
 *   \left( \begin{array}{ccc}
 *     1 & 0 & 0 \\
 *     0 & 1 & 0 \\
 *     0 & 0 & 1
 *   \end{array} \right)
 * \f$
 */
RMatrix RMatrix::createIdentity3x3() {
    return createIdentity(3);
}
Ejemplo n.º 9
0
WP_Matrix2D::WP_Matrix2D()
{
  createIdentity();
}
void lvDCOMInterface::createViRef(BSTR vi_name, bool reentrant, LabVIEW::VirtualInstrumentPtr& vi)
{
	epicsThreadOnce(&onceId, initCOM, NULL);
	std::wstring ws(vi_name, SysStringLen(vi_name));
	HRESULT hr;
	if ( (m_lv != NULL) && (m_lv->CheckConnection() == S_OK) )
	{
		;
	}
	else if (m_host.size() > 0)
	{
		std::cerr << "(Re)Making connection to LabVIEW on " << m_host << std::endl;
		CComBSTR host(m_host.c_str());
		m_pidentity = createIdentity(m_username, m_host, m_password);
		COAUTHINFO* pauth = new COAUTHINFO;
		COSERVERINFO csi = { 0, NULL, NULL, 0 };
		pauth->dwAuthnSvc = RPC_C_AUTHN_WINNT;
		pauth->dwAuthnLevel = RPC_C_AUTHN_LEVEL_DEFAULT;
		pauth->dwAuthzSvc = RPC_C_AUTHZ_NONE;
		pauth->dwCapabilities = EOAC_NONE;
		pauth->dwImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE;
		pauth->pAuthIdentityData = m_pidentity;
		pauth->pwszServerPrincName = NULL;
		csi.pwszName = host;
		csi.pAuthInfo = pauth;
		MULTI_QI mq[ 1 ] = { 0 }; 
		mq[ 0 ].pIID = &IID_IDispatch;  // &LabVIEW::DIID__Application; // &IID_IDispatch; 
		mq[ 0 ].pItf = NULL; 
		mq[ 0 ].hr   = S_OK; 
		hr = CoCreateInstanceEx( m_clsid, NULL, CLSCTX_REMOTE_SERVER | CLSCTX_LOCAL_SERVER, &csi, 1, mq ); 
		if( FAILED( hr ) ) 
		{ 
			hr = CoCreateInstanceEx( m_clsid, NULL, CLSCTX_ALL, &csi, 1, mq );
		}
		if( FAILED( hr ) ) 
		{
			throw COMexception("CoCreateInstanceEx (LabVIEW) ", hr);
		} 
		if( S_OK != mq[ 0 ].hr || NULL == mq[ 0 ].pItf ) 
		{ 
			throw COMexception("CoCreateInstanceEx (LabVIEW)(mq) ", mq[ 0 ].hr);
		} 
		setIdentity(m_pidentity, mq[ 0 ].pItf);
		m_lv.Release();
		m_lv.Attach( reinterpret_cast< LabVIEW::_Application* >( mq[ 0 ].pItf ) ); 
		std::cerr << "Successfully connected to LabVIEW on " << m_host << std::endl;
	}
	else
	{
		std::cerr << "(Re)Making local connection to LabVIEW" << std::endl;
		m_pidentity = NULL;
		m_lv.Release();
		hr = m_lv.CoCreateInstance(m_clsid, NULL, CLSCTX_LOCAL_SERVER);
		if( FAILED( hr ) ) 
		{
			throw COMexception("CoCreateInstance (LabVIEW) ", hr);
		} 
		std::cerr << "Successfully connected to local LabVIEW" << std::endl;
	}
	if (reentrant)
	{
		vi = m_lv->GetVIReference(vi_name, "", 1, 8);
		setIdentity(m_pidentity, vi);
	}
	else
	{
		//If a VI is reentrant then always get it as reentrant
		vi = m_lv->GetVIReference(vi_name, "", 0, 0);
		setIdentity(m_pidentity, vi);
		if (vi->IsReentrant)
		{
			vi = m_lv->GetVIReference(vi_name, "", 1, 8);
			setIdentity(m_pidentity, vi);
			reentrant = true;
		}
	}
	ViRef viref(vi, reentrant, false);
	// LabVIEW::ExecStateEnum::eIdle = 1
	// LabVIEW::ExecStateEnum::eRunTopLevel = 2
	if (vi->ExecState == LabVIEW::eIdle)
	{
		if ( checkOption(viStartIfIdle) ) 
		{
			std::cerr << "Starting \"" << CW2CT(vi_name) << "\" on " << (m_host.size() > 0 ? m_host : "localhost") << std::endl;
			vi->Run(true);
			viref.started = true;
		}
		else if ( checkOption(viWarnIfIdle) )
		{
			std::cerr << "\"" << CW2CT(vi_name) << "\" is not running on " << (m_host.size() > 0 ? m_host : "localhost") << " and autostart is disabled" << std::endl;
		}
	}
	m_vimap[ws] = viref;
}