Grid#

Module containing grid and relative objects.

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

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)#

Compute 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)#

Find 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 = '')#

Define 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 = '')#

Define 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()#

Define 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]