gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul...
Date: Fri, 06 Jun 2003 10:13:37 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/06/06 10:13:37

Modified files:
        include/vob/vobs: Fillet.hxx 
        vob/demo/multifil: multifil.py 

Log message:
        twids

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/multifil.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.10 
libvob/include/vob/vobs/Fillet.hxx:1.11
--- libvob/include/vob/vobs/Fillet.hxx:1.10     Fri Jun  6 04:31:00 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Fri Jun  6 10:13:37 2003
@@ -194,7 +194,11 @@
     }
 
     template<class G> void renderSpanPolyedged(const G &g, int sign) const {
-       glBegin(GL_QUAD_STRIP); 
+       // 32 = show curvature lines
+       if(flags & 32) 
+           glBegin(GL_LINES); 
+       else 
+           glBegin(GL_QUAD_STRIP); 
        ZVec intern0;
        ZVec p0 = g.point(0, &intern0);
 
@@ -203,7 +207,8 @@
 
        ZVec normal0 = sign * Vec(p1-p0).cw90().normalized();
 
-       pointInternNormal(p0, intern0, normal0);
+       if(!(flags & 32))
+           pointInternNormal(p0, intern0, normal0);
 
        ZVec prevpt = p0;
        ZVec curpt = p1; ZVec curintern = intern1;
@@ -214,14 +219,29 @@
            nextpt = g.point(fract, &nextintern);
 
            ZVec normal = sign * Vec(nextpt - prevpt).cw90().normalized();
-           pointInternNormal(curpt, curintern, normal);
+
+           if(flags & 32) {
+               glVertex(curpt);
+               // Calculate curvature
+               Vec d = (nextpt - prevpt) / 2;
+               Vec dd = (nextpt - 2* curpt + prevpt);
+               float l = d.length();
+               float k = (d.x * dd.y - d.y * dd.x) / (l * l * l);
+
+               glVertex(curpt + border * k * normal * sign);
+               
+               
+           } else
+               pointInternNormal(curpt, curintern, normal);
+
            prevpt = curpt;
            curpt = nextpt;
            curintern = nextintern;
        }
 
        ZVec normalLast = sign * Vec(curpt - prevpt).cw90().normalized();
-       pointInternNormal(curpt, curintern, normalLast);
+       if(!(flags & 32))
+           pointInternNormal(curpt, curintern, normalLast);
        
        glEnd();
     }
Index: libvob/vob/demo/multifil/multifil.py
diff -u libvob/vob/demo/multifil/multifil.py:1.9 
libvob/vob/demo/multifil/multifil.py:1.10
--- libvob/vob/demo/multifil/multifil.py:1.9    Fri Jun  6 07:29:41 2003
+++ libvob/vob/demo/multifil/multifil.py        Fri Jun  6 10:13:37 2003
@@ -24,6 +24,7 @@
            Toggle("depthColor", 0, "Color from depth", "d"),
            Toggle("lines", 0, "Toggle showing lines", "l"),
            Toggle("ellipses", 1, "Toggle ellipses", "s"),
+           Toggle("curvature", 1, "Show curvature", "c"),
            SlideLin("size", 50, 5, "Node size", "K", "k"),
            SlideLin("dice", 20, 1, "Dice factor", "P", "p"),
        )
@@ -45,7 +46,6 @@
 
        thick = vs.orthoCS(0, "Thi", 0, self.thick, 0, 0, 0);
 
-       dice = 20
        border = 2
        conns = GLRen.createSortedConnections(
            GLRen.createFilletSpan2(border, self.dice, 
@@ -55,6 +55,10 @@
            GLRen.createFilletSpan2(border, self.dice, 
                            2 + 4*self.depthColor + 16 * self.ellipses),
            2)
+       conns_c = GLRen.createSortedConnections(
+           GLRen.createFilletSpan2(1000, self.dice, 
+                           2 + 4*self.depthColor + 16 * self.ellipses + 32),
+           2)
 
        a = vs.orthoBoxCS(0, "A", 0, 100, 100, 1, 1, self.size, self.size);
        b = vs.orthoBoxCS(0, "B", 25, self.x, self.y, 1, 1, self.size, 
self.size);
@@ -88,6 +92,8 @@
            Color 0 0 0
        """))
        if self.drawEdge: pc(conns_l)
+
+       if self.curvature : pc(conns_c)
 
        vs.put(getDListNocoords("""
            PopAttrib




reply via email to

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