Example #1
0
        VertexHandle addVertex(Vector3 const & pos)
        {
          VertexHandle ref = builder->add_vertex(typename Mesh::Point_3(pos.x(), pos.y(), pos.z()));
          if (builder->error()) throw Error("IncrementalCGALMeshBuilder: Error adding vertex");

          vertex_indices->insert(typename VertexIndexMap::value_type(&(*ref), next_index));
          next_index++;
          return ref;
        }
Example #2
0
        template <typename VertexInputIterator> FaceHandle addFace(VertexInputIterator begin, VertexInputIterator end)
        {
          FaceHandle ref = builder->begin_facet();

          for (VertexInputIterator vi = begin; vi != end; ++vi)
          {
            typename VertexIndexMap::const_iterator existing = vertex_indices->find(&(**vi));
            if (existing != vertex_indices->end())
              builder->add_vertex_to_facet(existing->second);
            else
              throw Error("IncrementalCGALMeshBuilder: Vertex reference cannot be mapped to a known index");
          }

          builder->end_facet();
          if (builder->error()) throw Error("IncrementalCGALMeshBuilder: Error adding vertex");

          return ref;
        }