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

Public Member Functions

def __init__ (self, a, b)
 
def advised_mark_angle (self, pspict)
 
def numerical_approx (self)
 
def projection (self, seg, direction=None, advised=False)
 
def symmetric_by (self, Q)
 
def getPolarPoint (self, r, theta, pspict=None)
 
def get_polar_point (self, r, theta, pspict=None)
 
def getVisualPolarPoint (self, r, theta, pspict=None)
 
def rotation (self, alpha)
 
def value_on_line (self, line)
 
def translate (self, a, b=None)
 translate self. More...
 
def origin (self, P)
 
def Vector (self)
 
def norm (self)
 
def length (self)
 
def normalize (self, l=None)
 
def default_graph (self, opt)
 
def default_associated_graph_class (self)
 
def polar_coordinates (self, origin=None)
 
def angle (self, origin=None)
 
def coordinates (self, digits=5, pspict=None)
 Return the coordinates of the point as a string. More...
 
def graph_object (self)
 
def copy (self)
 
def mark_point (self, pspict=None)
 
def is_almost_equal (self, other, epsilon=0.0001)
 
def tikz_code (self, pspict=None)
 
def latex_code (self, language=None, pspict=None, with_mark=False)
 
def __eq__ (self, other)
 
   return True if the coordinates of `self` and `other`

are the same. More...

 
def __ne__ (self, other)
 
def translation (self, v)
 Translate the point with the vector. More...
 
def __add__ (self, other)
 addition of coordinates More...
 

Public Attributes

 x
 
 y
 
 point
 

Private Member Functions

def _bounding_box (self, pspict=None)
 
def _math_bounding_box (self, pspict=None)
 Return a bounding box which include itself and that's it. More...
 

Private Attributes

 _advised_mark_angle
 

Constructor & Destructor Documentation

def phystricks.src.PointGraph.PointGraph.__init__ (   self,
  a,
  b 
)

Member Function Documentation

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

addition of coordinates

def phystricks.src.PointGraph.PointGraph.__eq__ (   self,
  other 
)

   return True if the coordinates of `self` and `other`

are the same.

INPUT:

  • other - an other point

OUTPUT:

boolean

This function tests exact equality (even symbolic if one needs). For numerical equality (up to some epsilon), use the function is_almost_equal

def phystricks.src.PointGraph.PointGraph.__ne__ (   self,
  other 
)
def phystricks.src.PointGraph.PointGraph._bounding_box (   self,
  pspict = None 
)
private
return the bounding box of the point including its mark

A small box of radius 0.1 (modulo xunit,yunit[1]) is given in any case.
You need to provide a pspict in order to compute the size since
it can vary from the place in your document you place the figure.

[1] If you dont't know what is the "bounding box", or if you don't wan
t to fine tune it, you don't care.
def phystricks.src.PointGraph.PointGraph._math_bounding_box (   self,
  pspict = None 
)
private

Return a bounding box which include itself and that's it.

def phystricks.src.PointGraph.PointGraph.advised_mark_angle (   self,
  pspict 
)
def phystricks.src.PointGraph.PointGraph.angle (   self,
  origin = None 
)
Return the angle of the segment from (0,0) and self.

Return type : MathStructure.AngleMeasure
def phystricks.src.PointGraph.PointGraph.coordinates (   self,
  digits = 5,
  pspict = None 
)

Return the coordinates of the point as a string.

Parameters
digitsthe number of digits that will be written in the return string
pspictIf given,
  • we multiply by xunit and yunit
  • we apply the rotation

Some conversions and approximations are done. See number_to_string.

def phystricks.src.PointGraph.PointGraph.copy (   self)
def phystricks.src.PointGraph.PointGraph.default_associated_graph_class (   self)
Return the class which is the Graph associated type
def phystricks.src.PointGraph.PointGraph.default_graph (   self,
  opt 
)
Return a default Graph

<opt> is a tuple. The first is the symbol to the point (like "*" or "none").
The second is a string to be passed to pstricks, like "linecolor=blue,linestyle=dashed".
def phystricks.src.PointGraph.PointGraph.get_polar_point (   self,
  r,
  theta,
  pspict = None 
)
def phystricks.src.PointGraph.PointGraph.getPolarPoint (   self,
  r,
  theta,
  pspict = None 
)
Return the point located at distance r and angle theta from point self.

INPUT:

- ``r`` - A number.

- ``theta`` - the angle (degree or :class:`AngleMeasure`).

- ``pspict`` - the pspicture in which the point is supposed to live. If `pspict` is given, we compute the deformation due to the dilatation.  Be careful: in that case `r` is given as absolute value and the visual effect will not be affected by dilatations.

OUTPUT: A point.

EXAMPLES::

    sage: from phystricks import *
    sage: P=Point(1,2)
    sage: print P.get_polar_point(sqrt(2),45)
    <Point(2,3)>
def phystricks.src.PointGraph.PointGraph.getVisualPolarPoint (   self,
  r,
  theta,
  pspict = None 
)
def phystricks.src.PointGraph.PointGraph.graph_object (   self)
def phystricks.src.PointGraph.PointGraph.is_almost_equal (   self,
  other,
  epsilon = 0.0001 
)
def phystricks.src.PointGraph.PointGraph.latex_code (   self,
  language = None,
  pspict = None,
  with_mark = False 
)
def phystricks.src.PointGraph.PointGraph.length (   self)
The same as self.norm()

EXAMPLES::

    sage: from phystricks import *
    sage: P=Point(1,1)
    sage: P.length()
    sqrt(2)
def phystricks.src.PointGraph.PointGraph.mark_point (   self,
  pspict = None 
)
def phystricks.src.PointGraph.PointGraph.norm (   self)
Return the norm of the segment between (0,0) and self.

This is the radial component in polar coordinates.

EXAMPLES::

sage: from phystricks import *
sage: Point(1,1).norm()
sqrt(2)
sage: Point(-pi,sqrt(2)).norm()
sqrt(pi^2 + 2)
def phystricks.src.PointGraph.PointGraph.normalize (   self,
  l = None 
)
Return a vector of norm <l>. If <l> is not given, take 1.
def phystricks.src.PointGraph.PointGraph.numerical_approx (   self)
def phystricks.src.PointGraph.PointGraph.origin (   self,
  P 
)
Let S be the point self.

Return the affine vector   PK
where K is such that   PK=OS

In other words, it return the affine vector O->self but
attached on point P instead of O.
def phystricks.src.PointGraph.PointGraph.polar_coordinates (   self,
  origin = None 
)
Return the polar coordinates of the point as a tuple (r,angle) where angle is AngleMeasure

EXAMPLES::

    sage: from phystricks import *
    sage: Point(1,1).polar_coordinates()
    (sqrt(2), AngleMeasure, degree=45.0000000000000,radian=1/4*pi)
    sage: Point(-1,1).polar_coordinates()
    (sqrt(2), AngleMeasure, degree=135.000000000000,radian=3/4*pi)
    sage: Point(0,2).polar_coordinates()
    (2, AngleMeasure, degree=90.0000000000000,radian=1/2*pi)
    sage: Point(-1,0).polar_coordinates()
    (1, AngleMeasure, degree=180.000000000000,radian=pi)
    sage: alpha=-pi*(arctan(2)/pi - 2)
    sage: Point(cos(alpha),sin(alpha)).polar_coordinates()
    (1, AngleMeasure, degree=180.000000000000,radian=pi)

If 'origin' is given, it is taken as origin of the polar coordinates.

Only return positive angles (between 0 and 2*pi)
def phystricks.src.PointGraph.PointGraph.projection (   self,
  seg,
  direction = None,
  advised = False 
)
Return the projection of the point on the given segment.

INPUT:

- ``seg`` - a segment
- ``direction`` - (default=None) a vector.
If given, we use a projection parallel to 
`vector` instead of the orthogonal projection.

OUTPUT:

a point.
def phystricks.src.PointGraph.PointGraph.rotation (   self,
  alpha 
)
return a point that is the rotation of 'self' by the angle 'alpha'

- alpha : the rotation angle (degree)
def phystricks.src.PointGraph.PointGraph.symmetric_by (   self,
  Q 
)
return the central symmetry  with respect to 'Q'
def phystricks.src.PointGraph.PointGraph.tikz_code (   self,
  pspict = None 
)
def phystricks.src.PointGraph.PointGraph.translate (   self,
  a,
  b = None 
)

translate self.

The parameter is

  • either one vector
  • either two numbers
def phystricks.src.PointGraph.PointGraph.translation (   self,
  v 
)

Translate the point with the vector.

The parameter can also be a tuple of size 2.

def phystricks.src.PointGraph.PointGraph.value_on_line (   self,
  line 
)
Return the value of the equation of a line on `self`.

If $f(x,y)=0$ is the equation of `line`, return the number f(self.x,self.y).

NOTE:

The object `line` has to have an attribute line.equation

EXAMPLE::

    sage: from phystricks import *
    sage: s=Segment(Point(0,1),Point(1,0))
    sage: s.equation()
    x + y - 1 == 0
    sage: P=Point(-1,3)
    sage: P.value_on_line(s)
    1   

It allows to know if a point is inside or outside a circle::

    sage: circle=Circle(Point(-1,2),4)
    sage: Point(1,1).value_on_line(circle)
    -11

::

    sage: Point(1,sqrt(2)).value_on_line(circle)
    (sqrt(2) - 2)^2 - 12
def phystricks.src.PointGraph.PointGraph.Vector (   self)

Member Data Documentation

phystricks.src.PointGraph.PointGraph._advised_mark_angle
private
phystricks.src.PointGraph.PointGraph.point
phystricks.src.PointGraph.PointGraph.x
phystricks.src.PointGraph.PointGraph.y

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