Grid#

Module containing grid and relative objects.

class volmdlr.grid.Grid2D(lists_points: List[List[Point2D]], direction: List[str], name: str = '')[source]#

Bases: DessiaObject

A class defined with a list of points and characterized with a chosen direction.

Parameters:
  • lists_points (List[List[volmdlr.Point2D]]) – A list of a list of points

  • direction (List[str]) – A direction

displacement_compared_to(initial_grid2d)[source]#

Computes the deformation/displacement (dx,dy) of a grid2d based on another grid2d.

Parameters:

initial_grid2d (volmdlr.grid.Grid2D) – A 2 dimensional grid

Returns:

The displacement of the 2 dimensional grid

Return type:

find_direction_index(direction_axis: str)[source]#

Finds the index of a given direction_axis.

Parameters:

direction_axis (str) – ‘x’ or ‘y’

Returns:

The direction index

Return type:

int

classmethod from_points(points, points_dim_1, direction, name: str = '')[source]#

Defines a Grid2D given a list of points, number of points along the 1st dimension, and a direction.

Parameters:
  • points (List[volmdlr.Point2D]) –

  • points_dim_1 (int) –

  • direction (List[str].) –

  • name – object’s name.

Returns:

Return type:

classmethod from_properties(x_limits, y_limits, points_nbr, direction=None, name: str = '')[source]#

Defines Grid2d based on the given properties.

Parameters:
  • x_limits (Tuple[float, float]) – x_min and x_max

  • y_limits (Tuple[float, float]) – y_min and y_max

  • points_nbr (Tuple[int, int]) – Number of points along the x-axis and the y-axis

  • direction (List[str].) – Used for ordering the generated points

  • name – object’s name.

Returns:

The 2 dimensional grid

Return type:

volmdlr.grid.Grid2D

grid_pattern()[source]#

Defines a list of quadrilateral polygons defined based on Grid2d points.

Returns:

The list of quadrilateral polygons

Return type:

List[volmdlr.wires.ClosedPolygon2D]

property limits_xy#

Finds the limits (min, max) of points along x & y direction_axis.

Returns:

Return type:

property points#

Returns all the points in lists_points in just one list.

Returns:

The flattened list of points

Return type:

List[volmdlr.Point2D]

property points_xy#

Finds how many points there are along x & y direction_axis.

Returns:

Two counts, one for the x direction_axis and another one for the y direction_axis

Return type:

Tuple[int, int]