nvidia-texture-tools/src/nvmath/Fitting.h

39 lines
1.3 KiB
C
Raw Normal View History

// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
2008-11-22 08:30:20 +00:00
2010-05-27 23:19:24 +00:00
#pragma once
2008-11-22 08:30:20 +00:00
#ifndef NV_MATH_FITTING_H
#define NV_MATH_FITTING_H
2012-04-30 23:02:46 +00:00
#include "Vector.h"
#include "Plane.h"
2008-11-22 08:30:20 +00:00
namespace nv
{
class Vector3;
class Plane;
2010-05-27 23:19:24 +00:00
namespace Fit
{
Vector3 computeCentroid(int n, const Vector3 * points);
Vector3 computeCentroid(int n, const Vector3 * points, const float * weights, const Vector3 & metric);
2008-11-22 08:30:20 +00:00
2010-05-27 23:19:24 +00:00
Vector3 computeCovariance(int n, const Vector3 * points, float * covariance);
Vector3 computeCovariance(int n, const Vector3 * points, const float * weights, const Vector3 & metric, float * covariance);
2008-11-22 08:30:20 +00:00
2010-05-27 23:19:24 +00:00
Vector3 computePrincipalComponent(int n, const Vector3 * points);
Vector3 computePrincipalComponent(int n, const Vector3 * points, const float * weights, const Vector3 & metric);
2010-05-27 23:19:24 +00:00
Plane bestPlane(int n, const Vector3 * points);
2012-02-14 16:31:25 +00:00
bool isPlanar(int n, const Vector3 * points, float epsilon = NV_EPSILON);
bool eigenSolveSymmetric (float matrix[6], float eigenValues[3], Vector3 eigenVectors[3]);
2010-05-27 23:19:24 +00:00
// Returns number of clusters [1-4].
int compute4Means(int n, const Vector3 * points, const float * weights, const Vector3 & metric, Vector3 * cluster);
2010-05-27 23:19:24 +00:00
}
2008-11-22 08:30:20 +00:00
} // nv namespace
#endif // NV_MATH_FITTING_H