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


From: Janne V. Kujala
Subject: [Gzz-commits] libvob/include/vob/vobs Fillet.hxx
Date: Tue, 24 Jun 2003 09:26:22 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Janne V. Kujala <address@hidden>        03/06/24 09:26:22

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

Log message:
        handle zero normal in renderSpanPolyedged

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

Patches:
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.20 
libvob/include/vob/vobs/Fillet.hxx:1.21
--- libvob/include/vob/vobs/Fillet.hxx:1.20     Tue Jun 24 08:17:40 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Tue Jun 24 09:26:22 2003
@@ -207,6 +207,13 @@
        }
     }
 
+
+    ZVec norm(ZVec v) const {
+       if (v.length() > 0) 
+           return v.normalized();
+       return ZVec(0,0,0);
+    }
+
     template<class G> void renderSpanPolyedged(const G &g, int sign) const {
        // 32 = show curvature lines
        if(flags & 32) 
@@ -219,7 +226,7 @@
        ZVec intern1;
        ZVec p1 = g.point(1 / (ndice-1.0), &intern1);
 
-       ZVec normal0 = sign * Vec(p1-p0).cw90().normalized();
+       ZVec normal0 = sign * norm(Vec(p1-p0).cw90());
 
        if(!(flags & 32))
            pointInternNormal(p0, intern0, normal0);
@@ -232,7 +239,7 @@
            float fract = (i+1) / (ndice-1.0);
            nextpt = g.point(fract, &nextintern);
 
-           ZVec normal = sign * Vec(nextpt - prevpt).cw90().normalized();
+           ZVec normal = sign * norm(Vec(nextpt - prevpt).cw90());
 
            if(flags & 32) {
                glVertex(curpt);
@@ -253,7 +260,7 @@
            curintern = nextintern;
        }
 
-       ZVec normalLast = sign * Vec(curpt - prevpt).cw90().normalized();
+       ZVec normalLast = sign * norm(Vec(curpt - prevpt).cw90());
        if(!(flags & 32))
            pointInternNormal(curpt, curintern, normalLast);
        




reply via email to

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