INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Creates a plane with a specified number of vertices on it sides but no vertices on the interior. | def plane_hires_edges(script, size=1.0, x_segments=1, y_segments=1,
center=False, color=None):
""" Creates a plane with a specified number of vertices
on it sides, but no vertices on the interior.
Currently used to create a simpler bottom for cube_hires.
"""
size = util.make_... |
Create a box with user defined number of segments in each direction. | def cube_hires(script, size=1.0, x_segments=1, y_segments=1, z_segments=1,
simple_bottom=True, center=False, color=None):
"""Create a box with user defined number of segments in each direction.
Grid spacing is the same as its dimensions (spacing = 1) and its
thickness is one. Intended to be ... |
Create a cylinder with user defined number of segments | def annulus_hires(script, radius=None, radius1=None, radius2=None,
diameter=None, diameter1=None, diameter2=None,
cir_segments=48, rad_segments=1, color=None):
"""Create a cylinder with user defined number of segments
"""
if radius is not None and diameter is None:
... |
Create a cylinder with user defined number of segments | def tube_hires(script, height=1.0, radius=None, radius1=None, radius2=None,
diameter=None, diameter1=None, diameter2=None, cir_segments=32,
rad_segments=1, height_segments=1, center=False,
simple_bottom=False, color=None):
"""Create a cylinder with user defined number of... |
Read color_names. txt and find the red green and blue values for a named color. | def color_values(color):
"""Read color_names.txt and find the red, green, and blue values
for a named color.
"""
# Get the directory where this script file is located:
this_dir = os.path.dirname(
os.path.realpath(
inspect.getsourcefile(
lambda: 0)))
color_... |
Check if a variable is a list and is the correct length. | def check_list(var, num_terms):
""" Check if a variable is a list and is the correct length.
If variable is not a list it will make it a list of the correct length with
all terms identical.
"""
if not isinstance(var, list):
if isinstance(var, tuple):
var = list(var)
else... |
Make a variable a list if it is not already | def make_list(var, num_terms=1):
""" Make a variable a list if it is not already
If variable is not a list it will make it a list of the correct length with
all terms identical.
"""
if not isinstance(var, list):
if isinstance(var, tuple):
var = list(var)
else:
... |
Write filter to FilterScript object or filename | def write_filter(script, filter_xml):
""" Write filter to FilterScript object or filename
Args:
script (FilterScript object or filename str): the FilterScript object
or script filename to write the filter to.
filter_xml (str): the xml filter string
"""
if isinstance(script,... |
Apply LS3 Subdivision Surface algorithm using Loop s weights. | def ls3loop(script, iterations=1, loop_weight=0, edge_threshold=0,
selected=False):
""" Apply LS3 Subdivision Surface algorithm using Loop's weights.
This refinement method take normals into account.
See: Boye', S. Guennebaud, G. & Schlick, C.
"Least squares subdivision surfaces"
Comput... |
Merge together all the vertices that are nearer than the specified threshold. Like a unify duplicate vertices but with some tolerance. | def merge_vert(script, threshold=0.0):
""" Merge together all the vertices that are nearer than the specified
threshold. Like a unify duplicate vertices but with some tolerance.
Args:
script: the FilterScript object or script filename to write
the filter to.
threshold (float): M... |
Close holes smaller than a given threshold | def close_holes(script, hole_max_edge=30, selected=False,
sel_new_face=True, self_intersection=True):
""" Close holes smaller than a given threshold
Args:
script: the FilterScript object or script filename to write
the filter to.
hole_max_edge (int): The size is expr... |
Split non - manifold vertices until it becomes two - manifold. | def split_vert_on_nonmanifold_face(script, vert_displacement_ratio=0.0):
""" Split non-manifold vertices until it becomes two-manifold.
Args:
script: the FilterScript object or script filename to write
the filter to.
vert_displacement_ratio (float): When a vertex is split it is move... |
Try to snap together adjacent borders that are slightly mismatched. | def snap_mismatched_borders(script, edge_dist_ratio=0.01, unify_vert=True):
""" Try to snap together adjacent borders that are slightly mismatched.
This situation can happen on badly triangulated adjacent patches defined by
high order surfaces. For each border vertex the filter snaps it onto the
closes... |
An alternative translate implementation that uses a geometric function. This is more accurate than the built - in version. | def translate(script, value=(0.0, 0.0, 0.0)):
"""An alternative translate implementation that uses a geometric function.
This is more accurate than the built-in version."""
# Convert value to list if it isn't already
if not isinstance(value, list):
value = list(value)
vert_function(script,
... |
An alternative rotate implementation that uses a geometric function. This is more accurate than the built - in version. | def rotate(script, axis='z', angle=0.0):
"""An alternative rotate implementation that uses a geometric function.
This is more accurate than the built-in version."""
angle = math.radians(angle)
if axis.lower() == 'x':
vert_function(script,
x_func='x',
y_func='y*c... |
An alternative scale implementation that uses a geometric function. This is more accurate than the built - in version. | def scale(script, value=1.0):
"""An alternative scale implementation that uses a geometric function.
This is more accurate than the built-in version."""
"""# Convert value to list if it isn't already
if not isinstance(value, list):
value = list(value)
# If a single value was supplied use it ... |
Freeze the current transformation matrix into the coordinates of the vertices of the mesh ( and set this matrix to the identity ). | def freeze_matrix(script, all_layers=False):
""" Freeze the current transformation matrix into the coordinates of the
vertices of the mesh (and set this matrix to the identity).
In other words it applies in a definitive way the current matrix to the
vertex coordinates.
Args:
script: th... |
Geometric function using muparser lib to generate new Coordinates | def function(script, x_func='x', y_func='y', z_func='z'):
"""Geometric function using muparser lib to generate new Coordinates
You can change x, y, z for every vertex according to the function specified.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possible to use the followin... |
Geometric function using muparser lib to generate new Coordinates | def vert_function(script, x_func='x', y_func='y', z_func='z', selected=False):
"""Geometric function using muparser lib to generate new Coordinates
You can change x, y, z for every vertex according to the function specified.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possibl... |
Geometric function using cylindrical coordinates. | def function_cyl_co(script, r_func='r', theta_func='theta', z_func='z'):
"""Geometric function using cylindrical coordinates.
Define functions in Z up cylindrical coordinates, with radius 'r',
angle 'theta', and height 'z'
See "function" docs for additional usage info and accepted parameters.
Arg... |
flare_radius must be > = end_height ( height ) end_radius max = flare_radius + r end_radius ( num ): radius of mesh at end of flare + 15 r = 8. 8205 - 15 r = 1. 1795 z = 10 5 +/ - 15 - +/ - 15 * 0. 74535599249992989880305788957709 | def radial_flare2(script, flare_radius=None, start_radius=None, end_radius=None,
end_height=None):
"""
flare_radius must be >= end_height (height)
end_radius max = flare_radius + r
end_radius (num): radius of mesh at end of flare
+15 r= 8.8205
-15 r= 1.1795
z... |
flare_radius must be > = z2 ( height ) r2 max = flare_radius + r r2 ( num ): radius of mesh at end of flare + 15 r = 8. 8205 - 15 r = 1. 1795 z = 10 5 +/ - 15 - +/ - 15 * 0. 74535599249992989880305788957709 | def radial_flare(script, flare_radius=None, start_radius=None, end_radius=None,
end_height=None):
"""
flare_radius must be >= z2 (height)
r2 max = flare_radius + r
r2 (num): radius of mesh at end of flare
+15 r= 8.8205
-15 r= 1.1795
z=10, 5 +/-15 - +/-15*0.745... |
flare_radius must be > = z2 ( height ) r2 max = flare_radius + r r2 ( num ): radius of mesh at end of flare + 15 r = 8. 8205 - 15 r = 1. 1795 z = 10 5 +/ - 15 - +/ - 15 * 0. 74535599249992989880305788957709 | def curl_rim(script, curl_radius=None, start_radius=None, end_radius=None,
end_height=None):
"""
flare_radius must be >= z2 (height)
r2 max = flare_radius + r
r2 (num): radius of mesh at end of flare
+15 r= 8.8205
-15 r= 1.1795
z=10, 5 +/-15 - +/-15*0.745355992499... |
Deform mesh around cylinder of radius and axis z | def wrap2cylinder(script, radius=1, pitch=0, taper=0, pitch_func=None,
taper_func=None):
"""Deform mesh around cylinder of radius and axis z
y = 0 will be on the surface of radius "radius"
pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation
taper = ch... |
Bends mesh around cylinder of radius radius and axis z to a certain angle | def bend(script, radius=1, pitch=0, taper=0, angle=0, straght_start=True,
straght_end=False, radius_limit=None, outside_limit_end=True):
"""Bends mesh around cylinder of radius radius and axis z to a certain angle
straight_ends: Only apply twist (pitch) over the area that is bent
outside_limit_en... |
Deform a mesh along a parametric curve function | def deform2curve(script, curve=mp_func.torus_knot('t'), step=0.001):
""" Deform a mesh along a parametric curve function
Provide a parametric curve function with z as the parameter. This will
deform the xy cross section of the mesh along the curve as z increases.
Source: http://blackpawn.com/texts/pqt... |
Transfer vertex colors to texture colors | def vc2tex(script, tex_name='TEMP3D_texture.png', tex_width=1024,
tex_height=1024, overwrite_tex=False, assign_tex=False,
fill_tex=True):
"""Transfer vertex colors to texture colors
Args:
script: the FilterScript object or script filename to write
the filter to.
... |
Transfer mesh colors to face colors | def mesh2fc(script, all_visible_layers=False):
"""Transfer mesh colors to face colors
Args:
script: the FilterScript object or script filename to write
the filter to.
all_visible_layers (bool): If true the color mapping is applied to all the meshes
"""
filter_xml = ''.join([... |
Vertex Attribute Transfer ( between 2 meshes ) | def vert_attr_2_meshes(script, source_mesh=0, target_mesh=1,
geometry=False, normal=False, color=True,
quality=False, selection=False,
quality_distance=False, max_distance=0.5):
"""Vertex Attribute Transfer (between 2 meshes)
... |
Transfer Vertex Attributes to Texture ( between 2 meshes ) | def vert_attr2tex_2_meshes(script, source_mesh=0, target_mesh=1, attribute=0,
max_distance=0.5, tex_name='TEMP3D_texture.png',
tex_width=1024, tex_height=1024,
overwrite_tex=True, assign_tex=False,
fill_tex=True)... |
Transfer texture colors to vertex colors ( between 2 meshes ) | def tex2vc_2_meshes(script, source_mesh=0, target_mesh=1, max_distance=0.5):
"""Transfer texture colors to vertex colors (between 2 meshes)
Args:
script: the FilterScript object or script filename to write
the filter to.
source_mesh (int): The mesh with associated texture that we wa... |
Simplify a mesh using a Quadric based Edge Collapse Strategy better than clustering but slower. Optionally tries to preserve UV parametrization for textured meshes. | def simplify(script, texture=True, faces=25000, target_perc=0.0,
quality_thr=0.3, preserve_boundary=False, boundary_weight=1.0,
optimal_placement=True, preserve_normal=False,
planar_quadric=False, selected=False, extra_tex_coord_weight=1.0,
preserve_topology=True, qua... |
Create a new mesh that is a resampled version of the current one. | def uniform_resampling(script, voxel=1.0, offset=0.0, merge_vert=True,
discretize=False, multisample=False, thicken=False):
""" Create a new mesh that is a resampled version of the current one.
The resampling is done by building a uniform volumetric representation
where each voxel co... |
Calculate the convex hull with Qhull library http:// www. qhull. org/ html/ qconvex. htm | def hull(script, reorient_normal=True):
""" Calculate the convex hull with Qhull library
http://www.qhull.org/html/qconvex.htm
The convex hull of a set of points is the boundary of the minimal convex
set containing the given non-empty finite set of points.
Args:
script: the FilterScrip... |
Use the points and normals to build a surface using the Poisson Surface reconstruction approach. | def surface_poisson(script, octree_depth=10, solver_divide=8,
samples_per_node=1.0, offset=1.0):
""" Use the points and normals to build a surface using the Poisson
Surface reconstruction approach.
Args:
script: the FilterScript object or script filename to write
... |
This surface reconstruction algorithm creates watertight surfaces from oriented point sets. | def surface_poisson_screened(script, visible_layer=False, depth=8,
full_depth=5, cg_depth=0, scale=1.1,
samples_per_node=1.5, point_weight=4.0,
iterations=8, confidence=False, pre_clean=False):
""" This surface reconstruction alg... |
Use the points and normals to build a surface using the Poisson Surface reconstruction approach. | def curvature_flipping(script, angle_threshold=1.0, curve_type=0,
selected=False):
""" Use the points and normals to build a surface using the Poisson
Surface reconstruction approach.
Args:
script: the FilterScript object or script filename to write
the filter... |
Turn a model into a surface with Voronoi style holes in it | def voronoi(script, hole_num=50, target_layer=None, sample_layer=None, thickness=0.5, backward=True):
""" Turn a model into a surface with Voronoi style holes in it
References:
http://meshlabstuff.blogspot.com/2009/03/creating-voronoi-sphere.html
http://meshlabstuff.blogspot.com/2009/04/creating-vorono... |
Select all the faces of the current mesh | def all(script, face=True, vert=True):
""" Select all the faces of the current mesh
Args:
script: the FilterScript object or script filename to write
the filter to.
faces (bool): If True the filter will select all the faces.
verts (bool): If True the filter will select all t... |
Grow ( dilate expand ) the current set of selected faces | def grow(script, iterations=1):
""" Grow (dilate, expand) the current set of selected faces
Args:
script: the FilterScript object or script filename to write
the filter to.
iterations (int): the number of times to grow the selection.
Layer stack:
No impacts
MeshLab... |
Shrink ( erode reduce ) the current set of selected faces | def shrink(script, iterations=1):
""" Shrink (erode, reduce) the current set of selected faces
Args:
script: the FilterScript object or script filename to write
the filter to.
iterations (int): the number of times to shrink the selection.
Layer stack:
No impacts
Me... |
Select the small disconnected parts ( components ) of a mesh. | def small_parts(script, ratio=0.2, non_closed_only=False):
""" Select the small disconnected parts (components) of a mesh.
Args:
script: the FilterScript object or script filename to write
the filter to.
ratio (float): This ratio (between 0 and 1) defines the meaning of
... |
Select all the faces and vertexes within the specified vertex quality range. | def vert_quality(script, min_quality=0.0, max_quality=0.05, inclusive=True):
""" Select all the faces and vertexes within the specified vertex quality
range.
Args:
script: the FilterScript object or script filename to write
the filter] to.
min_quality (float): Minimum accept... |
Boolean function using muparser lib to perform face selection over current mesh. | def face_function(script, function='(fi == 0)'):
"""Boolean function using muparser lib to perform face selection over
current mesh.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possible to use parenthesis, per-vertex variables and boolean operator:
(, ), and, or, ... |
Boolean function using muparser lib to perform vertex selection over current mesh. | def vert_function(script, function='(q < 0)', strict_face_select=True):
"""Boolean function using muparser lib to perform vertex selection over current mesh.
See help(mlx.muparser_ref) for muparser reference documentation.
It's possible to use parenthesis, per-vertex variables and boolean operator:
... |
Select all vertices within a cylindrical radius | def cylindrical_vert(script, radius=1.0, inside=True):
"""Select all vertices within a cylindrical radius
Args:
radius (float): radius of the sphere
center_pt (3 coordinate tuple or list): center point of the sphere
Layer stack:
No impacts
MeshLab versions:
2016.12
... |
Select all vertices within a spherical radius | def spherical_vert(script, radius=1.0, center_pt=(0.0, 0.0, 0.0)):
"""Select all vertices within a spherical radius
Args:
radius (float): radius of the sphere
center_pt (3 coordinate tuple or list): center point of the sphere
Layer stack:
No impacts
MeshLab versions:
2... |
Flatten all or only the visible layers into a single new mesh. | def join(script, merge_visible=True, merge_vert=False, delete_layer=True,
keep_unreferenced_vert=False):
""" Flatten all or only the visible layers into a single new mesh.
Transformations are preserved. Existing layers can be optionally
deleted.
Args:
script: the mlx.FilterScript obje... |
Delete layer | def delete(script, layer_num=None):
""" Delete layer
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
layer_num (int): the number of the layer to delete. Default is the
current layer. Not supported on the file base API.
Layer stac... |
Rename layer label | def rename(script, label='blank', layer_num=None):
""" Rename layer label
Can be useful for outputting mlp files, as the output file names use
the labels.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
label (str): new label for the mes... |
Change the current layer by specifying the new layer number. | def change(script, layer_num=None):
""" Change the current layer by specifying the new layer number.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
layer_num (int): the number of the layer to change to. Default is the
last layer if s... |
Duplicate a layer. | def duplicate(script, layer_num=None):
""" Duplicate a layer.
New layer label is '*_copy'.
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
layer_num (int): layer number to duplicate. Default is the
current layer. Not supported on... |
Split current layer into many layers one for each part ( connected component ) | def split_parts(script, part_num=None, layer_num=None):
""" Split current layer into many layers, one for each part (connected
component)
Mesh is split so that the largest part is the lowest named layer "CC 0"
and the smallest part is the highest numbered "CC" layer.
Args:
script: the ... |
Delete all layers below the specified one. | def delete_lower(script, layer_num=None):
""" Delete all layers below the specified one.
Useful for MeshLab ver 2016.12, whcih will only output layer 0.
"""
if layer_num is None:
layer_num = script.current_layer()
if layer_num != 0:
change(script, 0)
for i in range(layer_num):
... |
Subprocess program error handling | def handle_error(program_name, cmd, log=None):
"""Subprocess program error handling
Args:
program_name (str): name of the subprocess program
Returns:
break_now (bool): indicate whether calling program should break out of loop
"""
print('\nHouston, we have a problem.',
'\... |
Run meshlabserver in a subprocess. | def run(script='TEMP3D_default.mlx', log=None, ml_log=None,
mlp_in=None, mlp_out=None, overwrite=False, file_in=None,
file_out=None, output_mask=None, cmd=None, ml_version=ML_VERSION,
print_meshlabserver_output=True):
"""Run meshlabserver in a subprocess.
Args:
log (str): filena... |
Finds the filenames of the referenced texture file ( s ) ( and material file for obj ) for the mesh. | def find_texture_files(fbasename, log=None):
"""Finds the filenames of the referenced texture file(s) (and material
file for obj) for the mesh.
Args:
fbasename (str): input filename. Supported file extensions:
obj
ply
dae
x3d
wrl
l... |
Set default output mask options based on file extension Note: v1. 34BETA changed - om switch to - m Possible options ( not all options are available for every format ): vc - > vertex colors vf - > vertex flags vq - > vertex quality vn - > vertex normals vt - > vertex texture coords fc - > face colors ff - > face flags ... | def default_output_mask(file_out, texture=True, vert_normals=True, vert_colors=False,
face_colors=False, ml_version=ML_VERSION):
"""
Set default output mask options based on file extension
Note: v1.34BETA changed -om switch to -m
Possible options (not all options are available fo... |
Create new mlx script and write opening tags. | def begin(script='TEMP3D_default.mlx', file_in=None, mlp_in=None):
"""Create new mlx script and write opening tags.
Performs special processing on stl files.
If no input files are provided this will create a dummy
file and delete it as the first filter. This works around
the meshlab limitation tha... |
Create mlp file mlp_mesh ( list containing dictionary ) filename * label matrix | def create_mlp(file_out, mlp_mesh=None, mlp_raster=None):
""" Create mlp file
mlp_mesh (list containing dictionary)
filename*
label
matrix
mlp_raster
filename*
label
semantic
camera
trans_vector*
rotation_matrix*
fo... |
Add new mesh layer to the end of the stack | def add_layer(self, label, change_layer=True):
""" Add new mesh layer to the end of the stack
Args:
label (str): new label for the mesh layer
change_layer (bool): change to the newly created layer
"""
self.layer_stack.insert(self.last_layer() + 1, label)
... |
Delete mesh layer | def del_layer(self, layer_num):
""" Delete mesh layer """
del self.layer_stack[layer_num]
# Adjust current layer if needed
if layer_num < self.current_layer():
self.set_current_layer(self.current_layer() - 1)
return None |
Save filter script to an mlx file | def save_to_file(self, script_file):
""" Save filter script to an mlx file """
# TODO: rasie exception here instead?
if not self.filters:
print('WARNING: no filters to save to file!')
script_file_descriptor = open(script_file, 'w')
script_file_descriptor.write(''.join... |
Run the script | def run_script(self, log=None, ml_log=None, mlp_out=None, overwrite=False,
file_out=None, output_mask=None, script_file=None, print_meshlabserver_output=True):
""" Run the script
"""
temp_script = False
temp_ml_log = False
if self.__no_file_in:
# ... |
Run main script | def main():
"""Run main script"""
# segments = number of segments to use for circles
segments = 50
# star_points = number of points (or sides) of the star
star_points = 5
# star_radius = radius of circle circumscribing the star
star_radius = 2
# ring_thickness = thickness of the colored ... |
Select & delete the small disconnected parts ( components ) of a mesh. | def small_parts(script, ratio=0.2, non_closed_only=False):
""" Select & delete the small disconnected parts (components) of a mesh.
Args:
script: the FilterScript object or script filename to write
the filter to.
ratio (float): This ratio (between 0 and 1) defines the meaning of
... |
Delete selected vertices and/ or faces | def selected(script, face=True, vert=True):
""" Delete selected vertices and/or faces
Note: if the mesh has no faces (e.g. a point cloud) you must
set face=False, or the vertices will not be deleted
Args:
script: the FilterScript object or script filename to write
the filter to.
... |
Check for every vertex on the mesh: if it is NOT referenced by a face removes it. | def unreferenced_vert(script):
""" Check for every vertex on the mesh: if it is NOT referenced by a face,
removes it.
Args:
script: the FilterScript object or script filename to write
the filter to.
Layer stack:
No impacts
MeshLab versions:
2016.12
... |
Check for every vertex on the mesh: if there are two vertices with the same coordinates they are merged into a single one. | def duplicate_verts(script):
""" "Check for every vertex on the mesh: if there are two vertices with
the same coordinates they are merged into a single one.
Args:
script: the FilterScript object or script filename to write
the filter to.
Layer stack:
No impacts
Mes... |
Compute the Hausdorff Distance between two meshes sampling one of the two and finding for each sample the closest point over the other mesh. | def hausdorff_distance(script, sampled_layer=1, target_layer=0,
save_sample=False, sample_vert=True, sample_edge=True,
sample_faux_edge=False, sample_face=True,
sample_num=1000, maxdist=10):
""" Compute the Hausdorff Distance between two meshes, s... |
Create a new layer populated with a point sampling of the current mesh. | def poisson_disk(script, sample_num=1000, radius=0.0,
montecarlo_rate=20, save_montecarlo=False,
approx_geodesic_dist=False, subsample=False, refine=False,
refine_layer=0, best_sample=True, best_sample_pool=10,
exact_num=False, radius_variance=1.0):
... |
Create a new layer populated with a point sampling of the current mesh at most one sample for each element of the mesh is created. | def mesh_element(script, sample_num=1000, element='VERT'):
""" Create a new layer populated with a point sampling of the current mesh,
at most one sample for each element of the mesh is created.
Samples are taking in a uniform way, one for each element
(vertex/edge/face); all the elements have the ... |
Create a new layer populated with a subsampling of the vertexes of the current mesh | def clustered_vert(script, cell_size=1.0, strategy='AVERAGE', selected=False):
""" "Create a new layer populated with a subsampling of the vertexes of the
current mesh
The subsampling is driven by a simple one-per-gridded cell strategy.
Args:
script: the FilterScript object or script filen... |
Flat plane parameterization | def flat_plane(script, plane=0, aspect_ratio=False):
"""Flat plane parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Flat Plane ">\n',
' <Param name="projectionPlane"',
'value="%d"' % plane,
'description="Projection plane"',
'enum_val0=... |
Trivial Per - Triangle parameterization | def per_triangle(script, sidedim=0, textdim=1024, border=2, method=1):
"""Trivial Per-Triangle parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Trivial Per-Triangle ">\n',
' <Param name="sidedim"',
'value="%d"' % sidedim,
'description="Quads p... |
Voronoi Atlas parameterization | def voronoi(script, region_num=10, overlap=False):
"""Voronoi Atlas parameterization
"""
filter_xml = ''.join([
' <filter name="Parametrization: Voronoi Atlas">\n',
' <Param name="regionNum"',
'value="%d"' % region_num,
'description="Approx. Region Num"',
'type="... |
Isometric parameterization | def isometric(script, targetAbstractMinFaceNum=140, targetAbstractMaxFaceNum=180,
stopCriteria=1, convergenceSpeed=1, DoubleStep=True):
"""Isometric parameterization
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization">\n',
' <Param name="targetAbstractMinFaceNu... |
Isometric parameterization: Build Atlased Mesh | def isometric_build_atlased_mesh(script, BorderSize=0.1):
"""Isometric parameterization: Build Atlased Mesh
This actually generates the UV mapping from the isometric parameterization
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization Build Atlased Mesh">\n',
' <Param na... |
Isometric parameterization: Save Abstract Domain | def isometric_save(script, AbsName="TEMP3D.abs"):
"""Isometric parameterization: Save Abstract Domain
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization Save Abstract Domain">\n',
' <Param name="AbsName"',
'value="%s"' % AbsName,
'description="Abstract Mesh f... |
Isometric parameterization: Load Abstract Domain | def isometric_load(script, AbsName="TEMP3D.abs"):
"""Isometric parameterization: Load Abstract Domain
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization Load Abstract Domain">\n',
' <Param name="AbsName"',
'value="%s"' % AbsName,
'description="Abstract Mesh f... |
Isometric parameterization: transfer between meshes | def isometric_transfer(script, sourceMesh=0, targetMesh=1):
"""Isometric parameterization: transfer between meshes
Provide the layer numbers of the source and target meshes.
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization transfer between meshes">\n',
' <Param name="... |
Isometric parameterization: remeshing | def isometric_remesh(script, SamplingRate=10):
"""Isometric parameterization: remeshing
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization Remeshing">\n',
' <Param name="SamplingRate"',
'value="%d"' % SamplingRate,
'description="Sampling Rate"',
'type... |
Set texture | def set_texture(script, textName="TEMP3D.png", textDim=1024):
"""Set texture
"""
filter_xml = ''.join([
' <filter name="Set Texture">\n',
' <Param name="textName"',
'value="%s"' % textName,
'description="Texture file"',
'type="RichString"',
'tooltip="If t... |
Set texture | def project_rasters(script, tex_file_out="TEMP3D.png", tex_size=1024,
fill_atlas_gaps=False, depth_threshold=0.5,
selected=False, use_angle=True, use_distance=True,
use_borders=True, use_silhouettes=True, use_alpha=False):
"""Set texture
Creates new t... |
Set texture | def param_texture_from_rasters(script, textName="TEMP3D.png", texsize=1024,
colorCorrection=True, colorCorrectionFilterSize=1,
useDistanceWeight=True, useImgBorderWeight=True,
useAlphaWeight=False, cleanIsolatedTriangles=True,
... |
Set texture | def param_from_rasters(script, useDistanceWeight=True, useImgBorderWeight=True,
useAlphaWeight=False, cleanIsolatedTriangles=True,
stretchingAllowed=False, textureGutter=4):
"""Set texture
"""
filter_xml = ''.join([
' <filter name="Parameterization fro... |
Compute the polyline representing a planar section ( a slice ) of a mesh. | def section(script, axis='z', offset=0.0, surface=False, custom_axis=None,
planeref=2):
""" Compute the polyline representing a planar section (a slice) of a mesh.
If the resulting polyline is closed the result can be filled with a
triangular mesh representing the section.
Args:
sc... |
Compute a set of geometric measures of a mesh/ pointcloud. | def measure_geometry(script):
""" Compute a set of geometric measures of a mesh/pointcloud.
Bounding box extents and diagonal, principal axis, thin shell barycenter
(mesh only), vertex barycenter and quality-weighted barycenter (pointcloud
only), surface area (mesh only), volume (closed mesh) and Inert... |
Compute a set of topological measures over a mesh | def measure_topology(script):
""" Compute a set of topological measures over a mesh
Args:
script: the mlx.FilterScript object or script filename to write
the filter to.
Layer stack:
No impacts
MeshLab versions:
2016.12
1.3.4BETA
"""
filter_xml = ' ... |
Parse the ml_log file generated by the measure_geometry function. | def parse_geometry(ml_log, log=None, ml_version='2016.12', print_output=False):
"""Parse the ml_log file generated by the measure_geometry function.
Warnings: Not all keys may exist if mesh is not watertight or manifold
Args:
ml_log (str): MeshLab log file to parse
log (str): filename to l... |
Parse the ml_log file generated by the measure_topology function. | def parse_topology(ml_log, log=None, ml_version='1.3.4BETA', print_output=False):
"""Parse the ml_log file generated by the measure_topology function.
Args:
ml_log (str): MeshLab log file to parse
log (str): filename to log output
Returns:
dict: dictionary with the following keys:
... |
Parse the ml_log file generated by the hausdorff_distance function. | def parse_hausdorff(ml_log, log=None, print_output=False):
"""Parse the ml_log file generated by the hausdorff_distance function.
Args:
ml_log (str): MeshLab log file to parse
log (str): filename to log output
Returns:
dict: dictionary with the following keys:
number_po... |
Color function using muparser lib to generate new RGBA color for every vertex | def function(script, red=255, green=255, blue=255, alpha=255, color=None):
"""Color function using muparser lib to generate new RGBA color for every
vertex
Red, Green, Blue and Alpha channels may be defined by specifying a function
for each.
See help(mlx.muparser_ref) for muparser reference do... |
Given a Mesh M and a Pointset P the filter projects each vertex of P over M and color M according to the geodesic distance from these projected points. Projection and coloring are done on a per vertex basis. | def voronoi(script, target_layer=0, source_layer=1, backward=True):
""" Given a Mesh 'M' and a Pointset 'P', the filter projects each vertex of
P over M and color M according to the geodesic distance from these
projected points. Projection and coloring are done on a per vertex
basis.
Ar... |
Color mesh vertices in a repeating sinusiodal rainbow pattern | def cyclic_rainbow(script, direction='sphere', start_pt=(0, 0, 0),
amplitude=255 / 2, center=255 / 2, freq=0.8,
phase=(0, 120, 240, 0), alpha=False):
""" Color mesh vertices in a repeating sinusiodal rainbow pattern
Sine wave follows the following equation for each color c... |
muparser atan2 function | def mp_atan2(y, x):
"""muparser atan2 function
Implements an atan2(y,x) function for older muparser versions (<2.1.0);
atan2 was added as a built-in function in muparser 2.1.0
Args:
y (str): y argument of the atan2(y,x) function
x (str): x argument of the atan2(y,x) function
Retur... |
muparser cross product function | def v_cross(u, v):
"""muparser cross product function
Compute the cross product of two 3x1 vectors
Args:
u (list or tuple of 3 strings): first vector
v (list or tuple of 3 strings): second vector
Returns:
A list containing a muparser string of the cross product
"""
"""
... |
Multiply vector by scalar | def v_multiply(scalar, v1):
""" Multiply vector by scalar"""
vector = []
for i, x in enumerate(v1):
vector.append('(({})*({}))'.format(scalar, v1[i]))
return vector |
A tight ( small inner crossings ) ( p q ) torus knot parametric curve | def torus_knot(t, p=3, q=4, scale=1.0, radius=2.0):
""" A tight (small inner crossings) (p,q) torus knot parametric curve
Source (for trefoil): https://en.wikipedia.org/wiki/Trefoil_knot
"""
return ['{scale}*(sin({t}) + ({radius})*sin({p}*({t})))'.format(t=t, p=p, scale=scale, radius=radius),
... |
Add a new Per - Vertex scalar attribute to current mesh and fill it with the defined function. | def vert_attr(script, name='radius', function='x^2 + y^2'):
""" Add a new Per-Vertex scalar attribute to current mesh and fill it with
the defined function.
The specified name can be used in other filter functions.
It's possible to use parenthesis, per-vertex variables and boolean operator:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.