ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
SurfaceTrimmer.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <algorithm>
#include "CmdLineParser.h"
#include "Geometry.h"
#include "Ply.h"
#include "MAT.h"
#include "MyTime.h"
Include dependency graph for SurfaceTrimmer.cpp:

Go to the source code of this file.

Functions

void ShowUsage (char *ex)
 
long long EdgeKey (int key1, int key2)
 
template<class Real , class Vertex >
Vertex InterpolateVertices (const Vertex &v1, const Vertex &v2, Real value)
 
template<class Real , class Vertex >
void SmoothValues (std::vector< Vertex > &vertices, const std::vector< std::vector< int > > &polygons)
 
template<class Real , class Vertex >
void SplitPolygon (const std::vector< int > &polygon, std::vector< Vertex > &vertices, std::vector< std::vector< int > > *ltPolygons, std::vector< std::vector< int > > *gtPolygons, std::vector< bool > *ltFlags, std::vector< bool > *gtFlags, std::unordered_map< long long, int > &vertexTable, Real trimValue)
 
template<class Real , class Vertex >
void Triangulate (const std::vector< Vertex > &vertices, const std::vector< std::vector< int > > &polygons, std::vector< std::vector< int > > &triangles)
 
template<class Real , class Vertex >
double PolygonArea (const std::vector< Vertex > &vertices, const std::vector< int > &polygon)
 
template<class Vertex >
void RemoveHangingVertices (std::vector< Vertex > &vertices, std::vector< std::vector< int > > &polygons)
 
void SetConnectedComponents (const std::vector< std::vector< int > > &polygons, std::vector< std::vector< int > > &components)
 
template<class Real >
Point3D< Real > CrossProduct (Point3D< Real > p1, Point3D< Real > p2)
 
template<class Real >
double TriangleArea (Point3D< Real > v1, Point3D< Real > v2, Point3D< Real > v3)
 
template<class Vertex >
int Execute (void)
 
int SurfaceTrimmer (int argc, char *argv[])
 

Variables

cmdLineString In ("in")
 
cmdLineString Out ("out")
 
cmdLineInt Smooth ("smooth", 5)
 
cmdLineFloat Trim ("trim")
 
cmdLineFloat IslandAreaRatio ("aRatio", 0.001f)
 
cmdLineReadable PolygonMesh ("polygonMesh")
 
cmdLineReadableparams []
 

Function Documentation

◆ CrossProduct()

template<class Real >
Point3D< Real > CrossProduct ( Point3D< Real >  p1,
Point3D< Real >  p2 
)
inline

Definition at line 266 of file SurfaceTrimmer.cpp.

Referenced by TriangleArea().

◆ EdgeKey()

long long EdgeKey ( int  key1,
int  key2 
)

Definition at line 63 of file SurfaceTrimmer.cpp.

Referenced by SetConnectedComponents(), and SplitPolygon().

◆ Execute()

◆ InterpolateVertices()

template<class Real , class Vertex >
Vertex InterpolateVertices ( const Vertex v1,
const Vertex v2,
Real  value 
)

Definition at line 70 of file SurfaceTrimmer.cpp.

Referenced by SplitPolygon().

◆ PolygonArea()

template<class Real , class Vertex >
double PolygonArea ( const std::vector< Vertex > &  vertices,
const std::vector< int > &  polygon 
)

Definition at line 189 of file SurfaceTrimmer.cpp.

References TriangleArea().

◆ RemoveHangingVertices()

template<class Vertex >
void RemoveHangingVertices ( std::vector< Vertex > &  vertices,
std::vector< std::vector< int > > &  polygons 
)

Definition at line 205 of file SurfaceTrimmer.cpp.

Referenced by Execute().

◆ SetConnectedComponents()

void SetConnectedComponents ( const std::vector< std::vector< int > > &  polygons,
std::vector< std::vector< int > > &  components 
)

Definition at line 218 of file SurfaceTrimmer.cpp.

References EdgeKey(), and size.

Referenced by Execute().

◆ ShowUsage()

void ShowUsage ( char *  ex)

◆ SmoothValues()

template<class Real , class Vertex >
void SmoothValues ( std::vector< Vertex > &  vertices,
const std::vector< std::vector< int > > &  polygons 
)

Definition at line 79 of file SurfaceTrimmer.cpp.

References count, and size.

◆ SplitPolygon()

template<class Real , class Vertex >
void SplitPolygon ( const std::vector< int > &  polygon,
std::vector< Vertex > &  vertices,
std::vector< std::vector< int > > *  ltPolygons,
std::vector< std::vector< int > > *  gtPolygons,
std::vector< bool > *  ltFlags,
std::vector< bool > *  gtFlags,
std::unordered_map< long long, int > &  vertexTable,
Real  trimValue 
)

Definition at line 97 of file SurfaceTrimmer.cpp.

References EdgeKey(), and InterpolateVertices().

Referenced by Execute().

◆ SurfaceTrimmer()

int SurfaceTrimmer ( int  argc,
char *  argv[] 
)

◆ TriangleArea()

template<class Real >
double TriangleArea ( Point3D< Real >  v1,
Point3D< Real >  v2,
Point3D< Real >  v3 
)

Definition at line 268 of file SurfaceTrimmer.cpp.

References CrossProduct().

Referenced by PolygonArea().

◆ Triangulate()

template<class Real , class Vertex >
void Triangulate ( const std::vector< Vertex > &  vertices,
const std::vector< std::vector< int > > &  polygons,
std::vector< std::vector< int > > &  triangles 
)

Definition at line 165 of file SurfaceTrimmer.cpp.

References size.

Variable Documentation

◆ In

cmdLineString In("in") ( "in"  )

Referenced by Execute(), ShowUsage(), and SurfaceTrimmer().

◆ IslandAreaRatio

cmdLineFloat IslandAreaRatio("aRatio", 0.001f) ( "aRatio"  ,
0.  001f 
)

Referenced by Execute(), and ShowUsage().

◆ Out

cmdLineString Out("out") ( "out"  )

Referenced by Execute(), and ShowUsage().

◆ params

cmdLineReadable* params[]
Initial value:
=
{
}
cmdLineFloat IslandAreaRatio("aRatio", 0.001f)
cmdLineString Out("out")
cmdLineString In("in")
cmdLineFloat Trim("trim")
cmdLineInt Smooth("smooth", 5)
cmdLineReadable PolygonMesh("polygonMesh")

Definition at line 47 of file SurfaceTrimmer.cpp.

Referenced by __flann_build_index(), __flann_compute_cluster_centers(), __flann_find_nearest_neighbors(), FastGlobalRegistrationDialog::autoEstimateRadius(), flann::AutotunedIndex< Distance >::AutotunedIndex(), DistanceMapGenerationDlg::baseRadiusChanged(), cloudViewer::visualization::gui::UIImage::CalcDrawParams(), ccVolumeCalcTool::ccVolumeCalcTool(), qCanupoProcess::Classify(), ComparePointsAndTriangles(), flann::CompositeIndex< Distance >::CompositeIndex(), cloudViewer::DistanceComputationTools::computeCellHausdorffDistance(), cloudViewer::DistanceComputationTools::computeCellHausdorffDistanceWithLocalModel(), cloudViewer::DistanceComputationTools::computeCloud2CloudDistances(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistances(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistancesWithOctree(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistanceWithOctree(), cloudViewer::t::geometry::PointCloud::ComputeMetrics(), cloudViewer::t::geometry::TriangleMesh::ComputeMetrics(), cloudViewer::t::geometry::ComputeMetricsCommon(), ComputeNeighborhood2MeshDistancesWithOctree(), cloudViewer::DistanceComputationTools::computePoint2MeshDistancesWithOctree(), DimensionalityScaleParamsComputer::computeScaleParams(), qCanupo2DViewDialog::computeStatistics(), cc2Point5DimEditor::create2DView(), flann::create_index_(), flann::create_index_by_type(), create_parameters(), create_search_params(), ccCropTool::Crop(), DecodeSensor(), cloudViewer::DistanceComputationTools::diff(), DistanceMapGenerationDlg::DistanceMapGenerationDlg(), qRansacSD::doAction(), qCanupoPlugin::doClassifyAction(), ccMouseCircle::draw(), cloudViewer::visualization::gui::Button::Draw(), cloudViewer::visualization::gui::ImageWidget::Draw(), qCanupoTools::EvaluateClassifier(), JsonRPCPlugin::execute(), Execute(), qFacets::exportFacets(), DistanceMapGenerationDlg::exportProfilesAsDXF(), ExtractMesh(), cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACRegularizerTerm(), ccPropertiesTreeDelegate::fillWithCameraSensor(), ccRasterizeTool::generateContours(), flann::get_param(), qHoughNormalsDialog::getParameters(), cloudViewer::DgmOctree::getPointsInBoxNeighbourhood(), cloudViewer::DgmOctree::getPointsInCylindricalNeighbourhood(), cloudViewer::DgmOctree::getPointsInCylindricalNeighbourhoodProgressive(), qM3C2Tools::GuessBestParams(), qM3C2Dialog::guessParams(), flann::has_param(), flann::hierarchicalClustering(), ccRegistrationTools::ICP(), flann::Index< Distance >::Index(), flann::mpi::Index< Distance >::Index(), ccContourExtractorDlg::init(), ccEntityAction::interpolateSFs(), flann::KDTreeCuda3dIndex< Distance >::KDTreeCuda3dIndex(), flann::KDTreeSingleIndex< Distance >::KDTreeSingleIndex(), flann::KMeansIndex< Distance >::KMeansIndex(), KNNRegions(), flann::mpi::Client::knnSearch(), flann::mpi::Index< Distance >::knnSearch(), flann::KDTreeCuda3dIndex< Distance >::knnSearch(), flann::AutotunedIndex< Distance >::knnSearch(), flann::LshIndex< Distance >::knnSearch(), flann::NNIndex< Distance >::knnSearch(), flann::Index< Distance >::knnSearch(), flann::KDTreeCuda3dIndex< Distance >::knnSearchGpu(), DistanceMapGenerationDlg::labelFontSizeChanged(), DistanceMapGenerationDlg::labelPrecisionChanged(), IcmFilter::LoadCalibratedImages(), PhotoScanFilter::loadFile(), LoadImage(), flann::AutotunedIndex< Distance >::loadIndex(), q3DMASCPlugin::loadTrainParameters(), MainWindow::onItemPicked(), PoissonRecon(), cloudViewer::t::pipelines::slac::PreprocessPointClouds(), flann::print_params(), CommandCPS::process(), CommandCanupoClassif::process(), CommandRANSAC::process(), cloudViewer::t::pipelines::slac::pybind_slac(), flann::mpi::Index< Distance >::radiusSearch(), flann::KDTreeCuda3dIndex< Distance >::radiusSearch(), flann::AutotunedIndex< Distance >::radiusSearch(), flann::NNIndex< Distance >::radiusSearch(), flann::Index< Distance >::radiusSearch(), cloudViewer::io::ReadModelUsingAssimp(), cloudViewer::t::io::ReadPCDData(), cloudViewer::io::ReadPointCloud(), cloudViewer::t::io::ReadPointCloud(), cloudViewer::io::ReadPointCloudFromPCD(), cloudViewer::t::io::ReadPointCloudFromPCD(), cloudViewer::io::ReadPointCloudFromPLY(), cloudViewer::t::io::ReadPointCloudFromPLY(), cloudViewer::io::ReadPointCloudFromPTS(), cloudViewer::t::io::ReadPointCloudFromPTS(), cloudViewer::t::io::ReadPointCloudFromSPLAT(), cloudViewer::t::io::ReadPointCloudFromTXT(), cloudViewer::io::ReadPointCloudFromXYZ(), cloudViewer::t::io::ReadPointCloudFromXYZI(), cloudViewer::io::ReadPointCloudFromXYZN(), cloudViewer::io::ReadPointCloudFromXYZRGB(), cloudViewer::io::ReadPointCloudInMemoryFromXYZ(), cloudViewer::io::ReadTriangleMesh(), cloudViewer::t::io::ReadTriangleMesh(), cloudViewer::io::ReadTriangleMeshFromPLY(), cloudViewer::io::ReadTriangleMeshUsingASSIMP(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), cloudViewer::io::ReadTriangleModel(), PoissonReconLib::Reconstruct(), cloudViewer::ICPRegistrationTools::Register(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleHybrid(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleIntensity(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScalePointToPlane(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), cloudViewer::t::pipelines::slac::SaveCorrespondencesForPointClouds(), DxfProfilesExporter::SaveHorizontalProfiles(), ccCompassExport::saveSVG(), LasIOFilter::saveToFile(), q3DMASCPlugin::saveTrainParameters(), DxfProfilesExporter::SaveVerticalProfiles(), flann::mpi::Server< Distance >::Server(), cloudViewer::ModelViewerWidget::SetBackgroundColor(), ccEntityAction::setColor(), ccVolumeCalcTool::setDisplayedNumberPrecision(), ccCameraSensor::setDistortionParameters(), ccPropertiesTreeDelegate::setEditorData(), cc2DViewportObject::setParameters(), qHoughNormalsDialog::setParameters(), ecvFilterTool::stop(), SurfaceTrimmer(), masc::Classifier::train(), cc2Point5DimEditor::update2DDisplayZoom(), update_flann_parameters(), DistanceMapGenerationDlg::updateZoom(), cloudViewer::t::io::WritePCDData(), cloudViewer::io::WritePointCloud(), cloudViewer::t::io::WritePointCloud(), cloudViewer::io::WritePointCloudInMemoryToXYZ(), cloudViewer::t::io::WritePointCloudToNPZ(), cloudViewer::io::WritePointCloudToPCD(), cloudViewer::t::io::WritePointCloudToPCD(), cloudViewer::io::WritePointCloudToPLY(), cloudViewer::t::io::WritePointCloudToPLY(), cloudViewer::io::WritePointCloudToPTS(), cloudViewer::t::io::WritePointCloudToPTS(), cloudViewer::t::io::WritePointCloudToSPLAT(), cloudViewer::t::io::WritePointCloudToTXT(), cloudViewer::io::WritePointCloudToXYZ(), cloudViewer::t::io::WritePointCloudToXYZI(), cloudViewer::io::WritePointCloudToXYZN(), and cloudViewer::io::WritePointCloudToXYZRGB().

◆ PolygonMesh

cmdLineReadable PolygonMesh("polygonMesh") ( "polygonMesh"  )

Referenced by Execute(), and ShowUsage().

◆ Smooth

cmdLineInt Smooth("smooth", 5) ( "smooth"  ,
 
)

Referenced by Execute(), and ShowUsage().

◆ Trim

cmdLineFloat Trim("trim") ( "trim"  )

Referenced by Execute(), ShowUsage(), and SurfaceTrimmer().