[Top][All Lists]
[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 14:47:17 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/05/29 14:47:17
Modified files:
include/vob/geom: Fillets.hxx
include/vob/vobs: Fillet.hxx
vob/demo : multifil.py
Log message:
Duh\! Fix depth of edges, now small angles work beautifully.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/geom/Fillets.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: libvob/include/vob/geom/Fillets.hxx
diff -u libvob/include/vob/geom/Fillets.hxx:1.4
libvob/include/vob/geom/Fillets.hxx:1.5
--- libvob/include/vob/geom/Fillets.hxx:1.4 Thu May 29 12:35:16 2003
+++ libvob/include/vob/geom/Fillets.hxx Thu May 29 14:47:17 2003
@@ -167,7 +167,6 @@
template <class Blender> ZVec point(float fract, const Blender &blend,
ZVec *intern = 0) {
if(type == CLEAVE) {
- if(intern) *intern = ctr;
if(fract < .5) {
// Angle of real current sample
float ang = lerp(aa, aang, 2*fract);
@@ -187,6 +186,19 @@
f);
p.z = lerp(ctr.z, za, ((p-ctr).length() - r) / (this->da-r));
+ if(intern) {
+ if(fract < .47) {
+ *intern = p-ctr;
+ intern->z = 0;
+ *intern -= intern->dot(a.dirconn.cw90()) *
a.dirconn.cw90();
+ intern->z = p.z - ctr.z;
+ if(intern->length() <= r) *intern = ZVec(0,0,0);
+ *intern += ctr;
+ } else {
+ *intern = ctr;
+ }
+ }
+
//DBG(dbg_fillets) << "f<.5: "<<ang<<" "<<ra<<" "<<rb<<" "<<
// p <<"\n";
return p;
@@ -210,6 +222,21 @@
f);
p.z = lerp(ctr.z, zb, ((p-ctr).length() - r) / (this->db-r));
+ if(intern) {
+ if(fract < .47) {
+ *intern = p-ctr;
+ intern->z = 0;
+ *intern -= intern->dot(b.dirconn.cw90()) *
b.dirconn.cw90();
+ intern->z = p.z - ctr.z;
+ if(intern->length() <= r) *intern = ZVec(0,0,0);
+ *intern += ctr;
+ } else {
+ *intern = ctr;
+ }
+ }
+
+
+
return p;
}
@@ -236,14 +263,14 @@
}
ZVec res = ctr + d * resr;
if(intern) {
- if(fract > .48 && fract < .52) {
- *intern = ctr;
- } else if(ra > rb) {
+ if(fract < .47) {
*intern = d*resr;
*intern -= intern->dot(a.dirconn.cw90()) * a.dirconn.cw90();
intern->z = z - ctr.z;
if(intern->length() <= r) *intern = ZVec(0,0,0);
- *intern += ctr;
+ *intern += ctr;
+ } else if(fract < .53) {
+ *intern = ctr;
} else {
*intern = d*resr;
*intern -= intern->dot(b.dirconn.cw90()) * b.dirconn.cw90();
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.3
libvob/include/vob/vobs/Fillet.hxx:1.4
--- libvob/include/vob/vobs/Fillet.hxx:1.3 Thu May 29 12:14:06 2003
+++ libvob/include/vob/vobs/Fillet.hxx Thu May 29 14:47:17 2003
@@ -130,14 +130,14 @@
void v(ZVec p) const {
if(flags & 4) {
- glColor3f(1, p.z / 60, p.z / 60);
+ glColor3f(1, p.z / 100, p.z / 100);
}
glVertex(p);
}
void vl(ZVec p) const {
if(flags & 4) {
- glColor3f(1 - p.z / 60, 0, 0);
+ glColor3f(0,p.z / 100, p.z / 100);
}
glVertex(p);
}
@@ -172,8 +172,8 @@
"\n";
FilletSpan sp(ctr, csize,
- a1, d1, th1, p1.z,
- a2, d2, th2, p2.z);
+ a1, d1, th1, lerp(p0.z, p1.z, .5),
+ a2, d2, th2, lerp(p0.z, p2.z, .5));
// Render it. XXX -- jvk, you need to make this
// render the solid fillet.
if(sp.split()) {
@@ -197,13 +197,13 @@
if(flags & 2) {
glBegin(GL_LINE_STRIP);
for(float f = 0; f < .5; f+= 1.0 / ndice) {
- Vec p = sp.point(f, BlendSimply());
+ ZVec 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());
+ ZVec p = sp.point(f, BlendSimply());
vl(p);
}
glEnd();
Index: libvob/vob/demo/multifil.py
diff -u libvob/vob/demo/multifil.py:1.4 libvob/vob/demo/multifil.py:1.5
--- libvob/vob/demo/multifil.py:1.4 Thu May 29 12:35:16 2003
+++ libvob/vob/demo/multifil.py Thu May 29 14:47:17 2003
@@ -26,14 +26,16 @@
vs.put(getDListNocoords("""
PushAttrib POLYGON_BIT
Enable DEPTH_TEST
+ DepthFunc LEQUAL
LineWidth 1
PolygonOffset 0 0
+ ShadeModel SMOOTH
"""))
if self.lines:
vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))
- dice = 20
+ dice = 200
conns = GLRen.createSortedConnections(
GLRen.createFilletSpan1(dice, 1 + 4*self.depthColor))
conns_l = GLRen.createSortedConnections(
@@ -41,11 +43,11 @@
size = 50
- a = vs.orthoBoxCS(0, "A", 10, 100, 100, 1, 1, size, size);
- b = vs.orthoBoxCS(0, "B", 20, self.x, self.y, 1, 1, size, size);
- c = vs.orthoBoxCS(0, "C", 30, 200, 500, 1, 1, size, size);
- d = vs.orthoBoxCS(0, "D", 40, 100, 300, 1, 1, size, size);
- e = vs.orthoBoxCS(0, "E", 50, 500, 500, 1, 1, size, size);
+ a = vs.orthoBoxCS(0, "A", 0, 100, 100, 1, 1, size, size);
+ b = vs.orthoBoxCS(0, "B", 25, self.x, self.y, 1, 1, size, size);
+ c = vs.orthoBoxCS(0, "C", 50, 200, 500, 1, 1, size, size);
+ d = vs.orthoBoxCS(0, "D", 75, 100, 300, 1, 1, size, size);
+ e = vs.orthoBoxCS(0, "E", 100, 500, 500, 1, 1, size, size);
def pc(conns):
vs.put(conns, [a, b, c, d])