By the way, rotation is counter-clockwise and at zero degrees text is left to right.

Solved

Posted on 2006-05-22

I'm placing some text via PHP, C#, and VB applications onto a PDF. The text position is based on a X,Y matrix with the lower left of the page being 0,0.

What I'm trying to calculate is where the end of the text string is when it is rotated, so I can add more text to it.

I do know the following works, but I need a formula to calculate all angles/rotations.

If the rotation is 0 degrees:

X = X + "width of string"

Y = Y

If the rotation is 90 degrees:

X = X

Y = Y + "width of string"

If the rotation is 180 degrees:

X = X - "width of string"

Y = Y

If the rotation is 270 degrees:

X = X

Y = Y - "width of string"

What I'm trying to calculate is where the end of the text string is when it is rotated, so I can add more text to it.

I do know the following works, but I need a formula to calculate all angles/rotations.

If the rotation is 0 degrees:

X = X + "width of string"

Y = Y

If the rotation is 90 degrees:

X = X

Y = Y + "width of string"

If the rotation is 180 degrees:

X = X - "width of string"

Y = Y

If the rotation is 270 degrees:

X = X

Y = Y - "width of string"

5 Comments

Let's say:

X = 1

Y = 2

intStrWidth = 4 (this is my width of string)

r = 0 (this is rotation)

You formula comes out correct if r=0, but if it is anything else it isn't working.

If r = 90 your formula returns:

X = -0.79

Y = 5.57

but it should return:

X = 1

Y = 6

Anymore thoughts?

Title | # Comments | Views | Activity |
---|---|---|---|

Good problem solving books | 4 | 313 | |

what is the clinical significance of an elevated Bun? | 3 | 45 | |

How to calculate specific humidity of air from pressure, temperature and relative humidity ? | 2 | 27 | |

Triangles - computing angles | 7 | 24 |

This is a research brief on the potential colonization of humans on Mars.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**18** Experts available now in Live!