Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.8 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. //
  3. // Code to compute the equation of a plane with a least-squares residual fit.
  4. //
  5. //===============================================================================
  6. #ifndef PLANEFIT_H
  7. #define PLANEFIT_H
  8. #if defined( COMPILER_MSVC )
  9. #pragma once
  10. #endif
  11. class VPlane;
  12. //-----------------------------------------------------------------------------
  13. // Finds a plane to best fit a set of points. The least-squares residual
  14. // error is computed along the X/Y/Z-axis, not orthogonally to the plane,
  15. // since doing the latter requires an SVD or a 3x3 eigendecomposition.
  16. //-----------------------------------------------------------------------------
  17. bool ComputeLeastSquaresPlaneFitX( const Vector *pPoints, int nNumPoints, VPlane *pFitPlane );
  18. bool ComputeLeastSquaresPlaneFitY( const Vector *pPoints, int nNumPoints, VPlane *pFitPlane );
  19. bool ComputeLeastSquaresPlaneFitZ( const Vector *pPoints, int nNumPoints, VPlane *pFitPlane );
  20. //-----------------------------------------------------------------------------
  21. // *WORK-IN-PROGRESS*
  22. // Finds a plane to best fit a set of points. The least-squares residual
  23. // error is computed along the optimal axis, orthogonally to the plane,
  24. // and requires a 3x3 eigendecomposition.
  25. //-----------------------------------------------------------------------------
  26. bool ComputeLeastSquaresOrthogonalPlaneFit( const Vector *pPoints, int nNumPoints, VPlane *pFitPlane );
  27. //-----------------------------------------------------------------------------
  28. // Given a plane and a set of points, computes the sum of
  29. // squared orthogonal residuals.
  30. //-----------------------------------------------------------------------------
  31. float ComputeSquaredError( const Vector *pPoints, int nNumPoints, const VPlane *pFitPlane );
  32. #endif // PLANEFIT_H