bertinireal.surface¶
Python libraries used: numpy, trimesh, copy, os, math
- platform:
Unix, Windows
- synopsis:
This module contains Surface and SurfacePiece types.
- class surface.Surface(directory, is_embedded=False, embedded_into=None)¶
Create a Surface object (Child class of Decomposition)
- Parameters:
Decomposition – Decomposition data from decomp file
- as_mesh_raw(which_faces=None, keep_all_vertices=True)¶
Compute a Trimesh object from the trimesh library for the corresponding faces using raw (unsmoothed or blocky) data.
which_faces: either None for all faces, or a list-like of ints indicating the indices of the surface faces you want. keep_all_vertices: bool, by default True. Unused vertices will be kept or merged. This value influences Trimesh’s process parameter.
- as_mesh_smooth(which_faces=None, keep_all_vertices=True)¶
Compute a Trimesh object from the trimesh library for the corresponding faces using sampled data. Raises if the surface is not sampled.
which_faces: either None for all faces, or a list-like of ints indicating the indices of the surface faces you want. keep_all_vertices: bool, by default True. Unused vertices will be kept or merged. This value influences Trimesh’s process parameter.
- cannot_possibly_meet(f, g)¶
Check whether faces f and g cannot possibly meet (because they are in different fiber intervals of the projection)
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g meet, else False
- check_data()¶
Check data
- export_raw(which_faces=None, basename='br_surface_raw', autoname_using_folder=False, file_type='stl', keep_all_vertices=True)¶
Export raw decomposition of surface
returns the name of the file which was saved
- export_smooth(which_faces=None, basename='br_surface_smooth', autoname_using_folder=False, file_type='stl', keep_all_vertices=True)¶
Export smooth decomposition of surface
returns the name of the file which was saved
- faces_meet_at_bottom(f, g)¶
Check whether faces f and g nonsingularly connected at bottom
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g nonsingularly connected at bottom, else False
- faces_meet_at_left(f, g)¶
Check whether faces f and g nonsingularly connected at left
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g nonsingularly connected at left, else False
- faces_meet_at_right(f, g)¶
Check whether faces f and g nonsingularly connected at right
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g nonsingularly connected at right, else False
- faces_meet_at_top(f, g)¶
Check whether faces f and g nonsingularly connected at top
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g nonsingularly connected at top, else False
- faces_nonsingularly_connect(f, g)¶
Check whether faces f and g are nonsingularly connected
- Parameters:
f – Current face
g – Other face
- Return type:
Return True if f and g are nonsingularly connected, else False
- faces_nonsingularly_connected(seed_index)¶
Compute the faces that are nonsingualrly connected
- Parameters:
seed_index – Index of seed
- Return type:
Two lists containing indices of connected and unconnected faces
- find_connected_faces(current)¶
Find connected faces from current face
- Parameters:
current – Current face
- Return type:
List containing indices of connected faces
- gather_curves(directory)¶
Gather the curves of surface
- Parameters:
directory – Directory of the surface folder
- gather_faces(directory)¶
Gather the faces of surface
- Parameters:
directory – Directory of the surface folder
- gather_surface_samples(directory)¶
Gather the surface samples of surface
- Parameters:
directory – Directory of the surface folder
- is_sampled()¶
Query whether the surface has been sampled.
- parse_surf(directory)¶
Parse and store into surface data
- Parameters:
directory – Directory of the surface folder
- separate_into_nonsingular_pieces()¶
Separate a surface into a list of pieces, connected at singularities
- solidify_raw(distance=0.1, which_faces=None, basename='br_surface_rawsolidified', autoname_using_folder=False, file_type='stl', keep_all_vertices=True)¶
Solidify raw version of surface.
Available formats include {‘stl’, ‘obj’}. Default file format given by _default_file_type
returns the name of the file which was saved
- solidify_smooth(distance=0.1, which_faces=None, basename='br_surface_rawsolidified', autoname_using_folder=False, file_type='stl', keep_all_vertices=True)¶
Solidify smooth version of surface. Requires that the surface has been sampled using sampler
Available formats include {‘stl’, ‘obj’}. Default file format given by _default_file_type
returns the name of the file which was saved
- write_piece_data()¶
Opens and edits current scad data to set the orientation and location of a plug and socket
- class surface.SurfacePiece(indices, surface)¶
A “Piece” of an algebraic surface. Essentially, a union of Faces, with some additional interface.
- centroid()¶
Compute the centroid of a piece
- edge_pieces()¶
takes a dict of set`s of edge indices. produces a `list of `CurvePiece`s
a kind of related note: the critical curve is very likely in the middle of the surface piece the boundary of a SurfacePiece is probably sphere or singular `CurvePiece`s. it’s possible the edges are degenerate, in case of nodal singularity.
- face_points(samples=True, as_indices=False, unique=True)¶
Get the coordinates of the points on all the faces of the Piece of a Surface.
if samples, then will return all samples on the Piece. otherwise, will return the points of the raw faces.
the computed point set should have no duplicates.
i do not know what order the points will be in, sorry.
- generate_filename_no_ext(basename, ninds=3)¶
construct a filename for the piece, using face indices to make unique. generates without an extension, so that it can be added later
- is_compact()¶
Check whether a piece is: (1) compact (no edges touch the bounding sphere) (2) non-compact (at least 1 edge touches bounding sphere)
Examples: sphere: (1 piece) - compact
dingdong: (2 pieces) - one compact, one not compact
octdong: (2 pieces) - both compact
whitney: (2 pieces) - both non-compact paraboloid: (1 piece) - non compact
- point_singularities()¶
Compute singularity points from a SurfacePiece object
- Return type:
A list of indices of point singularities
- surface.copy_all_scad_files_here()¶
copy all source .scad files provided in bertini_real to the current directory
- surface.export_mesh(mesh, basename, autoname_using_folder=False, file_type='stl', verbose=True)¶
Saves a mesh (generated elsewhere) to disk, and returns the name of the file which was saved