Package org.zkoss.canvas

Examples of org.zkoss.canvas.Path.lineTo()


 
  public static Path nGon(double r, int n){
    Path p = new Path().moveTo(r, 0);
    for(int i=1; i<n+1; i++){
      double arg = Math.PI * (1.5 + (2.0*i)/n);
      p.lineTo(r + r * Math.cos(arg), r + r * Math.sin(arg));
    }
    p.closePath();
    return p;
  }
 
View Full Code Here


    double r2 = r * Math.sin(Math.PI*theta/360) / Math.sin(Math.PI*(theta/360 + 2.0/n));
   
    for(int i=1; i<n+1; i++){
      double arg1 = Math.PI * (1.5 + (2.0*i)/n);
      double arg2 = arg1 - Math.PI/n;
      p.lineTo(r + r2 * Math.cos(arg2), r + r2 * Math.sin(arg2));
      p.lineTo(r + r * Math.cos(arg1), r + r * Math.sin(arg1));
    }
   
    p.closePath();
    return p;
View Full Code Here

   
    for(int i=1; i<n+1; i++){
      double arg1 = Math.PI * (1.5 + (2.0*i)/n);
      double arg2 = arg1 - Math.PI/n;
      p.lineTo(r + r2 * Math.cos(arg2), r + r2 * Math.sin(arg2));
      p.lineTo(r + r * Math.cos(arg1), r + r * Math.sin(arg1));
    }
   
    p.closePath();
    return p;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.