solid_figures
converter.converter.solid_figures
BoxFigure
dataclass
Bases: SolidFigure
A rectangular box (cuboid). The figure can be rotated (meaning its walls don't have to be aligned with the axes of the coordinate system). The edge lengths are the final lengths of each edge, not the distance from the center of the figure (meaning they are full-size not half-size, for example: the edge lengths 1, 1, 1 will result in a 1 by 1 by 1 cube).
Source code in yaptide/converter/converter/solid_figures.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
x_edge_length
class-attribute
instance-attribute
x_edge_length = 1.0
y_edge_length
class-attribute
instance-attribute
y_edge_length = 1.0
z_edge_length
class-attribute
instance-attribute
z_edge_length = 1.0
__init__
__init__(
uuid="AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
name="",
position=lambda: (0.0, 0.0, 0.0)(),
rotation=lambda: (0.0, 0.0, 0.0)(),
x_edge_length=1.0,
y_edge_length=1.0,
z_edge_length=1.0,
)
expand
expand(margin)
Expand the figure by margin
in each dimension.
Increases figures weight, depth and height by 2 * margin
to achieve the same
expansion (1 * margin
) on each side.
Source code in yaptide/converter/converter/solid_figures.py
71 72 73 74 75 76 77 78 79 |
|
CylinderFigure
dataclass
Bases: SolidFigure
A cylinder, a cone or a truncated cone. It's defined by the radii of both of its bases(top and bottom) and height. A cone can be created by setting one of the radii to zero.
Source code in yaptide/converter/converter/solid_figures.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
height
class-attribute
instance-attribute
height = 1.0
radius_bottom
class-attribute
instance-attribute
radius_bottom = 1.0
radius_top
class-attribute
instance-attribute
radius_top = 1.0
__init__
__init__(
uuid="AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
name="",
position=lambda: (0.0, 0.0, 0.0)(),
rotation=lambda: (0.0, 0.0, 0.0)(),
radius_top=1.0,
radius_bottom=1.0,
height=1.0,
)
expand
expand(margin)
Expand the figure by margin
in each dimension.
Increases figures height by 2 * margin
(to achieve the same expansion by 1 * margin
on the
bottom and top side.
Increase as well bottom and top radius by 1 * margin
.
Source code in yaptide/converter/converter/solid_figures.py
46 47 48 49 50 51 52 53 54 55 |
|
SolidFigure
dataclass
Bases: ABC
Abstract solid figure in 3D space. It is characterised by position in space and rotation along X,Y,Z axis in its own reference frame. Size of the figure (its extend in space) is defined in its subclasses.
Source code in yaptide/converter/converter/solid_figures.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
name
class-attribute
instance-attribute
name = ''
position
class-attribute
instance-attribute
position = field(default_factory=lambda: (0.0, 0.0, 0.0))
rotation
class-attribute
instance-attribute
rotation = field(default_factory=lambda: (0.0, 0.0, 0.0))
uuid
class-attribute
instance-attribute
uuid = 'AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA'
__init__
__init__(
uuid="AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
name="",
position=lambda: (0.0, 0.0, 0.0)(),
rotation=lambda: (0.0, 0.0, 0.0)(),
)
expand
expand(margin)
Expand figure by expansion
in each dimension.
Source code in yaptide/converter/converter/solid_figures.py
19 20 |
|
SphereFigure
dataclass
Bases: SolidFigure
A sphere. Its size is defined by its radius.
Source code in yaptide/converter/converter/solid_figures.py
23 24 25 26 27 28 29 30 31 |
|
radius
class-attribute
instance-attribute
radius = 1.0
__init__
__init__(
uuid="AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
name="",
position=lambda: (0.0, 0.0, 0.0)(),
rotation=lambda: (0.0, 0.0, 0.0)(),
radius=1.0,
)
expand
expand(margin)
Expand figure by margin
in each dimension. Increases figure radius by adding to it a margin
Source code in yaptide/converter/converter/solid_figures.py
29 30 31 |
|
parse_figure
parse_figure(figure_dict)
Parse json containing information about figure to figure.
Source code in yaptide/converter/converter/solid_figures.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|