mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-09 13:36:58 +02:00
add plot_revolution
This commit is contained in:
@@ -142,7 +142,7 @@ function lerpn(a,b,n,endpoint=true) =
|
|||||||
// Function: bilerp()
|
// Function: bilerp()
|
||||||
// Synopsis: Bi-linear interpolation between four values
|
// Synopsis: Bi-linear interpolation between four values
|
||||||
// Topics: Interpolation, Math
|
// Topics: Interpolation, Math
|
||||||
// See Also: lerpn()
|
// See Also: lerp()
|
||||||
// Usage:
|
// Usage:
|
||||||
// x = bilerp(pts, x, y);
|
// x = bilerp(pts, x, y);
|
||||||
// Description:
|
// Description:
|
||||||
|
@@ -2579,7 +2579,9 @@ function _circle_mask(r) =
|
|||||||
// same dimensions that is has on the plane, with y axis mapping to the z axis and the x axis bending
|
// same dimensions that is has on the plane, with y axis mapping to the z axis and the x axis bending
|
||||||
// around the curve of the cylinder. The angular span of the path on the cylinder must be somewhat
|
// around the curve of the cylinder. The angular span of the path on the cylinder must be somewhat
|
||||||
// less than 180 degrees, and the path shouldn't have closely spaced points at concave points of high curvature because
|
// less than 180 degrees, and the path shouldn't have closely spaced points at concave points of high curvature because
|
||||||
// this causes self-intersection in the mask polyhedron, resulting in CGAL failures.
|
// this causes self-intersection in the mask polyhedron, resulting in CGAL failures. The path also cannot include
|
||||||
|
// sharp corners, because it internally uses {{offset()}} which will expand those sharp corners into very long single
|
||||||
|
// segments that produce incorrect result.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// r / radius = center radius of the cylindrical shell to cut a hole in
|
// r / radius = center radius of the cylindrical shell to cut a hole in
|
||||||
// thickness = thickness of cylindrical shell (may need to be slighly oversized)
|
// thickness = thickness of cylindrical shell (may need to be slighly oversized)
|
||||||
@@ -4535,6 +4537,10 @@ function _find_center_anchor(desc1, desc2, anchor2, flip) =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function _is_anchor(a) = is_string(a) || is_vector(a,2) || is_vector(a,3);
|
||||||
|
|
||||||
|
function _is_anchor_list(list) = is_list(list) && [for(a=list) if (!_is_anchor(a)) a]==[];
|
||||||
|
|
||||||
|
|
||||||
module prism_connector(profile, desc1, anchor1, desc2, anchor2, shift1=0, shift2=0, spin_align=1,
|
module prism_connector(profile, desc1, anchor1, desc2, anchor2, shift1=0, shift2=0, spin_align=1,
|
||||||
scale=1,
|
scale=1,
|
||||||
@@ -4545,6 +4551,25 @@ module prism_connector(profile, desc1, anchor1, desc2, anchor2, shift1=0, shift2
|
|||||||
smooth_normals, smooth_normals1, smooth_normals2,
|
smooth_normals, smooth_normals1, smooth_normals2,
|
||||||
debug=false, debug_pos=false)
|
debug=false, debug_pos=false)
|
||||||
{
|
{
|
||||||
|
dummy1 = assert(_is_anchor(anchor1) || _is_anchor_list(anchor1) , "anchor1 must be an anchor (string or a 3-vector) or a list of anchors")
|
||||||
|
assert(_is_anchor(anchor2) || _is_anchor_list(anchor2) , "anchor2 must be an anchor (string or a 3-vector) or a list of anchors");
|
||||||
|
if (_is_anchor_list(anchor1) || _is_anchor_list(anchor2)) {
|
||||||
|
anchor1_list=_is_anchor(anchor1) ? [anchor1] : anchor1;
|
||||||
|
anchor2_list=_is_anchor(anchor2) ? [anchor2] : anchor2;
|
||||||
|
for(i = idx(anchor1_list))
|
||||||
|
for(j= idx(anchor2_list))
|
||||||
|
{
|
||||||
|
$anchor1 = anchor1_list[i];
|
||||||
|
$anchor2 = anchor2_list[j];
|
||||||
|
$idx = [i,j];
|
||||||
|
prism_connector(profile=profile, desc1=desc1, anchor1=$anchor1, desc2=desc2, anchor2=$anchor2, shift1=shift1, shift2=shift2, spin_align=spin_align,
|
||||||
|
scale=scale, fillet=fillet, fillet1=fillet1, fillet2=fillet2, overlap=overlap, overlap1=overlap1, overlap2=overlap2,
|
||||||
|
k=k, k1=k1, k2=k2, n=n, n1=n1, n2=n2, uniform=uniform, uniform1=uniform1, uniform2=uniform2,
|
||||||
|
smooth_normals=smooth_normals, smooth_normals1=smooth_normals1, smooth_normals2=smooth_normals2,
|
||||||
|
debug=debug, debug_pos=debug_pos) children();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
base_fillet = first_defined([fillet1,fillet,0]);
|
base_fillet = first_defined([fillet1,fillet,0]);
|
||||||
aux_fillet = first_defined([fillet2,fillet,0]);
|
aux_fillet = first_defined([fillet2,fillet,0]);
|
||||||
|
|
||||||
@@ -4581,8 +4606,7 @@ module prism_connector(profile, desc1, anchor1, desc2, anchor2, shift1=0, shift2
|
|||||||
tobase = current==base ? ident(4) : linear_solve(current[0],base[0]); // Maps from current frame into the base frame
|
tobase = current==base ? ident(4) : linear_solve(current[0],base[0]); // Maps from current frame into the base frame
|
||||||
auxmap = linear_solve(base[0], aux[0]); // Map from the base (desc1) coordinate frame into the aux (desc2) coordinate frame
|
auxmap = linear_solve(base[0], aux[0]); // Map from the base (desc1) coordinate frame into the aux (desc2) coordinate frame
|
||||||
|
|
||||||
dummy = assert(is_vector(base_anchor) || is_string(base_anchor), "anchor1 must be a string or a 3-vector")
|
dummy =
|
||||||
assert(is_vector(aux_anchor) || is_string(aux_anchor), "anchor2 must be a string or a 3-vector")
|
|
||||||
assert(is_rotation(auxmap), "desc1 and desc2 are not related to each other by a rotation (and translation)");
|
assert(is_rotation(auxmap), "desc1 and desc2 are not related to each other by a rotation (and translation)");
|
||||||
|
|
||||||
base_type = _get_obj_type(1,base[1],base_anchor,profile);
|
base_type = _get_obj_type(1,base[1],base_anchor,profile);
|
||||||
|
@@ -3417,7 +3417,7 @@ function associate_vertices(polygons, split, curpoly=0) =
|
|||||||
// Topics: Textures, Knurling
|
// Topics: Textures, Knurling
|
||||||
// Synopsis: Produce a standard texture.
|
// Synopsis: Produce a standard texture.
|
||||||
// Topics: Extrusion, Textures
|
// Topics: Extrusion, Textures
|
||||||
// See Also: linear_sweep(), rotate_sweep(), heightfield(), cylindrical_heightfield()
|
// See Also: linear_sweep(), rotate_sweep(), cyl(), vnf_vertex_array(), sweep(), path_sweep(), textured_tile()
|
||||||
// Usage:
|
// Usage:
|
||||||
// tx = texture(tex, [n=], [inset=], [gap=], [roughness=]);
|
// tx = texture(tex, [n=], [inset=], [gap=], [roughness=]);
|
||||||
// Description:
|
// Description:
|
||||||
|
@@ -884,6 +884,7 @@ module deprecate(new_name)
|
|||||||
// echo_viewport();
|
// echo_viewport();
|
||||||
// Description:
|
// Description:
|
||||||
// Display the current viewport parameters so that they can be pasted into examples for the wiki.
|
// Display the current viewport parameters so that they can be pasted into examples for the wiki.
|
||||||
|
// The viewport should have a 4x3 aspect ratio to ensure proper framing of the object.
|
||||||
|
|
||||||
module echo_viewport()
|
module echo_viewport()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user