Public Member Functions | Private Attributes | List of all members
wirecell.util.geo.shapes.Point Class Reference
Inheritance diagram for wirecell.util.geo.shapes.Point:
wirecell.util.geo.shapes.Point2D wirecell.util.geo.shapes.Point3D

Public Member Functions

def __init__ (self, coords)
 
def __str__ (self)
 
def __repr__ (self)
 
def __len__ (self)
 
def __getitem__ (self, key)
 
def __setitem__ (self, key, val)
 
def __iter__ (self)
 
def __abs__ (self)
 
def __sub__ (self, other)
 
def __add__ (self, other)
 
def __mul__ (self, other)
 
def __div__ (self, other)
 
def dot (self, other)
 
def magnitude (self)
 
def unit (self)
 

Private Attributes

 _coords
 

Detailed Description

A N-D Cartesian point.

It tries to acts as a collection and a number.

Definition at line 6 of file shapes.py.

Constructor & Destructor Documentation

def wirecell.util.geo.shapes.Point.__init__ (   self,
  coords 
)

Definition at line 13 of file shapes.py.

13  def __init__(self, *coords):
14  self._coords = list(coords)
15 
def __init__(self, coords)
Definition: shapes.py:13

Member Function Documentation

def wirecell.util.geo.shapes.Point.__abs__ (   self)

Definition at line 35 of file shapes.py.

35  def __abs__(self):
36  return Point(*[abs(a) for a in self])
37 
T abs(T value)
def wirecell.util.geo.shapes.Point.__add__ (   self,
  other 
)

Definition at line 44 of file shapes.py.

44  def __add__(self, other):
45  try:
46  return Point(*[(a+b) for a,b in zip(self, other)])
47  except TypeError:
48  return Point(*[(a+other) for a in self])
49 
def __add__(self, other)
Definition: shapes.py:44
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def wirecell.util.geo.shapes.Point.__div__ (   self,
  other 
)

Definition at line 56 of file shapes.py.

56  def __div__(self, other):
57  try:
58  return Point(*[(a/b) for a,b in zip(self, other)])
59  except TypeError:
60  return Point(*[(a/other) for a in self])
61 
def __div__(self, other)
Definition: shapes.py:56
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def wirecell.util.geo.shapes.Point.__getitem__ (   self,
  key 
)

Definition at line 26 of file shapes.py.

26  def __getitem__(self, key):
27  return self._coords[key]
28 
def __getitem__(self, key)
Definition: shapes.py:26
def wirecell.util.geo.shapes.Point.__iter__ (   self)

Definition at line 32 of file shapes.py.

32  def __iter__(self):
33  return self._coords.__iter__()
34 
def wirecell.util.geo.shapes.Point.__len__ (   self)

Definition at line 23 of file shapes.py.

23  def __len__(self):
24  return len(self._coords)
25 
def wirecell.util.geo.shapes.Point.__mul__ (   self,
  other 
)

Definition at line 50 of file shapes.py.

50  def __mul__(self, other):
51  try:
52  return Point(*[(a*b) for a,b in zip(self, other)])
53  except TypeError:
54  return Point(*[(a*other) for a in self])
55 
def __mul__(self, other)
Definition: shapes.py:50
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def wirecell.util.geo.shapes.Point.__repr__ (   self)

Definition at line 20 of file shapes.py.

20  def __repr__(self):
21  return str(self)
22 
static QCString str
def wirecell.util.geo.shapes.Point.__setitem__ (   self,
  key,
  val 
)

Definition at line 29 of file shapes.py.

29  def __setitem__(self, key, val):
30  self._coords[key] = val
31 
def __setitem__(self, key, val)
Definition: shapes.py:29
def wirecell.util.geo.shapes.Point.__str__ (   self)

Definition at line 16 of file shapes.py.

16  def __str__(self):
17  s = ",".join([str(a) for a in self._coords])
18  return "Point(%s)" % s
19 
static QCString str
def wirecell.util.geo.shapes.Point.__sub__ (   self,
  other 
)

Definition at line 38 of file shapes.py.

38  def __sub__(self, other):
39  try:
40  return Point(*[(a-b) for a,b in zip(self, other)])
41  except TypeError:
42  return Point(*[(a-other) for a in self])
43 
def __sub__(self, other)
Definition: shapes.py:38
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def wirecell.util.geo.shapes.Point.dot (   self,
  other 
)

Definition at line 62 of file shapes.py.

62  def dot(self, other):
63  return sum([a*b for a,b in zip(self, other)])
64 
def dot(self, other)
Definition: shapes.py:62
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def wirecell.util.geo.shapes.Point.magnitude (   self)

Definition at line 66 of file shapes.py.

66  def magnitude(self):
67  return math.sqrt(self.dot(self))
68 
def dot(self, other)
Definition: shapes.py:62
def wirecell.util.geo.shapes.Point.unit (   self)

Definition at line 70 of file shapes.py.

70  def unit(self):
71  mag = self.magnitude
72  return self/mag
73 

Member Data Documentation

wirecell.util.geo.shapes.Point._coords
private

Definition at line 14 of file shapes.py.


The documentation for this class was generated from the following file: