Beispiel #1
0
// -------------------------------------------------------------------------------
// CREATEROOTTRIXEL
trixel* CreateRootTrixel(std::string HTMId)
{
    trixel* trixel = new struct trixel();
    InitTrixel(trixel);
    trixel->_HTMId = HTMId;
    return trixel;
}
Beispiel #2
0
// -------------------------------------------------------------------------------
// CREATEROOTTRIXEL
trixel_t* ICoDF_HTM::CreateRootTrixel(std::string HTMId)
{
	trixel_t* trixel = new trixel_t();
	InitTrixel(trixel);
	trixel->_HTMId = HTMId;
	return trixel;
}
Beispiel #3
0
// -------------------------------------------------------------------------------
// CREATETRIXELCHILD
// Check if trixel children structure already exists
// Assert for given <index>
// Check if select child does not exist
//   Create new vertices on side midpoints
//   Set vertices that defines the new subtrixel
// else display a message
// return the pointer
trixel* CreateTrixelChild(trixel* parent, unsigned short int& index)
{
    if (parent->_children == NULL)
    {
        llog::debug["ICoDF::CreateTrixelChild"]
            <<  "Trixel has no container for children" << std::endl;
        CreateTrixelChildren(parent);
    }

    assert(index < 4);

    if (parent->_children[index] == NULL)
    {
        parent->_children[index] = new trixel();
        InitTrixel(parent->_children[index]);
        parent->_children[index]->_HTMId = parent->_HTMId + std::to_string(index);
        Eigen::Vector3d* midPoints = ComputeTrixelMidpoints(parent);

        switch (index)
        {
            case 0:
                parent->_children[index]->_vertices[0] = parent->_vertices[0];
                parent->_children[index]->_vertices[1] = midPoints[2];
                parent->_children[index]->_vertices[2] = midPoints[1];
                break;
            case 1:
                parent->_children[index]->_vertices[0] = parent->_vertices[1];
                parent->_children[index]->_vertices[1] = midPoints[0];
                parent->_children[index]->_vertices[2] = midPoints[2];
                break;
            case 2:
                parent->_children[index]->_vertices[0] = parent->_vertices[2];
                parent->_children[index]->_vertices[1] = midPoints[1];
                parent->_children[index]->_vertices[2] = midPoints[0];
                break;
            case 3:
                parent->_children[index]->_vertices[0] = midPoints[0];
                parent->_children[index]->_vertices[1] = midPoints[1];
                parent->_children[index]->_vertices[2] = midPoints[2];
                break;
            default:
                llog::warn["ICoDF::CreateTrixelChild"]
                    << "Given <index> is out of bound" << std::endl;
                delete [] midPoints; 
                return NULL;
        }
        delete [] midPoints; 
    }
    else
    {
        llog::warn["ICoDF::CreateTrixelChild"]
            << "SubTrixel [" << parent->_HTMId << index << "] already exists"
            << std::endl;
    }

    return parent->_children[index];
}
Beispiel #4
0
// -------------------------------------------------------------------------------
// CREATETRIXELCHILD
// Check if trixel children structure already exists
// Assert for given <index>
// Check if select child does not exist
//   Create new vertices on side midpoints
//   Set vertices that defines the new subtrixel
// else display a message
// return the pointer
trixel_t* ICoDF_HTM::CreateTrixelChild(trixel_t* parent, unsigned short int& index)
{
	if (parent->_children == NULL)
    {
		LS_ADDMSG(LogService::NOTICE, "ICoDF::CreateTrixelChild", "Trixel as no container for children");
		CreateTrixelChildren(parent);
    }
	
	assert(index < 4);
	
	if (parent->_children[index] == NULL)
    {
		std::stringstream tmp;
		parent->_children[index] = new trixel_t();
		InitTrixel(parent->_children[index]);
		tmp.str("");
		tmp << parent->_HTMId << index;
		parent->_children[index]->_HTMId = tmp.str();
        Vector3d midPoints[3];
		ComputeTrixelMidpoints(parent, midPoints);
		
		switch (index)
		{
			case 0:
				parent->_children[index]->_vertices[0] = parent->_vertices[0];
				parent->_children[index]->_vertices[1] = midPoints[2];
				parent->_children[index]->_vertices[2] = midPoints[1];
				break;
			case 1:
				parent->_children[index]->_vertices[0] = parent->_vertices[1];
				parent->_children[index]->_vertices[1] = midPoints[0];
				parent->_children[index]->_vertices[2] = midPoints[2];
				break;
			case 2:
				parent->_children[index]->_vertices[0] = parent->_vertices[2];
				parent->_children[index]->_vertices[1] = midPoints[1];
				parent->_children[index]->_vertices[2] = midPoints[0];
				break;
			case 3:
				parent->_children[index]->_vertices[0] = midPoints[0];
				parent->_children[index]->_vertices[1] = midPoints[1];
				parent->_children[index]->_vertices[2] = midPoints[2];
				break;
			default:
				LS_ADDMSG(LogService::FATAL, "ICoDF::CreateTrixelChild", "Given <index> is out of bound");
				return NULL;
		}
    }
	else
    {
		std::stringstream tmp;
		tmp << "SubTrixel [" << parent->_HTMId << index << "] already exists";
		LS_ADDMSG(LogService::NOTICE, "ICoDF::CreateTrixelChild", tmp.str());
    }
	
	return parent->_children[index];
}