shapes Package

This section provides an overview of the shapes currently in the toolbox.

Base classes

class ott.shapes.Shape

Shape abstract class for optical tweezers toolbox shapes

Properties

maxRadius maximum distance from shape origin volume volume of shape position Location of shape [x, y, z]

Methods (abstract):

inside(shape, …) determine if spherical point is inside shape

Methods:
writeWavefrontObj(shape, …) write shape to Wavefront OBJ file

only implemented if shape supports this action.

insideXyz(shape, …) determine if Cartesian point is inside shape

requires inside(shape, …) to be implemented.

simple(…) simplified constructor for shape-like objects.

See also simple, ott.shapes.Cube, ott.shapes.TriangularMesh.

class ott.shapes.AxisymShape

AxisymShape abstract class for axisymetric particles

Methods
  • boundarypoints calculate boudary points for surface integral

Abstract methods
  • radii Calculates the particle radii for angular coordinates

  • normals Calculates the particle normals for angular coorindates

  • axialSymmetry Returns x, y, z rotational symmetry (0 for infinite)

class ott.shapes.StarShape

StarShape abstract class for star shaped particles

Abstract methods:

radii Calculates the particle radii for angular coordinates normals Calculates the particle normals for angular coorindates axialSymmetry Returns x, y, z rotational symmetry (0 for infinite) mirrorSymmetry Returns x, y, z mirror symmetry

Geometric shapes

class ott.shapes.Cube(width)

Cube a simple cube shape

properties:

width % Width of the cube

class ott.shapes.RectangularPrism(x, y, z)

Cube a simple cube shape

properties:

x Size of prism in x direction y Size of prism in y direction z Size of prism in z direction

See also RectangularPrism and ott.shapes.Cube.

class ott.shapes.Cylinder(radius, height)

Cylinder a simple cylinder shape

properties:

radius % Radius of the cylinder height % Height of the cylinder

class ott.shapes.Ellipsoid(a, b, c)

Ellipsoid a simple ellipsoid shape

properties:

a % x-axis scaling b % y-axis scaling c % z-axis scaling

class ott.shapes.Sphere(radius, position)

Sphere a simple sphere shape

properties:

radius % Radius of the sphere

class ott.shapes.Superellipsoid(a, b, c, ew, ns)

Superellipsoid a simple superellipsoid shape

properties:

a % x-axis scaling b % y-axis scaling c % z-axis scaling ew % East-West smoothness (ew = 1 for ellipsoid) ns % North-South smoothness (sw = 1 for ellipsoid)

Sets of shapes

These classes can be used to create shapes by combining simple geometric shapes or other shape objects. For instance, the union class can be used to create a union of two spheres:

shape1 = ott.shapes.Sphere(1.0, [0, 0, -2]);
shape2 = ott.shapes.Sphere(1.0, [0, 0,  2]);
union = ott.shapes.Union([shape1, shape2]);
class ott.shapes.Union(shapes)

Represents union between two shapes. Inherits from ott.shapes.Shape.

A point is considered to be inside the union if the point is inside any of the shapes in the union.

Methods

inside – Determine if point is inside any contained shape.

Properties

shapes – Shapes contained in this union volume – Estimate of shape volume from sum of shapes in set maxRadius – Estimate of shape maximum radius

See also Union

Union(shapes)

Construct a new union of shapes.

Usage

shape = Union([shape1, shape2, …])

Todo

We will probably add other sets in future including differences or exclusions.

Procedural shapes

class ott.shapes.AxisymLerp(rho, z)

AxisymLerp a axisymmetric particle with lerping between points Inherits from ott.shapes.StarShape and ott.shapes.AxisymShape.

properties:

rho % Radial position of defining points (cylindrical coords) z % z position of defining points (cylindrical coords)

See also AxisymLerp

class ott.shapes.TriangularMesh(verts, faces)

TriangularMesh base class for triangular mesh objects (such as file loaders)

Properties (read-only):

verts 3xN matrix of vertex locations faces 3xN matrix of vertex indices describing faces

Faces vertices should be ordered so normals face outwards for volume and inside functions to work correctly.

File loaders

class ott.shapes.StlLoader(filename)

StlLoader load a shape from a STL file

Properties:

filename name of the file this object loaded verts (TriangularMesh) 3xN matrix of vertex locations faces (TriangularMesh) 3xN matrix of vertex indices describing faces maxRadius (Shape) maximum distance from shape origin volume (Shape) volume of shape

Inherited methods:

writeWavefrontObj(shape, …) write shape to Wavefront OBJ file. insideXyz(shape, …) determine if Cartesian point is inside shape. voxels(shape, …) xyz coordinates for voxels inside the shape. surf(shape, …) shape surface representation.

See also StlLoader, ott.shapes.TriangularMesh, ott.shapes.WavefrontObj.

This class uses a 3rd party STL file reader:

https://au.mathworks.com/matlabcentral/fileexchange/22409-stl-file-reader

See tplicenses/stl_EricJohnson.txt for information about licensing.

class ott.shapes.WavefrontObj(filename)

WavefrontObj load a shape from a Wavefront OBJ file

The file format is described on the Wikipedia page.