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: Wed, 25 Jun 2003 07:58:53 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Janne V. Kujala <address@hidden>        03/06/25 07:58:53

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

Log message:
        experimenting with z calculation

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

Patches:
Index: libvob/include/vob/geom/Fillets2.hxx
diff -u libvob/include/vob/geom/Fillets2.hxx:1.22 
libvob/include/vob/geom/Fillets2.hxx:1.23
--- libvob/include/vob/geom/Fillets2.hxx:1.22   Wed Jun 25 05:44:11 2003
+++ libvob/include/vob/geom/Fillets2.hxx        Wed Jun 25 07:58:53 2003
@@ -140,25 +140,28 @@
         * XXX Z calculation needs thinking.
         */
        ZVec projectToConnLine(ZVec v) const {
-           float l = dir.dot(v - node.ctr);
            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
-           float f = (l - node.r) / (d - node.r);
-           if (d <= node.r)
-               v.z = node.ctr.z;
-           else if (f >= 1)
-               v.z = z;
-           else if (f >= 0)
-               v.z = lerp(node.ctr.z, z, f);
-           else 
-               v.z = node.ctr.z;
+           v.z = depth(v);
            return v;
        }
 
+       float depth(Vec v) const {
+           float l = dir.dot(v - node.ctr);
+           //float l = (v - node.ctr).length();
+           float f = (l - node.r) / (d - node.r);
+           if (d > node.r)
+               if (f >= 1)
+                   return z;
+               else if (f >= 0)
+                   return lerp(node.ctr.z, z, f);
+           return node.ctr.z;
+       }
+
     };
 
     /** A nonlinearly stretched circle fillet (test). 
@@ -213,7 +216,8 @@
            ZVec pt = node.ctr + xn * conn.dir + y * conn.norm;
 
            ZVec proj = conn.projectToConnLine(pt);
-           pt.z = proj.z;
+           //pt.z = proj.z;
+           pt.z = conn.depth(pt);
            if(intern) {
                //if(fract > .94)
                //    *intern = node.ctr;
@@ -558,10 +562,9 @@
            ZVec p2 = other.point(Vec(p-main.node.ctr).normalized(), success);
            ZVec res;
            if(success) {
-               ZVec edgep = .5 *(p + p2 - 2 * main.node.ctr);
-               edgep *= main.node.r / edgep.xylength();
-               edgep += main.node.ctr;
-               res = p + p2 - edgep;
+               Vec edgep = p + p2 - 2 * main.node.ctr;
+               edgep *= main.node.r / edgep.length();
+               res = p + p2 - main.node.ctr - edgep;
            } else {
                res = p;
            } 
@@ -627,7 +630,7 @@
            v1(node.ctr + node.r * dirVec(aend)) {
        }
        CircularSliceSpan(const CircularNode &node, 
-                         Vec vstart, Vec vend)  :
+                         Vec vstart, Vec vend, int mode = 0) :
            node(node), 
            v0(vstart.x, vstart.y, node.ctr.z), 
            v1(vend.x, vend.y, node.ctr.z) {
@@ -635,7 +638,7 @@
 
        ZVec point(float fract, ZVec *intern = 0) const {
            if(intern) *intern = node.ctr - ZVec(0,0,20);
-           return lerp(v0, v1, fract);
+           return lerp(v0, v1, fract);;
        }
 
     };
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.23 
libvob/include/vob/vobs/Fillet.hxx:1.24
--- libvob/include/vob/vobs/Fillet.hxx:1.23     Wed Jun 25 05:44:11 2003
+++ libvob/include/vob/vobs/Fillet.hxx  Wed Jun 25 07:58:53 2003
@@ -367,16 +367,13 @@
                            makeLerpFilletSpan(
                                               makeFilletBlend(f1, vf2),
                                               f1,
-                                              fract), 1,
-                           overlap1);
+                                              fract), 1, overlap1);
 
                renderSpan2(node, a2,
                            makeLerpFilletSpan(
                                               makeFilletBlend(f2, vf1),
                                               f2,
-                                              fract), -1,
-                           overlap2
-                           );
+                                              fract), -1, overlap2);
            } else 
                renderNormalOrBlend(node, f1, f2, overlap1, overlap2);
        } else if(flags & 16) { // Ellipses
@@ -494,10 +491,8 @@
     }
 
     template<class F> void renderSpan2(const CircularNode &node, float a0, 
const F &f, int sign, bool overlap) const {
-       Vec p1 = f.point(1);
-       Vec n = dirVec(a0).cw90();
-       Vec p2 = p1 - node.ctr;
-       p2 = p2 - n.dot(p2) * n + node.ctr;
+       ZVec p2;
+       ZVec p1 = f.point(1, &p2);
        if (flags & 128)
            renderSpan(CircularSliceSpan(node, p1, p2), 0);
        if (!overlap) renderSpan(f, sign);




reply via email to

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