views:

32

answers:

1

I know that to scale verticies I simply have to multiply by a scale factor. But I noticed that most vector drawing applications show the shapes bounding box and by dragging one of the edge it will scale the geometry toward the opposite edge, then if you go past this edge it will end up mirroring the geometry on that axis. How is scaling toward an edge done? Ex: If you select the topmost edge of a circle, it will scale toward the bottom edge of its bounding box until it looks like nothing, sort of like a raindrop that collapses when it hits the ground. I hope this is clear enough. Thanks

+2  A: 

Keep track of the original distance between the two edges, and calculate the new edge distance as it is moved. Scale each point to the ratio of original/new, and use the edge that isn't moving as your zero point, i.e. subtract that value from each coordinate before scaling and add it back after scaling. Be careful not to crash when the two edges meet and the distance becomes zero.

Mark Ransom
Awesome thanks a lot :-)
Milo