PK!bsolid_toolbox/__init__.pyfrom solid_toolbox.units import * from solid_toolbox.transforms import * from solid_toolbox.poly import * from solid_toolbox.curves import * PK![==solid_toolbox/curves.pyfrom solid_toolbox.units import Point2d _pascal_triangle = [ [1], [1, 1], [1, 2, 1], [1, 3, 3, 1], ] def inclusive_range(start, end): return range(start, end + 1) def binomial(n, k): # Expand cache while n >= len(_pascal_triangle): s = len(_pascal_triangle) prev_row = _pascal_triangle[s - 1] next_row = [0 for _ in range(s + 1)] next_row[0] = 1 for i in range(1, s): next_row[i] = prev_row[i - 1] + prev_row[i] next_row[s] = 1 _pascal_triangle.append(next_row) return _pascal_triangle[n][k] def bezier_curve(control_points, num_samples): def bezier(t): x_final = 0 y_final = 0 n = len(control_points) - 1 for k, point in enumerate(control_points): fraction = binomial(n, k) * (1 - t)**(n - k) * t**k x_final += point.x * fraction y_final += point.y * fraction return Point2d(x_final, y_final) return [bezier(i / (num_samples - 1)) for i in range(num_samples)] PK!>solid_toolbox/poly.pyfrom solid import * from solid.utils import * def construct_polyhedron(faces): points = [] unique_points = {} translated_faces = [] for face in faces: translated_face = [] for point in face: if not isinstance(point, tuple): point = tuple(point) if point not in unique_points: unique_points[point] = len(points) points.append(point) translated_face.append(unique_points[point]) translated_faces.append(translated_face) return polyhedron(points=points, faces=translated_faces, convexity=10) def construct_polygon(*paths): unique_points = {} points_listing = [] path_indices = [] for path in paths: point_indices = [] for point in path: if point not in unique_points: unique_points[point] = len(unique_points) points_listing.append(point) point_indices.append(unique_points[point]) path_indices.append(point_indices) return polygon( points=points_listing, paths=path_indices, ) PK!esolid_toolbox/transforms.pyfrom solid import * from solid.utils import * def noop(*args): def func(transform): return transform return func def rotate_with_fake_origin(degree, axis, temp_origin): x, y, z = temp_origin def rotater(child): return translate((x, y, z))( rotate(degree, axis)( translate((-x, -y, -z))( child, ), ), ) return rotater PK!P44solid_toolbox/units.pyfrom typing import NamedTuple class Vec(NamedTuple): x: float y: float z: float def __repr__(self): return f'[{self.x}, {self.y}, {self.z}]' def __str__(self): return self.__repr__() class Vec2d(NamedTuple): x: float y: float def __repr__(self): return f'[{self.x}, {self.y}]' def __str__(self): return self.__repr__() Point = Vec Point2d = Vec2d mm = 1 cm = 10 x_axis = x_unit = Vec(1, 0, 0) y_axis = y_unit = Vec(0, 1, 0) z_axis = z_unit = Vec(0, 0, 1) PK!SEE(solid_toolbox-0.0.1.dist-info/LICENSE.md# MIT License Copyright (c) 2018 Michael Lee Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HW"TT#solid_toolbox-0.0.1.dist-info/WHEEL A н#J."jm)Afb~ ڡ5 G7hiޅF4+-3ڦ/̖?XPK!Hb2k&solid_toolbox-0.0.1.dist-info/METADATAn0 z $@,{IBS,H+RR،#L25⷟[Wzď?I\!J~`cY|Dʘn ,iӡS0ŒSh-k`xOJ3$gQymxneI.wkasOȡKSb68X"2tXgie/{q&`Q\&r:XXL玠mna}'w9_:PsaM SM>+.xc"+;[0 y) w`p,FWb(n0lA c}Γ?+ 6<_x$ip/9B?PK!HV$solid_toolbox-0.0.1.dist-info/RECORDr@}M,ev" n(=jdf 'Z:solid_toolbox/poly.pyPK!e solid_toolbox/transforms.pyPK!P44 solid_toolbox/units.pyPK!SEE(bsolid_toolbox-0.0.1.dist-info/LICENSE.mdPK!HW"TT#solid_toolbox-0.0.1.dist-info/WHEELPK!Hb2k&solid_toolbox-0.0.1.dist-info/METADATAPK!HV$1solid_toolbox-0.0.1.dist-info/RECORDPK (