5

This question already has an answer here:

I want to calculate coordinates for some lines using pstricks. How can I do this?

Example:

I want something like

(0.5*cos(45) + 8, 0.5*sin(45) + 8) 

and use coordinate pairs like this one to draw lines in between.

marked as duplicate by David Carlisle, Marco Daniel, Heiko Oberdiek, Andrew Swann, Claudio Fiandrino Jun 7 '13 at 10:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

It isn't clear if you want to do the calculation in TeX or PostScript, in PostScript that would be

0.5 45 cos mul 8 add 0.5 45 sin mul 8 add

as you can check by typing to gs (or any other PostScript interpreter):

GS>0.5 45 cos mul 8 add 0.5 45 sin mul 8 add pstack
8.35355377
8.35355377
GS<2>
  • I'm sorry, I want to do the calculations in PostScript, but don't know how to implement it, as \psline(0.5 45 cos mul 8 add,0.5 45 sin mul 8 add)(0,0) isn't working. – MrD Jun 7 '13 at 9:35
  • 2
    Try \psline(!0.5 45 cos mul 8 add 0.5 45 sin mul 8 add)(0,0). – AlexG Jun 7 '13 at 10:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.