gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob/include/vob/vobs Trivial.hxx


From: Asko Soukka
Subject: [Gzz-commits] libvob/include/vob/vobs Trivial.hxx
Date: Tue, 08 Apr 2003 15:44:00 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Asko Soukka <address@hidden>    03/04/08 15:44:00

Modified files:
        include/vob/vobs: Trivial.hxx 

Log message:
        forgot this

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.13 
libvob/include/vob/vobs/Trivial.hxx:1.14
--- libvob/include/vob/vobs/Trivial.hxx:1.13    Fri Apr  4 07:34:59 2003
+++ libvob/include/vob/vobs/Trivial.hxx Tue Apr  8 15:44:00 2003
@@ -27,6 +27,8 @@
 #ifndef VOB_VOBS_TRIVIAL
 #define VOB_VOBS_TRIVIAL
 
+#include <math.h>
+
 #include <GL/gl.h>
 #include <vob/Types.hxx>
 
@@ -65,6 +67,49 @@
 };
 
 VOB_DEFINED(LineConnector);
+
+/** A line drawn from the center of the first coordinate system
+ *  towards the center of another coordinate system and the end
+ *  decorated with a circle.
+ */
+struct PinStub {
+    enum { NTrans = 2 };
+  
+  /** Mounting points for connection. */
+    float px0, py0, px1, py1, factor, radius;
+
+    template<class F> void params(F &f) {
+       f(px0, py0, px1, py1, factor, radius);
+    }
+
+    template<class T> void render(const T &t0, const T &t1) const {
+        Pt box0 = t0.getSqSize();
+        Pt box1 = t1.getSqSize();
+
+       ZPt pt0 = t0.transform(ZPt(box0.x*px0, box0.y*py0, 0));
+       ZPt pt1 = t1.transform(ZPt(box1.x*px1, box1.y*py1, 0));
+
+       float len = sqrt(pow(pt1.x-pt0.x, 2)
+                        + pow(pt1.y-pt0.y, 2));
+       float dx, dy;
+       dx = (int)(((1-factor)*len*pt0.x + (factor)*len*pt1.x)/len);
+       dy = (int)(((1-factor)*len*pt0.y + (factor)*len*pt1.y)/len);
+
+       glBegin(GL_LINES);
+           glVertex3f(pt0.x, pt0.y, 0);
+           glVertex3f(dx, dy, 0);
+       glEnd();
+
+       glBegin(GL_POLYGON);
+            for (double i=0; i<360; i+=36) {
+               float a = (float)((M_PI / 180) * (360-i));
+               glVertex3f(dx+cos(a)*radius, dy+sin(a)*radius, 0);
+           }
+       glEnd();
+    }
+};
+
+VOB_DEFINED(PinStub);
 
 struct CallList {
     enum { NTrans = 0 };




reply via email to

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