phystricks
Public Member Functions | Public Attributes | List of all members
phystricks.src.AngleMeasure.AngleMeasure Class Reference
Inheritance diagram for phystricks.src.AngleMeasure.AngleMeasure:
Inheritance graph
[legend]
Collaboration diagram for phystricks.src.AngleMeasure.AngleMeasure:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, angle_measure=None, value_degree=None, value_radian=None, keep_negative=False)
 
def positive (self)
 
def __mul__ (self, coef)
 
def __floordiv__ (self, coef)
 
def __rmul__ (self, coef)
 
def __sub__ (self, other)
 
def __add__ (self, other)
 return the sum of two angles. More...
 
def __neg__ (self)
 
def __div__ (self, coef)
 
def __lt__ (self, other)
 
def __le__ (self, other)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __gt__ (self, other)
 
def __ge__ (self, other)
 
def __str__ (self)
 
def __repr__ (self)
 

Public Attributes

 degree
 
 radian
 

Detailed Description

Describe an angle.

This class is an attempt to abstract the degree/radian problem.

EXAMPLES::

    sage: from phystricks.SmallComputations import *
    sage: x=AngleMeasure(value_degree=360)
    sage: print x
    AngleMeasure, degree=360.000000000000,radian=2*pi

Conversions are exact::

    sage: a=AngleMeasure(value_degree=30)
    sage: cos(a.radian)
    1/2*sqrt(3)

You can create a new angle from an old one::

    sage: a=AngleMeasure(value_degree=180)
    sage: b=AngleMeasure(a)
    sage: b.degree
    180

If the numerical approximation of an angle in degree is close to an integer
up to less than 1e-10, we round it.
The reason is that in some case I got as entry such a number : 
-(3.47548077273962e-14)/pi + 360
Then the computation of radian gave 0 and we are left with degree 
around 359.9999 while the radian was rounded to 0.
(June, 2, 2013)

    sage: a=AngleMeasure(value_degree=-(3.47548077273962e-14)/pi + 360)
    sage: a.degree
    360
    sage: a.radian
    2*pi

Constructor & Destructor Documentation

def phystricks.src.AngleMeasure.AngleMeasure.__init__ (   self,
  angle_measure = None,
  value_degree = None,
  value_radian = None,
  keep_negative = False 
)

Member Function Documentation

def phystricks.src.AngleMeasure.AngleMeasure.__add__ (   self,
  other 
)

return the sum of two angles.

The return type is AngleMeasure

def phystricks.src.AngleMeasure.AngleMeasure.__div__ (   self,
  coef 
)
def phystricks.src.AngleMeasure.AngleMeasure.__eq__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__floordiv__ (   self,
  coef 
)
def phystricks.src.AngleMeasure.AngleMeasure.__ge__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__gt__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__le__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__lt__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__mul__ (   self,
  coef 
)
def phystricks.src.AngleMeasure.AngleMeasure.__ne__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.__neg__ (   self)
def phystricks.src.AngleMeasure.AngleMeasure.__repr__ (   self)
def phystricks.src.AngleMeasure.AngleMeasure.__rmul__ (   self,
  coef 
)
def phystricks.src.AngleMeasure.AngleMeasure.__str__ (   self)
def phystricks.src.AngleMeasure.AngleMeasure.__sub__ (   self,
  other 
)
def phystricks.src.AngleMeasure.AngleMeasure.positive (   self)
If the angle is negative, return the corresponding positive angle.

Member Data Documentation

phystricks.src.AngleMeasure.AngleMeasure.degree
phystricks.src.AngleMeasure.AngleMeasure.radian

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