Skip to content

UPoint

Upoint class is used to create an uniformized way of storing 2D points data. It can be used with other objects of that library to calculate basic geomety.

Attributes:

Name Type Description
vec np.array

a numpy array of two values containing the x,y coordinates. x and y methods are just wrapper to access the values stored there.

x scalar

returns x coordinate of the current point.

y scalar

returns y coordinate of the current point.

isnan bool

returns True if either x or y coordinates of the current point are np.nan. False otherwise

Methods

geometries.UPoint.__init__(self, x, y = None) special

Contructor for Upoint class. (2D space point)

Parameters:

Name Type Description Default
x scalar / np.array

x coordinate of the point if an int is given for y. If no y coordinate argument is given, x is expected to be a 2 value arraylike with first index as x and second index as y.

required
y scalar

y coordinate of the point or None, if x and y coords are given in an array like structure as fisrt argument. Defaults to None.

None

Returns:

Type Description
UPoint

An instance of the class

geometries.UPoint.distance(self, point)

Euclidian distance between the current point instance, and another point instance passed as first argument.

Parameters:

Name Type Description Default
point UPoint

the point to calculate distance relative to the current UPoint instance.

required

Returns:

Type Description
dist (int float)

the distance, in the same unit as the coordinate system used for both UPoints.

geometries.UPoint.dot(self, point)

Performs the dot vector product of the object holding this point and another Upoint object given as argument.

Parameters:

Name Type Description Default
point UPoint

The other Upoint object to perform dot product..

required

Returns:

Type Description
scalar

The result of the dot product of the two points.

Back to top