cisst-saw
Loading...
Searching...
No Matches
msh3PDTreePointCloud.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 _msh3PDTreePointCloud_h
38#define _msh3PDTreePointCloud_h
39
40#include <limits>
41
44
45// Always include last!
46#include <cisstMesh/mshExport.h>
47
49{
50 //
51 // This class implements a PD tree for a point cloud shape
52 //
53
54 //--- Variables ---//
55
56 public:
57
59
60 //--- Methods ---//
61
62 // constructors
63 // pointCloud - target shape from which to construct the tree
64 // (each point of the cloud becomes a datum in the tree)
65 // nThresh - min number of datums to subdivide a node
66 // diagThresh - min physical size to subdivide a node
68 int nThresh,
69 double diagThresh);
70
71 // destructor
73
74 void SavePointCloud(std::string &file)
75 {
77 pointCloud.SavePLY(file);
78 }
79
80 //--- Base Class Virtual Methods ---//
81 virtual vct3 DatumSortPoint(int datum) const; // return sort point of this datum
82 virtual void EnlargeBounds(const vctFrm3& F, int datum, msh3BoundingBox& BB) const;
83
84
85#ifdef ENABLE_PDTREE_NOISE_MODEL
86
87 //--- Noise Model Methods ---//
88
89 inline vct3x3& DatumCov(int datum) // return measurement noise model for this datum
90 {
91 return pointCloud.pointCov.Element(datum);
92 }
93 inline vct3x3* DatumCovPtr(int datum) // return measurement noise model for this datum
94 {
95 return &(pointCloud.pointCov.Element(datum));
96 }
97
98 inline vct3& DatumCovEig(int datum) // return measurement noise model for this datum
99 {
100 return pointCloud.pointCovEig.Element(datum);
101 }
102 inline vct3* DatumCovEigPtr(int datum) // return measurement noise model for this datum
103 {
104 return &(pointCloud.pointCovEig.Element(datum));
105 }
106
107#endif // ENABLE_PDTREE_NOISE_MODEL
108
109};
110
111#endif
msh3PDTreeBase()
Definition msh3PDTreeBase.h:92
void SavePointCloud(std::string &file)
Definition msh3PDTreePointCloud.h:74
virtual void EnlargeBounds(const vctFrm3 &F, int datum, msh3BoundingBox &BB) const
msh3PointCloud pointCloud
Definition msh3PDTreePointCloud.h:58
virtual vct3 DatumSortPoint(int datum) const
virtual ~msh3PDTreePointCloud()
msh3PDTreePointCloud(msh3PointCloud &pointCloud, int nThresh, double diagThresh)
Definition msh3PointCloud.h:50
vctDynamicVector< vct3 > pointCovEig
Definition msh3PointCloud.h:69
void SavePLY(const std::string &output_file)
int WritePointCloudToFile(std::string &filePath)
vctDynamicVector< vct3x3 > pointCov
Definition msh3PointCloud.h:68
#define CISST_EXPORT
Definition cmnExportMacros.h:50
vctBoundingBox3 msh3BoundingBox
Definition msh3BoundingBox.h:42
Macros to export the symbols of cisstMesh (in a Dll).
vctFixedSizeMatrix< double, 3, 3 > vct3x3
Definition vctFixedSizeMatrixTypes.h:59
vctFixedSizeVector< double, 3 > vct3
Definition vctFixedSizeVectorTypes.h:46
vctFrameBase< vctRot3 > vctFrm3
Definition vctTransformationTypes.h:137