Two link mainpulator

i`m working in a project to design to link arm that writes letters or draws some simple figure(sqaure,traingle).i obtained the inverse
kinematic and simulated the mechanasim in mathlab.I could draw cicrle my question is how i can modify my program to draw a suqaure or trianlge or even letters? this is the mathlab code:
clear all close all clc clear t=0:0.1:2*pi; r=1; //raduis of the cicle n=length(t); l1=1; l2=1;
for i=1:n; x(i)=r*cos(t(i)); y(i)=r*sin(t(i));
c2=(x(i)^2+y(i)^2-l1^2-l2^2)/(2*l1*l2); s2=sqrt(1-c2^2); th2(i)=atan2(s2,c2) k1=l1+l2*c2; k2=l2*s2; th1(i)=atan2(y(i),x(i))-atan2(k1,k2) x1=l1*cos(th1(i)); y1=l1*sin(th1(i)); x2=x1+l2*cos(th1(i)+th2(i)); y2=y1+l2*sin(th1(i)+th2(i)); line([0,x1,x2],[0,y1,y2]);hold on;pause(0.5); end;
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

x(i)=r*cos(t(i)); y(i)=r*sin(t(i)); (that fill the x() and y() arrays with all the points in a circle) with a table that fills x and y with the points that compose a letter or a square.
This program is filling x and y with a bunch of points for the arm to go to. If you have a PCB design program, the gerber file output could be used to give you a list of points that make up text and shapes. I imagine there must be simpler ways to convert text to line segment data (like maybe PostScript). Note you will need a "Lift pen" command in there somewhere.
-howy

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.