[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/libcoords Coords.cxx
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx/libcoords Coords.cxx |
Date: |
Tue, 08 Oct 2002 15:02:34 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/10/08 15:02:34
Modified files:
gfx/libcoords : Coords.cxx
Log message:
Buoys are starting to look good - scaling
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
Patches:
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.34 gzz/gfx/libcoords/Coords.cxx:1.35
*** gzz/gfx/libcoords/Coords.cxx:1.34 Tue Oct 8 14:23:43 2002
--- gzz/gfx/libcoords/Coords.cxx Tue Oct 8 15:02:34 2002
***************
*** 286,291 ****
--- 286,293 ----
class BuoyOnCircleCoords : public CoordSys {
ZVec tr;
CoordSys *anchor;
+ float scale;
+ bool valid;
public:
BuoyOnCircleCoords() : tr() { }
BuoyOnCircleCoords(ZVec tr) : tr(tr) { }
***************
*** 316,321 ****
--- 318,325 ----
float b = 2*v.dot(amc);
float c = amc.dot(amc) - radius*radius;
+ float rdist = (anchor-ctr).length() / radius;
+
float det = b*b - 4*a*c;
DBG(dbg_buoy) << "eq: "<<anchor<<" "<<amc<<" "<<v<<" "<<a<<"
"<<b<<" "<<c<<"\n";
***************
*** 330,352 ****
DBG(dbg_buoy) << "solution: "<<pt<<"\n";
}
tr = ctr + pointdir * (pt-ctr);
DBG(dbg_buoy) << "final: "<<tr<<"\n";
}
virtual CoordSys *createInverse() {
return new BuoyOnCircleCoords(-tr);
}
virtual void vertex(const ZPt &p) const {
! ZPt n = p + tr;
! glVertex3f(n.x, n.y, n.z);
}
virtual ZPt transform(const ZPt &p) const {
! return p + tr;
}
virtual bool canPerformGL() { return true; }
virtual bool performGL() {
glTranslatef(tr.x, tr.y, tr.z);
return true;
}
virtual bool getOthertypeParams(int type, float *into) {
--- 334,373 ----
DBG(dbg_buoy) << "solution: "<<pt<<"\n";
}
+
tr = ctr + pointdir * (pt-ctr);
DBG(dbg_buoy) << "final: "<<tr<<"\n";
+ if(rdist > 1) {
+ valid = 0;
+ scale = 0;
+ } else {
+ valid = 1;
+ scale = 1-rdist;
+ }
+
}
virtual CoordSys *createInverse() {
return new BuoyOnCircleCoords(-tr);
}
virtual void vertex(const ZPt &p) const {
! ZPt n = p;
! n.x *= scale;
! n.y *= scale;
! n += tr;
! super->vertex(n);
}
virtual ZPt transform(const ZPt &p) const {
! ZPt n = p;
! n.x *= scale;
! n.y *= scale;
! n += tr;
! return n;
}
virtual bool canPerformGL() { return true; }
virtual bool performGL() {
glTranslatef(tr.x, tr.y, tr.z);
+ glScalef(scale, scale, 1);
return true;
}
virtual bool getOthertypeParams(int type, float *into) {
***************
*** 355,367 ****
into[0] = tr.x;
into[1] = tr.y;
into[2] = tr.z;
! into[3] = 1;
into[4] = 0;
into[5] = 0;
! into[6] = 1;
return true;
}
return false;
}
};
--- 376,392 ----
into[0] = tr.x;
into[1] = tr.y;
into[2] = tr.z;
! into[3] = scale;
into[4] = 0;
into[5] = 0;
! into[6] = scale;
return true;
}
return false;
+ }
+ virtual bool shouldBeDrawn() {
+ return valid && super->shouldBeDrawn() && anchor->shouldBeDrawn();
+
}
};
- [Gzz-commits] gzz/gfx/libcoords Coords.cxx,
Tuomas J. Lukka <=