Shape Module¶
This module provides classes and functions for creating unified shape objects
that encapsulate both geometry (CSG) and form-factor definitions. Shapes can be
combined using + and - operators, which automatically keep geometry and
form-factor consistent.
Classes:¶
shape_obj: A class representing a shape with methods for CSG operations and form-factor generation.
Functions:¶
sbox: Creates a box shape.
ssphere: Creates a sphere shape.
scylinder: Creates a cylinder shape.
spyramid: Creates a pyramid shape.
sshape3d: Creates a shape from an existing geometry object.
- escape.scattering.shape.sbox(wx: ParameterLike = 2, wy: ParameterLike = 2, wz: ParameterLike = 2, swx: ParameterLike = 0.0, swy: ParameterLike = 0.0, swz: ParameterLike = 0.0, color: str = 'FF0000', pos=None, name: str = 'Box', notes: str = '') shape_obj¶
Create a box shape.
Parameters:¶
- wxParameterLike, optional
Width along x-axis (default 2).
- wyParameterLike, optional
Width along y-axis (default 2).
- wzParameterLike, optional
Width along z-axis (default 2).
- swxParameterLike, optional
Scattering width in x (default 0.0).
- swyParameterLike, optional
Scattering width in y (default 0.0).
- swzParameterLike, optional
Scattering width in z (default 0.0).
- colorstr, optional
Color in hex format (default “FF0000”).
- namestr, optional
The name of the shape (default “Box”).
- notesstr, optional
User notes.
Returns:¶
- shape_obj
A shape object representing the box.
- escape.scattering.shape.ssphere(radius: ParameterLike = 1, sw: ParameterLike = 0.0, numslices: int = 15, numstacks: int = 15, color: str = 'FF0000', pos=None, name: str = 'Sphere', notes: str = '') shape_obj¶
Create a sphere shape.
Parameters:¶
- radiusParameterLike, optional
Radius of the sphere (default 1).
- swParameterLike, optional
Scattering width (default 0.0).
- numslicesint, optional
Number of slices (default 15).
- numstacksint, optional
Number of stacks (default 15).
- colorstr, optional
Color in hex format (default “FF0000”).
- namestr, optional
The name of the shape (default “Sphere”).
- notesstr, optional
User notes.
Returns:¶
- shape_obj
A shape object representing the sphere.
- escape.scattering.shape.scylinder(radius: ParameterLike = 1, height: ParameterLike = 1, swp: ParameterLike = 0.0, swz: ParameterLike = 0.0, numslices: int = 15, color: str = 'FF0000', pos=None, name: str = 'Cylinder', notes: str = '') shape_obj¶
Create a cylinder shape.
Parameters:¶
- radiusParameterLike, optional
Radius of the cylinder (default 1).
- heightParameterLike, optional
Height of the cylinder (default 1).
- swpParameterLike, optional
Scattering width in-plane (default 0.0).
- swzParameterLike, optional
Scattering width along z (default 0.0).
- numslicesint, optional
Number of slices (default 15).
- colorstr, optional
Color in hex format (default “FF0000”).
- namestr, optional
The name of the shape (default “Cylinder”).
- notesstr, optional
User notes.
Returns:¶
- shape_obj
A shape object representing the cylinder.
- escape.scattering.shape.spyramid(wx_bot: ParameterLike = 1, wy_bot: ParameterLike = 1, wx_top: ParameterLike = 1, wy_top: ParameterLike = 1, center_bot: object = None, center_top: object = None, swx: ParameterLike = 0.0, swy: ParameterLike = 0.0, swz: ParameterLike = 0.0, color: str = 'FF0000', pos=None, name: str = 'Pyramid', notes: str = '') shape_obj¶
Create a pyramid shape.
Parameters:¶
- wx_botParameterLike, optional
Width at the bottom in x (default 1).
- wy_botParameterLike, optional
Width at the bottom in y (default 1).
- wx_topParameterLike, optional
Width at the top in x (default 1).
- wy_topParameterLike, optional
Width at the top in y (default 1).
- center_botobject, optional
Bottom center as [x, y, z] (default None -> [0,0,0]).
- center_topobject, optional
Top center as [x, y, z] (default None -> [0,0,0]).
- swxParameterLike, optional
Scattering width in x (default 0.0).
- swyParameterLike, optional
Scattering width in y (default 0.0).
- swzParameterLike, optional
Scattering width in z (default 0.0).
- colorstr, optional
Color in hex format (default “FF0000”).
- namestr, optional
The name of the shape (default “Pyramid”).
- notesstr, optional
User notes.
Returns:¶
- shape_obj
A shape object representing the pyramid.
- escape.scattering.shape.sshape3d(geom: geometry_obj, swx: ParameterLike = 0.0, swy: ParameterLike = 0.0, swz: ParameterLike = 0.0, pos=None, name: str = 'Shape3D', notes: str = '') shape_obj¶
Create a shape from an existing geometry object.
Parameters:¶
- geomgeometry_obj
The geometry object defining the shape.
- swxParameterLike, optional
Scattering width in x (default 0.0).
- swyParameterLike, optional
Scattering width in y (default 0.0).
- swzParameterLike, optional
Scattering width in z (default 0.0).
- namestr, optional
The name of the shape (default “Shape3D”).
- notesstr, optional
User notes.
Returns:¶
- shape_obj
A shape object wrapping the geometry.