Scaling selection by mouse

Drop in here to discuss whatever you want.

Moderator: andrew

Post Reply
Premier Member
Posts: 850
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Scaling selection by mouse

Post by CVH » Fri Sep 13, 2019 10:41 pm

Hi all,
This is something I stumbled upon more then a year ago.
I remarked that scaling (SZ) with the mouse:
Anything exactly on the reference point
does not scale to exactly on the target point.

As scaling by pointing somewhere is only seldom scaling with equal factors,
scaling with unequal factors became more of an issue.
Additional discovered that the bulging of polylines is kept while scaling.
This is only correct with equal scaling factors. A flaw confirmed by Andrew.
Not only a flaw by Qcad but by many CAD.
There isn't a proper way to do this with only polylines.

As this is addressed more or less by now the scaling by mouse remains an issue to me.

Have a look inside the attached dxf.
In particular at the examples in the orange rectangles.
Added a spike to the shape so there is something sitting exactly at the reference.
Then indicated 7 parts per 16 wide and 6 parts per 8 high.
The object (with spike) is not scaled as expected.
The scaling factor is found to be: 0.515388... and equal in X and Y.
This is the result of sqrt(7^2+6^2)/sqrt(16^2+8^2).

In the second example I tried to flip pasted the origin.
With factors -8/16 and -1/8 but no flipping occurs because:
Scaling factor = sqrt((-8)^2+(-1)^2)/sqrt(16^2+8^2) = 0.450694... and by definition allways positive.

It can't be 'intended behaviour' as even with the origin, the reference and the target colinear
the definition of an intended scale by merely pointing in the ether will still be pritty hard to achieve.
This is math humans are not good at.

Further it doesn't matter where we put the reference and the target as long as they are at the
intended distance of the scaling origin.
Casting the target point circle reveals more on how it works.
What really happens here is setting a scalar by the means of the ratio of two distances to the origin.
The orientation of these distances have no value and no further meaning at all.
All the individual vectors from the origin to the nodes of the shape are scaled by the scalar.
Scalar vector scaling in short.
Mathematically correct, allways uniform but as any scalar is
just a number and can be negative as well, here it can't.

When interested in the rest of the dxf, please have a look here:
But this is all preliminary stuff untill it is found sound by Andrew.

Imho, when I scale something from 'here' to 'there' with respect to a scaling origin,
at least 'here' should become 'there' and the rest selected should addapt to whatever the scale might be.
Are there people that share my vision?

Any comment welcome.
Scaling Poly-arcs by tangents.v2.dxf
(229.71 KiB) Downloaded 94 times
QCADpro / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
Site Admin
Posts: 7019
Joined: Fri Mar 30, 2007 6:07 am

Re: Scaling selection by mouse

Post by andrew » Sat Sep 14, 2019 10:52 pm

Perhaps the Modify > Align Reference Points tool is more what you are looking for.

It won't do non-uniform scaling either, but "maps" two reference points to two target points.

Scaling by mouse is always uniform (since we only define one factor by mouse).
The factor is the ratio between the two distances given from the focus point.

If the focus point, reference point and target point are on the same line, the reference point should indeed end up at the target point. If that's not the case, please provide an isolated example for that, thanks.

Premier Member
Posts: 850
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: Scaling selection by mouse

Post by CVH » Sun Sep 15, 2019 9:02 am

andrew wrote:
Sat Sep 14, 2019 10:52 pm
since we only define one factor by mouse
I do not fully agree with that.
After hitting 'by Mouse' we provide two points relative to the scaling origin.
Reference (dx1, dy1), Target (dx2, dy2).
I'll avoid the term 'vector' as RVector() are merely points.

One use is to define a uniform scalar (sv in the code) by deviding the lengths.
Lenghts are by definition allways positive so possible inversions are ruled out.
What the coding does is found to be mathematically equal to:
sv = sqrt(dx1^2+dy1^2) / sqrt(dx2^2+dy2^2) or in your words length1 / length2
Then do 'scalar vector scaling' but restricted to the first quadrant with respect to the scaling origin.

As I pointed out we can define these points pritty anywhere.
As long as the intended scalar is g*R1 over g*R2.
> with R being a radius of a circle with its center at the scaling origin.
> with magnitude factor g that is lost by deviding.
And hard to do with the intended outcome.

A more universal use would define two scaling factors fy = dx2/dx1 and fx = dy2/dy1.
this.factorX = undefined & this.factorY = undefined in de code.

The difference may sit in 'KeepProportions' but this is ruled out in 'by mouse'.
It still will be a inperfect scalar vector scaling in one case.
Scaling by fx and fy is much more versatile.

QCADpro / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

Post Reply

Return to “Chat”