Draw an additional projection line, when showing a point-line
projected distance constraint. [git-p4: depot-paths = "//depot/solvespace/": change = 1712]
This commit is contained in:
parent
e11da119f0
commit
018e8a0444
|
@ -151,6 +151,19 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
|||
LineDrawOrGetDistance(pt, closest);
|
||||
Vector ref = ((closest.Plus(pt)).ScaledBy(0.5)).Plus(disp.offset);
|
||||
DoLabel(ref, labelPos, gr, gu);
|
||||
|
||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
||||
// Draw the projection marker from the closest point on the
|
||||
// projected line to the projected point on the real line.
|
||||
lAB = (lA.Minus(lB));
|
||||
double t = (lA.Minus(closest)).DivPivoting(lAB);
|
||||
|
||||
Vector lA = SS.GetEntity(line->point[0])->PointGetNum();
|
||||
Vector lB = SS.GetEntity(line->point[1])->PointGetNum();
|
||||
|
||||
Vector c2 = (lA.ScaledBy(1-t)).Plus(lB.ScaledBy(t));
|
||||
DoProjectedPoint(&c2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
1
dsc.h
1
dsc.h
|
@ -48,6 +48,7 @@ public:
|
|||
Vector WithMagnitude(double s);
|
||||
Vector ScaledBy(double s);
|
||||
Vector ProjectInto(hEntity wrkpl);
|
||||
double DivPivoting(Vector delta);
|
||||
};
|
||||
|
||||
class Point2d {
|
||||
|
|
12
util.cpp
12
util.cpp
|
@ -275,6 +275,18 @@ Vector Vector::ProjectInto(hEntity wrkpl) {
|
|||
return p0.Plus((u.ScaledBy(up)).Plus(v.ScaledBy(vp)));
|
||||
}
|
||||
|
||||
double Vector::DivPivoting(Vector delta) {
|
||||
double m = max(fabs(delta.x), max(fabs(delta.y), fabs(delta.z)));
|
||||
|
||||
if(m == fabs(delta.x)) {
|
||||
return x/delta.x;
|
||||
} else if(m == fabs(delta.y)) {
|
||||
return y/delta.y;
|
||||
} else if(m == fabs(delta.z)) {
|
||||
return z/delta.z;
|
||||
} else oops();
|
||||
}
|
||||
|
||||
Point2d Point2d::Plus(Point2d b) {
|
||||
Point2d r;
|
||||
r.x = x + b.x;
|
||||
|
|
Loading…
Reference in New Issue
Block a user