Anthony,
It is not clear what you want. If you add the same number to each x coordinate, and another number to each y-coordinate you simply translate the original figure -- it retains its original size, shape, and orientation.
If you want to add different numbers to different y-coordinates, you distort the figure in an unpredictable way.
If you want to change the size of the figure you should multiply the x coordinate by a number b and the y coordinate by a number c. This stretches the figure out and increases (or decreases) the area by the factor bc. To maintain the shape of the figure, just let b = c.
Chris
To clarify my previous question...I am creating a computer program that will resize any polygon shape in a picture box, which has all positive X,Y coordinates beginning with (0,0).
When I resize the shape by multiplying the X,Y coordinate by the same number (ie., X * 1.25 and Y * 1.25), the shape enlarges but the center point has moved, thus moving the shape.
I need to enlarge or shrink the length or width of the shape while maintaining the same center point for the shape. For example:
Original Shape |
Reduced Length |
Reduced Width |
The two factors that I have to work with are the center point of the shape
xCenter = (the highest X value of the shape + the lowest X value of the shape) / 2,
yCenter = (the highest Y value of the shape + the lowest Y value of the shape) / 2
and each (X,Y) coordinate for each vertex of the shape.
I have recently been looking at ellipses, but I am currently stuck on determining the minor axis for the ellipse from the data I currently have.
Would the equation for an ellipse work for this, or is there another approach that I am not seeing?
Thank you,
Anthony,
Suppose that the center has coordinates (c,d), s is the scaling factor in the x direction and t is the scaling factor in the y direction. For any point P with coordinates (x,y) you want to transform P by
x is transformed to s(x - c) + c
y is transformed to
t(y - d) + d
Chris
|