58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// File generated by HDevelop for HALCON/C++ Version 20.11.1.0
|
|
// Non-ASCII strings in this file are encoded in local-8-bit encoding (cp936).
|
|
// Ensure that the interface encoding is set to locale encoding by calling
|
|
// SetHcppInterfaceStringEncodingIsUtf8(false) at the beginning of the program.
|
|
//
|
|
// Please note that non-ASCII characters in string constants are exported
|
|
// as octal codes in order to guarantee that the strings are correctly
|
|
// created on all systems, independent on any compiler settings.
|
|
//
|
|
// Source files with different encoding should not be mixed in one project.
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <Halcon.h>
|
|
#include <halconcpp.h>
|
|
|
|
|
|
using namespace HalconCpp;
|
|
|
|
// Procedures
|
|
// Chapter: 3D / ÄâºÏ
|
|
// Short Description: 2023_12_11
|
|
void fit_plane (HTuple hv_X, HTuple hv_Y, HTuple hv_Z, HTuple *hv_A, HTuple *hv_B,
|
|
HTuple *hv_C, HTuple *hv_D)
|
|
{
|
|
|
|
// Local iconic variables
|
|
|
|
// Local control variables
|
|
HTuple hv_ObjectModel3D, hv_ParamName1, hv_ParamVal1;
|
|
HTuple hv_ParamName2, hv_ObjectModel3DOut, hv_Plane;
|
|
|
|
|
|
GenObjectModel3dFromPoints(hv_X, hv_Y, hv_Z, &hv_ObjectModel3D);
|
|
|
|
hv_ParamName1.Clear();
|
|
hv_ParamName1[0] = "primitive_type";
|
|
hv_ParamName1[1] = "fitting_algorithm";
|
|
hv_ParamVal1.Clear();
|
|
hv_ParamVal1[0] = "plane";
|
|
hv_ParamVal1[1] = "least_squares_tukey";
|
|
hv_ParamName2 = "primitive_parameter";
|
|
|
|
FitPrimitivesObjectModel3d(hv_ObjectModel3D, hv_ParamName1, hv_ParamVal1, &hv_ObjectModel3DOut);
|
|
GetObjectModel3dParams(hv_ObjectModel3DOut, hv_ParamName2, &hv_Plane);
|
|
|
|
(*hv_A) = ((const HTuple&)hv_Plane)[0];
|
|
(*hv_B) = ((const HTuple&)hv_Plane)[1];
|
|
(*hv_C) = ((const HTuple&)hv_Plane)[2];
|
|
(*hv_D) = ((const HTuple&)hv_Plane)[3];
|
|
|
|
return;
|
|
}
|
|
|
|
|