Replace DPG table lookup logic with calculations

DPG used a pair of large tables to determine view
direction and rotation vector when subject was rotated
and spun.  There were many errors in the tables that
needed manual checking to correct.  The new version
uses calculations on a virtual glass cube to find view
direction and rotation vector.
This commit is contained in:
WandererFan
2017-06-13 10:34:57 -04:00
committed by wmayer
parent 75900944c9
commit 4c4e1e3210
7 changed files with 423 additions and 866 deletions

View File

@@ -176,24 +176,31 @@ void TaskProjGroup::rotateButtonClicked(void)
void TaskProjGroup::on3DClicked(void)
{
std::pair<Base::Vector3d,Base::Vector3d> dir3D = get3DViewDir();
Base::Vector3d dir = dir3D.first;
dir = DrawUtil::closestBasis(dir);
Base::Vector3d up = dir3D.second;
up = DrawUtil::closestBasis(up);
TechDraw::DrawProjGroupItem* front = multiView->getProjItem("Front");
if (front) { //why "if front"???
multiView->setTable(dir,up);
setUiPrimary();
Gui::Command::updateActive();
}
Base::Console().Warning("TaskProjGroup - this function is temporarily unavailable\n");
//TODO: how to set the DPG.Cube (or a brand new replacement Cube) to a specific orientation
// {10x(viewDirection + RotationVector)} given only the
// viewDirection + upDirection(!= RotationVector) of the front view?
// need to find the sequence of rotations Left/Right, Up/Down, CW/CCW
// from current orientation to desired orientation.
// std::pair<Base::Vector3d,Base::Vector3d> dir3D = get3DViewDir();
// Base::Vector3d dir = dir3D.first;
// dir = DrawUtil::closestBasis(dir);
// Base::Vector3d up = dir3D.second;
// up = DrawUtil::closestBasis(up);
// TechDraw::DrawProjGroupItem* front = multiView->getProjItem("Front");
// if (front) { //why "if front"???
// multiView->setTable(dir,up);
// setUiPrimary();
// Gui::Command::updateActive();
// }
}
void TaskProjGroup::onResetClicked(void)
{
TechDraw::DrawProjGroupItem* front = multiView->getProjItem("Front");
if (front) {
multiView->resetTable();
multiView->resetCube();
setUiPrimary();
Gui::Command::updateActive();
}