cisst-saw
Loading...
Searching...
No Matches
msh3PointCloud.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3// ****************************************************************************
4//
5// Copyright (c) 2014, Seth Billings, Russell Taylor, Johns Hopkins University
6// All rights reserved.
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions are
10// met:
11//
12// 1. Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14//
15// 2. Redistributions in binary form must reproduce the above copyright
16// notice, this list of conditions and the following disclaimer in the
17// documentation and/or other materials provided with the distribution.
18//
19// 3. Neither the name of the copyright holder nor the names of its
20// contributors may be used to endorse or promote products derived from
21// this software without specific prior written permission.
22//
23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34//
35// ****************************************************************************
36
37#ifndef _msh3PointCloud_h
38#define _msh3PointCloud_h
39
40#include <cisstMesh/msh3Mesh.h>
41
42#if CISST_MSH_HAS_RPLY
43#include <ply_io.h>
44#endif
45
46// Always include last!
47#include <cisstMesh/mshExport.h>
48
50{
51
52 private:
53
54#if CISST_MSH_HAS_RPLY
55 ply_io ply_obj;
56#endif
57
58 public:
59
60 //--- Variables ---//
61
63
64 // optional point cloud properties
65 // point orientations
67 // positional noise model
68 vctDynamicVector<vct3x3> pointCov; // covariance of measurement noise
69 vctDynamicVector<vct3> pointCovEig; // eigenvalues of covariance
70
71
72 //--- Methods ---//
73
74 // constructors
76
78
81
82 // build point cloud from a mesh by choosing the centerpoint
83 // from each mesh triangle as a point in the cloud; also
84 // the noise model of each mesh triangle is copied as the
85 // noise model for each point in the point cloud
87
88 // build point cloud from a mesh by choosing the centerpoint
89 // from each mesh triangle as a point in the cloud; the
90 // noise model of the point cloud is initialized such that
91 // the variance along the point orientation is as specified
92 // and the variance perpendicular to the point orientation
93 // is equal to the variance of the distance from the
94 // center of each triangle to its 3 vertices
95 msh3PointCloud(msh3Mesh &mesh, double noisePerpPlaneSD);
96
97
98 // initializes all point cloud properties to empty (default initializer);
99 // this is a useful routine to use while building a point cloud,
100 // since some point cloud properties are optional and may not be
101 // initialized by the data used to build the point cloud; calling this
102 // ensures that unused properties are emptied rather than left with
103 // possibly invalid values
105
106 // initializes point cloud noise model to zero (default initializer)
108
109
110 // I/O
111 // Point Set I/O
112 void LoadPLY(const std::string &input_file);
113 void SavePLY(const std::string &output_file);
114
115 // save point cloud noise model covariance matrices to file
116 void SavePointCloudCov(std::string &file);
117
118 // methods for writing / reading point cloud objects to / from a file
119 int WritePointCloudToFile(std::string &filePath);
120 int ReadPointCloudFromFile(std::string &filePath);
121 int AppendPointCloudFromFile(std::string &filePath);
122
123 // static methods for writing / reading point cloud points and
124 // optionall point orientations to / from file without
125 // referencing a point cloud object
126
127 static int WritePointCloudToFile(std::string &filePath,
129 vctDynamicVector<vct3> &orientaitons);
130
131 static int ReadPointCloudFromFile(std::string &filePath,
133 vctDynamicVector<vct3> &orientaitons);
134
135 static int AppendPointCloudFromFile(std::string &filePath,
137 vctDynamicVector<vct3> &orientaitons);
138
139
140 static int WritePointCloudToFile(std::string &filePath,
142
143 static int ReadPointCloudFromFile(std::string &filePath,
145
146 static int AppendPointCloudFromFile(std::string &filePath,
148
149};
150
151#endif
Definition msh3Mesh.h:57
msh3PointCloud()
Definition msh3PointCloud.h:75
vctDynamicVector< vct3 > pointCovEig
Definition msh3PointCloud.h:69
void SavePLY(const std::string &output_file)
void ResetPointCloud()
msh3PointCloud(msh3Mesh &mesh)
void InitializeNoiseModel()
vctDynamicVector< vct3 > pointOrientations
Definition msh3PointCloud.h:66
msh3PointCloud(vctDynamicVector< vct3 > &points)
msh3PointCloud(vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &pointOrientations)
static int ReadPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points)
void SavePointCloudCov(std::string &file)
int ReadPointCloudFromFile(std::string &filePath)
static int AppendPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
int WritePointCloudToFile(std::string &filePath)
vctDynamicVector< vct3 > points
Definition msh3PointCloud.h:62
int AppendPointCloudFromFile(std::string &filePath)
static int WritePointCloudToFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
msh3PointCloud(msh3Mesh &mesh, double noisePerpPlaneSD)
static int WritePointCloudToFile(std::string &filePath, vctDynamicVector< vct3 > &points)
vctDynamicVector< vct3x3 > pointCov
Definition msh3PointCloud.h:68
void LoadPLY(const std::string &input_file)
static int ReadPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
static int AppendPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points)
Definition vctForwardDeclarations.h:131
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Macros to export the symbols of cisstMesh (in a Dll).