math - imageline (PHP+gd) creates too long line -


i'm trying draw line representing complex number on circle (base image: http://i.imgur.com/mngenrp.png) starting centre of circle , ending on point on circle. here come problems: i have tried many formulas find $x2 , $y2 ended randomly positioned lines. what's right formula calculate ending coordinates?

edit: cleong solved positioning problem line still long, goes out of circle , out of image. of formulas use are:

$x2=$half+($radius*(cos(deg2rad($theta)))); $y2=$half-($radius*(sin(deg2rad($theta)))); 

where $half centre of circle (in pixels), $radius radius of circle in pixels , $theta angle in radians. in advance.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -