File: plane.py

package info (click to toggle)
python-scipy 0.3.2-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,572 kB
  • ctags: 20,326
  • sloc: ansic: 87,138; fortran: 51,876; python: 47,747; cpp: 2,134; objc: 384; makefile: 175; sh: 83
file content (37 lines) | stat: -rw-r--r-- 893 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (c) 1996, 1997, The Regents of the University of California.
# All rights reserved.  See Legal.htm for full text and disclaimer.

from slice3 import plane3
from Numeric import *
from scipy_base.fastumath import *
from graftypes import *

class Plane :

   """Plane (normal, point) simply embodies a plane through the
   given point with the given normal.
   """

   def type (self) :
       return PlaneType

   def __init__ (self, normal = array ([1., 0., 0.]),
                 point = array ([0., 0., 0.])) :
       self.coeffs = plane3 (normal, point)

   def __repr__ (self) :
       return `self.coeffs`

   def __str__ (self) :
       return `self.coeffs`

   def __neg__ (self) :
       p = Plane ()
       p.coeffs = - self.coeffs
       return p

   def rep (self) :
       return self.coeffs

   def astype (self, newtype) :
       return (array (self.coeffs, newtype))