You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
3.4 KiB

#ifndef SCANCONVERSIONCONFIG_H
#define SCANCONVERSIONCONFIG_H
#include <QObject>
#include "math.h"
#include "model/scenarioGenerator/dto/software/Pixel.h"
struct ScenGenScanConversionConfig_t
{
private:
float frameMaxXScan;
float frameMinXScan;
float frameMaxZScan;
float frameMinZScan;
void calcPixelParamConvex()
{
frameMaxXScan = probeRadius * sinf(bMaxScanAz) + bMaxScanAx * sinf(
bMaxScanAz / fieldOfView * angle);
frameMinXScan = probeRadius * sinf(bMinScanAz) + bMaxScanAx * sinf(
bMinScanAz / fieldOfView * angle);
auto maxAbsScanAz = qMax(abs(bMinScanAz), abs(bMaxScanAz));
float minAbsScanAz;
if(bMaxScanAz > 0 && bMinScanAz < 0)
{
minAbsScanAz = 0;
}
else
{
minAbsScanAz = qMin(abs(bMinScanAz), abs(bMaxScanAz));
}
frameMaxZScan = probeRadius * cosf(minAbsScanAz) + bMaxScanAx * cosf(
minAbsScanAz / fieldOfView * angle);
frameMinZScan = probeRadius * cosf(maxAbsScanAz) + bMinScanAx * cosf(
maxAbsScanAz / fieldOfView * angle);
}
void calcPixelParamVirtualConvex()
{
float minAbsScanAz;
if(bMaxScanAz > 0 && bMinScanAz < 0)
{
minAbsScanAz = 0;
}
else
{
minAbsScanAz = qMin(abs(bMinScanAz), abs(bMaxScanAz));
}
auto maxAbsScanAz = qMax(abs(bMinScanAz), abs(bMaxScanAz));
frameMaxZScan = bMaxScanAx * cos(minAbsScanAz / fieldOfView * 2 * vcMaxTheta);
frameMinZScan = bMinScanAx * cos(maxAbsScanAz / fieldOfView * 2 * vcMaxTheta);
frameMaxXScan = virtualOriginalZ * tanf(bMaxScanAz) + bMaxScanAx * sinf(
bMaxScanAz / fieldOfView * 2 * vcMaxTheta);
frameMinXScan = virtualOriginalZ * tanf(bMinScanAz) + bMaxScanAx * sinf(
bMinScanAz / fieldOfView * 2 * vcMaxTheta);
}
void calcPixelParamLinear()
{
frameMaxXScan = bMaxScanAz;
frameMinXScan = bMinScanAz;
frameMaxZScan = bMaxScanAx;
frameMinZScan = bMinScanAx;
}
void calculateMeshGrid(quint32 xPixelnumber, quint32 zPixelNumber, bool hdZoom)
{
auto pixelXStep = (frameMaxXScan - frameMinXScan) / (xPixelnumber - 1);
auto pixelZStep = (frameMaxZScan - frameMinZScan) / (zPixelNumber - 1);
float pixelStep;
pixelStep = pixelZStep;
auto finalPixelXNo = qMin<quint32>(floor((frameMaxXScan - frameMinXScan) / pixelStep) + 1,
xPixelnumber);
auto finalPixelZNo = qMin<quint32>(floor((frameMaxZScan - frameMinZScan) / pixelStep) + 1,
zPixelNumber);
pixel.minPixelXPos = (frameMinXScan + frameMaxXScan) / 2.0f - pixelStep *
(finalPixelXNo - 1) /
2.0f;
pixel.minPixelZPos = (frameMinZScan + frameMaxZScan) / 2.0f - pixelStep *
(finalPixelZNo - 1) /
2.0f;
pixel.pixelXStep = pixelStep;
pixel.pixelZStep = pixelStep;
pixel.pixelXNo = finalPixelXNo;
pixel.pixelZNo = finalPixelZNo;
}
public:
bool linear;
float probeRadius;
float fieldOfView;
float probeFieldOfView;
float virtualOriginalZ;
float bMinScanAx;
float bMinScanAz;
float bMaxScanAx;
float bMaxScanAz;
float minScanAx;
float minScanAz;
float maxScanAx;
float steering;
quint32 rxLineNo;
quint32 rxFocusPointNo;
float rxLineDaz;
float rxPointDax;
bool virtualConvex;
float vcMaxTheta;
float angle;
Pixel_t pixel;
void calcPixelParams(quint32 xPixelnumber, quint32 zPixelNumber, bool hdZoom)
{
if(linear)
{
if(virtualConvex)
{
calcPixelParamVirtualConvex();
}
else
{
calcPixelParamLinear();
}
}
else
{
calcPixelParamConvex();
}
calculateMeshGrid(xPixelnumber, zPixelNumber, hdZoom);
}
};
#endif //SCANCONVERSIONCONFIG_H