[wadalabfont-kit] / java / Point.java  

Diff of /java/Point.java

Parent Directory | Revision Log

version 1.2, Wed Jan 3 02:46:31 2001 UTC version 1.3, Thu Jan 4 10:23:56 2001 UTC
Line 1 
Line 1 
 //  //
 //  
 //  
 // $B:BI87O$,2hLL:BI87O(B($B:8>e$,(B(0,0))$B$G$"$k$3$H$KCm0U$9$k(B  // $B:BI87O$,2hLL:BI87O(B($B:8>e$,(B(0,0))$B$G$"$k$3$H$KCm0U$9$k(B
 //  //
   //        (0,-1)
   // (-1,0) (0,0)  (1,0)
   //        (0,1)
 public final class Point {  public final class Point {
   double x,y;    double x,y;
   // 10^-5$B0J2<$O(B0$B$H8+$J$9!%(B    // 10^-5$B0J2<$O(B0$B$H8+$J$9!%(B
Line 26 
Line 27 
   public Point minus(Point p){    public Point minus(Point p){
     return new Point(x-p.getX(),y-p.getY());      return new Point(x-p.getX(),y-p.getY());
   }    }
     public Point neg(){
       return new Point(-x,-y);
     }
   public Point times(double r){    public Point times(double r){
     return new Point(x*r,y*r);      return new Point(x*r,y*r);
   }    }
     public Point timesX(double r){
       return new Point(x*r,y);
     }
     public Point timesY(double r){
       return new Point(x,y*r);
     }
   // $B%Y%/%?!<$ND9$5$r(B newLength$B$K@55,2=$9$k!%(B    // $B%Y%/%?!<$ND9$5$r(B newLength$B$K@55,2=$9$k!%(B
   public Point normal(double newLength){    public Point normal(double newLength){
     double ratio=newLength/length();      double ratio=newLength/length();
Line 47 
Line 57 
   public Point rot270(){    public Point rot270(){
     return new Point(-y,x);      return new Point(-y,x);
   }    }
     // $BG$0UEY$N2sE>(B
     public Point rot(double theta){
       double cosTheta=Math.cos(theta),sinTheta=Math.sin(theta);
       return new Point(x*cosTheta+y*sinTheta,-x*sinTheta+y*cosTheta);
     }
   // $B<+J,$H%Y%/%?!<(Bp$B$NFb@Q(B(inner product)    // $B<+J,$H%Y%/%?!<(Bp$B$NFb@Q(B(inner product)
   public double product(Point p){    public double product(Point p){
     return x*p.x+y*p.y;      return x*p.x+y*p.y;
   }    }
     // (1,0)$B$+$i8+$?<+J,$N3QEY(B
     public double theta(){
       return Math.atan2(-y,x);
     }
   // $B<+J,$+$i%Y%/%?!<(Bp$B$r8+$?3QEY$N(B cos    // $B<+J,$+$i%Y%/%?!<(Bp$B$r8+$?3QEY$N(B cos
   public double cosTheta(Point p){    public double cosTheta(Point p){
     return product(p)/(p.length()*length());      return product(p)/(p.length()*length());


Generate output suitable for use with a patch program
Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help