474239c784
- Use 3x3 eigensolver for initial fit in ZOH. Slightly better perf and RMSE than power method. - Remove use of double precision in ZOH - speeds up by 12%. - Fixed RGBM encoding that was broken for HDR images. - Use gamma-2.0 space for RGBM for HDR images (improves precision in darks). - Use UNORM instead of TYPELESS formats when saving a DX10 .dds file. The TYPELESS formats break most viewers. - Cleaned up warnings in ZOH code. - Command-line utils will warn if you give them an unrecognized parameter. - Added VS2010 profiling results.
39 lines
1.5 KiB
C++
39 lines
1.5 KiB
C++
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
|
|
|
|
#pragma once
|
|
#ifndef NV_MATH_FITTING_H
|
|
#define NV_MATH_FITTING_H
|
|
|
|
#include "Vector.h"
|
|
#include "Plane.h"
|
|
|
|
namespace nv
|
|
{
|
|
namespace Fit
|
|
{
|
|
Vector3 computeCentroid(int n, const Vector3 * points);
|
|
Vector3 computeCentroid(int n, const Vector3 * points, const float * weights, const Vector3 & metric);
|
|
|
|
Vector3 computeCovariance(int n, const Vector3 * points, float * covariance);
|
|
Vector3 computeCovariance(int n, const Vector3 * points, const float * weights, const Vector3 & metric, float * covariance);
|
|
|
|
Vector3 computePrincipalComponent_PowerMethod(int n, const Vector3 * points);
|
|
Vector3 computePrincipalComponent_PowerMethod(int n, const Vector3 * points, const float * weights, const Vector3 & metric);
|
|
|
|
Vector3 computePrincipalComponent_EigenSolver(int n, const Vector3 * points);
|
|
Vector3 computePrincipalComponent_EigenSolver(int n, const Vector3 * points, const float * weights, const Vector3 & metric);
|
|
|
|
Plane bestPlane(int n, const Vector3 * points);
|
|
bool isPlanar(int n, const Vector3 * points, float epsilon = NV_EPSILON);
|
|
|
|
bool eigenSolveSymmetric (const float matrix[6], float eigenValues[3], Vector3 eigenVectors[3]);
|
|
|
|
|
|
// Returns number of clusters [1-4].
|
|
int compute4Means(int n, const Vector3 * points, const float * weights, const Vector3 & metric, Vector3 * cluster);
|
|
}
|
|
|
|
} // nv namespace
|
|
|
|
#endif // NV_MATH_FITTING_H
|