CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes

svgfig::Ellipse Class Reference

Inheritance diagram for svgfig::Ellipse:
svgfig::Curve

List of all members.

Public Member Functions

def __init__
def __repr__
def Path
def SVG

Public Attributes

 attr
 b
 f
 high
 loop
 low

Static Public Attributes

dictionary defaults = {}

Detailed Description

Draws an ellipse from a semimajor vector (ax,ay) and a semiminor
length (b).

Ellipse(x, y, ax, ay, b, attribute=value)

x, y                    required        the center of the ellipse/circle
ax, ay                  required        a vector indicating the length
                                        and direction of the semimajor axis
b                       required        the length of the semiminor axis.
                                        If equal to sqrt(ax2 + ay2), the
                                        ellipse is a circle
attribute=value pairs   keyword list    SVG attributes

(If sqrt(ax**2 + ay**2) is less than b, then (ax,ay) is actually the
semiminor axis.)

Definition at line 2235 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::Ellipse::__init__ (   self,
  x,
  y,
  ax,
  ay,
  b,
  attr 
)

Definition at line 2257 of file svgfig.py.

02258                                              :
02259     self.x, self.y, self.ax, self.ay, self.b = x, y, ax, ay, b
02260 
02261     self.attr = dict(self.defaults)
02262     self.attr.update(attr)


Member Function Documentation

def svgfig::Ellipse::__repr__ (   self)

Reimplemented from svgfig::Curve.

Definition at line 2254 of file svgfig.py.

02255                     :
02256     return "<Ellipse (%g, %g) a=(%g, %g), b=%g %s>" % (self.x, self.y, self.ax, self.ay, self.b, self.attr)

def svgfig::Ellipse::Path (   self,
  trans = None,
  local = False 
)
Apply the transformation "trans" and return a Path object in
global coordinates.  If local=True, return a Path in local coordinates
(which must be transformed again).

Reimplemented from svgfig::Curve.

Definition at line 2267 of file svgfig.py.

02268                                          :
02269     """Apply the transformation "trans" and return a Path object in
02270     global coordinates.  If local=True, return a Path in local coordinates
02271     (which must be transformed again)."""
02272     angle = math.atan2(self.ay, self.ax) + math.pi/2.
02273     bx = self.b * math.cos(angle)
02274     by = self.b * math.sin(angle)
02275 
02276     self.f = lambda t: (self.x + self.ax*math.cos(t) + bx*math.sin(t), self.y + self.ay*math.cos(t) + by*math.sin(t))
02277     self.low = -math.pi
02278     self.high = math.pi
02279     self.loop = True
02280     return Curve.Path(self, trans, local)

def svgfig::Ellipse::SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Reimplemented from svgfig::Curve.

Definition at line 2263 of file svgfig.py.

02264                            :
02265     """Apply the transformation "trans" and return an SVG object."""
02266     return self.Path(trans).SVG()


Member Data Documentation

Reimplemented from svgfig::Curve.

Definition at line 2257 of file svgfig.py.

Definition at line 2257 of file svgfig.py.

dictionary svgfig::Ellipse::defaults = {} [static]

Reimplemented from svgfig::Curve.

Definition at line 2252 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2269 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2269 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2269 of file svgfig.py.

Reimplemented from svgfig::Curve.

Definition at line 2269 of file svgfig.py.