开发者

Scalling connected lines

开发者 https://www.devze.com 2023-01-01 01:08 出处:网络
I have some kind of a shape consisting of vertical, horizontal and diagonal lines. I have starting X,Y and endi开发者_开发技巧ng X,Y (this is my input - just 2 points defining a line) of each line and

I have some kind of a shape consisting of vertical, horizontal and diagonal lines. I have starting X,Y and endi开发者_开发技巧ng X,Y (this is my input - just 2 points defining a line) of each line and I would like to make the whole shape scalable (just by changing the value of a scale ratio variable), so that I can still preserve the proper connection of the lines and the proportions as well. Just for getting a better idea of what I mean: it'd be as if I had the same lines in a vector editor.

Would that be possible with an algorithm, and could you please, give me another possible solution if there is no such algorithm ?

Thank you very much in advance!


what point do you want it to scale about? You could scale relative to the first point, the center, or some other arbitrary location. Typically, you subtract out an offset (for instance the first point in your input), multiply by a scale factor, and then add back the offset.

A more systematic approach in computer graphics would be to use a transformation matrix... although thats probably overkill in your case.

0

精彩评论

暂无评论...
验证码 换一张
取 消