New in SG-Lib 2.5
Last change of this page: 2017-07-14
VLFLreorder(VL,FL,nvi)- returns VL and FL with reordered vertices |
% VLFLreorder(VL,FL,nvi) - returns VL and FL with reordered vertices % (by Tim Lueth, VLFL-Lib, 2015-SEP-19 as class: AUXILIARY PROCEDURES) % % Auxiliary procedure for reordering (shifting, rotation) of vertices and % a corresponding face list: % VL(nvi,:)=VL; % FL=nvi(FL); % (Status of: 2015-09-19) % % [VL,FL]=VLFLreorder(VL,FL,nvi) % === INPUT PARAMETERS === % VL: Vertex list [n x 3] % FL: Facet list (mx3) % nvi: new vertex index list (same length as VL) (nx1) % === OUTPUT RESULTS ====== % VL: Resulting vertex list [nx3] % FL: Facet list using the new numbers % |
SGof2CPLz(CPA,CPB,z,stype,ctype)- returns a solid defined by 2 contours and height |
% SGof2CPLz(CPA,CPB,z,stype,ctype) - returns a solid defined by 2 % contours and height % (by Tim Lueth, VLFL-Lib, 2015-SEP-16 as class: SURFACES) % % The optimal result depends on the expectations of the user. Consider % different options for stype carefully: % "number" of points, i.e. 1:nmax % "length" of contour, i.e. 0:sum(edge length) % "angle" of contour, i.e. 0:sum(abs(edge angle)) % "center" of contour, i.e. 0:360 degree % also the starting point ctype ('rot' or 'min'); % % Quite optimal procedure to find the walls between two planar contours % without adding new points. The number of faces is na+nb. % The resulting vertex list SG: % SG.VL=[VLaddz(CPA,0);VLaddz(CPB,z)]; % SG.FL=[FLA;FLB;FLW]; % (Status of: 2015-10-02) % % [SG,FLW,FLA,FLB]=SGof2CPLz([CPA,CPB,z,stype,ctype]) % === INPUT PARAMETERS === % CPA: ONE bottom Contour % CPB: ONE top Contour % z: height of the solid % stype: "number", "length", "angle", "center"; default is "length" % ctype: "rot" or "miny"; default is "rot" % === OUTPUT RESULTS ====== % SG: Solid Geoemtry; VL=[CPA;CPB] % FLW: Face list of Wall % FLA: Face list of CPA % FLB: Face list of CPB % % EXAMPLE: % SGof2CPLz(PLcircle(10,8),PLstar(10,12),30) % |
exp_2015_09_16c(CPA,CPB,z)- EXPERIMENT that solves the problem of conntourwall of 2 independent contours |
% exp_2015_09_16c(CPA,CPB,z) - EXPERIMENT that solves the problem of % conntourwall of 2 independent contours % (by Tim Lueth, VLFL-Lib, 2015-SEP-16 as class: EXPERIMENTS) % % SG=exp_2015_09_16c(CPA,CPB,z) % === INPUT PARAMETERS === % CPA: Contour Bottom % CPB: Contour Top % z: % === OUTPUT RESULTS ====== % SG: Solid Geometry % |
mod1(n,k)- returns mod function for elements 1:k |
% mod1(n,k) - returns mod fnctn for elements 1:k % (by Tim Lueth, VLFL-Lib, 2015-SEP-16 as class: AUXILIARY PROCEDURES) % % auxiliary fnctn for array manipulation. Instead of return values % between [0..k-1], this fnctn returns [1..k] by a=mod(n-1,k)+1 (Status % of: 2015-09-16) % % See also: modN, mod % % a=mod1(n,k) % === INPUT PARAMETERS === % n: number % k: divider % === OUTPUT RESULTS ====== % a: rest % % EXAMPLE: % mod1(1:6,3) % |
CPLsortC(CPL,ctype,CA)- returns a contour that start with angle -pi |
% CPLsortC(CPL,ctype,CA) - returns a contour that start with angle -pi % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: CLOSED POLYGON LISTS) % % The contour is resorted around its center. It starts afterwards with % the minimal (ctype='min') angle, the angle nearest to zero % (ctype='zero'), or the maximum angle (ctype='max'). Often is is % important to take only points of the convex hull (for example in case % of spirals). Therefore, then only points are selected from the convex % hull for the nearest angle to zero (ctype='czero') on the convex hull % or the minimal angle value of the convex hull (type='cmin'). % % To resort the points backwards, use: circshift(CPS,[s 0]) % To compare results use: [A circshift(B,[s 0])] % % (Status of: 2015-10-02) % % [CPS,WA,CA,s]=CPLsortC(CPL,[ctype,CA]) % === INPUT PARAMETERS === % CPL: Original CPL % ctype: 'zero','min','max', 'czero', 'cmin'; default is 'czero' % CA: Optional Center Point; do not use it % === OUTPUT RESULTS ====== % CPS: Resorted CPL % WA: corresponding angle % CA: Center of CPL % s: circshift value to return % % EXAMPLE: % CPLsortC(PLstar(10,10)) % CPLsortC(CPLspiral(10,20,4*pi+pi/3)) % |
exp_2015_09_16(CPA,CPB)- EXPERIMENT TO SHOW THE PROBLEM WITH TETRAHEDRONS in 3D |
% exp_2015_09_16(CPA,CPB) - EXPERIMENT TO SHOW THE PROBLEM WITH % TETRAHEDRONS in 3D % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: EXPERIMENTS) % % SG=exp_2015_09_16(CPA,CPB) % === INPUT PARAMETERS === % CPA: Contour A % CPB: Contour B % === OUTPUT RESULTS ====== % SG: Resulting Solid % |
SGconvexHull(SG,sep)- returns the convex hulls of a solid geometry |
% SGconvexHull(SG,sep) - returns the convex hulls of a solid geometry % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: SURFACES) % % [SGC,TR3]=SGconvexHull(SG,[sep]) % === INPUT PARAMETERS === % SG: Solid Geometry % sep: false=one; true=separated solids % === OUTPUT RESULTS ====== % SGC: Convex hull(s) of the Solid % TR3: Delaunay Triangulation % % EXAMPLE: % SGconvexHull(SGsample(7)) % SGconvexHull(SGsample(9)) % |
SGarrangeSG(SGc,dist,adim)- arranges a cell list of solids in a single row |
% SGarrangeSG(SGc,dist,adim) - arranges a cell list of solids in a single row % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: SURFACES) % % 'SGarrangeSG' moves all solids of the cell list into the first quadrant % and then arranges them in line with a constant distance in x, y, or z % direction. It is a simple fnctn without any space optimization or size % ordering. For an optimal arrangement in a volume use 'SGpacking'. % In contrast to this fnctn, the fnctn 'SGarrangeSGC' uses a special % container format that allow to store different printing positions for % single solids of a set (Status of: 2017-01-21) % % See also: SGpacking, SGpatternXYZ, SGcopyrotZ, SGCaddSGn, SGCaddSG % % SG=SGarrangeSG(SGc,[dist,adim]) % === INPUT PARAMETERS === % SGc: Cell list of Solid Geometries % dist: fixed distance vector % adim: 'x' or 'y' or 'z' for arrangement % === OUTPUT RESULTS ====== % SG: One single solid without any cell structure % % EXAMPLE: % SGarrangeSG ({SGbox(rand(1,3)),SGbox(rand(1,3)),SGbox(rand(1,3))},0.5) % |
exp_2015_09_15- EXPERIMENT to understand the use of gear development |
%% PUBLISHABLE EXP_2015_09_15 EXPERIMENT TO UNDERSTAND THE USE OF GEAR DEVELOPMENT % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: EXPERIMENTS) %% % exp_2015_09_15 - EXPERIMENT to understand the use of gear development % (by Tim Lueth, VLFL-Lib, 2015-SEP-15 as class: EXPERIMENTS) % % exp_2015_09_15 % |
- EXPERIMENT to reimplement the function polybool |
% - EXPERIMENT to reimplement the procedure polybool % (by Tim Lueth, VLFL-Lib, 2015-SEP-14 as class: EXPERIMENTS) % % For reimplementation it is may be clever to check whether the source % code is visible and resuable % polybool % poly2fv % poly2ccw % poly2cw (Status of: 2015-09-14) % % % |
svgpolylineofCPL (fid,CPL,stroke,width,fill)- writes CPLs as polygons or polyeder lines for a laser cutter |
% svgpolylineofCPL (fid,CPL,stroke,width,fill) - writes CPLs as polygons or polyeder lines for a laser cutter % (by Tim Lueth, VLFL-Lib, 2015-SEP-13 as class: FILE HANDLING) % % See also: CPLsortinout, selectNaN, CPLwriteSVG % % svgpolylineofCPL(fid,CPL,[stroke,width,fill]) % === INPUT PARAMETERS === % fid: File Identifyer % CPL: Close Contour List % stroke: red, blue, etc. % width: 1, 3 % fill: none, or red, blue, etc. % % EXAMPLE: % CPLwriteSVG(CPLsample(10)) % |
CPLwriteSVG (CPL,FNAME,ONAME,cutter,colmap,stkwd)- writes a SVG file for a laser cutter |
% CPLwriteSVG (CPL,FNAME,ONAME,cutter,colmap,stkwd) - writes a SVG file for a laser cutter % (by Tim Lueth, VLFL-Lib, 2015-SEP-13 as class: FILE HANDLING) % % This fnctns writes a CPL as SVG file for plotting or laser cutting. It % is possible to sort the CPLS from inside to outside and give them % different colors depending on the level of embedding. % The file also include wrt Christina Hein the "height", "width" and the % "viewbox" commands of SVG. (Status of: 2017-03-14) % % See also: svgpolylineofCPL, CPLsortinout, selectNaN % % CPLwriteSVG(CPL,[FNAME,ONAME,cutter,colmap,stkwd]) % === INPUT PARAMETERS === % CPL: Contour list % FNAME: Filename % ONAME: Creator Name; default is calling fnctn name % cutter: if true; CPLs are sorted inside out in different colors; % default is false % colmap: stroke color or colormap; default is {} % stkwd: stroke width % % EXAMPLE: Try different parameters % CPLwriteSVG(CPLsample(10)) % CPLwriteSVG(CPLsample(14)) % CPLwriteSVG(CPLsample(14),'','Tim Lueth',false,'blue',1) % CPLwriteSVG(CPLsample(14),'','Tim % Lueth',true,{'blue','red','green'},0.2) % |
CPLofVLFL(VL,FL,fi)- creates a CPL and T of a planar VL,FL |
% CPLofVLFL(VL,FL,fi) - creates a CPL and T of a planar VL,FL % (by Tim Lueth, VLFL-Lib, 2015-SEP-12 as class: CLOSED POLYGON LISTS) % % Corresponding to procedure PLofVLFL. % if norm(ez)<1 we have a spherical surface. % Written on SY Bontekoning at Marina Panacea Palma de Mallorca % (Status of: 2015-09-12) % % [CPL,T,ez]=CPLofVLFL(VL,FL,[fi]) % === INPUT PARAMETERS === % VL: Vertex list % FL: Facet List % fi: index of facets; default is 1:end % === OUTPUT RESULTS ====== % CPL: Closed Contour List % T: Transformation Matrix % ez: ez vector % |
CPLgrow(CPL,w,edge)- grows a contour line in a distance |
% CPLgrow(CPL,w,edge) - grows a contour line in a distance % (by Tim Lueth, VLFL-Lib, 2015-SEP-11 as class: CLOSED POLYGON LISTS) % % Written on SY Bontekoning at Marina Panacea Palma de Mallorca (Status % of: 2015-09-20) % % See also: PLoutercontour, CPLoutercontour, PLgrow % % [RPL,ENL,PNL,PDL]=CPLgrow(CPL,w,[edge]) % === INPUT PARAMETERS === % CPL: Closed Polygon line % w: distance for growing % edge: true call CPLgrowEdge; default is false; % === OUTPUT RESULTS ====== % RPL: Recalculated CPL % ENL: Edge normal vector list % PNL: Point normal vector lit % PDL: Point direction vector list % % EXAMPLE: % CPLgrow(PLcircle(4),-1); % CPLgrow(PLstar(4,20),-1); % CPLgrow(PLstar(10,12),-3,true); % |
CPLinsideCPL(CPL,CPLs)- returns the contours of a CPL that inside another CPL |
% CPLinsideCPL(CPL,CPLs) - returns the contours of a CPL that inside % another CPL % (by Tim Lueth, VLFL-Lib, 2015-SEP-11 as class: CLOSED POLYGON LISTS) % % Written on SY Bontekoning at Marina Panacea Palma de Mallorca (Status % of: 2015-09-11) % % [ind,CPLN]=CPLinsideCPL(CPL,CPLs) % === INPUT PARAMETERS === % CPL: One outer CPL that defines the border line % CPLs: CPL with several contours separated by NAN % === OUTPUT RESULTS ====== % ind: index which contour is inside of CPLO % CPLN: CPL of all internal CPLs % % EXAMPLE: % CPLinsideCPL(PLcircle(9),CPLcopypattern(PLcircle(2),[5 5],[2 2])) % |
CPLfillPattern(CPL,CPLA,w,d,cut,pc)- fills a contour with copies of a pattern |
% CPLfillPattern(CPL,CPLA,w,d,cut,pc) - fills a contour with copies of a pattern % (by Tim Lueth, VLFL-Lib, 2015-SEP-11 as class: CLOSED POLYGON LISTS) % % Written on SY Bontekoning at Marina Panacea Palma de Mallorca. % The filling algorithm is expecting that the pattern are centered around % [0 0]; otherwise by using parameter pc, the fnctn filling contour is % moved into its bounding box center % (Status of: 2017-03-20) % % [CPLN,XPL]=CPLfillPattern(CPL,CPLA,[w,d,cut,pc]) % === INPUT PARAMETERS === % CPL: Contour to be filled % CPLA: Filling pattern to be copied % w: border thickness of CPL; default is 1 % d: distance between the pattern; default is w % cut: cut instead of removal of overlapping pattern; default is false % pc: 'c' moves the contour into the center; is 'c' on by default % === OUTPUT RESULTS ====== % CPLN: CPL of resulting contour with punched patterns % XPL: CPL of punching patterns % % EXAMPLE: Fill a circle with stars: % CPLfillPattern(PLcircle(30),PLstar(5,20),0,0); % Both contours % are centered % CPLfillPattern(PLcircle(30),PLstar(5,20)+3,0,0); % Pattern shifting % is ignored % CPLfillPattern(PLcircle(30)+10,PLstar(5,20),0,0); % Contour shifting is % compensated % CPLfillPattern(PLcircle(30)+10,PLstar(5,20)+3,0,0,true,'x'); % |
CPLofplateSG(SG)- returns for a flat plate solid its contour |
% CPLofplateSG(SG) - returns for a flat plate solid its contour % (by Tim Lueth, VLFL-Lib, 2015-SEP-10 as class: SURFACES) % % This procedure is may be of limited use. % Written on SY Bontekoning in the bay Cala Portals (Mallorca) % (Status of: 2015-09-10) % % [CPL,z,zmin]=CPLofplateSG(SG) % === INPUT PARAMETERS === % SG: Solid, i.e. a flat plate % === OUTPUT RESULTS ====== % CPL: Contour of the plate % z: height of the plate % zmin: zmin used for SG % % EXAMPLE: % CPLofplateSG(SGbox([30,20,10])) % |
exp_2015_09_10- EXPERIMENT to cut flat plates by an additional contour |
%% PUBLISHABLE EXP_2015_09_10 EXPERIMENT TO CUT FLAT PLATES BY AN ADDITIONAL CONTOUR % (by Tim Lueth, VLFL-Lib, 2015-SEP-10 as class: EXPERIMENTS) %% % exp_2015_09_10 - EXPERIMENT to cut flat plates by an additional contour % (by Tim Lueth, VLFL-Lib, 2015-SEP-10 as class: EXPERIMENTS) % % % Written on SY Bontekoning in the bay Cala Portals (Mallorca) % (Status of: 2015-09-10) % % exp_2015_09_10 % |
CPLinvert(CPL,add)- Change the direction of all contours in a CPL |
% CPLinvert(CPL,add) - Change the direction of all contours in a CPL % (by Tim Lueth, VLFL-Lib, 2015-SEP-09 as class: CLOSED POLYGON LISTS) % % Written on SY Bontekoning in the bay Cala Portals (Mallorca) % (Status of: 2015-09-09) % % NCPL=CPLinvert(CPL,[add]) % === INPUT PARAMETERS === % CPL: Closed Polygon List separated by NaN % add: frame around with distance add; default=0; no frame % === OUTPUT RESULTS ====== % NCPL: Closed Polygon List reversed direction % % EXAMPLE: % CPLinvert(PLcircle(10),4) % |
CPLedgeNormal(CPL)- returns edge normals and point normals for a CPL |
% CPLedgeNormal(CPL) - returns edge normals and point normals for a CPL % (by Tim Lueth, VLFL-Lib, 2015-SEP-09 as class: CLOSED POLYGON LISTS) % % Slow but correct fnctn for CPL and PL. In case of PL, the last edges % are not plotted. % Written on SY Bontekoning in the bay Cala Portals (Mallorca) % (Status of: 2017-01-13) % % Introduced first in SolidGeometry 2.5.1 % % See also: VLedgeNormal, edgeNormal, PLnorm, PLELnorm, PLFLfaceNormal, % VLnorm, VLFLnormf, VLFLfaceNormal % % [ENL,PNL,PDL]=CPLedgeNormal(CPL) % === INPUT PARAMETERS === % CPL: Closed Polygon List separated by NaN % === OUTPUT RESULTS ====== % ENL: edge normal list % PNL: Point normal list % PDL: Point distance list (vector to next point) % % EXAMPLE: % CPLedgeNormal(PLcircle(10,4)) % w=1; [~,PNL]=CPLedgeNormal(CPL); RPL=CPL-w*PNL; % % See also: VLedgeNormal, edgeNormal, PLnorm, PLELnorm, PLFLfaceNormal, % VLnorm, VLFLnormf, VLFLfaceNormal % |
exp_2015_09_09- Experiment to convert solid blocks into plate structures |
%% PUBLISHABLE EXP_2015_09_09 EXPERIMENT TO CONVERT SOLID BLOCKS INTO PLATE STRUCTURES % (by Tim Lueth, VLFL-Lib, 2015-SEP-09 as class: EXPERIMENTS) %% % exp_2015_09_09 - Experiment to convert solid blocks into plate % structures % (by Tim Lueth, VLFL-Lib, 2015-SEP-09 as class: EXPERIMENTS) % % This experiments separates a solid geometry into all mounting faces. % Afterwards all mounting faces are converted into solid plates by using % SGofSurface. Therefor, a solid block is converted into a shell of six % plates with the same outer and inner geometry. % Written on SY Bontekoning in the bay Cala Portals (Mallorca) % (Status of: 2015-09-09) % % C=exp_2015_09_09 % === OUTPUT RESULTS ====== % C: resulting solid consisting of plates % |
exp_2015_09_08- Experiment to convert solid blocks into plate structures |
%% PUBLISHABLE EXP_2015_09_08 EXPERIMENT TO CONVERT SOLID BLOCKS INTO PLATE STRUCTURES % (by Tim Lueth, VLFL-Lib, 2015-SEP-08 as class: EXPERIMENTS) %% % exp_2015_09_08 - Experiment to convert solid blocks into plate % structures % (by Tim Lueth, VLFL-Lib, 2015-SEP-08 as class: EXPERIMENTS) % % This experiments separates a solid geometry into all mounting faces. % Afterwards all mounting faces are converted into solid plates by using % SGofSurface. Therefor, a solid block is converted into a shell of six % plates with the same outer and inner geometry. % Written on SY Bontekoning in the bay Cala Egos (Mallorca) % (Status of: 2015-09-08) % % C=exp_2015_09_08 % === OUTPUT RESULTS ====== % C: resulting solid consisting of plates % |
SGplatesofSGML(SG,th,pat,w,UVF)- converts a solid into a plated solid |
% SGplatesofSGML(SG,th,pat,w,UVF) - converts a solid into a plated solid % (by Tim Lueth, VLFL-Lib, 2015-SEP-07 as class: SURFACES) % % This fnctn separates a solid geometry into all mounting faces. % Afterwards all mounting faces are converted into solid plates by using % SGofSurface. Thus, a solid block is converted into a shell of several % plates with about the same outer and inner geometry. Each mounting face % will result in one separate solid. The plates do not share any vertex. % Written on SY Bontekoning in the bay Cala Egos (Mallorca) % (Status of: 2017-01-29) % % See also: TofSGMLez, TofSGML, TofVLUL, TofVLULez, TofSGMLez, MLofSG, % MLplot % % NSG=SGplatesofSGML(SG,[th,pat,w,UVF]) % === INPUT PARAMETERS === % SG: Original solid % th: Thickness of the plates; default is 0.5 % pat: CPL of a pattern to fill % w: border size and pattern distance; default th % UVF: list of unit vectors for filling;default=all ([]) % === OUTPUT RESULTS ====== % NSG: resulting solid consisting of plates % % EXAMPLE: Convert a box into six plates % SGplatesofSGML(SGbox([30,20,10])) % SGplatesofSGML(SGbox([60,40,20]),2,PLcircle(3,4)); % SGplatesofSGML(SGbox([60,40,20]),2,PLcircle(3,4),1,[0 -1 0;0 +1 0]); % |
randsupp- returns a sign of minimum 1e-3 plus a random number of 1e-4 |
% randsupp - returns a sign of minimum 1e-3 plus a random number of 1e-4 % (by Tim Lueth, VLFL-Lib, 2015-SEP-07 as class: AUXILIARY PROCEDURES) % % s=±[1e-3..2e-3] % Written on SY Bontekoning in the bay Cala Egos (Mallorca) % (Status of: 2015-09-07) % % s=randsupp % === OUTPUT RESULTS ====== % s: random supplement % |
exp_2015_09_07- Experiment to convert solid blocks into plate structures |
%% PUBLISHABLE EXP_2015_09_07 EXPERIMENT TO CONVERT SOLID BLOCKS INTO PLATE STRUCTURES % (by Tim Lueth, VLFL-Lib, 2015-SEP-07 as class: EXPERIMENTS) %% % exp_2015_09_07 - Experiment to convert solid blocks into plate % structures % (by Tim Lueth, VLFL-Lib, 2015-SEP-07 as class: EXPERIMENTS) % % this experiments separates a solid geometry into all mounting faces. % Afterwards all mounting faces are converted into solid plates by using % SGofSurface. Therefor, a solid block is converted into a shell of six % plates with the same outer and inner geometry. % Written on SY Bontekoning in the bay Cala Egos (Mallorca) % (Status of: 2015-09-07) % % C=exp_2015_09_07 % === OUTPUT RESULTS ====== % C: resulting solid consisting of plates % |