Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

I have a list of points which define a shape

I need to shrink the shape

I know which direction to move the points

because if the angle is concave or convex

but sometimes if the points are too close to each other

they overlap and produce the wrong results

does anyone know of a good scaling algorithm that can avoid or compensate for this problem?

I need to shrink the shape

I know which direction to move the points

because if the angle is concave or convex

but sometimes if the points are too close to each other

they overlap and produce the wrong results

does anyone know of a good scaling algorithm that can avoid or compensate for this problem?

A uniform scale doesnt preserve the original shape but it does keep it proportional.

Therefore when computing the new point based on a cross vector at certain angles if the scale is to big

the points overlap themselves.

A uniform scale preserves the original shape and keeps it proportional,

(which I thought were the same thing, unless you are using "shape" or "proportional" in a way I don't understand)

Points have 0 size, so the only way they can overlap is if they are the same point.

scale it down (undersample, take for subsampling 2 times, every second pixel).

Another way to do it would be to calculate or store the centre point of the shape and use this to determine the distance of each point in the shape boundary for which you have a reading from that point. This way you could scale the shape by directly calculating the new size in proportion to its original position along the vector between it and the centre point.

It really depends on your original design and the complexity of the shapes you are drawing...

I created a shape drawing program, which deals with simple geometric forms such as squares, circles, triangles, diamonds and stars... I treated each as a circle...

A square is a circle with only 4 points on its circumference recorded, a triangle has 3 points recorded... etc

The method I outlined for resizing worked well in this approach, proportionality was always maintained... Rotating the shape was also simple...

To draw the shape you just need the centre point, the radius or the circle and the angle of rotation, the draw method is identical regardless of the shape type, using these parameters, using oom

More complex shapes may require a different approach

And the number of points on the circumference.... Sorry...

Basically, I dont want uniform proportional scaling as that doesnt maintain a uniform distance away from the line. (contraction or erosion scaling) not sure the proper term for this either?

http://i121.photobucket.com/albums/o209/DangerMode/bad-vector.gif

that is what I am doing

1) do you know the name of this algorithm, what would you call this?

So the problem arises when the distance is bigger then the point density and then points overlap

like in this case

http://i121.photobucket.com/albums/o209/DangerMode/vectorerr1.gif

(sorry the point numbers are upside down, but they show where the algorithm breaks down)

2) I thought of several approaches to fix it like removing those points and making a point at intersection etc

and all have other problems with them,

If you have any leads or ideas on how to fix this I would really really appreciated it.

http://www.capcode.de/help/setlinejoin

http://www.capcode.de/help/setmiterlimit

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

A01 = y1-y0;

B01 = x0-x1;

A12 = y2-y1;

B12 = x1-x2;

C01 = A01*x0+B01*y0+d*sqrt(A01*A

C12 = A12*x1+B12*y1+d*sqrt(A12*A

Det=A01*B12-A12*B01;

newX1= (B12*C01-B01*C12)/Det;

newY1= (A01*C12-A12*C01)/Det;