s3dlib.surface.PlanarSurface

class s3dlib.surface.PlanarSurface(rez=0, basetype=None, name=None, **kwargs)[source]

Bases: s3dlib.surface.Surface3DCollection

Flat square 3D surface in Cartesian coordinates.

Methods are inherited from the Surface3DCollection. Planar surface geometries are created in this subclass.

Create flat square surface of 2 x 2 units.

Parameters:
  • rez (integer, optional, default: 0) – Number of recursive subdivisions of the triangulated base faces. Rez values range from 0 to 7.
  • basetype ({'quad','oct1','oct2','squ'}, optional, default: 'quad') – Starting surface geometries from which the surface is constructed using recursive subdivisions of the faces.
  • name (string, optional, default: None.) – Descriptive identifier for the geometry.
Raises:

ValueError – If rez is not an integer in range 0 to 7. If basetype is not recognized for this surface constructor.

Other Parameters:
 

**kwargs – All other parameters are passed on to ‘s3dlib.surface.Surface3DCollection’.

domain(xlim=None, ylim=None, zcoor=None)[source]

Set the domain of the planar surface.

Used for setting the limits of the base plane.

Parameters:
  • ylim (xlim,) – Minimum and maximum values of the arrays are used to scale and translate the surface from an intial domains of [ -1, 1 ] If set to None, the domains are unchanged.
  • zcoor (number, default : 0) – Z offset of the plane. If set to None, the Z offset is unchanged.
Returns:

self (PlanarSurface object)

classmethod grid(xdiv, ydiv, basetype='r', minrad=None, name=None, **kwargs)[source]

PlanarSurface with X and Y rectangular faces.

Parameters:
  • xdiv (integer, required.) – Number of X divisions.
  • ydiv (integer, required.) – Number of Y divisions.
  • basetype ({'d','r'}, optional, default: 'r') – Starting surface geometries from which the surface is constructed indicating face shape.
  • minrad (placeholder, not used.) –
  • name (string, optional, default: None.) – Descriptive identifier.
Raises:

ValueError – If xdiv is not an integer greater or equal to 1. If ydiv is not an integer greater or equal to 1.

Other Parameters:
 

**kwargs – All other parameters are passed on to ‘s3dlib.surface.Surface3DCollection’.

Returns:

surface (PlanarSurface object.)

static meshgrid(X, Y, Z, revnormal=False, grid=False, name=None)[source]

PlanarSurface object based on a meshgrid.

Parameters:
  • X,Y,Z (N x M arrays) – Cartesian x,y,z coordinate values.
  • revnormal ({ True, False }, boolean, default: False) – Reverse the face normal directions if True.
  • grid ({ True, False }, boolean, default: False) – If True, polygon faces are rectangular. If False, polygon faces are triangular.
  • name (string, optional, default: None.) – Descriptive identifier for the mesh surface.
Returns:

surface (PlanarSurface object)

classmethod pntsurf(xyz_points, name=None, **kargs)[source]

PlanarSurface from points in Cartesian coordinates.

Parameters:
  • xyz_points (array, required.) – An N X 3 array of N Cartesian coordinate points.
  • name (string, optional, default: None.) – Descriptive identifier for the point surface.
Returns:

surface (PlanarSurface object)

static rand(rez=0, seed=None, name=None, kind=None, **kargs)[source]

PlanarSurface with random triangular faces.

Parameters:
  • rez (number, optional, default: 0) – Number of ‘recursive’ subdivisions of the triangulated base faces. Rez values range from 0 to 7.
  • seed (integer, optional, default: None) – An initialization seed for random generation.
  • name (string, optional, default: None.) – Descriptive identifier for the geometry.
  • kind (string, optional, default: None) – (reserved, not implemented)
Raises:

ValueError – If rez is not an integer in range 0 to 7. If basetype is not recognized for this surface constructor.

Other Parameters:
 

**kwargs – All other parameters are passed on to ‘s3dlib.surface.Surface3DCollection’.

Returns:

surface (PlanarSurface object.)

scale_dataframe(X, Y, Z)[source]

Scaling the surface geometry based on a datagrid.

Parameters:Y, Z (X,) – Minimum and maximum values of the arrays are used to scale and translate the surface from an intial domain of [ (-1,1), (-1,1), (0,1) ]
Returns:self (PlanarSurface object)