[Top][All Lists]
[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: |
Sat, 05 Jul 2003 07:55:58 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/07/05 07:55:57
Modified files:
include/vob/geom: Fillets2.hxx
include/vob/vobs: Fillet.hxx
Log message:
twid
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/geom/Fillets2.hxx.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
Patches:
Index: libvob/include/vob/geom/Fillets2.hxx
diff -u libvob/include/vob/geom/Fillets2.hxx:1.30
libvob/include/vob/geom/Fillets2.hxx:1.31
--- libvob/include/vob/geom/Fillets2.hxx:1.30 Fri Jul 4 13:29:12 2003
+++ libvob/include/vob/geom/Fillets2.hxx Sat Jul 5 07:55:57 2003
@@ -723,8 +723,6 @@
ZVec dir;
float a0;
- float da;
- float sin_da;
vector<float> rtbl;
Filletoid(const CircularNode &node,
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.46
libvob/include/vob/vobs/Fillet.hxx:1.47
--- libvob/include/vob/vobs/Fillet.hxx:1.46 Fri Jul 4 13:29:12 2003
+++ libvob/include/vob/vobs/Fillet.hxx Sat Jul 5 07:55:57 2003
@@ -684,11 +684,12 @@
typedef Filletoid<StretchedCircleFillet> Conn;
ZVec blend(Conn *conns[], int N, float r, ZVec pt,
- int *maxi = NULL) const {
+ int *maxip = NULL) const {
int i, num = 0;
double sum = 0;
float x[N];
- float maxt = 0;
+ float maxt = -1;
+ int maxi = -1;
pt = pt.normalized();
@@ -697,21 +698,28 @@
for (i = 0; i < N; i++) {
bool success;
float t = conns[i]->rad(pt, success);
- if (t < r) t = r;
- if (success) {
+ if (success && t > r) {
+ if (t > maxt) maxt = t, maxi = i;
+ x[num++] = (t - r) / r;
+
+ // Approximate the slope of the fillet surface
+ float t0 = sqrt(conns[i]->c.d * conns[i]->c.d +
+ conns[i]->c.t * conns[i]->c.t);
+ t = (t - r) / (t0 - r);
+ t = (t >? 0) <? 1;
+ t = sqrt(t * (2 - t)) / (1 - t);
+
+ sum += t;
+
//cout << t << " ";
- sum += x[num++] = (t - r) / r;
- if (maxi) {
- if (t > maxt) maxt = t, *maxi = i;
- }
}
}
+ if (maxip) *maxip = maxi;
// Compute p for an l^p norm to be used as the blending function
// p == 1: sum of distances,
// p == \infty: maximum of distances
float p = 1.0 + sum;
- if (p > 100) p = 100;
//cout << "p=" << p << " ";
@@ -719,6 +727,9 @@
for (i = 0; i < num; i++) {
sum += pow(x[i], p);
}
+
+ if (!finite(sum) || !finite(p))
+ return pt * maxt;
//cout << "->" << pow(sum, 1 / p) << std::endl;
@@ -879,8 +890,19 @@
glNormal(norm[i * m + (j + 1) % m]);
glVertex(pt[i * m + (j + 1) % m]);
- if (clip[i * m + j] &&
- clip[i * m + (j + 1)]) break;
+ int k;
+ for (k = i; k < n; k++)
+ if (!clip[k * m + j] ||
+ !clip[i * m + (j + 1)])
+ break;
+ if (k > i) {
+ if (k == n) break;
+ if (k >= i + 2) {
+ glEnd();
+ i = k - 2;
+ glBegin(GL_QUAD_STRIP);
+ }
+ }
}
glEnd();
}