gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/geom/Fillets.hxx include/vob...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/geom/Fillets.hxx include/vob...
Date: Thu, 29 May 2003 12:14:07 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/29 12:14:06

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

Log message:
        Show depth in color - apparently, still SERIOUS issues about that...

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

Patches:
Index: libvob/include/vob/geom/Fillets.hxx
diff -u libvob/include/vob/geom/Fillets.hxx:1.2 
libvob/include/vob/geom/Fillets.hxx:1.3
--- libvob/include/vob/geom/Fillets.hxx:1.2     Thu May 29 10:35:40 2003
+++ libvob/include/vob/geom/Fillets.hxx Thu May 29 12:14:06 2003
@@ -14,6 +14,7 @@
     Vec ctr;
     Vec filletcenter;
     float filletrad;
+    float dist;
 
     /** A unit vector pointing to the direction of the 
      * connection side.
@@ -32,8 +33,9 @@
            float sign,
            float dist,
            float thick) {
-       this->r = r;
        this->ctr = ctr;
+       this->r = r;
+       this->dist = dist;
        Vec dir = dirVec(angle);
        Vec p = ctr + dist * dir + .5 * thick * sign * dir.cw90();
        this->filletcenter = 
@@ -62,7 +64,7 @@
            if(succ) {
                return (in-ctr).length();
            } else {
-               return r;
+               return dist;
            }
 
        } else {
@@ -183,6 +185,7 @@
                        da * curvfra, 
                                    d * r0, 
                                    f);
+               p.z = lerp(ctr.z, za, ((p-ctr).length() - r) / (this->da-r));
 
                //DBG(dbg_fillets) << "f<.5: "<<ang<<" "<<ra<<" "<<rb<<" "<<
                //          p <<"\n";
@@ -205,6 +208,7 @@
                        db * curvfra, 
                                    d * r0, 
                                    f);
+               p.z = lerp(ctr.z, zb, ((p-ctr).length() - r) / (this->db-r));
 
                return p;
 
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.2 
libvob/include/vob/vobs/Fillet.hxx:1.3
--- libvob/include/vob/vobs/Fillet.hxx:1.2      Thu May 29 10:35:40 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Thu May 29 12:14:06 2003
@@ -121,12 +121,27 @@
        float rmin = r0 <? r1;
        if(d <= rmax - rmin) return .96 * rmin;
        float dr = (d - (rmax-rmin)) / (r0 + r1);
-       return .96 * rmin *  .1 / (.1 + dr);
+       return .96 * rmin *  1 / (1 + dr);
     }
     
     template<class F> void params(F &f) {
        f(ndice, flags);
     }
+
+    void v(ZVec p) const {
+       if(flags & 4) {
+           glColor3f(1, p.z / 60, p.z / 60);
+       }
+       glVertex(p);
+    }
+
+    void vl(ZVec p) const {
+       if(flags & 4) {
+           glColor3f(1 - p.z / 60, 0, 0);
+       }
+       glVertex(p);
+    }
+
     template<class T> void render(const T &t0, const T &t1, const T &t2) 
            const {
        ZVec p0 = t0.transform(t0.getSqSize());
@@ -162,28 +177,45 @@
        // Render it. XXX -- jvk, you need to make this
        // render the solid fillet.
        if(sp.split()) {
-           glBegin(GL_LINE_STRIP); 
-           for(float f = 0; f < .5; f+= 1.0 / ndice) {
-               Vec p = sp.point(f, BlendSimply());
-               glVertex3f(p.x, p.y, 
-                           lerp(p1.z, p0.z, 2*f) );
+           if(flags & 1) {
+               ZVec intern;
+               glBegin(GL_QUAD_STRIP); 
+               for(float f = 0; f < .5; f+= 1.0 / ndice) {
+                   ZVec p = sp.point(f, BlendSimply(), &intern);
+                   v(p);
+                   v(intern);
+               }
+               glEnd();
+               glBegin(GL_QUAD_STRIP);
+               for(float f = 1; f > .5; f-= 1.0 / ndice) {
+                   ZVec p = sp.point(f, BlendSimply(), &intern);
+                   v(p);
+                   v(intern);
+               }
+               glEnd();
            }
-           glEnd();
-           glBegin(GL_LINE_STRIP);
-           for(float f = 1; f > .5; f-= 1.0 / ndice) {
-               Vec p = sp.point(f, BlendSimply());
-               glVertex3f(p.x, p.y, 
-                           lerp(p2.z, p0.z, 2*(1-f)) );
+           if(flags & 2) {
+               glBegin(GL_LINE_STRIP); 
+               for(float f = 0; f < .5; f+= 1.0 / ndice) {
+                   Vec p = sp.point(f, BlendSimply());
+                   vl(p);
+               }
+               glEnd();
+               glBegin(GL_LINE_STRIP);
+               for(float f = 1; f > .5; f-= 1.0 / ndice) {
+                   Vec p = sp.point(f, BlendSimply());
+                   vl(p);
+               }
+               glEnd();
            }
-           glEnd();
        } else {
            if(flags & 1) {
                ZVec intern;
                glBegin(GL_QUAD_STRIP); 
                for(float f = 0; f < 1; f+= 1.0 / ndice) {
                    ZVec p = sp.point(f, BlendSimply(), &intern);
-                   glVertex(p);
-                   glVertex(intern);
+                   v(p);
+                   v(intern);
                }
                glEnd();
            } 
@@ -191,7 +223,7 @@
                glBegin(GL_LINE_STRIP); 
                for(float f = 0; f < 1; f+= 1.0 / ndice) {
                    ZVec p = sp.point(f, BlendSimply(), 0);
-                   glVertex(p);
+                   vl(p);
                }
                glEnd();
            }
Index: libvob/vob/demo/multifil.py
diff -u libvob/vob/demo/multifil.py:1.2 libvob/vob/demo/multifil.py:1.3
--- libvob/vob/demo/multifil.py:1.2     Thu May 29 10:35:40 2003
+++ libvob/vob/demo/multifil.py Thu May 29 12:14:06 2003
@@ -18,6 +18,7 @@
            SlideLin("y", 300, 20, "y", "Up", "Down"),
            Toggle("drawEdge", 1, "Draw edge", "e"),
            Toggle("drawInside", 1, "Draw inside", "i"),
+           Toggle("depthColor", 0, "Color from depth", "d"),
        )
     def scene(self, vs):
        putnoc(vs, background((.5,1,.2)))
@@ -28,9 +29,9 @@
        """))
 
        conns = GLRen.createSortedConnections(
-           GLRen.createFilletSpan1(1000, 1))
+           GLRen.createFilletSpan1(1000, 1 + 4*self.depthColor))
        conns_l = GLRen.createSortedConnections(
-           GLRen.createFilletSpan1(1000, 2))
+           GLRen.createFilletSpan1(1000, 2 + 4*self.depthColor))
 
        size = 50
        




reply via email to

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