Merge branch 'smithchart_fix'
This commit is contained in:
commit
ea8693566f
@ -97,8 +97,9 @@ QPoint TraceSmithChart::markerToPixel(Marker *m)
|
|||||||
double TraceSmithChart::nearestTracePoint(Trace *t, QPoint pixel, double *distance)
|
double TraceSmithChart::nearestTracePoint(Trace *t, QPoint pixel, double *distance)
|
||||||
{
|
{
|
||||||
double closestDistance = numeric_limits<double>::max();
|
double closestDistance = numeric_limits<double>::max();
|
||||||
unsigned int closestIndex = 0;
|
double closestXpos = 0;
|
||||||
for(unsigned int i=0;i<t->size();i++) {
|
auto samples = t->size();
|
||||||
|
for(unsigned int i=0;i<samples;i++) {
|
||||||
auto data = t->sample(i);
|
auto data = t->sample(i);
|
||||||
auto plotPoint = dataToPixel(data);
|
auto plotPoint = dataToPixel(data);
|
||||||
if (plotPoint.isNull()) {
|
if (plotPoint.isNull()) {
|
||||||
@ -109,13 +110,13 @@ double TraceSmithChart::nearestTracePoint(Trace *t, QPoint pixel, double *distan
|
|||||||
unsigned int distance = diff.x() * diff.x() + diff.y() * diff.y();
|
unsigned int distance = diff.x() * diff.x() + diff.y() * diff.y();
|
||||||
if(distance < closestDistance) {
|
if(distance < closestDistance) {
|
||||||
closestDistance = distance;
|
closestDistance = distance;
|
||||||
closestIndex = i;
|
closestXpos = t->sample(i).x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(distance) {
|
if(distance) {
|
||||||
*distance = closestDistance;
|
*distance = closestDistance;
|
||||||
}
|
}
|
||||||
return t->sample(closestIndex).x;
|
return closestXpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TraceSmithChart::xCoordinateVisible(double x)
|
bool TraceSmithChart::xCoordinateVisible(double x)
|
||||||
|
Loading…
Reference in New Issue
Block a user