pymead.core.point.Point#

class Point(x: float, y: float, name: str | None = None, relative_airfoil_name: str | None = None, setting_from_geo_col: bool = False)[source]#

Bases: PymeadObj

The Point is the lowest-level geometry object in pymead. All curves in pymead are tied directly to Point objects. For example, instances of this class are used to define the endpoints of finite lines and control points of Bézier curves.

__init__(x: float, y: float, name: str | None = None, relative_airfoil_name: str | None = None, setting_from_geo_col: bool = False)[source]#
Parameters:

sub_container (str) – Sub-container where this object will be stored in the GeometryCollection

Methods

as_array()

Gives a one-dimensional, two-element array representation of the point (\(x\) and \(y\) values)

generate_from_array(arr[, name])

get_dict_rep()

Gets a dictionary representation of the pymead object.

is_coincident(other[, rtol])

Determines whether this point is coincident with another point (within a tight tolerance)

is_movement_allowed()

This method determines if movement is allowed for the point.

measure_angle(other)

Measures the angle (in radians) of the line starting at this point and ending at other

measure_distance(other)

Measures the distance from this point to another point.

request_move(xp, yp[, force])

Updates the location of the point and updates any curves and canvas items associated with the point movement.

set_name(name)

Extends the base set_name() by also renaming the point's x and y parameters.

set_x(x)

set_y(y)

x()

Getter for the point's x parameter.

y()

Getter for the point's y parameter.

Attributes

as_array()[source]#

Gives a one-dimensional, two-element array representation of the point (\(x\) and \(y\) values)

Returns:

One-dimensional array containing the point’s \(x\) and \(y\) values

Return type:

np.ndarray

get_dict_rep()[source]#

Gets a dictionary representation of the pymead object. In general, this dictionary should consist of only the required arguments for object instantiation. For example, the dictionary representation of a point looks something like this: {"x": 0.3, "y": 0.5}. If the argument requires a reference to a PymeadObj rather than a string or float value, the name() method should be the value that is stored. For an example, see the overridden value of this method in pymead.core.airfoil.Airfoil. All subclasses of PymeadObj must implement this method, since it is the way pymead objects are stored in saved instances of a GeometryCollection (.jmea files).

is_coincident(other: Point, rtol: float = 1e-14) bool[source]#

Determines whether this point is coincident with another point (within a tight tolerance)

Parameters:
  • other (Point) – Other point to test for coincidence with this point

  • rtol (float) – Relative tolerance used for the coincidence test. Default: 1e-14

Returns:

Whether the points are coincident

Return type:

bool

is_movement_allowed() bool[source]#

This method determines if movement is allowed for the point. Movement is allowed in these cases:

  • Where the constraint solver has not been set or there are no geometric constraints attached

  • Where the point is a root or rotation handle of a constraint cluster. If a rotation handle, movement is allowed, but the movement gets accepted as a rotation about the root point with a fixed distance to the root point

  • Where the point is one of the first three out of the four points in a symmetry constraint, and no edges are attached to this point in the constraint graph

Returns:

True if movement is allowed for this point, False otherwise

Return type:

bool

measure_angle(other: Point)[source]#

Measures the angle (in radians) of the line starting at this point and ending at other

Parameters:

other (Point) – Other point (the endpoint of the line whose angle is measured)

Returns:

The angle of the line connecting self and other

Return type:

float

measure_distance(other: Point) float[source]#

Measures the distance from this point to another point.

Parameters:

other (Point) – Other point (the endpoint of the line whose distance is measured)

Returns:

The distance between self and other

Return type:

float

request_move(xp: float, yp: float, force: bool = False)[source]#

Updates the location of the point and updates any curves and canvas items associated with the point movement.

Parameters:
  • xp (float) – New \(x\)-value for the point

  • yp (float) – New \(y\)-value for the point

  • force (bool) – Force the movement of this point. Overrides is_movement_allowed.

Warning

The force keyword argument should never be called directly from the API, or unexpected behavior may result. This argument is used in the backend code for the constraint solver in the symmetry and curvature constraints.

set_name(name: str)[source]#

Extends the base set_name() by also renaming the point’s x and y parameters.

Parameters:

name (str) – Name for the point

x()[source]#

Getter for the point’s x parameter.

Returns:

The point’s x parameter

Return type:

LengthParam

y()[source]#

Getter for the point’s y parameter.

Returns:

The point’s y parameter

Return type:

LengthParam