inline void RaggedTable<MAP_TYPE,SET_TYPE>::addDiagonals(int numIndices,
                                                const int* indices)
{
  for(int i=0; i<numIndices; ++i) {
    int ind = indices[i];
    addIndices(ind, 1, &ind);
  }
}
Пример #2
0
 pcl::PointIndices::Ptr addIndices(const pcl::PointIndices& a,
                                   const pcl::PointIndices& b)
 {
   std::vector<int> indices = addIndices(a.indices, b.indices);
   pcl::PointIndices::Ptr ret(new pcl::PointIndices);
   ret->indices = indices;
   return ret;
 }
void RaggedTable<MapContig<fei::ctg_set<int>*>,fei::ctg_set<int> >::addDiagonals(int numIndices,
                                                         const int* indices)
{
  for(int i=0; i<numIndices; ++i) {
    int ind = indices[i];
    addIndices(ind, 1, &ind);
  }
}
void HtmlHeaderMetadataItemVisitor::visitTable(Table& /*table*/)
{
    emptyTitles();
    addSummary();
    addConstraints();
    addIndices();
    addTriggers();
    addPrivileges();
    addDependencies();
    addDDL();
}
Пример #5
0
ofxMesh &ofxMesh::addMesh(ofMesh b) {

    int numVertices = getNumVertices();
    int numIndices = getNumIndices();

    //add b
    addVertices(b.getVertices());
    addNormals(b.getNormals());
    addIndices(b.getIndices());

    //shift indices for b
    for (int i=0; i<b.getNumIndices(); i++) {
        getIndices()[numIndices+i] += numVertices;
    }

    return *this;
}
Пример #6
0
Mesh::Mesh(const vector<vec3>& vertices, const vector<GLuint>& indices){
    attributes.clear();
    this->modelMatrix = mat4x4();
    
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);
    
    Attribute vertexAttrib;
    
    addVBO(vertices, vertexAttrib);

    addIndices(indices);

    

    glBindVertexArray(0);
    
}
Пример #7
0
std::shared_ptr<Mesh> Mandelbrot::getMesh()
{
	auto mesh = std::make_shared<Mesh>();

	std::cout << "Assembling Mandelbrot (" << (RESOLUTION * RESOLUTION) << "), making: ";

	std::cout << "vertices... ";
	addVertices(mesh);

	std::cout << "triangles... ";
	addIndices(mesh);

	std::cout << "normals... ";
	mesh->calcNormalsMWE();

	std::cout << "done" << std::endl;
	return mesh;
}
Пример #8
0
void Vbo::addIndex(GLushort* _index) {
    addIndices(_index, 1);
}
Пример #9
0
Mesh::Mesh(const Pie3Level& p3)
{
    std::vector<Pie3Polygon>::const_iterator itL;

    typedef std::set<WZMPoint, compareWZMPoint_less_wEps> t_tupleSet;
    t_tupleSet tupleSet;
    std::pair<t_tupleSet::iterator, bool> inResult;

    std::vector<unsigned> mapping;
    std::vector<unsigned>::iterator itMap;

    IndexedTri iTri;
    WZMVertex tmpNrm;

    defaultConstructor();

    /*
     *	Try to prevent duplicate vertices
     *	(remember, different UV's, or animations,
     *	 will cause unavoidable duplication)
     *	so that our transformed vertex cache isn't
     *	completely useless.
     */

    // For each pie3 polygon
    for (itL = p3.m_polygons.begin(); itL != p3.m_polygons.end(); ++itL)
    {
        // pie2 integer-type problem?
        if (itL->getIndex(0) == itL->getIndex(1) || itL->getIndex(1) == itL->getIndex(2) || itL->getIndex(0) == itL->getIndex(2))
        {
            continue;
        }
        if (itL->m_texCoords[0] == itL->m_texCoords[1] || itL->m_texCoords[1] == itL->m_texCoords[2] || itL->m_texCoords[0] == itL->m_texCoords[2])
        {
            continue;
        }

        tmpNrm = normalizeVector(WZMVertex(WZMVertex(p3.m_points[itL->getIndex(1)]) - WZMVertex(p3.m_points[itL->getIndex(0)]))
                                 .crossProduct(WZMVertex(p3.m_points[itL->getIndex(2)]) - WZMVertex(p3.m_points[itL->getIndex(0)])));;

        // For all 3 vertices of the triangle
        for (int i = 0; i < 3; ++i)
        {
            inResult = tupleSet.insert(WZMPoint(p3.m_points[itL->getIndex(i)], itL->getUV(i, 0), tmpNrm));

            if (!inResult.second)
            {
                iTri.operator[](i) = mapping[std::distance(tupleSet.begin(), inResult.first)];
            }
            else
            {
                itMap = mapping.begin();
                std::advance(itMap, std::distance(tupleSet.begin(), inResult.first));
                mapping.insert(itMap, vertices());
                iTri.operator[](i) = vertices();
                addPoint(*inResult.first);
            }
        }
        addIndices(iTri);
    }

    std::list<Pie3Connector>::const_iterator itC;

    // For each pie3 connector
    for (itC = p3.m_connectors.begin(); itC != p3.m_connectors.end(); ++itC)
    {
        addConnector(WZMConnector(itC->pos.operator[](0),
                                  itC->pos.operator[](1),
                                  itC->pos.operator[](2)));
    }

    finishImport();
    recalculateBoundData();
}
Пример #10
0
filename_t* filename_t::concat (filename_t* other) {
  ___CBTPUSH;

  char* name;
  int* indices;
  filename_t* result;

  if (other->isAbsolute ()) {

    result = NULL;

  } else if (other->isReflexive ()) {

    result = this;
    reserve ();

  } else if (isReflexive ()) {

    result = other;
    other->reserve ();

  } else if (other->m_parentDirs == 0) {

    const int otherLen = other->m_indices[other->m_indexCount - 1];
    if (isRoot ()) {
      allocateNameAndIndices (&name, 1 + otherLen, &indices, other->m_indexCount);
      memcpy (mempcpy (name, "/", 1), other->m_name, otherLen + 1);
      addIndices (indices, other->m_indices, other->m_indexCount, 1);
      result = new filename_t (name, indices, other->m_indexCount, m_parentDirs);
    } else {
      const int thisLen = m_indices[m_indexCount - 1];
      allocateNameAndIndices (&name, thisLen + otherLen + 1, &indices, m_indexCount + other->m_indexCount);
      memcpy (mempcpy (mempcpy (name, m_name, thisLen), "/", 1), other->m_name, otherLen + 1);
      memcpy (indices, m_indices, sizeof (int) * m_indexCount);
      addIndices (indices + m_indexCount, other->m_indices, other->m_indexCount, thisLen + 1);
      result = new filename_t (name, indices, m_indexCount + other->m_indexCount, m_parentDirs);
    }

  } else if (m_indexCount - (m_parentDirs != 0) > other->m_parentDirs) {

    const int otherIndexCount = other->m_indexCount - 1;
    const int thisIndexCount = m_indexCount - other->m_parentDirs;
    const int thisLen = m_indices[thisIndexCount - 1];
    const int otherLen = other->m_indices[otherIndexCount] - other->m_indices[0];
    allocateNameAndIndices (&name, thisLen + otherLen, &indices, thisIndexCount + otherIndexCount);
    memcpy (mempcpy (name, m_name, thisLen), other->m_name + other->m_indices[0], otherLen + 1);
    memcpy (indices, m_indices, sizeof (int) * thisIndexCount);
    addIndices (indices + thisIndexCount, other->m_indices + 1, otherIndexCount, thisLen - other->m_indices[0]);
    result = new filename_t (name, indices, thisIndexCount + otherIndexCount, m_parentDirs);

  } else if (isAbsolute ()) {

    if (other->m_indexCount > 1) {
      const int otherIndexCount = other->m_indexCount - 1;
      const int otherLen = other->m_indices[otherIndexCount] - other->m_indices[0];
      allocateNameAndIndices (&name, otherLen, &indices, otherIndexCount);
      memcpy (name, other->m_name + other->m_indices[0], otherLen + 1);
      addIndices (indices, other->m_indices + 1, otherIndexCount, -other->m_indices[0]);
      result = new filename_t (name, indices, otherIndexCount, 0);
    } else {
      allocateNameAndIndices (&name, 1, &indices, 1);
      memcpy (name, "/", 2);
      indices[0] = 1;
      result = new filename_t (name, indices, 1, 0);
    }

  } else if (m_parentDirs == 0) {

    const int parentDirs = other->m_parentDirs - m_indexCount;
    if (parentDirs > 0 || other->m_indexCount > 1) {
      const int indexCount = other->m_indexCount - (parentDirs == 0);
      const int nameOffset = other->m_indices[0] + 1 - 3 * parentDirs;
      const int nameLen = other->m_indices[other->m_indexCount - 1] - nameOffset;
      allocateNameAndIndices (&name, nameLen, &indices, indexCount);
      memcpy (name, other->m_name + nameOffset, nameLen + 1);
      addIndices (indices, other->m_indices + (parentDirs == 0), indexCount, -nameOffset);
      result = new filename_t (name, indices, indexCount, parentDirs);
    } else {
      allocateNameAndIndices (&name, 1, &indices, 1);
      memcpy (name, ".", 2);
      indices[0] = 1;
      result = new filename_t (name, indices, 1, 0);
    }

  } else {

    const int extraParentDirs = other->m_parentDirs - m_indexCount + 1;
    if (extraParentDirs > 0 || other->m_indexCount > 1) {
      const int indexCount = other->m_indexCount;
      const int nameOffset = other->m_indices[0] + 1 - 3 * extraParentDirs;
      const int nameLen = other->m_indices[other->m_indexCount - 1] - nameOffset;
      allocateNameAndIndices (&name, nameLen + 3 * m_parentDirs, &indices, indexCount);
      memcpy (mempcpy (name, m_name, 3 * m_parentDirs), other->m_name + nameOffset, nameLen + 1);
      name[3 * m_parentDirs - 1] = '/';
      addIndices (indices, other->m_indices, indexCount, 3 * m_parentDirs - nameOffset);
      result = new filename_t (name, indices, indexCount, m_parentDirs + extraParentDirs);
    } else {
      allocateNameAndIndices (&name, 3 * m_parentDirs - 1, &indices, 1);
      mempcpy (name, m_name, 3 * m_parentDirs - 1);
      indices[0] = 3 * m_parentDirs - 1;
      name[3 * m_parentDirs - 1] = 0;
      result = new filename_t (name, indices, 1, m_parentDirs);
    }

  }

  ___CBTPOP;
  return result;
}
Пример #11
0
void Vbo::addIndex(INDEX_TYPE_GL* _index) {
    addIndices(_index, 1);
}