### 3.1. The `Pt` class: A Cartesian point

To represent a point in some Cartesian space, use a constructor of this general form.

```Pt(`coords`)
```

You may pass the `x` and `y` coordinates to the constructor as two separate arguments, or as a sequence of two numbers (`x`, `y`). The sequences can be either Python tuples or lists.

There is one more option for the constructor argument. You may provide a single argument containing a sequence of three values (`x`, `y`, `W`), for a coordinate that is already in homogeneous form.

Methods of this class include:

`.xy()`

Returns the coordinates as a 2-tuple.

`.x()`

Returns the `x` coordinate.

`.y()`

Returns the `y` coordinate.

`.dist(p)`

Given a point `p` as a `Pt` instance, this method returns the distance between `self` and `p` as a `float`.

`.bearingTo(p)`

Given another point `p`, this method returns the Cartesian angle from `self` to that point in radians: 0 is the bearing of the `x`-axis and π/2 is the bearing of the `y`-axis.

`.radial(d, bearing)`

Given a distance `d` and a `bearing` as a Cartesian angle in radians, return the point at that distance and bearing as a new `Pt` instance.

`.toPolar()`

Returns self in polar coordinates, as instances of the class described in Section 3.3, “The `Polar` class”.

`.__str__(self)`

Returns self as a string of the form `(x, y)`.

`.__add__(self, p)`

The sum of two `Pt` instances is a new `Pt` instance whose coordinates are the sum of the coordinates of `self` and `other`.

`.__sub__(self, p)`

The difference of two `Pt` instances is a `Pt` instance whose coordinates are the differences of the coordinates of `self` and `other`.

`.__cmp__(self, p)`

Returns 0 if the two points coincide; returns a nonzero value otherwise.