[comp.lang.postscript] Perpendicular Lines

cramer@optilink.UUCP (Clayton Cramer) (12/17/88)

I'm told my recent posting requesting PostScript for drawing perpendicular
lines to a circle was confusing and ambiguous.  Let me clarify.

I would like to draw a circle, and lines which are perpendicular to lines
tangent to the circle (much like the lines on a clock face).  I would 
also like to print text whose base line is parallel to the tangent lines.

Thank you.
-- 
Clayton E. Cramer
{pyramid,pixar,tekbspa}!optilink!cramer          (Note new path!)

geof@apolling (Geof Cooper) (12/22/88)

In article <723@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes:
>I would like to draw a circle, and lines which are perpendicular to lines
>tangent to the circle (much like the lines on a clock face).  I would 
>also like to print text whose base line is parallel to the tangent lines.

Here is some untested code.

Let cx, cy be the center of the circle.
Let r be its radius
Let theta be the angle around the circle at which you'd like
  to draw one of your radial lines or print text tangent
  to the circle

% Align X axis with circle
cx cy translate
theta rotate

% Move to perimeter of circle
r 0 translate

% Draw the line where you want it
-10 0 moveto 0 0 lineto stroke

% Rotate to put text tangent to the circle
% (if you speak hebrew, negate the angle!)
-90 rotate

(This text is tangent) show