gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob/include/vob geom/Fillets2.hxx vobs/Fille...


From: Janne V. Kujala
Subject: [Gzz-commits] libvob/include/vob geom/Fillets2.hxx vobs/Fille...
Date: Tue, 24 Jun 2003 07:18:34 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Janne V. Kujala <address@hidden>        03/06/24 07:18:34

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

Log message:
        don't try to get proper 3D look: thickness based on 2D distance; 
prevent 'negative' stretching of the fillet shape

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

Patches:
Index: libvob/include/vob/geom/Fillets2.hxx
diff -u libvob/include/vob/geom/Fillets2.hxx:1.16 
libvob/include/vob/geom/Fillets2.hxx:1.17
--- libvob/include/vob/geom/Fillets2.hxx:1.16   Mon Jun 23 07:47:50 2003
+++ libvob/include/vob/geom/Fillets2.hxx        Tue Jun 24 07:18:34 2003
@@ -142,9 +142,11 @@
        ZVec projectToConnLine(ZVec v) const {
            float l = (v - node.ctr).xylength();
            v = v - norm.dot(v-node.ctr) * norm;
+#if 0
            if(dir.dot(v-node.ctr) <= node.r) {
                v = v - dir.dot(v-node.ctr) * dir;
            }
+#endif
            v.z = lerp(node.ctr.z, z, (l - node.r) / (d - node.r));
            return v;
        }
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.16 
libvob/include/vob/vobs/Fillet.hxx:1.17
--- libvob/include/vob/vobs/Fillet.hxx:1.16     Mon Jun 23 09:44:39 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Tue Jun 24 07:18:34 2003
@@ -285,18 +285,35 @@
 
        float csize = crad(t0);
 
-       Conn conn1(thick_t, angle_t, t0, t1, 0.5 * (p1 - ctr).length());
-       Conn conn2(thick_t, angle_t, t0, t2, 0.5 * (p2 - ctr).length());
+       Conn conn1(thick_t, angle_t, t0, t1, d1);//0.5 * (p1 - ctr).length());
+       Conn conn2(thick_t, angle_t, t0, t2, d2);//0.5 * (p2 - ctr).length());
 
-       // XXX: interpolate angle to zero ...
+       // XXX: prevent negative stretching by adjusting the "tangent"
+       // angles, if necessary
+       float r = csize;
+       float T1 = 0.5 * conn1.th;
+       float T2 = 0.5 * conn2.th;
+       float R1 = (d1*d1+T1*T1-r*r) / (2*r - 2*T1);
+       float R2 = (d2*d2+T2*T2-r*r) / (2*r - 2*T2);
+       float at1 = asin((T1 + R1) / (r + R1));
+       float at2 = asin((T2 + R2) / (r + R2));
+       if (conn1.a > at1) conn1.a = at1;
+       if (conn2.a > at2) conn2.a = at2;
+
+       // XXX: interpolate angle to zero from the point of
+       // "overlap" (i.e., where the beginning and end of the side
+       // of a fillet meet) to when the nodes coincide.
        float frac1 = 2 * d1 / (crad(t0) + crad(t1));
        float frac2 = 2 * d2 / (crad(t0) + crad(t2));
-       if (frac1 < 1.0) conn1.a *= sin(M_PI_2 * frac1);
-       if (frac2 < 1.0) conn2.a *= sin(M_PI_2 * frac2);
+       if (frac1 < 1.0) conn1.a = asin(T1 / r) * sin(M_PI_2 * frac1);
+       if (frac2 < 1.0) conn2.a = asin(T2 / r) * sin(M_PI_2 * frac2);
 
        float th1 = conn1.th;
        float th2 = conn2.th;
 
+       bool overlap1 = 2 * d1 <= (csize + crad(t1)) * cos(conn1.a);
+       bool overlap2 = 2 * d2 <= (csize + crad(t2)) * cos(conn2.a);
+
        DBG(dbg_vfillets) << "P: "<<ctr<<" "<<csize<<" "<<
                    a1<<" "<<d1<<" "<<th1<<" "<<
                    a2<<" "<<d2<<" "<<th2<<" "<<
@@ -305,9 +322,6 @@
        CircularNode node(ctr, csize);
        LinearConnectionHalf c1(node, a1, d1, th1, -1, lerp(p0.z, p1.z, .5));
        LinearConnectionHalf c2(node, a2, d2, th2, 1, lerp(p0.z, p2.z, .5));
-
-       bool overlap1 = 2 * d1 < (csize + crad(t1)) * cos(conn1.a);
-       bool overlap2 = 2 * d2 < (csize + crad(t2)) * cos(conn2.a);
 
        if(flags & 64) { // Stretched circle
 




reply via email to

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