------------------------------------------------------------------------------
| 1437 | |
| 1438 | //------------------------------------------------------------------------------ |
| 1439 | void vtkParallelCoordinatesRepresentation::LassoSelectInternal( |
| 1440 | vtkPoints* brushPoints, vtkIdTypeArray* outIds) |
| 1441 | { |
| 1442 | if (brushPoints->GetNumberOfPoints() <= 0) |
| 1443 | return; |
| 1444 | |
| 1445 | double* p = brushPoints->GetPoint(0); |
| 1446 | int position = this->ComputePointPosition(p); |
| 1447 | |
| 1448 | if (position < 0 || position >= this->NumberOfAxes) |
| 1449 | return; |
| 1450 | |
| 1451 | double leftAxisRange[2], rightAxisRange[2]; |
| 1452 | leftAxisRange[0] = leftAxisRange[1] = rightAxisRange[0] = rightAxisRange[1] = 0; |
| 1453 | this->GetRangeAtPosition(position, leftAxisRange); |
| 1454 | this->GetRangeAtPosition(position + 1, rightAxisRange); |
| 1455 | |
| 1456 | double dLeft = leftAxisRange[1] - leftAxisRange[0]; |
| 1457 | double dRight = rightAxisRange[1] - rightAxisRange[0]; |
| 1458 | double dy = this->YMax - this->YMin; |
| 1459 | |
| 1460 | this->LinearThreshold->Initialize(); |
| 1461 | this->LinearThreshold->SetLinearThresholdTypeToBetween(); |
| 1462 | this->LinearThreshold->SetDistanceThreshold(this->AngleBrushThreshold); |
| 1463 | this->LinearThreshold->UseNormalizedDistanceOn(); |
| 1464 | this->LinearThreshold->SetColumnRanges(dLeft, dRight); |
| 1465 | this->LinearThreshold->AddColumnToThreshold(position, 0); |
| 1466 | this->LinearThreshold->AddColumnToThreshold(position + 1, 0); |
| 1467 | |
| 1468 | // add a line equation for each brush point |
| 1469 | for (int i = 0; i < brushPoints->GetNumberOfPoints(); i++) |
| 1470 | { |
| 1471 | p = brushPoints->GetPoint(i); |
| 1472 | |
| 1473 | // normalize p into [0,1]x[0,1] |
| 1474 | double pn[2] = { (p[0] - this->Xs[position]) / (this->Xs[position + 1] - this->Xs[position]), |
| 1475 | (p[1] - this->YMin) / dy }; |
| 1476 | |
| 1477 | // now compute actual data values for two PC lines passing through pn, |
| 1478 | // starting from the endpoints of the left axis |
| 1479 | double q[2] = { leftAxisRange[0], rightAxisRange[0] + pn[1] / pn[0] * dRight }; |
| 1480 | |
| 1481 | double r[2] = { leftAxisRange[1], rightAxisRange[0] + (1.0 + (pn[1] - 1.0) / pn[0]) * dRight }; |
| 1482 | |
| 1483 | this->LinearThreshold->AddLineEquation(q, r); |
| 1484 | } |
| 1485 | |
| 1486 | this->LinearThreshold->Update(); |
| 1487 | vtkIdTypeArray* ids = this->LinearThreshold->GetSelectedRowIds(); |
| 1488 | for (int i = 0; i < ids->GetNumberOfTuples(); i++) |
| 1489 | { |
| 1490 | outIds->InsertNextTuple(i, ids); |
| 1491 | } |
| 1492 | } |
| 1493 | //------------------------------------------------------------------------------ |
| 1494 | // All lines that have the same slope in PC space represent a set of points |
| 1495 | // that define a line in XY space. PC lines that have similar slope are all |
no test coverage detected