Fix ProjectionGroup Directions

This commit is contained in:
WandererFan 2016-10-17 11:57:47 -04:00 committed by Yorik van Havre
parent a51b3f7b11
commit a82a50a60f
2 changed files with 47 additions and 20 deletions

View File

@ -338,59 +338,68 @@ int DrawProjGroup::purgeProjections()
void DrawProjGroup::setViewOrientation(DrawProjGroupItem *v, const char *projType) const
{
Base::Vector3d dir, xDir;
Base::Vector3d dir;
// Base::Vector3d dir, xDir;
// Traditional orthographic
if(strcmp(projType, "Front") == 0) {
dir.Set(0, 1, 0);
xDir.Set(1, 0, 0);
dir.Set(0, -1, 0);
// xDir.Set(1, 0, 0);
} else if(strcmp(projType, "Rear") == 0) {
dir.Set(0, -1, 0);
xDir.Set(-1, 0, 0);
dir.Set(0, 1, 0);
// xDir.Set(-1, 0, 0);
} else if(strcmp(projType, "Right") == 0) {
dir.Set(1, 0, 0);
xDir.Set(0, -1, 0);
// xDir.Set(0, -1, 0);
} else if(strcmp(projType, "Left") == 0) {
dir.Set(-1, 0, 0);
xDir.Set(0, 1, 0);
// xDir.Set(0, 1, 0);
} else if(strcmp(projType, "Top") == 0) {
dir.Set(0, 0, 1);
xDir.Set(1, 0, 0);
// xDir.Set(1, 0, 0);
} else if(strcmp(projType, "Bottom") == 0) {
dir.Set(0, 0, -1);
xDir.Set(1, 0, 0);
// xDir.Set(1, 0, 0);
// Isometric
} else if(strcmp(projType, "FrontTopLeft") == 0) {
dir.Set(-1/sqrt(3), 1/sqrt(3), 1/sqrt(3));
xDir.Set(sqrt(2)/2.0, sqrt(2.0)/2.0, 0);
dir.Set(-1,-1,1);
dir.Normalize();
// dir.Set(-1/sqrt(3), 1/sqrt(3), 1/sqrt(3));
// xDir.Set(sqrt(2)/2.0, sqrt(2.0)/2.0, 0);
} else if(strcmp(projType, "FrontTopRight") == 0) {
dir.Set(1/sqrt(3), 1/sqrt(3), 1/sqrt(3));
xDir.Set(sqrt(2)/2.0, -sqrt(2.0)/2.0, 0);
dir.Set(1, -1, 1);
dir.Normalize();
// dir.Set(1/sqrt(3), 1/sqrt(3), 1/sqrt(3));
// xDir.Set(sqrt(2)/2.0, -sqrt(2.0)/2.0, 0);
} else if(strcmp(projType, "FrontBottomRight") == 0) {
dir.Set(1/sqrt(3), 1/sqrt(3), -1/sqrt(3));
xDir.Set(sqrt(2)/2.0, -sqrt(2.0)/2.0, 0);
dir.Set(1, -1, -1);
dir.Normalize();
// dir.Set(1/sqrt(3), 1/sqrt(3), -1/sqrt(3));
// xDir.Set(sqrt(2)/2.0, -sqrt(2.0)/2.0, 0);
} else if(strcmp(projType, "FrontBottomLeft") == 0) {
dir.Set(-1/sqrt(3), 1/sqrt(3), -1/sqrt(3));
xDir.Set(sqrt(2)/2.0, sqrt(2.0)/2.0, 0);
dir.Set(-1, -1, -1);
dir.Normalize();
// dir.Set(-1/sqrt(3), 1/sqrt(3), -1/sqrt(3));
// xDir.Set(sqrt(2)/2.0, sqrt(2.0)/2.0, 0);
} else {
throw Base::Exception("Unknown view type in DrawProjGroup::setViewOrientation()");
}
dir = viewOrientationMatrix.getValue() * dir;
xDir = viewOrientationMatrix.getValue() * xDir;
dir = viewOrientationMatrix.getValue() * dir; //multiply std dir by transform matrix
//xDir = viewOrientationMatrix.getValue() * xDir;
v->Direction.setValue(dir);
v->XAxisDirection.setValue(xDir);
//v->XAxisDirection.setValue(xDir);
}
void DrawProjGroup::arrangeViewPointers(DrawProjGroupItem *viewPtrs[10]) const

View File

@ -179,6 +179,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<widget class="QPushButton" name="butCWRotate">
<property name="toolTip">
<string>About 3D Y</string>
</property>
<property name="text">
<string>Spin CW</string>
</property>
@ -186,6 +189,9 @@
</item>
<item row="3" column="2">
<widget class="QPushButton" name="butRightRotate">
<property name="toolTip">
<string>About 3D Z</string>
</property>
<property name="text">
<string>&gt;</string>
</property>
@ -193,6 +199,9 @@
</item>
<item row="2" column="0">
<widget class="QPushButton" name="butCCWRotate">
<property name="toolTip">
<string>About 3D Y</string>
</property>
<property name="text">
<string>Spin CCW</string>
</property>
@ -200,6 +209,9 @@
</item>
<item row="2" column="1">
<widget class="QPushButton" name="butTopRotate">
<property name="toolTip">
<string>About 3D X</string>
</property>
<property name="text">
<string>/\</string>
</property>
@ -217,6 +229,9 @@
</item>
<item row="3" column="0">
<widget class="QPushButton" name="butLeftRotate">
<property name="toolTip">
<string>About 3D Y</string>
</property>
<property name="text">
<string>&lt;</string>
</property>
@ -224,6 +239,9 @@
</item>
<item row="4" column="1">
<widget class="QPushButton" name="butDownRotate">
<property name="toolTip">
<string>About 3D X</string>
</property>
<property name="text">
<string>\/</string>
</property>