gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob ./Makefile include/vob/trans/LinearPrimi...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob ./Makefile include/vob/trans/LinearPrimi...
Date: Tue, 01 Apr 2003 07:53:56 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/04/01 07:53:56

Modified files:
        .              : Makefile 
        include/vob/trans: LinearPrimitives.hxx 
        src/jni        : Makefile-Gen 
        test/vob/gl    : glvobcoorder.test 
Added files:
        include/vob/geom: Quadrics.hxx 

Log message:
        As per mudyc's request, buoy coordinate system

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/Makefile.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/geom/Quadrics.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/LinearPrimitives.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile-Gen.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/glvobcoorder.test.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: libvob/Makefile
diff -u libvob/Makefile:1.21 libvob/Makefile:1.22
--- libvob/Makefile:1.21        Mon Mar 31 05:00:03 2003
+++ libvob/Makefile     Tue Apr  1 07:53:56 2003
@@ -1,6 +1,7 @@
 include rules.mk
 
-SUBDIRS = ctest src/trans src/util src/texture src/paper src/os src/main
+SUBDIRS = src/trans src/util src/texture src/paper src/os src/main
+# ctest off for now
 
 RAWSRC = `find org/ -name "*.java"` 
 
Index: libvob/include/vob/trans/LinearPrimitives.hxx
diff -u libvob/include/vob/trans/LinearPrimitives.hxx:1.1 
libvob/include/vob/trans/LinearPrimitives.hxx:1.2
--- libvob/include/vob/trans/LinearPrimitives.hxx:1.1   Tue Apr  1 06:03:54 2003
+++ libvob/include/vob/trans/LinearPrimitives.hxx       Tue Apr  1 07:53:56 2003
@@ -34,6 +34,7 @@
 #include <GL/gl.h>
 
 #include <vob/trans/Primitives.hxx>
+#include <vob/geom/Quadrics.hxx>
 
 namespace Vob {
 namespace Primitives {
@@ -116,7 +117,6 @@
     VOB_PRIMITIVETRANS_DEFINED(TranslateXYZ_Explicit, "translate");
     VOB_PRIMITIVETRANS_DEFINED(ScaleXYZ_Explicit, "scale");
 
-
     /** Rotation clockwise. 
      */
     class RotateXY :
@@ -416,6 +416,89 @@
        }
     };
     VOB_PRIMITIVETRANS_DEFINED(Ortho_Explicit, "ortho");
+
+    /** A buoy coordinate system.
+     */
+    class BuoyOnCircle1 :
+       public Ortho
+    {
+    public:
+       /** Set this coordinate system to be the buoy with given params.
+        * @param anchorPt The location of the anchor.
+        * @param ctrPoint The center of the buoy circle.
+        * @param radius The radius of the circle.
+        * @param projPoint the point to project the buoy from, if it would be 
+        *              inside the circle just shifted.
+        * @param shiftAmount The amount to shift the buoy.
+        */
+       void setBuoy(Pt anchorPt, Pt ctrPoint, float radius, Pt projPoint, 
float shiftAmount) {
+
+           // shifted point: default buoy location
+           Pt shifted = anchorPt + (ctrPoint - projPoint) * shiftAmount;
+
+           float shiftrad = (shifted - ctrPoint).length();
+           float anchorrad = (anchorPt - ctrPoint).length();
+           
+           Pt buoy;
+           if(shiftrad >= radius) {
+               // if shifted point is outside circle, our work is done
+               buoy = shifted;
+           } else {
+               if(anchorrad >= radius)
+                   // otherwise, kludge it by placing it on the anchor.
+                   // There's a small jump here; we should do it differently.
+                   buoy = anchorPt; // XXX ???
+               else
+                   // If both anchor and shifted point are inside circle,
+                   // project.
+                   buoy = Geom::project2circle(anchorPt, projPoint, ctrPoint, 
radius);
+           }
+
+           float scale = 1-anchorrad / radius ;
+
+           if(scale <shiftAmount) {
+               scale = shiftAmount;
+           }
+           // DBG(dbg_buoy) << "final: "<<buoy << " "<<" "<<scale<<" "<<"\n";
+
+           this->x = buoy.x;
+           this->y = buoy.y;
+           this->z = - scale;
+           this->sx = scale;
+           this->sy = scale;
+
+       }
+    };
+
+    /*
+     * <p>
+     * The depth is between -1 (center) and 0 (edge)
+     * <p>
+     * Parameter layout:
+     *  x_circle, y_circle, radius, x_projpoint, y_projpoint, shiftamount
+     *  <p>
+     *  Linear interp between 0..1, 0..-1
+     */
+    class BuoyOnCircle1_Explicit :
+       public BuoyOnCircle1,
+       public DependentPrimitiveTransform,
+       public ParametrizedPrimitiveTransform
+    {
+    public:
+       enum { NDepends = 2, NParams = 6 }; // usual super and plus the anchor
+       template<class SPtr, class P> void setParams(SPtr depends, P params) {
+           ZPt anchor = depends[1]->transform(ZPt(0,0,0));
+
+           Pt ctr(params[0], params[1]);
+           float radius = params[2];
+           Pt proj(params[3], params[4]);
+           float shiftamount = params[5];
+
+           this->setBuoy(anchor, ctr, radius, proj, shiftamount);
+       }
+    };
+    VOB_PRIMITIVETRANS_DEFINED(BuoyOnCircle1_Explicit, "buoyOnCircle1");
+
 
     /** Orthonormal transformation along with setting the box 
      * size of the coordinate system.
Index: libvob/src/jni/Makefile-Gen
diff -u libvob/src/jni/Makefile-Gen:1.2 libvob/src/jni/Makefile-Gen:1.3
--- libvob/src/jni/Makefile-Gen:1.2     Thu Mar 27 05:11:46 2003
+++ libvob/src/jni/Makefile-Gen Tue Apr  1 07:53:56 2003
@@ -13,3 +13,4 @@
 Gen: Gen.o
        $(CXX) -o Gen $(CXXFLAGS) $(EXTRAINCLUDE) Gen.o ../util/Debug.o $(LIBS)
 
+include Gen.dep
Index: libvob/test/vob/gl/glvobcoorder.test
diff -u libvob/test/vob/gl/glvobcoorder.test:1.8 
libvob/test/vob/gl/glvobcoorder.test:1.9
--- libvob/test/vob/gl/glvobcoorder.test:1.8    Thu Mar 27 06:04:53 2003
+++ libvob/test/vob/gl/glvobcoorder.test        Tue Apr  1 07:53:56 2003
@@ -167,7 +167,15 @@
        [55, 15, 0]
     )
 
+def testBuoy():
 
+    cs_anch = c.translate(0, 50, 100)
+    cs_b = c.buoyOnCircle1(0, cs_anch, 
+       50, 100, 
+       25, 
+       25, 100,
+       .01)
+    checkTrans(vs, cs_b, [0, 0, 0], [75,100,-1])
 
 def testCulling():
     """Test culling.




reply via email to

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