cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstMesh
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
49
class
CISST_EXPORT
msh3PointCloud
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
62
vctDynamicVector<vct3>
points
;
63
64
// optional point cloud properties
65
// point orientations
66
vctDynamicVector<vct3>
pointOrientations
;
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
75
msh3PointCloud
() {};
76
77
msh3PointCloud
(
vctDynamicVector<vct3>
&
points
);
78
79
msh3PointCloud
(
vctDynamicVector<vct3>
&
points
,
80
vctDynamicVector<vct3>
&
pointOrientations
);
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
86
msh3PointCloud
(
msh3Mesh
&mesh);
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
104
void
ResetPointCloud
();
105
106
// initializes point cloud noise model to zero (default initializer)
107
void
InitializeNoiseModel
();
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,
128
vctDynamicVector<vct3>
&
points
,
129
vctDynamicVector<vct3>
&orientaitons);
130
131
static
int
ReadPointCloudFromFile
(std::string &filePath,
132
vctDynamicVector<vct3>
&
points
,
133
vctDynamicVector<vct3>
&orientaitons);
134
135
static
int
AppendPointCloudFromFile
(std::string &filePath,
136
vctDynamicVector<vct3>
&
points
,
137
vctDynamicVector<vct3>
&orientaitons);
138
139
140
static
int
WritePointCloudToFile
(std::string &filePath,
141
vctDynamicVector<vct3>
&
points
);
142
143
static
int
ReadPointCloudFromFile
(std::string &filePath,
144
vctDynamicVector<vct3>
&
points
);
145
146
static
int
AppendPointCloudFromFile
(std::string &filePath,
147
vctDynamicVector<vct3>
&
points
);
148
149
};
150
151
#endif
msh3Mesh
Definition
msh3Mesh.h:57
msh3PointCloud::msh3PointCloud
msh3PointCloud()
Definition
msh3PointCloud.h:75
msh3PointCloud::pointCovEig
vctDynamicVector< vct3 > pointCovEig
Definition
msh3PointCloud.h:69
msh3PointCloud::SavePLY
void SavePLY(const std::string &output_file)
msh3PointCloud::ResetPointCloud
void ResetPointCloud()
msh3PointCloud::msh3PointCloud
msh3PointCloud(msh3Mesh &mesh)
msh3PointCloud::InitializeNoiseModel
void InitializeNoiseModel()
msh3PointCloud::pointOrientations
vctDynamicVector< vct3 > pointOrientations
Definition
msh3PointCloud.h:66
msh3PointCloud::msh3PointCloud
msh3PointCloud(vctDynamicVector< vct3 > &points)
msh3PointCloud::msh3PointCloud
msh3PointCloud(vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &pointOrientations)
msh3PointCloud::ReadPointCloudFromFile
static int ReadPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points)
msh3PointCloud::SavePointCloudCov
void SavePointCloudCov(std::string &file)
msh3PointCloud::ReadPointCloudFromFile
int ReadPointCloudFromFile(std::string &filePath)
msh3PointCloud::AppendPointCloudFromFile
static int AppendPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
msh3PointCloud::WritePointCloudToFile
int WritePointCloudToFile(std::string &filePath)
msh3PointCloud::points
vctDynamicVector< vct3 > points
Definition
msh3PointCloud.h:62
msh3PointCloud::AppendPointCloudFromFile
int AppendPointCloudFromFile(std::string &filePath)
msh3PointCloud::WritePointCloudToFile
static int WritePointCloudToFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
msh3PointCloud::msh3PointCloud
msh3PointCloud(msh3Mesh &mesh, double noisePerpPlaneSD)
msh3PointCloud::WritePointCloudToFile
static int WritePointCloudToFile(std::string &filePath, vctDynamicVector< vct3 > &points)
msh3PointCloud::pointCov
vctDynamicVector< vct3x3 > pointCov
Definition
msh3PointCloud.h:68
msh3PointCloud::LoadPLY
void LoadPLY(const std::string &input_file)
msh3PointCloud::ReadPointCloudFromFile
static int ReadPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points, vctDynamicVector< vct3 > &orientaitons)
msh3PointCloud::AppendPointCloudFromFile
static int AppendPointCloudFromFile(std::string &filePath, vctDynamicVector< vct3 > &points)
vctDynamicVector
Definition
vctForwardDeclarations.h:131
CISST_EXPORT
#define CISST_EXPORT
Definition
cmnExportMacros.h:50
msh3Mesh.h
mshExport.h
Macros to export the symbols of cisstMesh (in a Dll).
Generated by
1.18.0