Package pyscript :: Module objects :: Class AffineObj
[show private | hide private]
[frames | no frames]

Class AffineObj

object --+    
         |    
     PsObj --+
             |
            AffineObj

Known Subclasses:
Area, ArrowHead, Circle, Path

A base class for object that should implement affine transformations, this should apply to any object that draws on the page.
Method Summary
self concat(self, t, p)
concat matrix t to tranformation matrix
P etoi(self, p_e)
convert external to internal co-ords
P itoe(self, p_i)
convert internal to external co-ords
self move(self, *args)
translate object by a certain amount
string postbody(self)
undo coordinate system transformation
string prebody(self)
set up transformation of coordinate system
self reflect(self, angle, p)
reflect object in mirror
self rotate(self, angle, p)
rotate object, the rotation is around p when supplied otherwise it's the objects origin
self scale(self, sx, sy, p)
scale object size (towards objects origin or p)
self shear(self, s, angle, p)
shear object
    Inherited from PsObj
  __init__(self, **options)
can pass a dict of atributes to set
self __call__(self, **options)
Set a whole lot of attributes in one go
string __repr__(self)
Return a representation of this object
string __str__(self)
return actual postscript string to generate object
Bbox bbox(self)
return objects bounding box this can be a Null Bbox() if object doesn't draw anything on the page.)
string body(self)
subclasses should overide this for generating postscipt code
self copy(self, **options)
return a copy of this object with listed attributes modified
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T

Class Variable Summary
P o = <class 'pyscript.vectors.P'>
Matrix T = <pyscript.vectors.Matrix instance at 0x40449cec>

Method Details

concat(self, t, p=None)

concat matrix t to tranformation matrix
Parameters:
t - a 2x2 Matrix dectribing Affine transformation
p - the origin for the transformation
Returns:
reference to self
           (type=self)

etoi(self, p_e)

convert external to internal co-ords
Parameters:
p_e - external co-ordinate
Returns:
internal co-ordinate
           (type=P)

itoe(self, p_i)

convert internal to external co-ords
Parameters:
p_i - internal co-ordinate
Returns:
external co-ordinate
           (type=P)

move(self, *args)

translate object by a certain amount
Parameters:
args - amount to move by, can be given as
  • dx,dy
  • P
Returns:
reference to self
           (type=self)

postbody(self)

undo coordinate system transformation
Returns:
string
Overrides:
pyscript.base.PsObj.postbody

prebody(self)

set up transformation of coordinate system
Returns:
string
Overrides:
pyscript.base.PsObj.prebody

reflect(self, angle, p=None)

reflect object in mirror
Parameters:
angle - angle of mirror (deg clockwise from top)
p - origin of reflection
Returns:
reference to self
           (type=self)

rotate(self, angle, p=None)

rotate object, the rotation is around p when supplied otherwise it's the objects origin
Parameters:
angle - angle in degrees, clockwise
p - point to rotate around (external co-ords)
Returns:
reference to self
           (type=self)

scale(self, sx, sy=None, p=None)

scale object size (towards objects origin or p)
Parameters:
sx - x scale factor, or total scale factor if sy=None
sy - y scale factor
p - point around which to scale
Returns:
reference to self
           (type=self)

shear(self, s, angle, p=None)

shear object
Parameters:
s - amount of shear
angle - direction of shear (deg clockwise from top)
p - origin of shear
Returns:
reference to self
           (type=self)

Class Variable Details

o

Type:
P
Value:
<class 'pyscript.vectors.P'>                                           

T

Type:
Matrix
Value:
<pyscript.vectors.Matrix instance at 0x40449cec>                       

Generated by Epydoc 2.0 on Mon Apr 24 17:02:35 2006 http://epydoc.sf.net