Consolidate Section logic in DrawViewSection
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
#include "Geometry.h"
|
||||
#include "GeometryObject.h"
|
||||
#include "EdgeWalker.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "DrawProjectSplit.h"
|
||||
#include "DrawViewSection.h"
|
||||
|
||||
@@ -449,6 +450,50 @@ bool DrawViewSection::isReallyInBox (const Base::Vector3d v, const Base::BoundBo
|
||||
return true;
|
||||
}
|
||||
|
||||
//! calculate the section Normal/Projection Direction given baseView projection direction and section name
|
||||
/*static*/
|
||||
Base::Vector3d DrawViewSection::getSectionVector (const Base::Vector3d baseViewDir, const std::string sectionName)
|
||||
{
|
||||
Base::Vector3d result;
|
||||
Base::Vector3d stdX(1.0,0.0,0.0);
|
||||
Base::Vector3d stdY(0.0,1.0,0.0);
|
||||
Base::Vector3d stdZ(0.0,0.0,1.0);
|
||||
Base::Vector3d view = baseViewDir;
|
||||
view.Normalize();
|
||||
Base::Vector3d left = view.Cross(stdZ);
|
||||
left.Normalize(); //redundent?
|
||||
Base::Vector3d down = view.Cross(left);
|
||||
down.Normalize(); //redundent?
|
||||
double dot = view.Dot(stdZ);
|
||||
|
||||
if (sectionName == "Up") {
|
||||
result = down;
|
||||
if (DrawUtil::fpCompare(fabs(dot),1.0)) {
|
||||
result = (-1.0 * stdY);
|
||||
}
|
||||
} else if (sectionName == "Down") {
|
||||
result = down * -1.0;
|
||||
if (DrawUtil::fpCompare(fabs(dot),1.0)) {
|
||||
result = stdY;
|
||||
}
|
||||
} else if (sectionName == "Left") {
|
||||
result = left * -1.0;
|
||||
if (DrawUtil::fpCompare(fabs(dot),1.0)) {
|
||||
result = stdX;
|
||||
}
|
||||
} else if (sectionName == "Right") {
|
||||
result = left;
|
||||
if (DrawUtil::fpCompare(fabs(dot),1.0)) {
|
||||
result = -1.0 * stdX;
|
||||
}
|
||||
} else {
|
||||
Base::Console().Log("Error - DVS::getSectionVector - bad sectionName: %s\n",sectionName.c_str());
|
||||
result = stdZ;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrawViewSection::getParameters()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
|
||||
Reference in New Issue
Block a user