File: plane.py

package info (click to toggle)
python-scipy 0.5.2-0.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 33,888 kB
  • ctags: 44,231
  • sloc: ansic: 156,256; cpp: 90,347; python: 89,604; fortran: 73,083; sh: 1,318; objc: 424; makefile: 342
file content (39 lines) | stat: -rw-r--r-- 959 bytes parent folder | download | duplicates (2)
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
38
39
## Automatically adapted for scipy Oct 31, 2005 by

# 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 scipy import *
from numpy.core.umath 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))