Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
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 if (isPlane())
17 {
18 Scalar sqnorm = m_ul.squaredNorm();
19 return Base::getNeighborFilter().convertToGlobalBasis(lq - m_ul * (lq.dot(m_ul)) / sqnorm);
20 }
21 else
22 {
23 Scalar potential = potentialLocal(lq);
24 VectorType grad = primitiveGradientLocal(lq);
25 Scalar norm = grad.norm();
26 Scalar t = -(norm - sqrt(norm * norm - Scalar(4) * m_uq * potential)) / (Scalar(2) * m_uq * norm);
27 return Base::getNeighborFilter().convertToGlobalBasis(lq + t * grad);
28 }
29}
30
31template <class DataPoint, class _NFilter, typename T>
33 const VectorType& _lq) const
34{
35 return m_uc + _lq.dot(m_ul) + m_uq * _lq.squaredNorm();
36}
37
38template <class DataPoint, class _NFilter, typename T>
40 DataPoint, _NFilter, T>::primitiveGradientLocal(const VectorType& _lq) const
41{
42 return (m_ul + Scalar(2.) * m_uq * _lq);
43}
44
Algebraic Sphere primitive.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.