------------------------------------------------------------------------------ Description: Square distance between a straight line (defined by points x and y) and a point z. Property: if x and y are equal, the line is a point and the result is the square distance between points x and z.
| 194 | // and a point z. Property: if x and y are equal, the line is a point and |
| 195 | // the result is the square distance between points x and z. |
| 196 | double vtkGeometricErrorMetric::Distance2LinePoint(double x[3], double y[3], double z[3]) |
| 197 | { |
| 198 | double u[3]; |
| 199 | double v[3]; |
| 200 | double w[3]; |
| 201 | |
| 202 | u[0] = y[0] - x[0]; |
| 203 | u[1] = y[1] - x[1]; |
| 204 | u[2] = y[2] - x[2]; |
| 205 | |
| 206 | vtkMath::Normalize(u); |
| 207 | |
| 208 | v[0] = z[0] - x[0]; |
| 209 | v[1] = z[1] - x[1]; |
| 210 | v[2] = z[2] - x[2]; |
| 211 | |
| 212 | double dot = vtkMath::Dot(u, v); |
| 213 | |
| 214 | w[0] = v[0] - dot * u[0]; |
| 215 | w[1] = v[1] - dot * u[1]; |
| 216 | w[2] = v[2] - dot * u[2]; |
| 217 | |
| 218 | return vtkMath::Dot(w, w); |
| 219 | } |
| 220 | |
| 221 | //------------------------------------------------------------------------------ |
| 222 | void vtkGeometricErrorMetric::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected