cisst-saw
Loading...
Searching...
No Matches
msh3AlgDirPDTreevonMisesProj.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 _msh3AlgDirPDTreevonMisesProj_h
38#define _msh3AlgDirPDTreevonMisesProj_h
39
42
43// Always include last!
44#include <cisstMesh/mshExport.h>
45
47{
48 //
49 // This algorithm implements most-likely point search using a projected
50 // von-Mises distribution (for 2D orientation) on an arbitrary 2D plane
51 // along with a generalized Gaussian distribution (for 3D positions)
52 //
53
54 //--- Algorithm Parameters ---//
55
56 protected:
57
59
60 vct2 Xpln; // non-transformed in-plane orientation of sample
61 // NOTE: 3d orientation in local sample coords = [Xpln; 0]
62
63 // sample noise model
64 double sample_k; // orientational concentration
65 //vct3x3 sample_M; // positional covariance
66 //vct3 sample_M_Eig; // eigenvalues of sample covariance in order of decreasing magnitude
67
68 // Current rotation of registration
69 //vctRot3 Rreg; // position matches Yp close to Rreg * Xp + t = Xp_xfm
70
71 // Yn_2d_xfm = Rpln_y * Yn_3d
72 // NOTE: orientation matches Yn_3d are chosen such that
73 // Prj_xy(Rreg^-1 * Yn_3d) = Yn_2d_xfm is close to Xpln
75
76 // effective noise model for node intersection test
77 // (i.e. for transformed samples)
78 //vct3x3 M; // effective measurement error covariance for a node & sample pair
79 vct3x3 Minv; // M = effective measurement error covariance for a node & sample pair
80 vct3x3 N, Ninv; // decomposition of inv(M) = N'N
81 double Dmin; // inverse sqrt of largest eigenvalue of M
82 // (or the sqrt of the smallest eigenvalue of inv(M))
83
84 // the log term is constant when the measurement error of the target is
85 // is assumed to be zero
86 //double MinLogM; // lower bound on the log component of error for this node
87
88 //--- Algorithm Methods ---//
89
90 public:
91
92 // constructor
96
97 // destructor
99
100 // Set sample to be matched in the search (slower routine)
101 // Xpln ~ non-transformed in-plane (2d) sample orientation
102 // Rx_pln ~ transformation from plane to y coordinates: Xn = Rx_pln * [Xpln; 0]
103 // sample_k ~ orientation concentration of sample
104 // sample_M ~ position covariance of non-transformed sample
105 // Rreg ~ rotation from current registration: Yp = Rreg*Xp + t
107 vctRot3 Rx_pln,
108 double sample_k,
109 vct3x3 sample_M, //vct3 sample_M_Eig,
110 vctRot3 Rreg);
111
112 // Set sample to be matched in the search
113 // (fast routine for pre-computed noise-model decompositions)
114 // Xpln ~ non-transformed in-plane (2d) sample orientation
115 // Ry_pln ~ Ry_pln = Rreg * Rx_pln
116 // sample_k ~ orientation concentration of sample
117 // Minv ~ M is position covariance of transformed sample
118 // N, Ninv ~ inv(M) = N'N
119 // Dmin ~ sqrt of smallest eigenvalue of inv(M)
121 vctRot3 Ry_pln,
122 double sample_k,
123 vct3x3 Minv, // vct3x3 M,
125 double Dmin);
126
128 vct3x3 &N, vct3x3 &Ninv,
129 double &Dmin);
130
131 //--- PD Tree Interface Methods ---//
132
133 int NodeMightBeCloser(const vct3 &Xp, const vct3 &Xn,
134 msh3DirPDTreeNode const *node,
135 double ErrorBound);
136
137 virtual double FindClosestPointOnDatum(const vct3 &Xp, const vct3 &Xn,
138 vct3 &closest, vct3 &closestNorm,
139 int datum) = 0;
140
141 virtual int DatumMightBeCloser(const vct3 &Xp, const vct3 &Xn,
142 int datum,
143 double ErrorBound) = 0;
144};
145
146#endif
Definition EllipsoidOBBIntersectionSolver.h:50
msh3AlgDirPDTree(msh3DirPDTreeBase *pTree)
void InitializeSample(vct2 Xpln, vctRot3 Rx_pln, double sample_k, vct3x3 sample_M, vctRot3 Rreg)
vct3x3 Minv
Definition msh3AlgDirPDTreevonMisesProj.h:79
vct2 Xpln
Definition msh3AlgDirPDTreevonMisesProj.h:60
virtual ~msh3AlgDirPDTreevonMisesProj()
Definition msh3AlgDirPDTreevonMisesProj.h:98
virtual double FindClosestPointOnDatum(const vct3 &Xp, const vct3 &Xn, vct3 &closest, vct3 &closestNorm, int datum)=0
vct3x3 Ninv
Definition msh3AlgDirPDTreevonMisesProj.h:80
void InitializeSample(vct2 Xpln, vctRot3 Ry_pln, double sample_k, vct3x3 Minv, vct3x3 N, vct3x3 Ninv, double Dmin)
EllipsoidOBBIntersectionSolver IntersectionSolver
Definition msh3AlgDirPDTreevonMisesProj.h:58
virtual int DatumMightBeCloser(const vct3 &Xp, const vct3 &Xn, int datum, double ErrorBound)=0
int NodeMightBeCloser(const vct3 &Xp, const vct3 &Xn, msh3DirPDTreeNode const *node, double ErrorBound)
vctFixedSizeMatrix< double, 2, 3 > Rpln_y
Definition msh3AlgDirPDTreevonMisesProj.h:74
msh3AlgDirPDTreevonMisesProj(msh3DirPDTreeBase *pDirTree)
Definition msh3AlgDirPDTreevonMisesProj.h:93
static void ComputeCovDecomposition(const vct3x3 &M, vct3x3 &Minv, vct3x3 &N, vct3x3 &Ninv, double &Dmin)
double Dmin
Definition msh3AlgDirPDTreevonMisesProj.h:81
vct3x3 N
Definition msh3AlgDirPDTreevonMisesProj.h:80
double sample_k
Definition msh3AlgDirPDTreevonMisesProj.h:64
Definition msh3DirPDTreeBase.h:55
Definition msh3DirPDTreeNode.h:53
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
#define CISST_EXPORT
Definition cmnExportMacros.h:50
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
vctFixedSizeVector< double, 2 > vct2
Definition vctFixedSizeVectorTypes.h:41
vctMatrixRotation3< double, VCT_ROW_MAJOR > vctRot3
Definition vctTransformationTypes.h:109