Ponca  b63e69866b9b277a96802d3d06e6492d50ffc055
Point Cloud Analysis library
Loading...
Searching...
No Matches
algebraicSphere.hpp
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7template <class DataPoint, class _NFilter, typename T> // Outer template for the class
8typename AlgebraicSphere<DataPoint, _NFilter, T>::VectorType // Return type
10{
11 PONCA_MULTIARCH_STD_MATH(sqrt);
12
13 // turn to centered basis
14 const VectorType lq = Base::getNeighborFilter().convertToLocalBasis(_q);
15
16
17
18 if(isPlane())
19 {
20 Scalar sqnorm = m_ul.squaredNorm();
21 return Base::getNeighborFilter().convertToGlobalBasis( lq - m_ul*(lq.dot(m_ul))/sqnorm );
22 }
23 else
24 {
25 Scalar potential = potentialLocal(lq);
26 VectorType grad = primitiveGradientLocal(lq);
27 Scalar norm = grad.norm();
28 Scalar t = - (norm - sqrt(norm*norm - Scalar(4) * m_uq * potential)) / (Scalar(2) * m_uq * norm);
29 return Base::getNeighborFilter().convertToGlobalBasis( lq + t * grad );
30 }
31
32}
33
34template < class DataPoint, class _NFilter, typename T>
37{
38 return m_uc + _lq.dot(m_ul) + m_uq * _lq.squaredNorm();
39}
40
41template < class DataPoint, class _NFilter, typename T>
44{
45 return (m_ul + Scalar(2.) * m_uq * _lq);
46}
47
Algebraic Sphere primitive.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.