omdl  v0.5
OpenSCAD Mechanical Design Library
primitives.scad File Reference

Mathematical primitive functions. More...

#include <constants.scad>
+ Include dependency graph for primitives.scad:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

function is_defined (v)
 Test if a value is defined. More...
 
function not_defined (v)
 Test if a value is not defined. More...
 
function is_empty (v)
 Test if an iterable value is empty. More...
 
function is_scalar (v)
 Test if a value is a single non-iterable value. More...
 
function is_iterable (v)
 Test if a value has multiple parts and is iterable. More...
 
function is_string (v)
 Test if a value is a string. More...
 
function is_vector (v)
 Test if a value is a vector. More...
 
function is_boolean (v)
 Test if a value is a boolean constant. More...
 
function is_integer (v)
 Test if a value is an integer. More...
 
function is_decimal (v)
 Test if a value is a decimal. More...
 
function is_number (v)
 Test if a value is a number. More...
 
function is_range (v)
 Test if a value is a range definition. More...
 
function is_nan (v)
 Test if a numerical value is invalid. More...
 
function is_inf (v)
 Test if a numerical value is infinite. More...
 
function is_even (v)
 Test if a numerical value is even. More...
 
function is_odd (v)
 Test if a numerical value is odd. More...
 
function all_equal (v, cv)
 Test if all elements of a value equal a comparison value. More...
 
function any_equal (v, cv)
 Test if any element of a value equals a comparison value. More...
 
function all_defined (v)
 Test if no element of a value is undefined. More...
 
function any_undefined (v)
 Test if any element of a value is undefined. More...
 
function all_scalars (v)
 Test if all elements of a value are scalars. More...
 
function all_vectors (v)
 Test if all elements of a value are vectors. More...
 
function all_strings (v)
 Test if all elements of a value are strings. More...
 
function all_numbers (v)
 Test if all elements of a value are numbers. More...
 
function all_len (v, l)
 Test if all elements of a value have a given length. More...
 
function almost_equal (v1, v2, p=4)
 Test if all elements of two values are approximately equal. More...
 
function compare (v1, v2, s=true)
 Compare any two values (may be iterable and/or of different types). More...
 
function consts (l, v)
 Create a vector of constant elements. More...
 
function vstr (v)
 Convert all vector elements to strings and concatenate. More...
 
function sum (v, i1, i2)
 Compute the sum of a vector of numbers. More...
 
function find (mv, v, c=1, i, i1=0, i2)
 Find the occurrences of a match value in an iterable value. More...
 
function count (mv, v, s=true, i)
 Count all occurrences of a match value in an iterable value. More...
 
function exists (mv, v, s=true, i)
 Check the existence of a match value in an iterable value. More...
 
function defined_or (v, d)
 Return a defined or default value. More...
 
function edefined_or (v, i, d)
 Return a defined vector element or default value. More...
 
function first (v)
 Return the first element of an iterable value. More...
 
function second (v)
 Return the second element of an iterable value. More...
 
function last (v)
 Return the last element of an iterable value. More...
 
function nfirst (v, n=1)
 Return a vector containing the first n elements of an iterable value. More...
 
function nlast (v, n=1)
 Return a vector containing the last n elements of an iterable value. More...
 
function nhead (v, n=1)
 Return a vector containing all but the last n elements of an iterable value. More...
 
function ntail (v, n=1)
 Return a vector containing all but the first n elements of an iterable value. More...
 
function rselect (v, i)
 Select a range of elements from an iterable value. More...
 
function eselect (v, f=true, l=false, i)
 Select an element from each iterable value. More...
 
function ciselect (v, i)
 Case-like select a value from a vector of ordered options by index. More...
 
function cmvselect (v, mv)
 Case-like select a value from a vector of identified options by match-value. More...
 
function smerge (v, r=false)
 Serial-merge vectors of iterable values. More...
 
function pmerge (v, j=true)
 Parallel-merge vectors of iterable values. More...
 
function reverse (v)
 Reverse the elements of an iterable value. More...
 
function qsort (v, r=false)
 Sort the numeric or string elements of a vector using quick sort. More...
 
function qsort2 (v, d=0, r=false, s=true)
 Hierarchically sort all elements of a vector using quick sort. More...
 
function strip (v, mv=empty_v)
 Strip all matching values from an iterable value. More...
 
function eappend (nv, v, r=true, j=true, l=true)
 Append a value to each element of an iterable value. More...
 
function insert (nv, v, i=0, mv, mi=0, s=true, si)
 Insert a new value into an iterable value. More...
 
function delete (v, i, mv, mc=1, s=true, si)
 Delete elements from an iterable value. More...
 
function unique (v)
 Return the unique elements of an iterable value. More...
 

Detailed Description

Mathematical primitive functions.

Author
Roy Allen Sutton
Date
2015-2017

This file is part of omdl, an OpenSCAD mechanical design library.

The omdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

The omdl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the omdl; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA; or see http://www.gnu.org/licenses/.

Note
Include this library file using the include statement.

Definition in file primitives.scad.