Exemplo n.º 1
0
def create_ros(faces):
  mesh = PolygonMesh()

  for face in faces:
    index = []
    for point in face:
      index.append(len(mesh.vertices))
      ros_point = Point()
      ros_point.x = point[0]
      ros_point.y = point[1]
      ros_point.z = point[2]
      mesh.vertices.append(ros_point)
    indices = PolygonIndices()
    indices.vertex_indices = index
    mesh.polygons.append(indices)
  return mesh
Exemplo n.º 2
0
def create_ros(faces):
    mesh = PolygonMesh()

    for face in faces:
        index = []
        for point in face:
            index.append(len(mesh.vertices))
            ros_point = Point()
            ros_point.x = point[0]
            ros_point.y = point[1]
            ros_point.z = point[2]
            mesh.vertices.append(ros_point)
        indices = PolygonIndices()
        indices.vertex_indices = index
        mesh.polygons.append(indices)
    return mesh
Exemplo n.º 3
0
def toPolygonMesh3D(geometry, is_text=False):
    if not is_text:
        geometry = db().execute(ST_AsText(geometry)).scalar()

    mesh = PolygonMesh()
    polygons = geometry.split(')),')
    for polygon in polygons:
        index = []
        points = polygon.strip('POLYHEDRALSURFACE Z(((').strip('))').split(',')
        for point in points[0:len(points) - 1]:
            values = [float(x) for x in point.split()]
            index.append(len(mesh.vertices))
            ros_point = Point()
            ros_point.x = values[0]
            ros_point.y = values[1]
            ros_point.z = values[2]
            mesh.vertices.append(ros_point)

        indices = PolygonIndices()
        indices.vertex_indices = index
        mesh.polygons.append(indices)

    return mesh
Exemplo n.º 4
0
def toPolygonMesh3D(geometry, is_text = False):
  if not is_text:
    geometry = db().execute(ST_AsText(geometry)).scalar()

  mesh = PolygonMesh()
  polygons = geometry.split(')),')
  for polygon in polygons:
    index = []
    points = polygon.strip('POLYHEDRALSURFACE Z(((').strip('))').split(',')
    for point in points[0:len(points)-1]:
      values = [float(x) for x in point.split()]
      index.append(len(mesh.vertices))
      ros_point = Point()
      ros_point.x = values[0]
      ros_point.y = values[1]
      ros_point.z = values[2]
      mesh.vertices.append(ros_point)

    indices = PolygonIndices()
    indices.vertex_indices = index
    mesh.polygons.append(indices)

  return mesh