资源简介
平面度及平整度算法,已将编译成DLL,在多个专案验证无误,可以放心调用,C#、labview都可以
代码片段和文件信息
// dll.cpp : 定义 DLL 应用程序的入口点。
//
#include “stdafx.h“
#include
#include “afx.h“
#include “Winspool.h“
#include “math.h“
#ifdef _MANAGED
#pragma managed(push off)
#endif
HANDLE hPrinter;
CString m_str_PrinterName;
CString m_str_Heat;
CString m_str_XOffset;
CString m_str_YOffset;
CString m_str_TopOffset;
CString m_str_PrintString;
PRINTER_DEFAULTS m_Printer_Default_Setting;
struct coordinate
{
float x_axis[256];
float y_axis[256];
float z_axis[256];
};
extern “C“ __declspec(dllexport) BOOL OpenBarcodePrinter(wchar_t* strPrinterName)
{
CString str(strPrinterName);
ASSERT(str != ““);
m_str_PrinterName = str;
//CString a =m_str_PrinterName.Mid(17);
//MessageBox(NULLm_str_PrinterNameNULLNULL);
//m_str_PrinterName.MakeUpper();
m_str_PrinterName.TrimLeft();
m_str_PrinterName.TrimRight();
memset(&m_Printer_Default_Setting 0 sizeof(m_Printer_Default_Setting));
memset(&hPrinter0sizeof(hPrinter));
m_Printer_Default_Setting.DesiredAccess = PRINTER_ACCESS_ADMINISTER;
if(!OpenPrinter((LPSTR)(LPCTSTR)m_str_PrinterName &hPrinter &m_Printer_Default_Setting))
{
return FALSE;
}
return TRUE;
}
extern “C“ __declspec(dllexport) float FlatnessResult(float* fOriginal float* fx float* fy int iDataNumber)
{
coordinate Axis;
coordinate all_axis;
int point_num;
int ij;
int flag[256];
int flag2;
int high_flag;
float point_xpoint_ypoint_z;
float higher[256];
float top_higher;
float ddivisord1divisor2;
float a1[3] = {0.00.00.0};
float a2[3] = {0.00.00.0};
float a3[3] = {0.00.00.0};
float a4[3] = {0.00.00.0};
float mm1m2m3;
float ABC;
for(int i = 0; i < iDataNumber; i++)
{
Axis.x_axis[i] = fx[i];
Axis.y_axis[i] = fy[i];
Axis.z_axis[i] = fOriginal[i];
}
all_axis = Axis;
point_num = iDataNumber;
if(point_num < 4 || point_num > 256)
{
return -2;
}
for(i = 0; i < point_num; i++)
{
a1[0] = a1[0]+all_axis.x_axis[i]*all_axis.x_axis[i];
a1[1] = a1[1]+all_axis.x_axis[i]*all_axis.y_axis[i];
a1[2] = a1[2]+all_axis.x_axis[i];
a2[0] = a2[0]+all_axis.x_axis[i]*all_axis.y_axis[i];
a2[1] = a2[1]+all_axis.y_axis[i]*all_axis.y_axis[i];
a2[2] = a2[2]+all_axis.y_axis[i];
a3[0] = a3[0]+all_axis.x_axis[i];
a3[1] = a3[1]+all_axis.y_axis[i];
a3[2] = point_num;
a4[0] = a4[0]+all_axis.x_axis[i]*all_axis.z_axis[i];
a4[1] = a4[1]+all_axis.y_axis[i]*all_axis.z_axis[i];
a4[2] = a4[2]+all_axis.z_axis[i];
}
m = a1[0]*a2[1]*a3[2]+a2[0]*a3[1]*a1[2]+a3[0]*a1[1]*a2[2]-a2[0]*a1[1]*a3[2]-a1[0]*a3[1]*a2[2]-a3[0]*a2[1]*a1[2];
m1 = a4[0]*a2[1]*a3[2]+a2[0]*a3[1]*a4[2]+a3[0]*a4[1]*a2[2]-a2[0]*a4[1]*a3[2]-a4[0]*a3[1]*a2[2]-a3[0]*a2[1]*a4[2];
m2 = a1[0]*a4[1]*a3[2]+a4[0]*a3[1]*a1[2]+a3[0]*a1[1]*a4[2]-a4[0]*a1[1]*a3[2]-a1[0]*a3[1]*a4[2]-a3[0]*a4[1]*a1[2];
m3 = a1[0]*a2[1]*a4[2]+a2[0]*a4[1]*a1[2]+a4[0]*a1[1]*a2[2]-a2[0]*a1[1]*a4[2]-a1[0]*a4[1]*a2[2]-a4[0]*a2[1]*a1[2];
A
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1818624 2013-12-02 18:14 dll\debug\dll.dll
文件 1096 2013-08-05 11:27 dll\debug\dll.exp
文件 5987540 2013-08-05 11:49 dll\debug\dll.ilk
文件 2400 2013-08-05 11:27 dll\debug\dll.lib
文件 11168768 2013-08-05 11:49 dll\debug\dll.pdb
文件 14342 2013-12-02 18:14 dll\dll\Debug\BuildLog.htm
文件 406 2013-12-02 18:14 dll\dll\Debug\dll.dll.em
文件 472 2013-12-02 18:14 dll\dll\Debug\dll.dll.em
文件 381 2013-12-02 18:14 dll\dll\Debug\dll.dll.intermediate.manifest
文件 1060 2013-08-05 12:16 dll\dll\Debug\dll.exp
文件 2400 2013-08-05 12:16 dll\dll\Debug\dll.lib
文件 133302 2013-12-02 18:14 dll\dll\Debug\dll.obj
文件 786432 2013-12-02 18:14 dll\dll\Debug\dll.pch
文件 11168768 2013-08-05 12:49 dll\dll\Debug\dll.pdb
文件 69 2013-12-02 18:14 dll\dll\Debug\mt.dep
文件 9247 2013-12-02 18:14 dll\dll\Debug\stdafx.obj
文件 396288 2013-12-02 18:14 dll\dll\Debug\vc90.idb
文件 290816 2013-12-02 18:14 dll\dll\Debug\vc90.pdb
文件 3956 2013-12-02 18:14 dll\dll\dll.cpp
文件 15 2013-08-05 14:53 dll\dll\dll.def
文件 4719 2013-08-06 08:29 dll\dll\dll.vcproj
文件 4515 2009-04-02 17:00 dll\dll\dll.vcproj.8.00.old
文件 1375 2009-04-03 16:18 dll\dll\dll.vcproj.HP.br.user
文件 1502 2013-12-02 18:15 dll\dll\dll.vcproj.PCN.Seven.Zhang.user
文件 1391 2013-08-04 18:12 dll\dll\dll.vcproj.PCOS-20121.Administrator.user
文件 1401 2013-08-06 08:53 dll\dll\dll.vcproj.TP-J44-TF9-STM9.a.user
文件 1205 2009-04-02 17:00 dll\dll\ReadMe.txt
文件 208 2009-04-02 17:00 dll\dll\stdafx.cpp
文件 1051 2013-08-04 16:56 dll\dll\stdafx.h
文件 875 2013-08-04 16:34 dll\dll.sln
............此处省略10个文件信息
评论
共有 条评论