# Point (hwx.common.math)#

class Point(x=0, y=0, z=0)#

Bases: `Vector`

A mathematical representation of a point in 3D space.

Method Table#

Name

Description

`along` (self, towards, distance)

Computes the point along the line segment.

`distanceTo` (self, x, y=None, z=None)

Computes the distance to the point defined by x, y, z.

`distanceTo` (self, x, y=None, z=None)

Computes the distance to the point defined by x, y, z.

`distanceToPlane` (self, a, b=None, c=None, d=None)

Computes the distance to the parametric plane.

`midpt` (self, x, y=None, z=None)

Computes the middle point of the line segment between self and the point

`planeFromPoints` (pt1, pt2, pt3)

Computes the plane defined by the three points.

Example

Create and use a point#
```from hwx.common.math import Point

p = Point(1, 2, 3)

p += (12, 13, 15)
print("x = {}, y = {}, z = {}".format(p.x, p.y, p.z))

p /= 2
print("x = {}, y = {}, z = {}".format(p.x, p.y, p.z))

p = p * 3
print("x = {}, y = {}, z = {}".format(p.x, p.y, p.z))
```
midpt(x, y=None, z=None)#

Computes the middle point of the line segment between self and the point defined by x, y, z.

If y is None, x is assumed to be a Point (or list).

Parameters:
• x (float | Point | list[float]) – The x coordinate or a Point.

• y (float) – The y coordinate.

• z (float) – The z coordinate.

Returns:

The middle point.

Return type:

Point

along(towards, distance)#

Computes the point along the line segment.

Defined by self and ‘towards’, at ‘distance’ from self.

Parameters:
• towards (Point) – The end point.

• distance (float) – The distance from the Point defined in self.

Returns:

The newly created point.

Return type:

Point

distanceTo(x, y=None, z=None)#

Computes the distance to the point defined by x, y, z.

If y is None, x is assumed to be a point (or list).

Parameters:
• x (float | Point | list[float]) – The x coordinate or a point.

• y (float) – The y coordinate.

• z (float) – The z coordinate.

Returns:

The distance.

Return type:

float

distance(x, y=None, z=None)#

Computes the distance to the point defined by x, y, z.

If y is None, x is assumed to be a point (or list).

Parameters:
• x (float | Point | list[float]) – The x coordinate or a point.

• y (float) – The y coordinate.

• z (float) – The z coordinate.

Returns:

The distance.

Return type:

float

distanceToPlane(a, b=None, c=None, d=None)#

Computes the distance to the parametric plane.

The parametric plane is given by the equation is ax + by + cz + d = 0.

If b is None, a is assumed to be a list.

Parameters:
• a (float, list[float]) – The constant ‘a’ or a list of all constants.

• b (float) – The constant ‘b’.

• c (float) – The constant ‘c’.

• d (float) – The constant ‘d’.

Returns:

The distance.

Return type:

float

static planeFromPoints(pt1, pt2, pt3)#

Computes the plane defined by the three points.

Parameters:
• pt1 (Point) – The first point.

• pt2 (Point) – The second point.

• pt3 (Point) – The third point.

Returns:

The constants of the a parametric plane equation.

Return type:

tuple