+ rename methods in Vector3 class

+ add convenience methods Cross and Dot to Vector3 class
+ fix bug in DistanceToLineSegment in Vector3 class
This commit is contained in:
wmayer
2016-07-30 15:14:47 +02:00
parent 56f5b9c568
commit c294c8bdbd
18 changed files with 241 additions and 212 deletions

View File

@@ -962,8 +962,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
delete arc;
return -1;
}
dist1.ProjToLine(arc->getStartPoint(/*emulateCCW=*/true)-intersection, dir1);
dist2.ProjToLine(arc->getStartPoint(/*emulateCCW=*/true)-intersection, dir2);
dist1.ProjectToLine(arc->getStartPoint(/*emulateCCW=*/true)-intersection, dir1);
dist2.ProjectToLine(arc->getStartPoint(/*emulateCCW=*/true)-intersection, dir2);
Part::Geometry *newgeo = dynamic_cast<Part::Geometry* >(arc);
filletId = addGeometry(newgeo);
if (filletId < 0) {

View File

@@ -759,7 +759,7 @@ public:
EditCurve[EditCurve.size()-1] = onSketchPos;
if (TransitionMode == TRANSITION_MODE_Tangent) {
Base::Vector2D Tangent(dirVec.x,dirVec.y);
EditCurve[1].ProjToLine(EditCurve[2] - EditCurve[0], Tangent);
EditCurve[1].ProjectToLine(EditCurve[2] - EditCurve[0], Tangent);
if (EditCurve[1] * Tangent < 0) {
EditCurve[1] = EditCurve[2];
suppressTransition = true;
@@ -770,7 +770,7 @@ public:
else if (TransitionMode == TRANSITION_MODE_Perpendicular_L ||
TransitionMode == TRANSITION_MODE_Perpendicular_R) {
Base::Vector2D Perpendicular(-dirVec.y,dirVec.x);
EditCurve[1].ProjToLine(EditCurve[2] - EditCurve[0], Perpendicular);
EditCurve[1].ProjectToLine(EditCurve[2] - EditCurve[0], Perpendicular);
EditCurve[1] = EditCurve[0] + EditCurve[1];
}
@@ -2452,7 +2452,7 @@ private:
Base::Vector2D cursor = Base::Vector2D(onSketchPos - f); // vector from f to cursor pos
// decompose cursor with a projection, then length of w_2 will give us b
Base::Vector2D w_1 = cursor;
w_1.ProjToLine(cursor, (periapsis - apoapsis)); // projection of cursor line onto apse line
w_1.ProjectToLine(cursor, (periapsis - apoapsis)); // projection of cursor line onto apse line
Base::Vector2D w_2 = (cursor - w_1);
b = w_2.Length();
@@ -2512,7 +2512,7 @@ private:
Base::Vector2D cursor = Base::Vector2D(onSketchPos - centroid); // vector from centroid to cursor pos
// decompose cursor with a projection, then length of w_2 will give us b
Base::Vector2D w_1 = cursor;
w_1.ProjToLine(cursor, (fixedAxis - centroid)); // projection of cursor line onto fixed axis line
w_1.ProjectToLine(cursor, (fixedAxis - centroid)); // projection of cursor line onto fixed axis line
Base::Vector2D w_2 = (cursor - w_1);
if (w_2.Length() > fixedAxisLength) {
// b is fixed, we are seeking a

View File

@@ -263,7 +263,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
continue;
Base::Vector3d projPnt(0.f, 0.f, 0.f);
projPnt = projPnt.ProjToLine(center - tmpPos, tmpDir);
projPnt = projPnt.ProjectToLine(center - tmpPos, tmpDir);
double projDist = std::abs(projPnt.Length() - radius);
// Find if nearest
@@ -311,7 +311,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
continue;
Base::Vector3d projPnt(0.f, 0.f, 0.f);
projPnt = projPnt.ProjToLine(center - tmpPos, tmpDir);
projPnt = projPnt.ProjectToLine(center - tmpPos, tmpDir);
double projDist = std::abs(projPnt.Length() - radius);
if (projDist < tangDeviation) {

View File

@@ -1204,7 +1204,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo
Base::Vector3d l2p1 = lineSeg->getStartPoint();
Base::Vector3d l2p2 = lineSeg->getEndPoint();
// calculate the projection of p1 onto line2
p2.ProjToLine(p1-l2p1, l2p2-l2p1);
p2.ProjectToLine(p1-l2p1, l2p2-l2p1);
p2 += p1;
} else
return;
@@ -3516,7 +3516,7 @@ Restart:
Base::Vector3d l2p1 = lineSeg->getStartPoint();
Base::Vector3d l2p2 = lineSeg->getEndPoint();
// calculate the projection of p1 onto line2
pnt2.ProjToLine(pnt1-l2p1, l2p2-l2p1);
pnt2.ProjectToLine(pnt1-l2p1, l2p2-l2p1);
pnt2 += pnt1;
} else
break;