Last change of this documentation page: 2022-06-02 of SolidGeometry 4.6
SGplotalpha(SG,c,a,e)- plots a solid support directly color and alpha value

SGplotalpha(SG,c,a,e)% SGplotalpha(SG,c,a,e) - plots a solid support directly color and alpha value
% (by Tim Lueth, VLFL-Lib, 2019-JUN-12 as class: USER INTERFACE)
%
% This fnctn was written in Tokyo visiting Hajime Asama's Lab at The
% University of Tokyo (Status of: 2020-02-25)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGplot, setplotlight, SGTplotalpha
%
% h=SGplotalpha(SG,[c,a,e])
% === INPUT PARAMETERS ===
% SG: SOlid Geometry
% c: color; default is [];
% a: alpha value; default is 1;
% e: edge color; default is [];
% === OUTPUT RESULTS ======
% h: handle to grhics object patch
%
% EXAMPLE:
% SGfigure; view(-30,30); SGplotalpha(SGcylinder(10,20,6),'b',.2);
% SGfigure; view(-30,30); SGplotalpha(SGcylinder(10,20,6),'b',.2,'r');
% cla; SGplotalpha({SGbox,SGcylinder(5)},'r',0.4,'g'); shg
%
% See also: SGplot, setplotlight, SGTplotalpha
%
%
% Copyright 2019-2020 Tim C. Lueth

SGstent(l,d,n,s,m,r)- returns a cylindric stent consisting of two spirals

SGstent(l,d,n,s,m,r)% SGstent(l,d,n,s,m,r) - returns a cylindric stent consisting of two spirals
% (by Tim Lueth, VLFL-Lib, 2019-JUN-12 as class: PARAMETRIC DESIGN)
%
% This fnctn uses SGspring.
% This fnctn was written in Tokyo visiting Hajime Asama's Lab at The
% University of Tokyo
% (Status of: 2019-06-12)
%
% Introduced first in SolidGeometry 4.6
%
% See also: VLFLspring, SGspring, VLhelix
%
% [SGX,SGA,SGB]=SGstent([l,d,n,s,m,r])
% === INPUT PARAMETERS ===
% l: length of spring
% d: outer diameter of spring
% n: number of windings
% s: ratio of compressed spring default is 0.5
% m: number of parallel yarns
% r: optional radius
% === OUTPUT RESULTS ======
% SGX: Solid mesh
% SGA: Bottom ring
% SGB: Top ring
%
% EXAMPLE:
% SGstent(30,10,10,.5,4);
% SGstent(30,10,10,.5,1);
% SGstent(30,10,10,.5,8);
% SGstent(30,10,10,.5,8,.35);
% SGstent(30,5,4,.5,4,.25);
%
% See also: VLFLspring, SGspring, VLhelix
%
%
% Copyright 2019 Tim C. Lueth

SGofCPLflat(CPL,T)- returns a SG struct of an open flat surface from a polyshape or closed polygon

SGofCPLflat(CPL,T)% SGofCPLflat(CPL,T) - returns a SG struct of an open flat surface from a polyshape or closed polygon
% (by Tim Lueth, VLFL-Lib, 2019-JUN-12 as class: CLOSED POLYGON LISTS)
%
% This fnctn does not create a watertight solid geometry but only a
% surface of the shape of the polygon!
% It used when a polyshape surface should be drawn in space (Status of:
% 2019-06-12)
%
% Introduced first in SolidGeometry 4.6
%
% See also: PLFLofCPLdelaunay
%
% SGofCPLflat(CPL,[T])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon or Polyshape
% T: vector, rotation matrix, or HT matrix to locate the surface in space
%
% EXAMPLE:
% SGofCPLflat(PLstar(30),[0 0 10])
% SGofCPLflat(PLsquare(30),rot(pi/3))
% SGofCPLflat(PLsquare(30),rot(pi/3,-pi/3,-pi/3))
% SGofCPLflat(CPLsample(12),rot(pi/3,-pi/3,-pi/3))
%
% See also: PLFLofCPLdelaunay
%
%
% Copyright 2019 Tim C. Lueth

SGspring(l,d,n,s,m,r)- returns a cylindric spring

SGspring(l,d,n,s,m,r)% SGspring(l,d,n,s,m,r) - returns a cylindric spring
% (by Tim Lueth, VLFL-Lib, 2019-JUN-11 as class: PARAMETRIC DESIGN)
%
% circular cross section is different to the former fnctn square cross
% section spring of Dec 2011: VLFLspring
% This fnctn was written in Tokyo visiting Hajime Asama's Lab at The
% University of Tokyo
% (Status of: 2019-06-12)
%
% Introduced first in SolidGeometry 4.6
%
% See also: VLFLspring, SGstent
%
% [SGX,SG,SGA,SGB]=SGspring([l,d,n,s,m,r])
% === INPUT PARAMETERS ===
% l: length of spring
% d: outer diameter of spring
% n: number of windings
% s: ratio of compressed spring default is 0.5
% m: number of parallel yarns
% r: optional radius
% === OUTPUT RESULTS ======
% SGX:
% SG:
% SGA:
% SGB:
%
% EXAMPLE:
% SGspring(30,10,10,.5,4);
% SGspring(30,10,10,.5,1);
% SGspring(30,10,10,.5,8);
% SGspring(30,10,10,.5,8,.35);
%
% See also: VLFLspring, SGstent
%
%
% Copyright 2019 Tim C. Lueth

SGCLsample(Nr,T)- returns examples for the SGofCPLcommand strings

SGCLsample(Nr,T)% SGCLsample(Nr,T) - returns examples for the SGofCPLcommand strings
% (by Tim Lueth, VLFL-Lib, 2019-JUN-11 as class: MODELING PROCEDURES)
%
% Introduced first in SolidGeometry 4.6
%
% See also: CPLsample, SGsample, VLsample, PLsample, VLFLsample,
% CSGsample, SGerrorsample, SGfischertechniksample, SGcmdsample
%
% [SG,FL]=SGCLsample([Nr,T])
% === INPUT PARAMETERS ===
% Nr: Number of Sample
% T:
% === OUTPUT RESULTS ======
% SG: Solid Geometry
% FL:
%
% See also: CPLsample, SGsample, VLsample, PLsample, VLFLsample,
% CSGsample, SGerrorsample, SGfischertechniksample, SGcmdsample
%
%
% Copyright 2019 Tim C. Lueth

video2animatedGIF (fname,WName,sizecr,cutt,frames,accel)- creates an animated GIF from a video file

video2animatedGIF (fname,WName,sizecr,cutt,frames,accel)% video2animatedGIF (fname,WName,sizecr,cutt,frames,accel) - creates an animated GIF from a video file
% (by Tim Lueth, VLFL-Lib, 2019-JUN-10 as class: VISUALIZATION)
%
% Since Peter Corke advised me to use animated GIFs for documentation,
% this fnctn has been written for this purpose. Written in Tokyo visiting
% Hajime Asama's Lab at The University of Tokyo. (Status of: 2019-06-26)
%
% Introduced first in SolidGeometry 4.6
%
% See also: image2video, videoCopyCutMovies, video2video
%
% video2animatedGIF([fname,WName,sizecr,cutt,frames,accel])
% === INPUT PARAMETERS ===
% fname: Video file; default is ''=> selection by browser
% WName: Name for animated GIF file; default is same as Video file name
% sizecr: size columns by rows; default is unchanged; if scalar<10 =>
% ratio if scalar>10 =>rows
% cutt: [start time end time]; default is [0 inf]
% frames: fps; default is unchanged; 10 is a useful value;
% accel: integer acceleration factor > 1; default is 1
%
% EXAMPLE: Just try
% video2animatedGIF('','',[1024 768],[2 3]) % select any video and cut between 2 and 3 seconds
% video2animatedGIF('','',0.5,[2 3]) % scaling ration 0.5
% video2animatedGIF('','',720 lines,[2 3]) % use 720 lines
% video2animatedGIF('','',720 lines,[2 3],10) % use 720 lines and 10 fps
%
% See also: image2video, videoCopyCutMovies, video2video
%
%
% Copyright 2019-2020 Tim C. Lueth

PLofhandle(h,ascell)- returns the point list of different graphics objects in gca

PLofhandle(h,ascell)% PLofhandle(h,ascell) - returns the point list of different graphics objects in gca
% (by Tim Lueth, Video-Lib, 2019-JUN-10 as class: USER INTERFACE)
%
% written in Tokyo visiting Hajime Asama's Lab at The University of Tokyo
% (Status of: 2019-06-11)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGfigure, hideingca, findingca
%
% [PLs,hp]=PLofhandle(h,[ascell])
% === INPUT PARAMETERS ===
% h: handle or string such as 'point', 'line', 'text', 'polygon', 'patch'
% etc.
% ascell: result as separeted list; default is false
% === OUTPUT RESULTS ======
% PLs: Point lists
% hp: handle to objects if input handle was a string
%
% EXAMPLE:
% SGfigure; PLcircle(1)
% PLofhandle('line')
%
% See also: SGfigure, hideingca, findingca
%
%
% Copyright 2019 Tim C. Lueth

findingca(gotype,);- select graphics objects of a specific type

findingca(gotype,);% findingca(gotype,); - select graphics objects of a specific type
% (by Tim Lueth, Video-Lib, 2019-JUN-10 as class: USER INTERFACE)
%
% a modified version of hideingca and support also the type 'point'
% written in Tokyo visiting Hajime Asama's Lab at The University of Tokyo
% (Status of: 2019-06-10)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGfigure, hideingca
%
% h=findingca(gotype,[]);
% === INPUT PARAMETERS ===
% gotype: type such as 'point', 'line', 'text','polygon' , 'ptach' etc.
% === OUTPUT RESULTS ======
% h: handle to object
%
% EXAMPLE:
% SGfigure; PLplot(PLcircle(100));
% shg; hideingca('line','invi');pause(.5); hideingca('line','visi');
% SGfigure; CPLplotasPS(PLcircle(10)); CPLplot(PLcircle(20),'b-'); textVL(PLcircle(15)); SGplot(SGbox(5)); findingca('patch')
%
% See also: SGfigure, hideingca
%
%
% Copyright 2019 Tim C. Lueth

PLcircleui- returns a PL for a circle interactively defined

PLcircleui% PLcircleui - returns a PL for a circle interactively defined
% (by Tim Lueth, VLFL-Lib, 2019-JUN-10 as class: CLOSED POLYGON LISTS)
%
% written in Tokyo visiting Hajime Asama's Lab at The University of Tokyo
% (Status of: 2019-06-20)
%
% Introduced first in SolidGeometry 4.6
%
% See also: PLcircle, VLui, CPSlineui, CPLui, CPSui, PLui, PLsquareui,
% VLFLui, SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
% PL=PLcircleui
% === OUTPUT RESULTS ======
% PL: Point List
%
% EXAMPLE:
% PLsquare(30,10); PLcircleui % interactively creating a Point list for a circle
%
% See also: PLcircle, VLui, CPSlineui, CPLui, CPSui, PLui, PLsquareui,
% VLFLui, SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
%
% Copyright 2019 Tim C. Lueth

CPLofPosefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLR,XCPL1)- returns collision free path shaped contour for a specific fourbar linkage

CPLofPosefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLR,XCPL1)% CPLofPosefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLR,XCPL1) - returns collision free path shaped contour for a specific fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-JUN-03 as class: MECHANICAL PROCEDURES)
%
% This is a full implementation of original Posefourbarshaping introduced
% SG-Lib in 4.5 (Status of: 2021-11-18)
%
% Introduced first in SolidGeometry 4.6
%
% See also: exp_2019_04_16_Shape, exp_2019_03_28_Shape,
% exp_2018_12_20_cuttingshape
%
% CPL=CPLofPosefourbarshaping(PS,[aps,SCPL,rel,XCPLW,XCPLA,XCPLR,XCPL1])
% === INPUT PARAMETERS ===
% PS: Pose and fourbar linkage struct including GPL and GAL
% aps: [solution, limiting order]
% SCPL: Contour to shape
% rel: CPL is moved relative to 'P'ose, 'C'rank, or 'Swing' or 'WORLD'
% XCPLW: Static obstacles in the environment
% XCPLA: Obstacle contours attached to Pose
% XCPLR: Obstacle contour moved with crank
% XCPL1: Obstacle contour moved with swing
% === OUTPUT RESULTS ======
% CPL: Collision free contour
%
% EXAMPLE:
% PosereadAPD('/Volumes/LUETH-WIN/MATLAB_files_for_experiments/basecabinet_new.APD');PS=ans;
% PS=checkfourbar3Poseattachpermutation(PS,'',20)
% PS.CPLE=CPLfillinside(PS.CPLE);
% CPLofPosefourbarshaping(PS,[546]) % Full path of the fourbar
% CPLofPosefourbarshaping(PS,[546,123]) % limited to poses 123
% %% TRY WITH 546 and 153
% CPLofPosefourbarshaping(PS,[546,123],'','E',''); PS.CPLE=ans; % Shape of effektor
% CPLofPosefourbarshaping(PS,[546,123],'','C','',PS.CPLE); PS.CPLC=ans; % Shape of crank
% CPLofPosefourbarshaping(PS,[546,123],'','S','',PS.CPLE,PS.CPLC); PS.CPLS=ans; % Shape of swing
% CPLofPosefourbarshaping(PS,[546,123],'','W','',PS.CPLE,PS.CPLC,PS.CPLS); % Work Space
%
%
% See also: exp_2019_04_16_Shape, exp_2019_03_28_Shape,
% exp_2018_12_20_cuttingshape
%
%
% Copyright 2019-2021 Tim C. Lueth

Posefourbarselectcouplercurve(PS,dim,rots,CPLR,CPL1);- selects coupler courves based on the coupler curve

Posefourbarselectcouplercurve(PS,dim,rots,CPLR,CPL1);% Posefourbarselectcouplercurve(PS,dim,rots,CPLR,CPL1); - selects coupler courves based on the coupler curve
% (by Tim Lueth, VLFL-Lib, 2019-MAI-28 as class: KINEMATICS AND FRAMES)
%
% This fnctn was implemented during discussions with Alexandra Mercader
% and improved during the Mathworks Research Summit in Newton/Boston
% Tim should contact Marco Riani from Univ. of Parma to lean about the
% documentation creation tool
% Peter Corke recommended to switch to Github (Status of: 2019-06-01)
%
% Introduced first in SolidGeometry 4.6
%
% See also: Posefourbarselectui, PosefourbarselectAP
%
% [PS,gapi]=Posefourbarselectcouplercurve(PS,[dim,rots,CPLR,CPL1]);
% === INPUT PARAMETERS ===
% PS: Pose struct including CPLE, GPL, GAL
% dim: number of curves, or limits of the curve, or enclosing contour
% rots: true = full rotation, false = no rotation, default is both
% CPLR: Area for Crank Base Point; default is not limits
% CPL1: Area for Swing Base Point; default is CPLR
% === OUTPUT RESULTS ======
% PS: Pose with only the slelected solutions left
% gapi: index list of the solutions in GAL that were selected
%
% EXAMPLE:
% clear PS
% PS.CPLE=[ 0,0; 0,38; 0,60; 10,60; 10,34; 8,8; 20,8; 20,0];
% PS.A=[ -13.888,12.554; 9.336,-0.147; 36.205,7.592; ]; % PS=Posetransui(PS)
% PS.B=[ -12.968,12.160; 10.336,-0.167; 37.082,8.072; ];
% SGfigure; Poseplot(PS);
% PS=checkfourbar3Poseattachpermutation(PS,'',15)
% Posefourbarselectcouplercurve(PS)
%
% See also: Posefourbarselectui, PosefourbarselectAP
%
%
% Copyright 2019 Tim C. Lueth

SGofPosefourbar(PS,ap,lim,roi)- returns a fourbar linkage geometry for a given attachment point solution

SGofPosefourbar(PS,ap,lim,roi)% SGofPosefourbar(PS,ap,lim,roi) - returns a fourbar linkage geometry for a given attachment point solution
% (by Tim Lueth, VLFL-Lib, 2019-MAI-26 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGfourbarlinkage
%
% [SGM,SGA]=SGofPosefourbar(PS,[ap,lim,roi])
% === INPUT PARAMETERS ===
% PS: Pose struct including PS.GPL and PS.GAL
% ap: solution number of PS
% lim: optional limitation of pose order
% roi: [outer and inner radius and slot size [ro ri si]
% === OUTPUT RESULTS ======
% SGM: Solid Geometries mounted
% SGA: Solid Geometries ready for printing
%
% EXAMPLE:
% clear PS
% PS.CPLE=[ 0,0; 0,38; 0,60; 10,60; 10,34; 8,8; 20,8; 20,0];
% PS.A=[ -13.888,12.554; 9.336,-0.147; 36.205,7.592; ]; % PS=Posetransui(PS)
% PS.B=[ -12.968,12.160; 10.336,-0.167; 37.082,8.072; ];
% SGfigure; Poseplot(PS);
% PS=checkfourbar3Poseattachpermutation(PS,'',20); PS.GAL=PS.GAL(PS.GAL(:,6)==0,:);
% SGofPosefourbar(PS,118)
%
% See also: SGfourbarlinkage
%
%
% Copyright 2019 Tim C. Lueth

retainfields(S,L)- retains a list of fields from a struct

retainfields(S,L)% retainfields(S,L) - retains a list of fields from a struct
% (by Tim Lueth, VLFL-Lib, 2019-MAI-26 as class: LANGUAGE PROCEDURES)
%
% Introduced first in SolidGeometry 4.6
%
% See also: stripfields, rmfield, isfield
%
% S=retainfields(S,[L])
% === INPUT PARAMETERS ===
% S: struct
% L: List of field names as varargin
% === OUTPUT RESULTS ======
% S: struct with removed fields
%
% EXAMPLE:
% S.A=1; S.B=2; S.C=3; S.D=4
% stripfields(S,'A','C','B')
% retainfields(S,'A','C','B')
%
% See also: stripfields, rmfield, isfield
%
%
% Copyright 2019 Tim C. Lueth

SGplotcell(SG,c,w)- plot a cell list solid in different colors

SGplotcell(SG,c,w)% SGplotcell(SG,c,w) - plot a cell list solid in different colors
% (by Tim Lueth, VLFL-Lib, 2019-MAI-26 as class: SURFACES)
%
% it plots until the facet difference is less than 1e-4 (Status of:
% 2019-12-09)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGsurfacessort, SGsurfaces, SGsurfaceplot, SGsurfaceplot,
% SGplotsurfaces
%
% h=SGplotcell(SG,[c,w])
% === INPUT PARAMETERS ===
% SG: cell list of solid
% c: color
% w: width
% === OUTPUT RESULTS ======
% h: handle to plot
%
% See also: SGsurfacessort, SGsurfaces, SGsurfaceplot, SGsurfaceplot,
% SGplotsurfaces
%
%
% Copyright 2019 Tim C. Lueth

fprintfvec2 (f,s,X)- prints vectors in a way that it can used in code generation

fprintfvec2 (f,s,X)% fprintfvec2 (f,s,X) - prints vectors in a way that it can used in code generation
% (by Tim Lueth, VLFL-Lib, 2019-MAI-24 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.6
%
% See also: fprintfvec, str2codelines, sprintfvec
%
% fprintfvec2([f,s,X])
% === INPUT PARAMETERS ===
% f: file pointer; default is ''
% s: format string
% X: number
%
% EXAMPLE:
% fprintfvec2('%.3f',[1 2 3; 4 5 6])
%
% See also: fprintfvec, str2codelines, sprintfvec
%
%
% Copyright 2019-2020 Tim C. Lueth

CPLfillgap(CPL,d)- creates a contour that fills a another or several contours

CPLfillgap(CPL,d)% CPLfillgap(CPL,d) - creates a contour that fills a another or several contours
% (by Tim Lueth, VLFL-Lib, 2019-MAI-21 as class: CLOSED POLYGON LISTS)
%
% The fnctns are based on the planar CPLfnctns
% - CPLconvexhullfillgap - closes gaps and try to find a SINGLE OUTLINE
% contour
% - CPLoutlinecontour - just returns ALL OUTLINE contours
% - CPLfillgap -just fillgapsb etween contours (Status of: 2020-08-29)
%
% Introduced first in SolidGeometry 4.6
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLharbour, CPLfillin, CPLfillinside, CPLoutlinecontour,
% CPLconvexhullfillgap
%
% CPLN=CPLfillgap(CPL,[d])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon List
% d: gap distance to bridge; by default 1% of maximum size length
% === OUTPUT RESULTS ======
% CPLN: new polygon
%
% EXAMPLE:
% CPLfillgap(CPLsample(14),3);
% CPLfillgap(CPLsample(19),3);
% CPLfillgap(CPLsample(21),3);
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLharbour, CPLfillin, CPLfillinside, CPLoutlinecontour,
% CPLconvexhullfillgap
%
%
% Copyright 2019-2020 Tim C. Lueth

CPLfillinside(CPL,Amin,Asam)- creates a contour that fills a another or several contours

CPLfillinside(CPL,Amin,Asam)% CPLfillinside(CPL,Amin,Asam) - creates a contour that fills a another or several contours
% (by Tim Lueth, VLFL-Lib, 2019-MAI-21 as class: CLOSED POLYGON LISTS)
%
% Mainly the same as CPLfillin
% Find out the difference to CPLfillinside
% CPSplot(CPLfillinside(CPLsample(12)))
% CPSplot(CPLofouterregionboundary(CPLsample(12))) (Status of: 2021-12-01)
%
% Introduced first in SolidGeometry 4.6
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLharbour, CPLfillin, CPLfillgap, CPLofouterregionboundary
%
% CPLN=CPLfillinside(CPL,[Amin,Asam])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon List
% Amin: Minimum surface to be interested
% Asam: percentage of maximum area ; default a=90%, 0.9
% === OUTPUT RESULTS ======
% CPLN: inverse polygon
%
% EXAMPLE:
% CPLfillinside(CPLsample(14));
% CPLfillinside(CPLsample(19));
% CPLfillinside(CPLsample(21));
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLharbour, CPLfillin, CPLfillgap, CPLofouterregionboundary
%
%
% Copyright 2019-2021 Tim C. Lueth

PLofPosecentrodes(PS,aps,npnt,ncur)- returns fixed centrode (Rastpolbahn) and moving centrode (Gangpolbahn) of a fourbar linkage solution

PLofPosecentrodes(PS,aps,npnt,ncur)% PLofPosecentrodes(PS,aps,npnt,ncur) - returns fixed centrode (Rastpolbahn) and moving centrode (Gangpolbahn) of a fourbar linkage solution
% (by Tim Lueth, VLFL-Lib, 2019-MAI-21 as class: KINEMATICS AND FRAMES)
%
% Fixed Centrode (Rastpolbahn) and Moving Centrode (Gangpolbahn) describe
% two parts of a rolling joint and can be determined for each
% fourbar-linkage. The rolling joint can very well illustrate the
% movement of the fourbar-linkage. (Status of: 2019-05-22)
%
% Introduced first in SolidGeometry 4.6
%
% See also: PLofPosecouplercurve, Posefourbarplotcouplercurve,
% checkfourbar3Poseattachpermutation, FourBarLinkageofCouplercurve
%
% LITERATURE:
% - https://commons.wikimedia.org/wiki/Category:Centrodes
%
% [PLP,PL0,T0,wcr,TA0,TB0,TA1,TB1]=PLofPosecentrodes(PS,[aps,npnt,ncur])
% === INPUT PARAMETERS ===
% PS: Pose incl. GPL and GAL
% aps: index in GAL or [iA iB] for GAL
% npnt: number of points of the curve
% ncur: number of curves desired; default=0 (Pose Coupler Curve);(will be
% removed)
% === OUTPUT RESULTS ======
% PLP: Point list of Coupler Points Movement
% PL0: Transformation matrix list of Coupler Points Movement
% T0: angle list of crank returned by invkinplan2
% wcr: Transformation matrix list of joint A0 (only rotation)
% TA0: Transformation matrix list of joint B0 (only rotation)
% TB0: Transformation matrix list of Attachment point A1 (circular
% Movement)
% TA1: Transformation matrix list of Attachment point B1 (circular
% Movement)
%
% EXAMPLE:
% PS=Posesample(7);PS.CPLE = PLsquare([6 4]); checkfourbar3Poseattachpermutation(PS); PS=ans;
% close all; PLofPosecentrodes(PS,56);
%
% See also: PLofPosecouplercurve, Posefourbarplotcouplercurve,
% checkfourbar3Poseattachpermutation, FourBarLinkageofCouplercurve
%
%
% Copyright 2019 Tim C. Lueth

Poseoffourbarlinkage(L1,L2,R,D,ebow,segm,np,TPB)- creates a Pose struct with 3 or more poses for given fourbar linkgae parameters L1, L2, R, D/[A0;B0]

Poseoffourbarlinkage(L1,L2,R,D,ebow,segm,np,TPB)% Poseoffourbarlinkage(L1,L2,R,D,ebow,segm,np,TPB) - creates a Pose struct with 3 or more poses for given fourbar linkgae parameters L1, L2, R, D/[A0;B0]
% (by Tim Lueth, VLFL-Lib, 2019-MAI-12 as class: KINEMATICS AND FRAMES)
%
% The resulting struct contrains of
% PS.A Pose starting point
% PS.B Pose ending points
% PS.GPL Pose solution list for A1 and B1, i.e. 2 Point rel. to Origin
% PS.GAL Pose attachment point solution for A1 and B1
% PS.CPLE Minimal Contour for Coupler that fulfills A1 and A2
% PS.A0 Crank Base Point
% PS.B0 Swing Base Point
% PS.A1 Crank Attachment Location in Pose 1
% PS.B1 Swing Attachment Location in Pose 1 (Status of: 2019-05-12)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGfourbarlinkage, Posesample, Poseplot
%
% PS=Poseoffourbarlinkage(L1,L2,R,D,[ebow,segm,np,TPB])
% === INPUT PARAMETERS ===
% L1: Length of Swing
% L2: Length of Coupler
% R: Radius of Crank
% D: Distance or [A0; B0]
% ebow: 1== ellbow down; 2== ellbow up
% segm: segment 1 or segment 2
% np: number of poses; default is 3
% TPB: Pose relative to A1; 'A1','B1', dx, [dx dy]; Pose of P rel. to B1;
% not implemented yet
% === OUTPUT RESULTS ======
% PS: Pose struct PS.A, OS.B, PS.A0, PS.B0
%
% EXAMPLE:
% Poseoffourbarlinkage(60,40,90,[0 0;60 60]);
% SGfourbarlinkage(60,40,90,[0 0;60 60]);
% Poseoffourbarlinkage(60,40,90,85,2,1,'',TofR(rot(pi/2),[0 50]))
%
% See also: SGfourbarlinkage, Posesample, Poseplot
%
%
% Copyright 2019 Tim C. Lueth

str2codelines(Str,ll,fle)- creates from long string, several lines that can be used as matlab code

str2codelines(Str,ll,fle)% str2codelines(Str,ll,fle) - creates from long string, several lines that can be used as matlab code
% (by Tim Lueth, VLFL-Lib, 2019-MAI-10 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGofCPLcommand, fprintfvec2, fprintfvec, sprintfvec
%
% [clstr]=str2codelines(Str,[ll,fle])
% === INPUT PARAMETERS ===
% Str: string to break into lines
% ll: maximum length of line
% fle: reduced number of chars if 1st line or string
% === OUTPUT RESULTS ======
% [clstr]: String broken into code lines
%
% EXAMPLE:
% str2codelines(['The quick brown fox ',...
% 'jumps over the lazy dog'],10)
% str2codelines(['b 5 5,h 4.5,roty 90,move -4.5 0 0,save B,enter,b 3 5,enter,d 5 1.5 0,+,h',...
% ' 1.5,save A,move 1.5 0 -2.5,dups 1 1 2 2,+,enter,d 2.5 3 0,h 10,move 0 0',...
% ' -5,-,enter,load A,rotz 180,move 4.5 0 -'])
%
%
% See also: SGofCPLcommand, fprintfvec2, fprintfvec, sprintfvec
%
%
% Copyright 2019-2021 Tim C. Lueth

PofBB(VLO,loc,turn)- returns a point relative to the bounding box

PofBB(VLO,loc,turn)% PofBB(VLO,loc,turn) - returns a point relative to the bounding box
% (by Tim Lueth, VLFL-Lib, 2019-MAI-08 as class: VERTICES / CLOUDS)
%
% The locations are defined to the optimized bounding box:
% x = longest dimension, y = second, z = shortest dimension
% '-' => minimal value of dimension
% 'c' => center of dimension
% '+' => maximal value
% loc = 'ccc' => center of bounding box
% loc = '-cc' => center of plane at lower x value of BB
% loc = 'c+-' => center of the longest axis of BB butoutside (Status of:
% 2019-05-10)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGconvexhullVL, SGofBB, BBofVL, textBB
%
% p=PofBB(VLO,[loc,turn])
% === INPUT PARAMETERS ===
% VLO: Vertex list, or SG or graphics handle
% loc: location string 3 chars '+", '-', 'c'
% turn: minimal bounding box; relative to
% === OUTPUT RESULTS ======
% p: coordinate relative to bounding biox
%
% EXAMPLE:
% PofBB(SGarrow([0 0 0;1000 1000 1000]),'+-+',true)
% PofBB(SGarrow([0 0 0;1000 1000 1000]),'ccc',true)
%
%
% See also: SGconvexhullVL, SGofBB, BBofVL, textBB
%
%
% Copyright 2019 Tim C. Lueth

SGconvexhullVL(VL)- creates the convex hull of a cloud of vertices

SGconvexhullVL(VL)% SGconvexhullVL(VL) - creates the convex hull of a cloud of vertices
% (by Tim Lueth, VLFL-Lib, 2019-MAI-08 as class: SURFACES)
%
% just delaunay traingulation of the vertex list
% SG.VL=VL; [SG.FL]=convexHull(delaunayTriangulation(SG.VL));
% not the same as: SGconvexHull
%
% (Status of: 2019-05-08)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGconvexHull
%
% SG=SGconvexhullVL(VL)
% === INPUT PARAMETERS ===
% VL: Vertex List or SG
% === OUTPUT RESULTS ======
% SG: Solid Geometry
%
% EXAMPLE:
% SGconvexhullVL(rand(1000,3))
% SGconvexhullVL(SGarrow([0 0 0;100 100 100]))
%
% See also: SGconvexHull
%
%
% Copyright 2019 Tim C. Lueth

textBB(VLO,STR,loc,c,s)- writes a text at specified position relative to bounding box

textBB(VLO,STR,loc,c,s)% textBB(VLO,STR,loc,c,s) - writes a text at specified position relative to bounding box
% (by Tim Lueth, VLFL-Lib, 2019-MAI-08 as class: USER INTERFACE)
%
% The locations are defined to the optimized bounding box:
% x = longest dimension, y = second, z = shortest dimension
% '-' => minimal value of dimension
% 'c' => center of dimension
% '+' => maximal value
% loc = 'ccc' => center of bounding box
% loc = '-cc' => center of plane at lower x value of BB
% loc = 'c+-' => center of the longest axis of BB butoutside
% (Status of: 2019-05-10)
%
% Introduced first in SolidGeometry 4.6
%
% See also: PofBB, textT, textP, textCVL, textVLFL, VLFLfaceNormalplot
%
% [h,p]=textBB(VLO,[STR,loc,c,s])
% === INPUT PARAMETERS ===
% VLO: Vertex List or SG or graphics handle
% STR: String
% loc: location "+cc" or "c+-"
% c: color; default is red
% s: size; default is 12 point
% === OUTPUT RESULTS ======
% h: handle
% p: point of text
%
% EXAMPLE:
% SGfigure; VLFLplotlight(1,1); SG=SGarrow([0 0 0;100 100 100]); h=SGplot(SG,'m',0.1);
% textBB(h,'test','c+-','r',18)
% textBB(SG,'test','c+-','r',18)
% textBB(SG,'test','c+-','r',18)
%
% See also: PofBB, textT, textP, textCVL, textVLFL, VLFLfaceNormalplot
%
%
% Copyright 2019 Tim C. Lueth

SGfourbarhullplate(ARCR,ARC1,ARCB,roi,h)- returns the hull shapes of crank, and swing

SGfourbarhullplate(ARCR,ARC1,ARCB,roi,h)% SGfourbarhullplate(ARCR,ARC1,ARCB,roi,h) - returns the hull shapes of crank, and swing
% (by Tim Lueth, VLFL-Lib, 2019-MAI-05 as class: EXPERIMENTS)
%
% Introduced first in SolidGeometry 4.6
%
% See also: CPLfourbarlinkagehull, SGfourbarplate
%
% SG=SGfourbarhullplate(ARCR,ARC1,ARCB,roi,[h])
% === INPUT PARAMETERS ===
% ARCR: Hull of crank movement
% ARC1: Hull of swing movement
% ARCB: Contour to connect base points of crank and swing
% roi: outer and inner radius if link geoemtry
% h: heiht; default is [roi(1)/2]
% === OUTPUT RESULTS ======
% SG: Solid Geometry
%
% EXAMPLE:
% CPLfourbarlinkagehull (60,40,100,60,'',1);
% CPLfourbarlinkagehull (60,40,50,60,'',1);
% [ARCR,ARC1,ARCB]=CPLfourbarlinkagehull (60,40,50,60,'',2); roi=[5 3]
% SGfourbarhullplate(ARCR,ARC1,ARCB,roi);
%
% See also: CPLfourbarlinkagehull, SGfourbarplate
%
%
% Copyright 2019 Tim C. Lueth

CPLfourbarlinkagehull(L1,L2,R,D,roi,eb,wres)- returns the hull shapes of crank, and swing

CPLfourbarlinkagehull(L1,L2,R,D,roi,eb,wres)% CPLfourbarlinkagehull(L1,L2,R,D,roi,eb,wres) - returns the hull shapes of crank, and swing
% (by Tim Lueth, VLFL-Lib, 2019-MAI-05 as class: ANALYTICAL GEOMETRY)
%
% [L1,L2,R,D] ==> fourBarLinkageplot, fourBarLinkageplotanimui,
% CPLfourbarlinkagehull
% [A0,B0,A1,B1] ==> CPLfourbarlinkage, PLofFourbarcouplercurve
% (Status of: 2019-05-06)
%
% Introduced first in SolidGeometry 4.6
%
% See also: fourBarLinkageplot, SGfourbarhullplate, SGfourbarplate
%
% [ARCR,ARC1,ARCB]=CPLfourbarlinkagehull(L1,L2,R,D,[roi,eb,wres])
% === INPUT PARAMETERS ===
% L1: Length of Swing
% L2: Length of Coupler
% R: Radius of Crank
% D: Distance between Swing and Crank
% roi: outer and inner radius if link geoemtry
% eb: 1=ellbow down; 2=ellbow up
% wres: optional angle area to check
% === OUTPUT RESULTS ======
% ARCR: Hull of crank movement
% ARC1: Hull of swing movement
% ARCB: Contour to connect base points of crank and swing
%
% EXAMPLE:
% CPLfourbarlinkagehull (60,40,100,60,'',1);
% CPLfourbarlinkagehull (60,40,50,60,'',1);
% CPLfourbarlinkagehull (60,40,50,60,'',2);
%
% See also: fourBarLinkageplot, SGfourbarhullplate, SGfourbarplate
%
%
% Copyright 2019-2021 Tim C. Lueth

shiftindexofinvkinplan2(rs)- analyzses the real solution index of invkinplan2 and returns shift index and solution tbale

shiftindexofinvkinplan2(rs)% shiftindexofinvkinplan2(rs) - analyzses the real solution index of invkinplan2 and returns shift index and solution tbale
% (by Tim Lueth, VLFL-Lib, 2019-MAI-05 as class: AUXILIARY PROCEDURES)
%
% It is possible to use
% - shiftindexofinvkinplan2 to detect the angle areas of invkinplan2 for
% a point list
% - checkfourbarsegment to detect the general limits of the crossing
% circles in invkinplan2
% (Status of: 2019-05-12)
%
% Introduced first in SolidGeometry 4.6
%
% See also: invkinplan2, miofPLA0B0, realfourbarsolutions, invkinplan2,
% checkfourbarsegment, wofcross2circ
%
% [shi,wtab]=shiftindexofinvkinplan2(rs)
% === INPUT PARAMETERS ===
% rs: reals solution index of invkinplan2
% === OUTPUT RESULTS ======
% shi: shift indexe for circshift (rs,-shi)
% wtab: angle access table (start end)
%
% EXAMPLE:
% shiftindexofinvkinplan2([1 1 1 0 0 0 0 0 0 0 1 1 0]);
% [W1,W2,B1,B2,rs,Ai]=invkinplan2(L1,L2,[R A0-B0 n])
% Ai=Ai+B0; B1=B1+B0; B2=B2+B0;
% [ii,a]=shiftindexofinvkinplan2(rs)
% rs=circshift(rs,-ii);
% Ai=circshift(Ai,-ii); wc=circshift(wc,-ii);
% W1=circshift(W1,-ii); W2=circshift(W2,-ii);
% B1=circshift(B1,-ii); B2=circshift(B2,-ii);
%
% See also: invkinplan2, miofPLA0B0, realfourbarsolutions, invkinplan2,
% checkfourbarsegment, wofcross2circ
%
%
% Copyright 2019 Tim C. Lueth

wofcross2circ(A0,B0,r1,r2)- just returns the angles of the two crosspoints

wofcross2circ(A0,B0,r1,r2)% wofcross2circ(A0,B0,r1,r2) - just returns the angles of the two crosspoints
% (by Tim Lueth, VLFL-Lib, 2019-MAI-03 as class: ANALYTICAL GEOMETRY)
%
% Introduced first in SolidGeometry 4.5
%
% See also: cross2circ
%
% [w1,w2,dw,Q1,Q2]=wofcross2circ(A0,B0,r1,r2)
% === INPUT PARAMETERS ===
% A0: Center of circle A
% B0: Center of circle B
% r1: radius of circle A
% r2: radius of circle B
% === OUTPUT RESULTS ======
% w1: absolute angle of Q1 angle relative to A0
% w2: absolute angle of Q2 angle relative to B0
% dw: angle of direction B0-A0
% Q1: cross point 1
% Q2: cross point 1
%
% EXAMPLE: try
% wofcross2circ([0 0],[4 0],4,2) % 2 Solutions
% wofcross2circ([0 0],[4 0],2,2) % 1 Solution
% wofcross2circ([0 0],[4 0],1,6) % No Solution
%
% See also: cross2circ
%
%
% Copyright 2019 Tim C. Lueth

SGfourbarplate(D,roi,h,s,sdate,siz)- returns a base plate for a fourbar linkage experiment

SGfourbarplate(D,roi,h,s,sdate,siz)% SGfourbarplate(D,roi,h,s,sdate,siz) - returns a base plate for a fourbar linkage experiment
% (by Tim Lueth, VLFL-Lib, 2019-MAI-02 as class: PARAMETRIC DESIGN)
%
% In case that instead of a simple distance a complete set of (L1;L2;R;D)
% is used to describe the fourbar linkage, the plate is designed using
% (Status of: 2019-05-05)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGsnaprivet, CPLlinkofPL, SGofCPLz, SGfourbarhullplate,
% CPLfourbarlinkagehull
%
% SG=SGfourbarplate([D,roi,h,s,sdate,siz])
% === INPUT PARAMETERS ===
% D: Distance between A0 and B0 or [L1;L2:R;D;[eb]]
% roi: outer and inner diameter of the links
% h: height of the links
% s: step size
% sdate: true = attach date
% siz: size of board
% === OUTPUT RESULTS ======
% SG: Solid Geometry of board, pins, and date string
%
% EXAMPLE:
% SGfourbarplate
% SGfourbarplate ([60,40,50,60]);
% SGfourbarplate ([60,40,50,60,1]);
% SGfourbarplate ([60,40,50,60,2]);
%
%
% See also: SGsnaprivet, CPLlinkofPL, SGofCPLz, SGfourbarhullplate,
% CPLfourbarlinkagehull
%
%
% Copyright 2019 Tim C. Lueth

SGsnaprivet(d,h,n,F,s,sl)- returns a solid geometry for a snap rivet

SGsnaprivet(d,h,n,F,s,sl)% SGsnaprivet(d,h,n,F,s,sl) - returns a solid geometry for a snap rivet
% (by Tim Lueth, VLFL-Lib, 2019-MAI-02 as class: PARAMETRIC DESIGN)
%
% mainly the same as VLFLsnaprivet of 2013 July.
% If there is no force specified, the snap ribved is designed only wrt
% geoemetric conditions (Status of: 2020-09-18)
%
% Introduced first in SolidGeometry 4.6
%
% See also: VLFLsnaprivet, SGbending, lofbendinggirder, sofbendinggirder,
% rofcircbend, bofbendinggirder, Fofbendinggirder
%
% SG=SGsnaprivet([d,h,n,F,s,sl])
% === INPUT PARAMETERS ===
% d: diameter
% h: height (without base and snaps) of single unit
% n: number of units (multiplies height)
% F: Push force to open solid; def= 0 N
% s: base size; default is one
% sl: slot size
% === OUTPUT RESULTS ======
% SG: Solid Geoemtry
%
% EXAMPLE:
% SGsnaprivet (10,10,1)
% SGsnaprivet (10,10,2)
% SGsnaprivet (10,10,2,0.5)
%
% See also: VLFLsnaprivet, SGbending, lofbendinggirder, sofbendinggirder,
% rofcircbend, bofbendinggirder, Fofbendinggirder
%
%
% Copyright 2019-2020 Tim C. Lueth

SGfourbarlinkage(L1,L2,R,D,roi,h,eb,CPLE,CPLRx,CPL1x)- creates solid geometry parts for a given linkage

SGfourbarlinkage(L1,L2,R,D,roi,h,eb,CPLE,CPLRx,CPL1x)% SGfourbarlinkage(L1,L2,R,D,roi,h,eb,CPLE,CPLRx,CPL1x) - creates solid geometry parts for a given linkage
% (by Tim Lueth, VLFL-Lib, 2019-MAI-01 as class: SURFACES)
%
% started 2016-12-27 but finally implemented for SG-Lib 4.6
% 2021-01-16 Printer independent by slfit for AG-Lib 5.0
% (Status of: 2019-05-06)
%
% Introduced first in SolidGeometry 4.6
%
% See also: SGfourbarplate, SGsnaprivet, CPLlinkofPL
%
% [SGM,SGAll]=SGfourbarlinkage(L1,L2,R,D,[roi,h,eb,CPLE,CPLRx,CPL1x])
% === INPUT PARAMETERS ===
% L1: Length of Swing
% L2: Length of coupler
% R: Length of Crank
% D: Distance between Base points of Swing and Crank
% roi: [ro [ri]], outer radius, inner radius
% h: height; default is ro
% eb: ellbow configuration 1/2
% CPLE:
% === OUTPUT RESULTS ======
% SGM: Solid Geometry of all Parts mounted
% SGAll: Solid Geometry of all Parts packed
%
% EXAMPLE:
% SGfourbarlinkage(60,40,50,60,'','',1)
% SGfourbarlinkage(60,40,50,10)
% SGfourbarlinkage(60,40,50,100)
%
% See also: SGfourbarplate, SGsnaprivet, CPLlinkofPL
%
%
% Copyright 2019-2021 Tim C. Lueth
RapidWeaver Icon

Last Change Oct 2023 for SG-Lib 5.3