Tesseract 0.28.4
Loading...
Searching...
No Matches
ply_io.cpp File Reference

Writing ply files. More...

#include <tesseract/common/ply_io.h>
#include <tesseract/common/utils.h>
#include <console_bridge/console.h>
#include <boost/algorithm/string.hpp>
#include <fstream>
#include <iostream>
#include <iomanip>

Functions

bool tesseract::common::writeSimplePlyFile (const std::string &path, const tesseract::common::VectorVector3d &vertices, const std::vector< Eigen::Vector3i > &vectices_color, const Eigen::VectorXi &faces, int num_faces)
 Write a simple ply file given vertices and faces.
 
bool tesseract::common::writeSimplePlyFile (const std::string &path, const tesseract::common::VectorVector3d &vertices, const Eigen::VectorXi &faces, int num_faces)
 Write a simple ply file given vertices and faces.
 
int tesseract::common::loadSimplePlyFile (const std::string &path, tesseract::common::VectorVector3d &vertices, Eigen::VectorXi &faces, bool triangles_only=false)
 Loads a simple ply file given a path.
 

Detailed Description

Writing ply files.

Author
Levi Armstrong
Date
Dec 18, 2017
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ writeSimplePlyFile() [1/2]

bool tesseract::common::writeSimplePlyFile ( const std::string &  path,
const tesseract::common::VectorVector3d &  vertices,
const std::vector< Eigen::Vector3i > &  vectices_color,
const Eigen::VectorXi &  faces,
int  num_faces 
)

Write a simple ply file given vertices and faces.

Parameters
pathThe file path
verticesA vector of vertices
vertices_colorThe vertices color (0-255,0-255,0-255), if empty uses a default color
facesThe first values indicates the number of vertices that define the face followed by the vertice index
num_facesThe number of faces
Returns
False if failed to write file, otherwise true

◆ writeSimplePlyFile() [2/2]

bool tesseract::common::writeSimplePlyFile ( const std::string &  path,
const tesseract::common::VectorVector3d &  vertices,
const Eigen::VectorXi &  faces,
int  num_faces 
)

Write a simple ply file given vertices and faces.

Parameters
pathThe file path
verticesA vector of vertices
facesThe first values indicates the number of vertices that define the face followed by the vertice index
num_facesThe number of faces
Returns
False if failed to write file, otherwise true

◆ loadSimplePlyFile()

int tesseract::common::loadSimplePlyFile ( const std::string &  path,
tesseract::common::VectorVector3d &  vertices,
Eigen::VectorXi &  faces,
bool  triangles_only = false 
)

Loads a simple ply file given a path.

Parameters
pathThe file path
verticesA vector of vertices
facesThe first values indicates the number of vertices that define the face followed by the vertice index
triangles_onlyConvert to only include triangles
Returns
Number of faces, If returned 0 it failed to load.