FitLineKD

require.mx('mxjs/base/math/fit_line_kd.js');

Fit a line to a collection of points, in k-dimensions (for limited values of k).

StatusName
Boolean fitLine3D ( vec3 ↑mean, vec3 ↑normalDir, Number pointsBegin, Number pointsEnd, Function readPoint )

Fit a line to a collection of 3D points.

Boolean fitLine4D ( vec4 ↑mean, vec4 ↑normalDir, Number pointsBegin, Number pointsEnd, Function readPoint )

Fit a line to a collection of 4D points.


Library Functions

result = Lib.fitLine3D ( ↑mean, ↑normalDir, pointsBegin, pointsEnd, readPoint )

Fit a line to a collection of 3D points.

Parameters:
  • vec3 ↑mean - receives the mean value of all input points
  • vec3 ↑normalDir - receives the normal direction of the fitted line
  • Number pointsBegin - first row number for points
  • Number pointsEnd - terminating row number for points (stop reading before this number)
  • Function readPoint - function(index,output_point) reads the point at row index into the provided output_point
Returns: Boolean result - true if the line was fit
result = Lib.fitLine4D ( ↑mean, ↑normalDir, pointsBegin, pointsEnd, readPoint )

Fit a line to a collection of 4D points.

Parameters:
  • vec4 ↑mean - receives the mean value of all input points
  • vec4 ↑normalDir - receives the normal direction of the fitted line
  • Number pointsBegin - first row number for points
  • Number pointsEnd - terminating row number for points (stop reading before this number)
  • Function readPoint - function(index,output_point) reads the point at row index into the provided output_point
Returns: Boolean result - true if the line was fit