void
DelaunayAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("DelaunayAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("dimension")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 3)
                SetDimension(Dimension(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            Dimension value;
            if(Dimension_FromString(node->AsString(), value))
                SetDimension(value);
        }
    }
}
Beispiel #2
0
void CUICellInfo::Render(){
            char tmp[100];
            MyOGL::Vector4f font_color;
            // get map field
            m_field=dungeon->GetMapFiled(m_map_tile_x, m_map_tile_y);
            // set panel width and height
            if(!m_field.viewed){
                SetDimension(200, 35); // for 2 strings
            }else{
                SetDimension(280, 180); // for full information
            }

            // display base class (panel border and background)
            CUIPanel::Render();
            // display field information
            font_color.r=0; font_color.g=1,font_color.b=0, font_color.a=1;
            sprintf(tmp,"Координаты: ^ffffff%d, %d", m_map_tile_x, m_map_tile_y);
            m_font->PrintAt(m_left_top.x+2,m_left_top.y+2,tmp,font_color);
            if(!m_field.viewed){ // unknown field
                sprintf(tmp,"Местность: ^ffffffНеизвестная");
                m_font->PrintAt(m_left_top.x+2,m_left_top.y+14,tmp,font_color);
            }else{
                sprintf(tmp,"Местность: ^ffffff%s",GetTileNameByType(m_field.tile_type));
                m_font->PrintAt(m_left_top.x+2,m_left_top.y+14,tmp,font_color);
                CFOV *fov=dungeon->GetFOV();
                sMapFovField *fov_field=fov->GetFovField(m_map_tile_x, m_map_tile_y);
                if(fov_field){
                    sprintf(tmp,"Интенсивность света: ^ffffff%d",fov_field->distance);
                    m_font->PrintAt(m_left_top.x+2, m_left_top.y+14+14,tmp,font_color);
                    m_font->PrintAt(m_left_top.x+2, m_left_top.y+14+14*2,"Вектор взгляда:",font_color);
                    font_color.Set(0,1,1,1);
                    sprintf(tmp,"north: ^ffffff%d",fov_field->north);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*3,tmp,font_color);
                    sprintf(tmp,"south: ^ffffff%d",fov_field->south);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*4,tmp,font_color);
                    sprintf(tmp,"east: ^ffffff%d",fov_field->east);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*5,tmp,font_color);
                    sprintf(tmp,"west: ^ffffff%d",fov_field->west);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*6,tmp,font_color);
                    sprintf(tmp,"north-east: ^ffffff%d",fov_field->north_east);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*7,tmp,font_color);
                    sprintf(tmp,"north-west: ^ffffff%d",fov_field->north_west);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*8,tmp,font_color);
                    sprintf(tmp,"south-east: ^ffffff%d",fov_field->south_east);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*9,tmp,font_color);
                    sprintf(tmp,"south-west: ^ffffff%d",fov_field->south_west);
                    m_font->PrintAt(m_left_top.x+22, m_left_top.y+14+14*10,tmp,font_color);
                }else{
                    m_font->PrintAt(m_left_top.x+2, m_left_top.y+14+14,"FOV field: ^ffffffNULL",font_color);
                }
            }
        };
void CClientPickup::Create ( void )
{
    if ( !m_pPickup )
    {
        // Create the pickup
        m_pPickup = g_pGame->GetPickups ()->CreatePickup ( &m_vecPosition, m_usModel, PICKUP_ONCE );
        m_pObject = NULL;
        if ( m_pPickup )
        {
            // Grab the attributes from the MTA interface for this pickup
            unsigned char ucAreaCode = GetInterior ();
            unsigned short usDimension = GetDimension ();

            // Make sure we have an object
            if ( !m_pPickup->GetObject () ) m_pPickup->GiveUsAPickUpObject ();

            // Store our pickup's object
            m_pObject = m_pPickup->GetObject ();

            // Create our collision
            m_pCollision = new CClientColSphere ( g_pClientGame->GetManager(), NULL, m_vecPosition, 1.0f );
            m_pCollision->m_pOwningPickup = this;
            m_pCollision->SetHitCallback ( this );

            // Increment pickup counter
            ++m_pPickupManager->m_uiPickupCount;

            // Restore the attributes
            SetInterior ( ucAreaCode );
            SetDimension ( usDimension );
        }
    }
}
Beispiel #4
0
Grid::Grid(GuiEngine* guiEngine)
	:Gui(guiEngine), dimension(0, 0)
{
	SetDimension(1, 1);
	StretchFitToContent();
	SetBgToColor(GetBgIdleColor());
}
	CentralDifferenceDerivativeKernel<T, U>::CentralDifferenceDerivativeKernel(bool iOrientY/*=false*/)
	{		
		unsigned int iDimension = 3;
		m_orientY = iOrientY;
		m_separable = false;
		SetDimension(iDimension);	
		Initialize_();
	}
	LaplacianKernel<T, U> &LaplacianKernel<T, U>::operator=(const LaplacianKernel<T, U> &iKernelObject) 
	{	
		unsigned int iDimension = iKernelObject.GetDimension();		
		if(SetDimension(iDimension)) {
			memcpy(m_buffer, iKernelObject.GetBuffer(), iDimension*sizeof(float));				
		}
		return *this;
	}
	LaplacianKernel<T, U>::LaplacianKernel()
	{		
		unsigned int iDimension = 3;
		
		m_separable = false;
		SetDimension(iDimension);	
		Initialize_();
	}
	CentralDifferenceDerivativeKernel<T, U> &CentralDifferenceDerivativeKernel<T, U>::operator=(const CentralDifferenceDerivativeKernel<T, U> &iKernelObject) 
	{	
		unsigned int iDimension = iKernelObject.GetDimension();		
		if(SetDimension(iDimension)) {
			memcpy(m_buffer, iKernelObject.GetBuffer(), iDimension*sizeof(float));				
		}
		return *this;
	}
DerivativeOfGaussianKernel<T, U> &DerivativeOfGaussianKernel<T, U>::operator=(const DerivativeOfGaussianKernel<T, U> &iKernelObject) 
{	
	unsigned int iDimension = iKernelObject.GetDimension();		
	if(SetDimension(iDimension)) 
	{
		memcpy(m_buffer, iKernelObject.GetBuffer(), iDimension*sizeof(T));		
		m_sigma = iKernelObject.GetSigma();
	}
	return *this;
}
Beispiel #10
0
OptionWindow::OptionWindow() : GUIWindow(),
	nextMode(OPTION_MODE_OPTION),
	current(NULL),
	option(NULL),
	video(NULL),
	audio(NULL)
{
	SetDimension(500, 550);
	SetModal(true);
}
Beispiel #11
0
IRenderable::IRenderable(const std::string& filePath, const glm::vec3& pos, const glm::vec2& size )
{
    m_asset = new ModelAsset();
    m_scale = glm::vec3(1,1,1);
    m_zdepth = pos.z;
    m_angle = 0.0f;
    SetPosition(pos);
    SetDimension(size);
    LoadTexture(filePath);
    SetTextureCoords(glm::vec2(1.0f, 1.0f));
    m_animate = false;
}
Beispiel #12
0
	ErosionKernel<T, U>::ErosionKernel(const int iRadius/*=1*/)
	{	
		m_radius = iRadius;
		m_separable = false;

		// compute default dimension
		unsigned int pDimension = 1+2*m_radius;	

		// set dimensions
		SetDimension(pDimension);	

		// initialize the buffer, fill kernel values
		Initialize_();
	}
DerivativeOfGaussianKernel<T, U>::DerivativeOfGaussianKernel(const double iSigma/*=1*/, const int iDimension/*=-1*/)
{	
	m_sigma = iSigma;
	m_separable = true;
	//m_kernelType = kPgKernelType1D;
	unsigned int pDimension = 1 + 2 * ceil(2.5f * m_sigma);	
	
	if (iDimension>=5)// && iDimension > pDimension)
	{
		pDimension = iDimension;
	}

	SetDimension(pDimension);	
	Initialize_();
}
EntityId CObjectManager::Create(DWORD dwModelHash, const CVector3& vecPosition, const CVector3& vecRotation)
{
	for(EntityId x = 0; x < MAX_OBJECTS; x++)
	{
		if(!m_bActive[x])
		{
			m_Objects[x].dwModelHash = dwModelHash;
			m_Objects[x].vecPosition = vecPosition;
			m_Objects[x].vecRotation = vecRotation;
			m_bActive[x] = true;
			m_Objects[x].iBone = -1;
			m_Objects[x].m_iInterior = -1;
			m_Objects[x].bAttached = false;

			CBitStream bsSend;
			bsSend.WriteCompressed(x);
			bsSend.Write(m_Objects[x].dwModelHash);
			bsSend.Write(m_Objects[x].vecPosition);
			bsSend.Write(m_Objects[x].vecRotation);
			bsSend.Write(m_Objects[x].m_iInterior);
			bsSend.Write(m_Objects[x].bAttached);
			bsSend.Write(m_Objects[x].bVehicleAttached);
			bsSend.Write(m_Objects[x].uiVehiclePlayerId);
			bsSend.Write(m_Objects[x].vecAttachPosition);
			bsSend.Write(m_Objects[x].vecAttachRotation);
				
			if(m_Objects[x].iBone == -1)
				bsSend.Write0();
			else
			{
				bsSend.Write1();
				bsSend.Write(m_Objects[x].iBone);
			}

			g_pNetworkManager->RPC(RPC_NewObject, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED, INVALID_ENTITY_ID, true);
			
			CSquirrelArguments pArguments;
			pArguments.push(x);
			g_pEvents->Call("objectCreate", &pArguments);

			SetDimension(x, this->GetDimension(x));	

			return x;
		}
	}
	return INVALID_ENTITY_ID;
}
void UserInterfaceComponent::Initialize()
{
    text_ = parentLayer_->createCaption(
        font_,
        textMargin_.x + topLeftOffset_.x,
        textMargin_.y + topLeftOffset_.y,
        "");

    rectangle_ = parentLayer_->createRectangle(
        topLeftPosition_ + topLeftOffset_, dimensions_);

    markupText_ = parentLayer_->createMarkupText(
        UserInterfaceComponent::SMALL,
        textMargin_.x + topLeftOffset_.x + markupTextLeftOffset,
        textMargin_.y + topLeftOffset_.y + markupTextTopOffset,
        "");

    SetBackgroundColor(Ogre::ColourValue(0, 0, 0, 0));
    SetDimension(Ogre::Vector2(100, 100));
}
	DiffOfGaussianKernel<T, U>::DiffOfGaussianKernel(const double iSigmaOuter/*=2*/, const double iSigmaInner/*=1*/, const int iDimension/*=-1*/)
	{	
		if (iSigmaInner>=iSigmaOuter)
			return;

		m_sigmaOuter = iSigmaOuter;
		m_sigmaInner = iSigmaInner;		
		
		m_separable = true;//false;
		//m_orientY = iOrientY;

		unsigned int pDimension = 1 + 2 * ceil(2.5f * m_sigmaOuter);	

		if (iDimension>=5)
		{
			pDimension = iDimension;
		}

		SetDimension(pDimension);	
		Initialize_();
	}
void CObjectManager::HandleClientJoin(EntityId playerId)
{
	if(GetObjectCount() > 0)
	{
		CBitStream bsSend;

		for(EntityId x = 0; x < MAX_OBJECTS; x++)
		{
			if(m_bActive[x])
			{
				bsSend.Reset();
				bsSend.WriteCompressed(x);
				bsSend.Write(m_Objects[x].dwModelHash);
				bsSend.Write(m_Objects[x].vecPosition);
				bsSend.Write(m_Objects[x].vecRotation);
				bsSend.Write(m_Objects[x].m_iInterior);
				bsSend.Write(m_Objects[x].bAttached);
				bsSend.Write(m_Objects[x].bVehicleAttached);
				bsSend.Write(m_Objects[x].uiVehiclePlayerId);
				bsSend.Write(m_Objects[x].vecAttachPosition);
				bsSend.Write(m_Objects[x].vecAttachRotation);
				
				if(m_Objects[x].iBone == -1)
					bsSend.Write0();
				else
				{
					bsSend.Write1();
					bsSend.Write(m_Objects[x].iBone);
				}

				g_pNetworkManager->RPC(RPC_NewObject, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED, playerId, false);
				SetDimension(x, this->GetDimension(x));
			}
		}
	}
}
void UserInterfaceComponent::SetWidth(const Ogre::Real width)
{
    SetDimension(Ogre::Vector2(width, dimensions_.y));
}
Beispiel #19
0
/** Constructor with the list of segments and the position of the first ref */
Graph::Graph(SegmentsGroup* _segmentsGroup, SpeakerMatch* _pSpeakerMatch, const int& _typeCost, const int& _costTrans, const int& _costIns, const int& _costOpt, const int& _costCorrectNonSpeaker, const int& _costAdaptive, const bool& _optRef, const bool& _optHyp, const bool& _bCompressedArray)
	: m_pSpeakerMatch(_pSpeakerMatch),
	m_typeCostModel(_typeCost),
	m_CostTransition(_costTrans),
	m_CostInsertion(_costIns),
	m_CostOptionally(_costOpt),
	m_CostCorrectNonSpeaker(_costCorrectNonSpeaker),
	m_CostAdaptive(_costAdaptive),
	m_useOptForRef(_optRef),
	m_useOptForHyp(_optHyp),
	m_bCompressedArray(_bCompressedArray)	
{
	m_HypRefStatus = (string("true").compare(Properties::GetProperty("align.genericmethod")) != 0);
	
//	m_NbThreads = static_cast<size_t>(atoi(Properties::GetProperty("threads.number").c_str()));
	
	if(m_typeCostModel == 2)
	{
		// Calculate the safe divider
		m_TimeBasedSafeDivider = min(min(min(m_CostTransition, m_CostInsertion), m_CostOptionally), m_CostCorrectNonSpeaker);
	}
	
	Token* curToken;
	size_t i, k, sizevector;
	
	SetDimension(_segmentsGroup->GetNumberOfReferences()+_segmentsGroup->GetNumberOfHypothesis());
	
	if(m_HypRefStatus)
		SetIndexRef(_segmentsGroup->GetNumberOfHypothesis());
	else
		SetIndexRef(0);
	
	m_TabDimensionDeep = new size_t[GetDimension()];
	m_TabVecHypRef = new vector<Token*>[GetDimension()];
	m_TabMapTokenIndex = new map<Token*, size_t>[GetDimension()];
	m_TabFirstTokens = new list<Token*>[GetDimension()];
	m_TabLastTokens = new list<Token*>[GetDimension()];
	   
	int minTimeSafeDividerToken = -1;
	
	// Planning each Segment and look for the last and first token
	for(i=0; i<GetDimension(); ++i)
	{
        vector<Segment*> temp_segs;
		
        if (i < _segmentsGroup->GetNumberOfHypothesis())
        {
            m_TabVecHypRef[i] = _segmentsGroup->ToTopologicalOrderedStructHyp(i);
            temp_segs = _segmentsGroup->GetHypothesis(i);
        }
        else
        {
            m_TabVecHypRef[i] = _segmentsGroup->ToTopologicalOrderedStructRef(i-_segmentsGroup->GetNumberOfHypothesis());
            temp_segs = _segmentsGroup->GetReference(i-_segmentsGroup->GetNumberOfHypothesis());
        }
		
		sizevector = m_TabVecHypRef[i].size();
		        				
		SetDimensionDeep(i, sizevector);
		
		for(k=0; k<sizevector; ++k)
		{
			curToken = m_TabVecHypRef[i][k];
			
			if(curToken != NULL)
			{
				if(m_typeCostModel == 2)
				{
					int TimeSafeDividerToken = curToken->TimeSafeDivider();
				
					if( (minTimeSafeDividerToken == -1) || (TimeSafeDividerToken < minTimeSafeDividerToken) )
						minTimeSafeDividerToken = TimeSafeDividerToken;
				}
				
				m_TabMapTokenIndex[i][curToken] = k;
				size_t prcs = 0;
				
				while( (prcs < (temp_segs.size()-1)) && (temp_segs[prcs]->isEmpty()) )
					++prcs;
				
				if(temp_segs[prcs]->isFirstToken(curToken))
                    m_TabFirstTokens[i].push_front(curToken);
				
				prcs = temp_segs.size()-1;
				
				while( (prcs > 0) && (temp_segs[prcs]->isEmpty()) )
					--prcs;
				
				if(temp_segs[prcs]->isLastToken(curToken))
                    m_TabLastTokens[i].push_front(curToken);
			}
		}
	}
	
	SetGraphOptimization();
	m_MaxDurationSegmentGroup = _segmentsGroup->GetTotalDuration();
	
	if(m_bCompressedArray)
	{
		LOG_DEBUG(logger, "Lenvenshtein Matrix Compression: ON");
		m_MapCost = new CompressedLevenshteinMatrix(GetDimension(), m_TabDimensionDeep);
	}
	else
	{
		LOG_DEBUG(logger, "Lenvenshtein Matrix Compression: OFF");
		m_MapCost = new ArrayLevenshteinMatrix(GetDimension(), m_TabDimensionDeep);
	}
	    
    // Creating cache container
    m_TabCacheDimPreviousIndex = new list<size_t>** [GetDimension()];
    
    for(i=0; i<GetDimension(); ++i)
    {
        m_TabCacheDimPreviousIndex[i] = new list<size_t>* [m_TabDimensionDeep[i]];
        
        for(k=0; k<m_TabDimensionDeep[i]; ++k)
            m_TabCacheDimPreviousIndex[i][k] = NULL;
    }
    
    if(m_typeCostModel == 2)
	{
		m_TimeBasedSafeDivider *= minTimeSafeDividerToken;
		char buffer [BUFFER_SIZE];
        sprintf(buffer, "Use Safe divider (%d)!", m_TimeBasedSafeDivider);
		LOG_DEBUG(logger, buffer);
	}
}
Beispiel #20
0
Rossler::Rossler() {
  SetDimension(3);
  SetNumberOfParameters(3);
  SetNumberOfEvents(GetDimension());
  xderiv = N_VNew_Serial(GetDimension());
}
void UserInterfaceComponent::SetHeight(const Ogre::Real height)
{
    SetDimension(Ogre::Vector2(dimensions_.x, height));
}