�
��g,� � �B � d Z ddlZddlmZmZmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZmZ dd lmZ dd
lmZ ddlmZ ddlmZmZ dd
lmZ ddlmZ ddlmZm Z ddl!m"Z"m#Z#m$Z$ ddl%m&Z& ddl'm(Z( G d� de&� � Z) G d� de)� � Z* G d� de)� � Z+dS )aD Geometrical Points.
Contains
========
Point
Point2D
Point3D
When methods of Point require 1 or more points as arguments, they
can be passed as a sequence of coordinates or Points:
>>> from sympy import Point
>>> Point(1, 1).is_collinear((2, 2), (3, 4))
False
>>> Point(1, 1).is_collinear(Point(2, 2), Point(3, 4))
False
� N)�S�sympify�Expr)�Add)�Tuple)�Float)�global_parameters)� nsimplify�simplify)�
GeometryError)�sqrt)�im)�cos�sin)�Matrix)� Transpose)�uniq�is_sequence)�
filldedent� func_name�Undecidable� )�GeometryEntity)�prec_to_dpsc � � e Zd ZdZdZd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zd� Zd� Zed� � � Zed� � � Zed� � � Zed� � � Zd� Zd� Zd� Zd)d�Zd� Zd� Zd� Z ed� � � Z!d� Z"ed� � � Z#ed � � � Z$d!� Z%ed"� � � Z&ed#� � � Z'ed$� � � Z(d%� Z)d&� Z*ed'� � � Z+d(S )*�Pointa� A point in a n-dimensional Euclidean space.
Parameters
==========
coords : sequence of n-coordinate values. In the special
case where n=2 or 3, a Point2D or Point3D will be created
as appropriate.
evaluate : if `True` (default), all floats are turn into
exact types.
dim : number of coordinates the point should have. If coordinates
are unspecified, they are padded with zeros.
on_morph : indicates what should happen when the number of
coordinates of a point need to be changed by adding or
removing zeros. Possible values are `'warn'`, `'error'`, or
`ignore` (default). No warning or error is given when `*args`
is empty and `dim` is given. An error is always raised when
trying to remove nonzero coordinates.
Attributes
==========
length
origin: A `Point` representing the origin of the
appropriately-dimensioned space.
Raises
======
TypeError : When instantiating with anything but a Point or sequence
ValueError : when instantiating with a sequence with length < 2 or
when trying to reduce dimensions if keyword `on_morph='error'` is
set.
See Also
========
sympy.geometry.line.Segment : Connects two Points
Examples
========
>>> from sympy import Point
>>> from sympy.abc import x
>>> Point(1, 2, 3)
Point3D(1, 2, 3)
>>> Point([1, 2])
Point2D(1, 2)
>>> Point(0, x)
Point2D(0, x)
>>> Point(dim=4)
Point(0, 0, 0, 0)
Floats are automatically converted to Rational unless the
evaluate flag is False:
>>> Point(0.5, 0.25)
Point2D(1/2, 1/4)
>>> Point(0.5, 0.25, evaluate=False)
Point2D(0.5, 0.25)
Tc � � |� dt j � � }|� dd� � }t |� � dk r|d n|}t |t
� � r8d}t |� � |� dt |� � � � k r|S t
|� � s<t t d� t |� � � � � � � � �t |� � dk r9|� dd � � r#t j f|� d� � z }t |� }|� dt |� � � � }t |� � d k rt t d
� � � � �t |� � |k ryd� |t |� � |� � }|dk rnN|dk rt |� � �|d
k rt j |d �� � nt t d� � � � �t# ||d � � � rt d� � �t# d� |D � � � � rt d� � �t% d� |D � � � � st d� � �|d |� t j f|t |� � z
z z }|r7|� d� |� t* � � D � � � � }t |� � d k rd|d<