52 #ifndef __PCL_WorldTransformation_h
53 #define __PCL_WorldTransformation_h
58 #include <pcl/Diagnostics.h>
74 #define __PCL_WCS_DEFAULT_SPLINE_ORDER 2
75 #define __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS 0.005F
76 #define __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_ENABLED true
77 #define __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_REJECT_FRACTION 0.10F
78 #define __PCL_WCS_MAX_SPLINE_POINTS 2100
165 : m_transWI( transIW.Inverse() )
166 , m_transIW( transIW )
206 return m_transWI.Transform( p );
213 return m_transIW.Transform( p );
233 class PCL_CLASS XMLElement;
342 float smoothness = __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS,
344 int order = __PCL_WCS_DEFAULT_SPLINE_ORDER,
345 bool enableSimplifier = __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_ENABLED,
346 float simplifierRejectFraction = __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_REJECT_FRACTION )
347 : m_controlPointsW( controlPointsW )
348 , m_controlPointsI( controlPointsI )
350 , m_smoothness( smoothness )
351 , m_weights( weights )
352 , m_useSimplifiers( enableSimplifier )
353 , m_simplifierRejectFraction( simplifierRejectFraction )
356 CalculateLinearApproximation();
387 if ( linearIW.IsSingularMatrix() )
388 CalculateLinearApproximation();
390 m_linearIW = linearIW;
428 return m_controlPointsW.IsEmpty() || m_controlPointsI.IsEmpty();
457 if ( m_gridWI.IsValid() )
458 if ( m_gridWI.ReferenceRect().IncludesFast( pW ) )
459 return m_gridWI( pW );
460 return m_splineWI( pW );
481 if ( m_gridIW.IsValid() )
482 if ( m_gridIW.ReferenceRect().IncludesFast( pI ) )
483 return m_gridIW( pI );
484 return m_splineIW( pI );
523 PCL_PRECONDITION( deltaI >= 1 && deltaI <= 64 )
524 deltaI =
Range( deltaI, 1, 64 );
530 DRect rectW( std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
531 std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() );
532 for (
int x = 0; x < rectI.
Width(); ++x )
533 for (
int p = 0; p < 2; ++p )
536 if ( pW.
x < rectW.
x0 )
538 if ( pW.
x > rectW.
x1 )
540 if ( pW.
y < rectW.
y0 )
542 if ( pW.
y > rectW.
y1 )
545 for (
int y = 0; y < rectI.
Height(); ++y )
546 for (
int p = 0; p < 2; ++p )
549 if ( pW.
x < rectW.
x0 )
551 if ( pW.
x > rectW.
x1 )
553 if ( pW.
y < rectW.
y0 )
555 if ( pW.
y > rectW.
y1 )
558 double deltaW = m_splineIW(
DPoint( -deltaI/2, -deltaI/2 ) ).DistanceTo(
559 m_splineIW(
DPoint( +deltaI/2, +deltaI/2 ) ) )/1.4142;
561 m_gridWI.Initialize( rectW, deltaW, m_splineWI,
false );
562 m_gridIW.Initialize( rectI, deltaI, m_splineIW,
false );
572 return m_gridWI.IsValid() && m_gridIW.IsValid();
581 return "PCL:AstrometricSolution:SplineWorldTransformation:";
609 return int( m_controlPointsW.Length() );
626 return m_controlPointsW;
643 return m_controlPointsI;
675 xWI = m_splineWI.SplineX().Length();
676 yWI = m_splineWI.SplineY().Length();
677 xIW = m_splineIW.SplineX().Length();
678 yIW = m_splineIW.SplineY().Length();
706 return m_useSimplifiers;
716 return m_simplifierRejectFraction;
736 xWI = m_splineWI.ErrorX();
737 yWI = m_splineWI.ErrorY();
738 xIW = m_splineIW.ErrorX();
739 yIW = m_splineIW.ErrorY();
747 int m_order = __PCL_WCS_DEFAULT_SPLINE_ORDER;
748 float m_smoothness = __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS;
750 bool m_useSimplifiers = __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_ENABLED;
751 float m_simplifierRejectFraction = __PCL_WCS_SURFACE_SIMPLIFIER_DEFAULT_REJECT_FRACTION;
752 bool m_truncated =
false;
771 void InitializeSplines();
772 void CalculateLinearApproximation();
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
A generic rectangle in the two-dimensional space.
component x1
Horizontal coordinate of the lower right corner.
component y1
Vertical coordinate of the lower right corner.
component y0
Vertical coordinate of the upper left corner.
component x0
Horizontal coordinate of the upper left corner.
component Width() const noexcept
component Height() const noexcept
Generic vector of arbitrary length.
Homography geometric transformation.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Discretized vector surface interpolation/approximation in two dimensions.
Vector surface spline interpolation/approximation in two dimensions.
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept