gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/org/nongnu/libvob/impl OrthoCoorder.java


From: Matti Katila
Subject: [Gzz-commits] libvob/org/nongnu/libvob/impl OrthoCoorder.java
Date: Tue, 08 Apr 2003 08:52:32 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Matti Katila <address@hidden>   03/04/08 08:52:31

Modified files:
        org/nongnu/libvob/impl: OrthoCoorder.java 

Log message:
        fix coords

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/OrthoCoorder.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: libvob/org/nongnu/libvob/impl/OrthoCoorder.java
diff -u libvob/org/nongnu/libvob/impl/OrthoCoorder.java:1.10 
libvob/org/nongnu/libvob/impl/OrthoCoorder.java:1.11
--- libvob/org/nongnu/libvob/impl/OrthoCoorder.java:1.10        Mon Apr  7 
09:16:05 2003
+++ libvob/org/nongnu/libvob/impl/OrthoCoorder.java     Tue Apr  8 08:52:31 2003
@@ -35,7 +35,7 @@
  */
 
 public class OrthoCoorder extends VobCoorder {
-public static final String rcsid = "$Id: OrthoCoorder.java,v 1.10 2003/04/07 
13:16:05 mudyc Exp $";
+public static final String rcsid = "$Id: OrthoCoorder.java,v 1.11 2003/04/08 
12:52:31 mudyc Exp $";
     public static boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.out.println("OrthoCoorder::"+s); 
}
@@ -131,14 +131,15 @@
 
     /** place buoys on circle
      * @param into the cs where to make the translation and box.
-     * @param anchor the anchor of buoy.
-     * @param cx and cy are circle's center point
-     * @param rad radius from the x, y point
-     * @param px and py is the point for affine.
+     *              XXX currently doesn't use transformation at all.
+     * @param anchor the anchor of the buoy.
+     * @param cx and cy are the coords of the circle's center point
+     * @param rad radius from the (cx, cy) point
+     * @param px and py are coords for the point of affine.
      * @param min the size of min w/h box for buoy.
      * @param max the size of max width/height of buoy
      *
-     * @return boxCS for buoy fragment.
+     * @return boxCS for the buoy fragment.
      */
     public int buoyOnCircle(int into, int anchor, float cx, float cy, float 
rad,
                             float px, float py, float min, float max)
@@ -169,16 +170,18 @@
            float uy = y - py;
            float vx = px - cx;
            float vy = py - cy;
-           float A = ux * ux / (rad*rad) + uy * uy / (rad*rad);
-           float B = ux * vx / (rad*rad) + uy * vy / (rad*rad);
-           float C = vx * vx / (rad*rad) + vy * vy / (rad*rad) - 1;
+           float rad2 = rad*rad;
+           float A = ux * ux / rad2 + uy * uy / rad2;
+           float B = ux * vx / rad2 + uy * vy / rad2;
+           float C = vx * vx / rad2 + vy * vy / rad2 - 1;
            float t = (float)(-B + Math.sqrt(B * B - A * C)) / A;
 
            x = px + t * ux;
            y = py + t * uy;
            
-           cs = orthoBox(0, (len/rad)*99f, // most close go up - others down.
-                         x, y, 1,1, boxSize,boxSize ); 
+           cs = orthoBox(0, 1+(len/rad)*99f, // most close go up - others down.
+                         x-boxSize/2, y-boxSize/2, 
+                         1,1, boxSize,boxSize ); 
        }
        return cs;
    }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]