mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-19 09:11:37 +02:00
Wrote better documentation for get_named_args()
This commit is contained in:
@@ -67,17 +67,17 @@ module bounding_box(excess=0) {
|
||||
// Function&Module: half_of()
|
||||
//
|
||||
// Usage: as module
|
||||
// half_of(v, [cp], [s]) ...
|
||||
// half_of(v, <cp>, <s>) ...
|
||||
// Usage: as function
|
||||
// half_of(v, [cp], p, [s])...
|
||||
// half_of(v, <cp>, p, <s>)...
|
||||
//
|
||||
// Description:
|
||||
// Slices an object at a cut plane, and masks away everything that is on one side.
|
||||
// * Called as a function with a path in the `p` argument, returns the
|
||||
// intersection of path `p` and given half-space.
|
||||
// intersection of path `p` and given half-space.
|
||||
// * Called as a function with a 2D path in the `p` argument
|
||||
// and a 2D vector `p`, returns the intersection of path `p` and given
|
||||
// half-plane.
|
||||
// and a 2D vector `p`, returns the intersection of path `p` and given
|
||||
// half-plane.
|
||||
//
|
||||
// Arguments:
|
||||
// v = Normal of plane to slice at. Keeps everything on the side the normal points to. Default: [0,0,1] (UP)
|
||||
@@ -121,7 +121,7 @@ module half_of(v=UP, cp, s=1000, planar=false)
|
||||
function half_of(_arg1=_undef, _arg2=_undef, _arg3=_undef, _arg4=_undef,
|
||||
v=_undef, cp=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3, _arg4],
|
||||
[[v,undef,0], [cp,0,2], [p,undef,1], [s,1e4,3]]),
|
||||
[[v,undef,0], [cp,0,2], [p,undef,1], [s, 1e4]]),
|
||||
v=args[0], cp0=args[1], p=args[2], s=args[3],
|
||||
cp = is_num(cp0) ? cp0*unit(v) : cp0)
|
||||
assert(is_vector(v,2)||is_vector(v,3),
|
||||
@@ -160,12 +160,12 @@ function half_of(_arg1=_undef, _arg2=_undef, _arg3=_undef, _arg4=_undef,
|
||||
// Function&Module: left_half()
|
||||
//
|
||||
// Usage: as module
|
||||
// left_half([s], [x]) ...
|
||||
// left_half(planar=true, [s], [x]) ...
|
||||
// left_half(<s>, <x>) ...
|
||||
// left_half(planar=true, <s>, <x>) ...
|
||||
// Usage: as function
|
||||
// left_half([s], [x], path)
|
||||
// left_half([s], [x], region)
|
||||
// left_half([s], [x], vnf)
|
||||
// left_half(<s>, <x>, path)
|
||||
// left_half(<s>, <x>, region)
|
||||
// left_half(<s>, <x>, vnf)
|
||||
//
|
||||
// Description:
|
||||
// Slices an object at a vertical Y-Z cut plane, and masks away everything that is right of it.
|
||||
@@ -197,7 +197,7 @@ module left_half(s=1000, x=0, planar=false)
|
||||
function left_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[1,0,0], cp=x, p=p);
|
||||
|
||||
@@ -209,6 +209,7 @@ function left_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
// right_half([s], [x]) ...
|
||||
// right_half(planar=true, [s], [x]) ...
|
||||
//
|
||||
//
|
||||
// Description:
|
||||
// Slices an object at a vertical Y-Z cut plane, and masks away everything that is left of it.
|
||||
//
|
||||
@@ -239,7 +240,7 @@ module right_half(s=1000, x=0, planar=false)
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[-1,0,0], cp=x, p=p);
|
||||
|
||||
@@ -281,7 +282,7 @@ module front_half(s=1000, y=0, planar=false)
|
||||
function front_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,1,0], cp=x, p=p);
|
||||
|
||||
@@ -323,7 +324,7 @@ module back_half(s=1000, y=0, planar=false)
|
||||
function back_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,-1,0], cp=x, p=p);
|
||||
|
||||
@@ -357,7 +358,7 @@ module bottom_half(s=1000, z=0)
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,0,-1], cp=x, p=p);
|
||||
|
||||
@@ -391,7 +392,7 @@ module top_half(s=1000, z=0)
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4,2]]),
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,0,1], cp=x, p=p);
|
||||
|
||||
|
Reference in New Issue
Block a user