change to CVS wadalab font project
import java.util.*; public class Bezier extends OutlineComponent{ Point p0,p1,p2,p3; public Bezier(Point p0,Point p1,Point p2,Point p3){ this.p0=p0; this.p1=p1; this.p2=p2; this.p3=p3; } public Bezier[] divide(){ Bezier[] ret=new Bezier[2]; Point midp=p0.inter(p3,0.5).inter(p1.inter(p2,0.5),0.75); ret[0]=new Bezier(p0,p0.inter(p1,0.5), p0.inter(p2,0.5).inter(p1,0.5),midp); ret[1]=new Bezier(midp,p3.inter(p1,0.5).inter(p2,0.5), p3.inter(p2,0.5),p3); return ret; } public void render(Vector ret,double limit){ ret.addElement(p0); if(p0.distance(p3)<limit){ ret.addElement(p3); } else{ Bezier[] div=divide(); div[0].render(ret,limit); div[1].render(ret,limit); } } }
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |