[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx librenderables/renderables.py libutil/e...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx librenderables/renderables.py libutil/e... |
Date: |
Fri, 18 Oct 2002 10:02:39 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/10/18 10:02:14
Modified files:
gfx/librenderables: renderables.py
gfx/libutil : effects.py
Added files:
gfx/demo : xuconn.py
Log message:
paper connectors
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xuconn.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.105
gzz/gfx/librenderables/renderables.py:1.106
*** gzz/gfx/librenderables/renderables.py:1.105 Tue Oct 15 11:17:10 2002
--- gzz/gfx/librenderables/renderables.py Fri Oct 18 10:02:14 2002
***************
*** 1221,1226 ****
--- 1221,1242 ----
#endif
"""
},
+
+ {
+ "Type": "2",
+ "Name": "PaperConnector",
+ "Data" : """
+ float r, g, b;
+ float alpha_end;
+ float alpha_
+ """,
+ "Params": """
+ float r, float g, float b,
+ """,
+ "ParamCode" : """
+ this->ind = ind;
+ """,
+ },
]
def iddedParam(p):
Index: gzz/gfx/libutil/effects.py
diff -c gzz/gfx/libutil/effects.py:1.16 gzz/gfx/libutil/effects.py:1.17
*** gzz/gfx/libutil/effects.py:1.16 Tue Oct 8 14:23:43 2002
--- gzz/gfx/libutil/effects.py Fri Oct 18 10:02:14 2002
***************
*** 3,134 ****
from gzz.vob.buoy import Buoy3Floater, Buoy4Floater
import math
- class CircleFloater4(Buoy4Floater):
- def __init__(self, vs, parent, center, radius, p):
- self.__dict__.update(locals())
- def buoyCoordsys(self, anchorCS, key):
- cs = self.vs.coords.buoyOnCircle(
- self.parent, anchorCS,
- self.center[0], self.center[1],
- self.radius,
- self.p[0], self.p[1],
- 1)
- self.vs.matcher.add(cs, key)
- return cs
- def finishFloating(self):
- pass
-
- # Prototype: project to a semicircle
- # from a point.
- class NadirCircleFloater(Buoy3Floater):
- def __init__(self, vs, center, radius, p, nadir):
- self.vs, self.c, self.r, self.p, self.nadir = vs, center, radius, p,
nadir
- self.linecon = GLRen.createLineConnector(0, 0)
- def addBuoy(self, anchorX, anchorY, importance, key, w, h):
- size = importance
-
- # 1. find the projected buoy point
-
- # Vector from center to projection point
- AmC = (self.p[0] - self.c[0], self.p[1] - self.c[1])
-
- # Vector from anchor to projection point
- v = (anchorX - self.p[0], anchorY - self.p[1])
-
- # Coefficients of the 2nd degree eq
- a = v[0]*v[0] + v[1]*v[1]
- b = 2*(v[0]*AmC[0] + v[1]*AmC[1])
- c = AmC[0]*AmC[0] + AmC[1]*AmC[1] - self.r**2
-
- print "S: ",v,AmC,self.r, a,b,c
-
- # Determinant
- det = b**2 - 4*a*c
- if det <= 0:
- # For now, ignore
- print "Ignoring ",key
- b = (0,0)
-
- else:
-
- ans = (-b + math.sqrt(det)) / (2*a)
- print "DA: ",det,ans
-
- b = (self.p[0] + ans * v[0], self.p[1] + ans * v[1])
- print "Buoy: (%s,%s): (%s,%s)\n"%(
- anchorX, anchorY, b[0], b[1])
-
- # Create the coordinate system
-
- vs = self.vs
- cs1 = vs.coords.affineCoordsys(0, 50, b[0], b[1], size, 0, 0, size)
- vs.matcher.add(cs1, str(key)+"_buo_1")
- cs2 = vs.coords.rotateXY(cs1, -360 * self.nadir.getAngleRad(b[0], b[1])
/ (2 * math.pi))
- vs.matcher.add(cs2,str(key)+"_buo_2")
- return cs2
-
- # ac = vs.coords.coordsys(0, str(key)+"_5", 10, anchorX, anchorY, 0, 0)
- # bc = vs.coords.coordsys(0, str(key)+"_6", 10, b[0], b[1], 0, 0)
- # vs.map.put(self.linecon, ac, bc)
- def addCentralBuoy(self, key):
- b = self.c
- size = 1
- vs = self.vs
- cs = vs.coords.affineCoordsys(0, 100, b[0], b[1], size, 0, 0, size)
- vs.matcher.add(cs, str(key)+"_buo_1")
-
- cs2 = vs.coords.rotateXY(cs, 0)
- vs.matcher.add(cs2, str(key)+"_buo_2")
- return cs2
-
-
-
- # Prototype: just start from the middle, then up & down
- class NadirCircleFloater_NoAnchor(Buoy3Floater):
- def __init__(self, vs, center, radius, nadir, dir):
- self.vs, self.c, self.r, self.nadir = vs, center, radius, nadir
- self.dir = dir
- self.ind = 0
- self.angles = [0.2 * 2*math.pi, 0.4 * 2*math.pi]
- def addBuoy(self, anchorX, anchorY, importance, key, w, h):
- size = importance
-
- # 1. find the buoy point
-
- angle = self.angles[self.ind]
- angle *= self.dir
- self.ind += 1
-
- b = (self.c[0] + self.r * math.sin(angle),
- self.c[1] + self.r * math.cos(angle))
-
- print "Buoy: (%s,%s): (%s,%s)\n"%(
- anchorX, anchorY, b[0], b[1])
-
- # Create the coordinate system
-
- vs = self.vs
- cs1 = vs.coords.affineCoordsys(0, 50, b[0], b[1], size, 0, 0, size)
- vs.matcher.add(cs1, str(key)+"_buo_1")
- cs2 = vs.coords.rotateXY(cs1, 360 * self.nadir.getAngleRad(b[0], b[1])
/ (2 * math.pi))
- vs.matcher.add(cs2,str(key)+"_buo_2")
- return cs2
-
- # ac = vs.coords.coordsys(0, str(key)+"_5", 10, anchorX, anchorY, 0, 0)
- # bc = vs.coords.coordsys(0, str(key)+"_6", 10, b[0], b[1], 0, 0)
- # vs.map.put(self.linecon, ac, bc)
- def addCentralBuoy(self, key):
- b = self.c
- size = 1
- vs = self.vs
- cs = vs.coords.affineCoordsys(0, 100, b[0], b[1], size, 0, 0, size)
- vs.matcher.add(cs, str(key)+"_buo_1")
-
- cs2 = vs.coords.rotateXY(cs, 0)
- vs.matcher.add(cs2, str(key)+"_buo_2")
- return cs2
-
-
class IrreguFrame:
dicefactor = 0.8
--- 3,8 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx librenderables/renderables.py libutil/e...,
Tuomas J. Lukka <=