Last change of this documentation page: 2022-06-02 of SolidGeometry 4.5
Posefourbarcheck(PS,aps,lim,CPLB,CPLE,CPLR,CPL1);- shows the shape of effector, crank and swing

Posefourbarcheck(PS,aps,lim,CPLB,CPLE,CPLR,CPL1);% Posefourbarcheck(PS,aps,lim,CPLB,CPLE,CPLR,CPL1); - shows the shape of effector, crank and swing
% (by Tim Lueth, VLFL-Lib, 2019-APR-22 as class: KINEMATICS AND FRAMES)
%
% In contrast to Posefourbaranimate, this fnctn uses the sjapes of
% effector, swing and crank during animation (Status of: 2019-08-11)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Posefourbaranimate, Posefourbarshaping
%
% Posefourbarcheck(PS,[aps,lim,CPLB,CPLE,CPLR,CPL1]);
% === INPUT PARAMETERS ===
% PS: Pose
% aps: solution to check
% lim: if true; limit the movement to the pose order
% CPLB: Optional Background Shape
% CPLE: Optional Effector Shape
% CPLR: Optional Crank Shape
% CPL1: Optional Swing Shape
%
% EXAMPLE:
% PS=PosereadAPD('basecabinet_new')
% PosereadAPD('/Volumes/LUETH-WIN/MATLAB_files_for_experiments/basecabinet_new.APD'); PS=ans;
% PS=checkfourbar3Poseattachpermutation(PS,'',20)
% n=546
% PS.CPLE=Posefourbarshaping(PS,[n,123],PLsquare(500,400),'E');
% PS.CPLR=Posefourbarshaping(PS,[n,123],PLsquare(500,400),'C');
% PS.CPL1=Posefourbarshaping(PS,[n,123],PLsquare(500,400),'S');
% Posefourbarcheck(PS,n)
%
% See also: Posefourbaranimate, Posefourbarshaping
%
%
% Copyright 2019 Tim C. Lueth

CPLlinkofPL(PL,s)- returns a convex hull including budder for a list of points

CPLlinkofPL(PL,s)% CPLlinkofPL(PL,s) - returns a convex hull including budder for a list of points
% (by Tim Lueth, VLFL-Lib, 2019-APR-22 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLcircleoval, CPLremstraightAmin, CPLofPLgrow, CPLbuffer
%
% CPL=CPLlinkofPL(PL,[s])
% === INPUT PARAMETERS ===
% PL: Point list
% s: outer radius and inner radius [ro ri]; or default values
% === OUTPUT RESULTS ======
% CPL: Closed contour
%
% EXAMPLE:
% CPLlinkofPL(rand(3,2))
% CPLlinkofPL(rand(3,2),0.05)
% CPLlinkofPL(rand(3,2),[0.05 0.04])
% CPLlinkofPL(rand(3,2),[0.05 0.01])
%
% See also: PLcircleoval, CPLremstraightAmin, CPLofPLgrow, CPLbuffer
%
%
% Copyright 2019 Tim C. Lueth

TofPoseattachmentpoints(P1,A1,B1)- returns the HT matrices from A1 to Pose and B1 to Pose

TofPoseattachmentpoints(P1,A1,B1)% TofPoseattachmentpoints(P1,A1,B1) - returns the HT matrices from A1 to Pose and B1 to Pose
% (by Tim Lueth, VLFL-Lib, 2019-APR-22 as class: KINEMATICS AND FRAMES)
%
% quite often it is necessary to transform the effector shape which is
% relative defined to the pose into the coordinate system of the crank A1
% or the Swing B1. This fnctn returns both
% TofPose - Frame of A1 from Point A1 and B1
% TofPoseGPL - Frames of A1 and B1 from Pose and GPL
% TofA1B1GPL - Frame of Pose from A1 and B1 and GPL
% TofPoseattachmentpoints - Frames of B1 and A1 from Pose qnd Points A1
% and B1
% (Status of: 2021-12-10)
%
% Introduced first in SolidGeometry 4.5
%
% See also: TofPose, CPLofPosefourbarshape
%
% [TBP,TAP,TA1,TB1]=TofPoseattachmentpoints(P1,A1,B1)
% === INPUT PARAMETERS ===
% P1: Absolute Pose coordinates or complete pose consisting of PS.A,
% PS.B, PS.A1, PS.B1
% A1: absolute coordinates of A1 when P1 is reached
% B1: absolute coordinates of B1 when P1 is reached
% === OUTPUT RESULTS ======
% TBP: TAP=TA1\T0; to transform Pose origin coordinates into absolute
% Coordinate v TB1*TBP
% TAP: TBP=TB1\T0; to transform Pose origin coordinates into absolute
% Coordinate v TA1*TAP
% TA1: TA1=TofPose(A1,B1); % Simple frame in A1 with direction to B1
% TB1: TB1=TofPose(B1,A1); % Simple frame in B1 with direction to A1
%
% EXAMPLE:
% Posesample(7); PS=ans;
% checkfourbar3Poseattachpermutation(PS,3,10); PS=ans;
% PosefourbarselectAP(PS,1); PS=ans;
% TofPoseattachmentpoints(PS); TAP=ans
% [~,~,~,~,~,TA1,TB1]=PLofPosecouplercurve(PS,1); TA1=TA1(:,:,50), TB1=TB1(:,:,50)
% cla; Posefourbarplot(PS,1)
% PLofPosecouplercurve(PS)
% CPLplot(PLtransT(PLarrow(5),TA1*TAP),'m-',2)
% CPL=CPLlinkofPL([0 0;norm(TA1(1:2,3)-TB1(1:2,3))' 0;TAP(1:2,3)']); CPSplot(PLtrans(CPL,TA1),'m');
%
% See also: TofPose, CPLofPosefourbarshape
%
%
% Copyright 2019-2021 Tim C. Lueth

Posefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLC,XCPLS)- returns collision free path shaped contour for a specific fourbar linkage

Posefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLC,XCPLS)% Posefourbarshaping(PS,aps,SCPL,rel,XCPLW,XCPLA,XCPLC,XCPLS) - returns collision free path shaped contour for a specific fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-APR-20 as class: MECHANICAL PROCEDURES)
%
% =======================================================================
% OBSOLETE (2019-06-03) - USE 'CPLofPosefourbarshaping' INSTEAD
% =======================================================================
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ CPLofPosefourbarshaping ] ; exp_2019_04_16_Shape,
% exp_2019_03_28_Shape, exp_2018_12_20_cuttingshape
%
% CPL=Posefourbarshaping(PS,[aps,SCPL,rel,XCPLW,XCPLA,XCPLC,XCPLS])
% === 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'
% XCPLW: Static obstacles in the environment
% XCPLA: Obstacle contours attached to Pose
% XCPLC: Obstacle contour moved with crank
% XCPLS: Obstacle contour moved with swing
% === OUTPUT RESULTS ======
% CPL: Collision free contour
%
% EXAMPLE:
% PS.CPL1=Posefourbarshaping(PS,[-546,123],PLsquare(200,200),'S');
%
% See also: [ CPLofPosefourbarshaping ] ; exp_2019_04_16_Shape,
% exp_2019_03_28_Shape, exp_2018_12_20_cuttingshape
%
%
% Copyright 2019 Tim C. Lueth

PLconnectopenradial(PL,R);- closes an open line by a contour

PLconnectopenradial(PL,R);% PLconnectopenradial(PL,R); - closes an open line by a contour
% (by Tim Lueth, VLFL-Lib, 2019-APR-20 as class: CLOSED POLYGON LISTS)
%
% Uses:
% VLradialEdges
%
% (Status of: 2019-04-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLtangentarc4P, PLcloseopenends
%
% PLconnectopenradial(PL,[R]);
% === INPUT PARAMETERS ===
% PL: single open line
% R:
%
% EXAMPLE:
% PLconnectopenradial(rand(10,2)*100);
% PLconnectopenradial(rand(10,2)*100); CPL=ans; SGfigure; CPLplot(CPL,'m-');
%
% See also: PLtangentarc4P, PLcloseopenends
%
%
% Copyright 2019 Tim C. Lueth

PLfft(PL,)- same as CPLfft but for open contours

PLfft(PL,)% PLfft(PL,) - same as CPLfft but for open contours
% (by Tim Lueth, VLFL-Lib, 2019-APR-20 as class: CLOSED POLYGON LISTS)
%
% Uses PLconnectopenends before using CPLfft (Status of: 2019-04-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLfft, PLconnectopenends, VLBezierC
%
% PLN=PLfft(PL,[])
% === INPUT PARAMETERS ===
% PL: Open Point List
% === OUTPUT RESULTS ======
% PLN: Frequency limited Contour
%
% EXAMPLE:
% PLfft(PLsample(4),10)
%
% See also: CPLfft, PLconnectopenends, VLBezierC
%
%
% Copyright 2019 Tim C. Lueth

PLconnectopenends(PL,)- closes an open line by a contour

PLconnectopenends(PL,)% PLconnectopenends(PL,) - closes an open line by a contour
% (by Tim Lueth, VLFL-Lib, 2019-APR-20 as class: CLOSED POLYGON LISTS)
%
% Uses:
% PLtangentarc4P
% (Status of: 2019-04-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLtangentarc4P, PLcloseopenends
%
% [CPL,PLE]=PLconnectopenends(PL,[])
% === INPUT PARAMETERS ===
% PL: single open line
% === OUTPUT RESULTS ======
% CPL: Closed contour without doubled entries
% PLE: Externsion may contain start or end point
%
% EXAMPLE:
% PLX=PLradialEdges(PLrand(10,4)*10,30); SGfigure; PLplot(PLX,'b-'); % Arbitrary Line
% PLcloseopenends(PLX)
% CPLfft(PLcloseopenends(PLsample(3)),4)
%
% See also: PLtangentarc4P, PLcloseopenends
%
%
% Copyright 2019 Tim C. Lueth

PLtangentarc4P(PLA,PLB)- returns center point and circle segment for the two tangents

PLtangentarc4P(PLA,PLB)% PLtangentarc4P(PLA,PLB) - returns center point and circle segment for the two tangents
% (by Tim Lueth, VLFL-Lib, 2019-APR-19 as class: ANALYTICAL GEOMETRY)
%
% This fnctn connects the endpoints of two point lists via a circle. The
% circle is selected so that the last two points of the two point lists
% are regarded as tangents of the circle. The contour always runs from
% the end points of the first list to the end points of the second list.
% To connect the two point lists, the last 4 points of both must be
% replaced by the new point list and the sequence of the second point
% list rotated.
%
% All circles (!) for which the two straight lines form the tangents lie
% on the halving of the angle between the two straight lines. The two
% possible radii are determined by the respective perpendicular to the
% lines through the respective end point. The larger of the two radii can
% be used for both lines by extending the other line. For the smaller of
% the two radii, the other would have to be shortened.
% (Status of: 2019-04-19)
%
% Introduced first in SolidGeometry 4.5
%
% See also: crosscircline, rofcircbend, circof2tangent, PLtangentcirc,
% PLtangentcirc3, tangent2circ, cross2circ
%
% [PLall,PLX,R]=PLtangentarc4P(PLA,PLB)
% === INPUT PARAMETERS ===
% PLA: Start Point and Endpoint of Line A [xs ys; xe ye]
% PLB: Start Point and Endpoint of Line B [xs ys; xe ye]
% === OUTPUT RESULTS ======
% PLall: Radius of the 4 circles (1st is left of PLA(2,:)
% PLX: center points of the 4 circles (1st is left of PLA(2,:)
% R: cross points of B of 4 circles (1st is left of PLA(2,:)
%
% EXAMPLE:
% PLX=PLradialEdges(PLrand(10,4)*100,30); SGfigure; PLplot(PLX,'b-');
% SGfigure; PLplot(PLX,'b-'); PLY=PLtangentarc4P(PLX,flipud(PLX(1:2,:))); PLplot(PLY,'m-',2)
% PLX=rand(4,2)*10; PLtangentarc4P(PLX(1:2,:),PLX(3:4,:)); fullview(1500) % ANY CASE
%
%
% See also: crosscircline, rofcircbend, circof2tangent, PLtangentcirc,
% PLtangentcirc3, tangent2circ, cross2circ
%
%
% Copyright 2019 Tim C. Lueth

PLcirclearc(cp,A,B,)- returns an circle arc between two circle points in right hand rule

PLcirclearc(cp,A,B,)% PLcirclearc(cp,A,B,) - returns an circle arc between two circle points in right hand rule
% (by Tim Lueth, VLFL-Lib, 2019-APR-19 as class: ANALYTICAL GEOMETRY)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLcircle, PLcircleoval, PLcircleseg
%
% [PLR,PLL]=PLcirclearc(cp,A,B,[])
% === INPUT PARAMETERS ===
% cp: center point or R (+/-) alternatviely
% A: point A or angle w1
% B: point B or angle w2
% === OUTPUT RESULTS ======
% PLR: Right hand arc starting at A (red)
% PLL: Left hand arc starting at B (green)
%
% EXAMPLE:
% PLcirclearc([10 10],[10 11],[9 10])
%
% [PLX,PLY]=PLcirclearc(10,[10 0],[0 0]); cla; PLplot(PLX); shg
% [PLX,PLY]=PLcirclearc(-10,[10 0],[0 0]); shg; PLplot(PLY,'g-'); shg
%
% See also: PLcircle, PLcircleoval, PLcircleseg
%
%
% Copyright 2019 Tim C. Lueth

CPLfindsmalldist(CPL,z)- returns areas of a CPL that have a small wall distance to the opposite contour

CPLfindsmalldist(CPL,z)% CPLfindsmalldist(CPL,z) - returns areas of a CPL that have a small wall distance to the opposite contour
% (by Tim Lueth & Andreas Schroeffer, VLFL-Lib, 2019-APR-17 as class:
% CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLbuffer
%
% [CPLF,CPLX]=CPLfindsmalldist(CPL,[z])
% === INPUT PARAMETERS ===
% CPL: Closed Contour
% z: minimalcontour thickness; default is 0.5mm
% === OUTPUT RESULTS ======
% CPLF: Lost Contours; if empty, the contour has no problems
% CPLX: Remaining Contour;
%
% EXAMPLE:
% CPLfindsmalldist(PLstar(10,'','','','',.5),2);
% CPLfindsmalldist(PLstar(10,'','','','',.5),1);
% CPLfindsmalldist(PLgearDIN(.1,80));
%
%
% See also: CPLbuffer
%
%
% Copyright 2019-2020 Tim C. Lueth

Posefourbarangles(PS,aps)- returns the angle position of the crank for the poses used in the fourbar linkage

Posefourbarangles(PS,aps)% Posefourbarangles(PS,aps) - returns the angle position of the crank for the poses used in the fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-APR-15 as class: KINEMATICS AND FRAMES)
%
% written in in Carvoeiro, Portugal
% (Status of: 2019-04-24)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Posefourbarinvkin, Posefourbartorquetrans,
% Posefourbaranglelimit, Posefourbarposelimit
%
% [wcr,A1i,err]=Posefourbarangles(PS,[aps])
% === INPUT PARAMETERS ===
% PS: Pose using A0,A1,B0,B1 or PS.GAL & PS.GPL if aps ~= [];
% aps: specific solution of PS.GAL to replace A0,A1,B0,B1
% === OUTPUT RESULTS ======
% wcr: list of crank angles for the pose list PS.A
% A1i: list of endpoints Ai for the Poses
% err: error in distance
%
% EXAMPLE:
% PS=PosereadAPD('gripper')
% PS=checkfourbar3Poseattachpermutation(PS,'',15);
% Posefourbarangles(PS,140)
%
% See also: Posefourbarinvkin, Posefourbartorquetrans,
% Posefourbaranglelimit, Posefourbarposelimit
%
%
% Copyright 2019 Tim C. Lueth

Posefourbartorquetrans(PS,aps,nw,Ti)- returns the torque transmission factor for crank to swing and crank to pose

Posefourbartorquetrans(PS,aps,nw,Ti)% Posefourbartorquetrans(PS,aps,nw,Ti) - returns the torque transmission factor for crank to swing and crank to pose
% (by Tim Lueth, VLFL-Lib, 2019-APR-14 as class: KINEMATICS AND FRAMES)
%
% written in in Carvoeiro, Portugal
% The transmission Pose to Crank is still missing but important if the
% force is applied at the pose location (Status of: 2019-04-14)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Posefourbarposelimit, Posefourbaranimate
%
% [tcp,tcs,wcr]=Posefourbartorquetrans(PS,[aps,nw,Ti])
% === INPUT PARAMETERS ===
% PS: Pose
% aps: selected solution
% nw: number of auxiliary point
% Ti: optional point relative to pose; not implemented yet
% === OUTPUT RESULTS ======
% tcp: transmission crank pose
% tcs: transmission crank swing
% wcr: crank angles
%
% EXAMPLE:
% PosereadAPD('/Volumes/LUETH-WIN/MATLAB_files_for_experiments/basecabinet_new.APD'); PS=ans;
% PS=Posefourbarposelimit(PS);
% Posefourbartorquetrans(PS,50); fullview(500);
%
% See also: Posefourbarposelimit, Posefourbaranimate
%
%
% Copyright 2019 Tim C. Lueth

Tplotangle (T,wcr)- plot for a list of HT matrices the angle, angle velocity and angle acceleration

Tplotangle (T,wcr)% Tplotangle (T,wcr) - plot for a list of HT matrices the angle, angle velocity and angle acceleration
% (by Tim Lueth, VLFL-Lib, 2019-APR-11 as class: KINEMATICS AND FRAMES)
%
% returns currently no handle
% theta is the explicit rotation angle of the R matix relative to start
% frame (Status of: 2019-04-11)
%
% Introduced first in SolidGeometry 4.5
%
% See also: tplot, tplotangle
%
% Tplotangle(T,[wcr])
% === INPUT PARAMETERS ===
% T: Transformation matrix list
% wcr: optional angle interval
%
% EXAMPLE:
% PosereadAPD('/Volumes/LUETH-WIN/MATLAB_files_for_experiments/basecabinet_new.APD'); PS=ans;
% aps=200; [PL,T0,wcr,TA0,TB0,TA1,TB1]=PLofPosecouplercurve(PS,aps,60);
%
%
%
% See also: tplot, tplotangle
%
%
% Copyright 2019 Tim C. Lueth

PLgearDIN(m,z,tig,n)- returns a gear contour wrt DIN from 3 to 48 teeth (replaces PLgear of year 2012)

PLgearDIN(m,z,tig,n)% PLgearDIN(m,z,tig,n) - returns a gear contour wrt DIN from 3 to 48 teeth (replaces PLgear of year 2012)
% (by Tim Lueth and Yannick Krieger, VLFL-Lib, 2019-APR-10 as class:
% ANALYTICAL GEOMETRY)
%
% Completely new written for SG-Lib 4.5 by Tim Lueth and Yannick Krieger,
% Replace the original fnctn of 2012-10-28
% diameter d=z*m (Status of: 2019-04-23)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLhexalobular, PLinbus, PLgearrackDIN, PLthreadDIN,
% SGofCPLrota, PLevolvente, PLgear, SGgearDIN, SGgearpairDIN, SGspurgear,
% VLFLgear, VLFLgearhub4shaft, VLFLinternalgear
%
% LITERATURE:
% Traeger, M.F.; Krieger, Y.S.; Lueth, T.C.: "Automated construction of
% gear racks, spur gears and helical gears using Matlab & STL files for
% rapid manufacturing ", Advanced Intelligent Mechatronics (AIM), 2013
% IEEE/ASME International Conference on, 1603 - 1608
%
% [PLG,d,da,df,db]=PLgearDIN([m,z,tig,n])
% === INPUT PARAMETERS ===
% m: modul; negative means internal gear
% z: Teeth number
% tig: starting orientation (=gap, 1=tooth)
% n: number of nodes per flank; default 5
% === OUTPUT RESULTS ======
% PLG: Point list (2D)
% d: rolling circle
% da: head diameter
% df: foot diameter
% db: radius of 2nd contour
%
% EXAMPLE: Draw a gear with module 1 and 20 teeth (i.e. d=zm, i.e. 20 mm)
% PLgearDIN(1,-20,1,100); PL=ans; fullview(1200); cla; PLplot(PL,'m-');
% PLgearDIN(1+-20,1,100); PL=ans; fullview(1200); cla; PLplot(PL,'m-');
%
% See also: PLhexalobular, PLinbus, PLgearrackDIN, PLthreadDIN,
% SGofCPLrota, PLevolvente, PLgear, SGgearDIN, SGgearpairDIN, SGspurgear,
% VLFLgear, VLFLgearhub4shaft, VLFLinternalgear
%
%
% Copyright 2019-2021 Tim C. Lueth

PLtoothevolvente(rb,z,ra,rf,ratio,n)- returns the evolvent between base circle and outer circle

PLtoothevolvente(rb,z,ra,rf,ratio,n)% PLtoothevolvente(rb,z,ra,rf,ratio,n) - returns the evolvent between base circle and outer circle
% (by Tim Lueth & Yannick Krieger, VLFL-Lib, 2019-APR-09 as class: CLOSED
% POLYGON LISTS)
%
% d= z * m
% This fnctn by Tim Lueth and Yannick Krieger in SG-Lib 4.5 is a complete
% redesign of the former PLgearDIN fnctn of 2012-10-28. It support teeth
% numbers starting with 3. (Status of: 2019-04-10)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLevolvente
%
% LITERATURE:
% Traeger, M.F.; Krieger, Y.S.; Lueth, T.C.: "Automated construction of
% gear racks, spur gears and helical gears using Matlab & STL files for
% rapid manufacturing ", Advanced Intelligent Mechatronics (AIM), 2013
% IEEE/ASME International Conference on, 1603 - 1608
%
% [PLT,PLE,PL2,PLG]=PLtoothevolvente([rb,z,ra,rf,ratio,n])
% === INPUT PARAMETERS ===
% rb: base circle = d*cos(20/180*pi)
% z: number of teeth
% ra: outer circle = (z+2)*m
% rf: foot circle = df=(z-2.5)*m
% ratio: ratio default is 0.7
% n: number of auxiliary points
% === OUTPUT RESULTS ======
% PLT: Point list of evolvente
% PLE:
% PL2:
% PLG:
%
% EXAMPLE:
% PLtoothevolvente(100,120,21,20)
%
% See also: PLevolvente
%
%
% Copyright 2019 Tim C. Lueth

fullview (wid)- maximize current figure to maximal height og the screen

fullview (wid)% fullview (wid) - maximize current figure to maximal height og the screen
% (by Tim Lueth, VLFL-Lib, 2019-APR-08 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGfigure, copyfig, SGfigureannotation, SGfiguremovie, subfig,
% togglefig, pastego, copygo
%
% fullview([wid])
% === INPUT PARAMETERS ===
% wid: optional width in pixels or percent or [mincol maxcol]
%
% EXAMPLE:
% SGfigure; fullview; shg; pause(1)
% SGfigure; fullview(2000); shg; pause(1)
% fullview(0.3);shg; pause(1)
% fullview([0.3 0.5]);shg; pause(1)
%
% See also: SGfigure, copyfig, SGfigureannotation, SGfiguremovie, subfig,
% togglefig, pastego, copygo
%
%
% Copyright 2019-2020 Tim C. Lueth

SGofSG(SGO)- converts cell list of solids into a solid struct

SGofSG(SGO)% SGofSG(SGO) - converts cell list of solids into a solid struct
% (by Tim Lueth, VLFL-Lib, 2019-APR-06 as class: SURFACES)
%
% exactly the same as SGofVLFL (2012), implemented just to avoid not
% remembering the name of the already implemented fnctn (Status of:
% 2019-04-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGofVLFL
%
% SG=SGofSG(SGO)
% === INPUT PARAMETERS ===
% SGO: cell list of structs
% === OUTPUT RESULTS ======
% SG: Solid struct
%
% EXAMPLE:
% SG=SGbox([30,20,10])
% SGofVLFL({SG,SG,SG}) % Adds even dace colors
% SGcheckmeshlab(ans)
%
% SGsample(20)
% SGofSG(SGsample(20))
%
%
% See also: SGofVLFL
%
%
% Copyright 2019 Tim C. Lueth

SGcolorfaces(SG,col,ind,alpha)- colors the faces of a solid

SGcolorfaces(SG,col,ind,alpha)% SGcolorfaces(SG,col,ind,alpha) - colors the faces of a solid
% (by Tim Lueth, VLFL-Lib, 2019-APR-04 as class: SURFACES)
%
% SG-Lib 4.7: ..sorry name changed from SGcoloringfaces to SGcolorfaces
% (Status of: 2019-04-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGcolorseparation, rgbofall, SGwriteSTL
%
% SG=SGcolorfaces(SG,[col,ind,alpha])
% === INPUT PARAMETERS ===
% SG: Solid Geometry
% col: color
% ind: index for coloring
% alpha: alpha value
% === OUTPUT RESULTS ======
% SG: Solid Geometry
%
% EXAMPLE:
% SG=SGbox([30,20,10]); SG.col='g'; SG.alpha=0.3; SGfigure; SGplot(SG); view(-30,30);
% SGcolorfaces(SG,'m',8:12); SG=ans
% SGcolorfaces(SG,'b',6:9); SG=ans
% SGmeshlab(SG); % MESHLAB HAS A COLOR BUG
%
% See also: SGcolorseparation, rgbofall, SGwriteSTL
%
%
% Copyright 2019 Tim C. Lueth

PLshortestpathinCPL(CPL,A,B,shr,n,smo)- returns a path inside of a CPL using A* Zelinzky, Lozano-Perez, Dikstra

PLshortestpathinCPL(CPL,A,B,shr,n,smo)% PLshortestpathinCPL(CPL,A,B,shr,n,smo) - returns a path inside of a CPL using A* Zelinzky, Lozano-Perez, Dikstra
% (by Tim Lueth, VLFL-Lib, 2019-APR-01 as class: CLOSED POLYGON LISTS)
%
% This fnctn is helpful not only for path planning in 2D but also to
% define CPLs for Solids inside of a limiting contour between start and
% endpoints (Base points, Attachment points)
% read also the dissertation of Tim Lueth ;-) (Status of: 2019-04-14)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofPLgrowline, PLshortestpathinCPLcost
%
% [PLB,PL,k,shr]=PLshortestpathinCPL(CPL,A,B,[shr,n,smo])
% === INPUT PARAMETERS ===
% CPL: CPL
% A: Starting Point A inside the CPL
% B: End Point B inside the CPL
% shr: shrinkage value; default is sofBB/n
% n: number of grid points; default is 100
% smo: 'A*', 'Bezier', 'fft' for smoothening
% === OUTPUT RESULTS ======
% PLB: Bezier smoothed path
% PL: Grid bases path
% k: grid numbers
% shr: dynamic shrinkage value
%
% EXAMPLE:
% CPL=CPLsample(20); CPL=CPLsample(9);
% SGfigure; CPLplot(CPL); shg; PLAB=ginput(2);
% PLshortestpathinCPL(CPL,PLAB(1,:), PLAB(2,:)); PL=ans(:,1:2);
% CPLofPLgrowline(PL,1,true,true); CPLplot(CPL,'b-');
%
% See also: CPLofPLgrowline, PLshortestpathinCPLcost
%
%
% Copyright 2019-2022 Tim C. Lueth

BBofT(T)- returns the BB for a list of matrices

BBofT(T)% BBofT(T) - returns the BB for a list of matrices
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-30 as class: ANALYTICAL GEOMETRY)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPS, BBofCPL, BBofPS, BBofSGcut,
% BBofPose
%
% BB=BBofT(T)
% === INPUT PARAMETERS ===
% T: List of 3x3 or 4x4 HT matrices
% === OUTPUT RESULTS ======
% BB: [xmin xmax ymin y max zmin zmax]
%
% EXAMPLE:
% PS.A=PLcircle(10,36); PS.B=PS.A*2; T0=TofPose(PS), BBofT(T0)
%
% TofPLpath(PLcircle(10)), BBofT(ans)
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPS, BBofCPL, BBofPS, BBofSGcut,
% BBofPose
%
%
% Copyright 2019 Tim C. Lueth

exp_2019_03_28_Shape(PS,aps,lim,smooth,optcrank,optswing)- will be the fnct to automatically defined the effector shape

exp_2019_03_28_Shape(PS,aps,lim,smooth,optcrank,optswing)% exp_2019_03_28_Shape(PS,aps,lim,smooth,optcrank,optswing) - will be the fnct to automatically defined the effector shape
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-28 as class: KINEMATICS AND FRAMES)
%
% This is after 3 month research the next experiment to complete the
% experiment exp_2018_12_20_cuttingshape.
% It creates the shape of effector, crank and swing by analyzing the
% movement, cutting at the work space boarders and searching the path
% with minimal length between base point and attachment point.
%
% (Status of: 2019-04-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: exp_2019_03_28_Shape
%
% PS=exp_2019_03_28_Shape(PS,[aps,lim,smooth,optcrank,optswing])
% === INPUT PARAMETERS ===
% PS: Pose including PS.GAL and PS.GPL
% aps: selected solution of PS.GAL
% lim: if true; the contours are limited to the limiting order 123 etc.
% smooth: CPLfft for smoothening the effector contour
% optcrank: if true the cank is shaped
% optswing: if true the swing is shaped
% === OUTPUT RESULTS ======
% PS: Final Pose including shaped effectors
%
% EXAMPLE:
% PS=PosereadAPD('basecabinet_new')
% % PS=checkfourbar3Poseattachpermutation(PS,'',20)
% % Posefourbarselectui(PS)
% exp_2019_03_28_Shape(PS,307)
%
%
% See also: exp_2019_03_28_Shape
%
%
% Copyright 2019 Tim C. Lueth

Posefourbarposelimit(PS,aps,ford)- finds the angle limits for a fourbar movement

Posefourbarposelimit(PS,aps,ford)% Posefourbarposelimit(PS,aps,ford) - finds the angle limits for a fourbar movement
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-26 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: checkfourbar3Poseattachpermutation, Posefourbaranimate,
% PLofPosecouplercurve, Posefourbarangles, Posefourbaranglelimit
%
% [PS,wlim,ford]=Posefourbarposelimit(PS,[aps,ford])
% === INPUT PARAMETERS ===
% PS: Pose struct including GPL and GAL
% aps: optional index for test
% ford: optional order; default is default order or 123
% === OUTPUT RESULTS ======
% PS: Pose struct with modified PS.GAL List and limited angles!
% wlim: limitation for angle [0 0] if no solution possible for input ford
% ford: order of poses; 0 if no solution possible for input ford
%
% EXAMPLE:
% PS=Posesample(5)
% PS=checkfourbar3Poseattachpermutation(PS,3)
% PS=Posefourbarposelimit(PS,2)
% Posefourbaranimate(PS,2);
% [[1:20]' PS.GAL(1:20,:)] % 1 2 7 17
% Posefourbarposelimit(PS,7,123)
% Posefourbarposelimit(PS,7,231)
% Posefourbarposelimit(PS,7,312)
% Posefourbarposelimit(PS,7,321)
% Posefourbarposelimit(PS,7,132)
% Posefourbarposelimit(PS,7,213); % Tiger Claw shape
%
% See also: checkfourbar3Poseattachpermutation, Posefourbaranimate,
% PLofPosecouplercurve, Posefourbarangles, Posefourbaranglelimit
%
%
% Copyright 2019 Tim C. Lueth

number2vec(s)- converst a number into vector of integer

number2vec(s)% number2vec(s) - converst a number into vector of integer
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-26 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: round, vec2number, digitofnum
%
% vec=number2vec(s)
% === INPUT PARAMETERS ===
% s: string or integer scalar
% === OUTPUT RESULTS ======
% vec: vector if integer
%
% EXAMPLE:
% number2vec(123)
% number2vec('123')
%
% See also: round, vec2number, digitofnum
%
%
% Copyright 2019 Tim C. Lueth

Posefourbarplotcouplercurve(PS,aps,col,lw,cot)- simply plots a coupler curve for fourbar linkage

Posefourbarplotcouplercurve(PS,aps,col,lw,cot)% Posefourbarplotcouplercurve(PS,aps,col,lw,cot) - simply plots a coupler curve for fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-25 as class: KINEMATICS AND FRAMES)
%
% plots the coupler curve based on base points A0, B0, and attachment
% points A1, B1
% or based on an index "aps" relative to the lists GPL and GAL. (Status
% of: 2020-08-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLofPosecouplercurve, Posefourbarselectcouplercurve,
% checkfourbar3Poseattachpermutation, checkfourbar2Poseattachpermutation,
% checkfourbar1Poseattachpermutation
%
% h=Posefourbarplotcouplercurve(PS,[aps,col,lw,cot])
% === INPUT PARAMETERS ===
% PS: Pose including A0, B0, A1, B1, or GPL and GAL
% aps: select solution or combination of attachment points in GAL,
% requires GPL and GAL
% col: col of coupler courve; default is 'r-'
% lw: line width of coupler courve; default is 2
% cot: col of coupler orientation; default is 'r-'
% === OUTPUT RESULTS ======
% h: handle to line
%
% EXAMPLE:
% PS=Posesample(7)
% PS=checkfourbar3Poseattachpermutation(PS,3)
% PS=PosefourbarselectAP(PS,1), PS=stripfields(PS,'GPL','GAL')
% SGfigure; Posefourbarplotcouplercurve(PS,'','r',2,'b');
% Poseplot(PS); Posefourbarplot(PS);
% Posefourbaranimate(PS);
%
% See also: PLofPosecouplercurve, Posefourbarselectcouplercurve,
% checkfourbar3Poseattachpermutation, checkfourbar2Poseattachpermutation,
% checkfourbar1Poseattachpermutation
%
%
% Copyright 2019-2021 Tim C. Lueth

Posetransui(PS,CPLE,GPL,m,gp,lim)- turns and moves interactively poses and recalculate fourbar linkage solutions

Posetransui(PS,CPLE,GPL,m,gp,lim)% Posetransui(PS,CPLE,GPL,m,gp,lim) - turns and moves interactively poses and recalculate fourbar linkage solutions
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-24 as class: KINEMATICS AND FRAMES)
%
% This interactive fnctn is useful if the 3 Pose syntheses should be used
% to identify coupler courves. This fnctn moves the Poses in Space, while
% PosetransrelCPLE just moves the Poses relative to the Effector shape.
% (Status of: 2019-08-06)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Poseui, PosetransrelCPLE, PosetransrelGPL,
% Posefourbarselectui, PosefourbarselectAP, Posefourbarplot,
% Posefourbaranimate
%
% PS=Posetransui(PS,[CPLE,GPL,m,gp,lim])
% === INPUT PARAMETERS ===
% PS: Pose
% CPLE: Optional size or contour of effector
% GPL: Grid number or Grid list
% m: alternative buffer size of
% gp: Grid point density
% lim: currently unused
% === OUTPUT RESULTS ======
% PS: Pose with changed Lists for A, B, GAL
%
% EXAMPLE:
% fname=loadweb('Posebasecabinet.APD'); PS=PosereadAPD(fname);
% PS=checkfourbar3Poseattachpermutation(PS)
% PS=Posetransui(PS)
%
%
% See also: Poseui, PosetransrelCPLE, PosetransrelGPL,
% Posefourbarselectui, PosefourbarselectAP, Posefourbarplot,
% Posefourbaranimate
%
%
% Copyright 2019-2021 Tim C. Lueth

CPRofPosefourbar(PS,ord)- returns center point list and radius list for a fourbar linkage for a given GPL and GAL

CPRofPosefourbar(PS,ord)% CPRofPosefourbar(PS,ord) - returns center point list and radius list for a fourbar linkage for a given GPL and GAL
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-24 as class: KINEMATICS AND FRAMES)
%
% extracted from Posefourbarselectui
% (Status of: 2019-03-24)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Posefourbarselectui
%
% [C,R,P1,P2,P3,api,oi,xpi]=CPRofPosefourbar(PS,[ord])
% === INPUT PARAMETERS ===
% PS: Pose including GPL and GAL
% ord: optional required order
% === OUTPUT RESULTS ======
% C: center point list corresponds to GPL
% R: radius list corresponds to GPL
% P1: GPL Point list transformed into Pose 1
% P2: GPL Point list transformed into Pose 2
% P3: GPL Point list transformed into Pose 3
% api: list of valid points for solutions of GAL => list of invalid
% points for solutions of GAL
% oi: list of valid solutions of GAL to fullfil order
%
% EXAMPLE:
% fname=loadweb('Posebasecabinet.APD'); PS=PosereadAPD(fname);
% PS=checkfourbar3Poseattachpermutation(PS)
% CPRofPosefourbar(PS)
%
%
% See also: Posefourbarselectui
%
%
% Copyright 2019 Tim C. Lueth

sofgca- returns the pixel resolution of gca

sofgca% sofgca - returns the pixel resolution of gca
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-24 as class: USER INTERFACE)
%
% this fnctn is helpful if interactive fnctns select points near a line,
% point or polygon and the figure / axis resultion must be taken into
% account to select the items
% it is not the same as:
% sofBB(axis) % return the maximum coordinate length in gca (Status
% of: 2019-03-24)
%
% Introduced first in SolidGeometry 4.5
%
% See also: sofBB
%
% [s,ss]=sofgca
% === OUTPUT RESULTS ======
% s: largest inaccuracy
% ss: inaccuracy (pixel size in units)
%
% EXAMPLE:
% figure; sofgca
% figure; axis([-1000 1000 -1000 1000]); sofgca, sofBB(axis)
%
% See also: sofBB
%
%
% Copyright 2019 Tim C. Lueth

getgcatitle- returns the current title of gca as string

getgcatitle% getgcatitle - returns the current title of gca as string
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-24 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGtitle, getgcapixelsize
%
% s=getgcatitle
% === OUTPUT RESULTS ======
% s: string
%
% EXAMPLE:
% figure; title('test'); getgcatitle
%
% See also: SGtitle, getgcapixelsize
%
%
% Copyright 2019 Tim C. Lueth

Posefourbaranimate(PS,ap)- animates the fourbar linkage given Pose parameter

Posefourbaranimate(PS,ap)% Posefourbaranimate(PS,ap) - animates the fourbar linkage given Pose parameter
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-23 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PosefourbarselectAP, Posefourbarplot, Poseplot, Poseplotspace
%
% hx=Posefourbaranimate(PS,[ap])
% === INPUT PARAMETERS ===
% PS: Pose (A0,A1,B0,B1,A)
% ap: optional selected solution in GAL if desired
% === OUTPUT RESULTS ======
% hx: handle to graphics
%
% EXAMPLE:
% PS=Posesample(7)
% PS=checkfourbar3Poseattachpermutation(PS,3) % Creates Solution
% PS=PosefourbarselectAP(PS,1) % Selects a solution
% SGfigure; Posefourbarplot(PS) % plots the solution
% PLofPosecouplercurve(PS,1)
% Posefourbaranimate(PS)
%
% See also: PosefourbarselectAP, Posefourbarplot, Poseplot, Poseplotspace
%
%
% Copyright 2019 Tim C. Lueth

Posefourbarplot(PS,aps,psnum)- plots the fourbar linkage given Pose parameter

Posefourbarplot(PS,aps,psnum)% Posefourbarplot(PS,aps,psnum) - plots the fourbar linkage given Pose parameter
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-23 as class: KINEMATICS AND FRAMES)
%
% =======================================================================
% OBSOLETE (2022-01-20) - USE 'Poseplotsolution' INSTEAD
% =======================================================================
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ Poseplotsolution ] ; PosefourbarselectAP, Poseplot,
% Poseplotspace, Posefourbaranimate
%
% h=Posefourbarplot(PS,[aps,psnum])
% === INPUT PARAMETERS ===
% PS: Pose (A0,A1,B0,B1,A)
% aps: optional different fourbar solution from GAL
% psnum: optional different pose to show instead of # 1
% === OUTPUT RESULTS ======
% h: handle to graphics
%
% EXAMPLE:
% PS=Posesample(7)
% PS=checkfourbar3Poseattachpermutation(PS,3) % Creates Solutions in a square size 3
% PS=PosefourbarselectAP(PS,1) % Selects a solution
% SGfigure; Posefourbarplot(PS) % plots the solution
%
%
% See also: [ Poseplotsolution ] ; PosefourbarselectAP, Poseplot,
% Poseplotspace, Posefourbaranimate
%
%
% Copyright 2019-2022 Tim C. Lueth

PosefourbarselectAP(PS,aps)- simply select a solution from the Pose attachment point list

PosefourbarselectAP(PS,aps)% PosefourbarselectAP(PS,aps) - simply select a solution from the Pose attachment point list
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-23 as class: KINEMATICS AND FRAMES)
%
% The pose struct must contain the following information
% PS.A - Starting Points
% PS.B - End Points
% PS.CPLE = Contour of the effector
% PS.GPL = Grid Point list inside the effector
% PS.GAP = Grid Point Attachment List created by
% checkfourbar3Poseattachpermutation
% THIS FNCTN REMOVES / MODIFIES EXISTING FIELDS: 'A0','B0','A1','B1'
% (Status of: 2019-03-23)
%
% Introduced first in SolidGeometry 4.5
%
% See also: checkfourbar3Poseattachpermutation, Posefourbarselectui
%
% [PS,i,A0,B0,A1,B1]=PosefourbarselectAP(PS,[aps])
% === INPUT PARAMETERS ===
% PS: Posestruct
% aps: solution number or combination of attachment points
% === OUTPUT RESULTS ======
% PS: New PS.GPL = Grid Point list, PS.GAP = Grid Point Attachment List
% i: Solution selected if aps was used with 2 input parameters
% A0: Base Point Crank
% B0: Base Point Swing
% A1: Attachment Point Crank
% B1: Attachment Point Swing
%
% EXAMPLE:
% PS=Posesample(7);
% PS=checkfourbar3Poseattachpermutation(PS,3),
% PosefourbarselectAP(PS,1);
%
% See also: checkfourbar3Poseattachpermutation, Posefourbarselectui
%
%
% Copyright 2019 Tim C. Lueth

PLofT(T0)- returns a point list path from the translation part of a list of HT matrices

PLofT(T0)% PLofT(T0) - returns a point list path from the translation part of a list of HT matrices
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-21 as class: KINEMATICS AND FRAMES)
%
% could also be named PLpathofT (Status of: 2019-03-21)
%
% Introduced first in SolidGeometry 4.5
%
% See also: TofPLpath, radofT
%
% PL=PLofT(T0)
% === INPUT PARAMETERS ===
% T0: List of matrices in 2D
% === OUTPUT RESULTS ======
% PL: Point list
%
% EXAMPLE:
% PLofT(TofPLpath(PLsample(9)))
%
% See also: TofPLpath, radofT
%
%
% Copyright 2019 Tim C. Lueth

radofT(T0)- returns only the radian turning angles of a list of T@ matrices

radofT(T0)% radofT(T0) - returns only the radian turning angles of a list of T@ matrices
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-21 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: TofPLpath, PLofT
%
% w=radofT(T0)
% === INPUT PARAMETERS ===
% T0: List of HT matrices in 2D
% === OUTPUT RESULTS ======
% w: list of angles (atan2)
%
% EXAMPLE:
% radofT( TofPLpath(PLsample(9)))
%
% See also: TofPLpath, PLofT
%
%
% Copyright 2019 Tim C. Lueth

TofPLpath(PL)- creates a list of HT matrices from a point list path

TofPLpath(PL)% TofPLpath(PL) - creates a list of HT matrices from a point list path
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-21 as class: KINEMATICS AND FRAMES)
%
% 2D Fnctn x is in the direction of the path
% TofPL creates the center of a cloud
% TofPLpath creates a list HT matrices (Status of: 2019-03-21)
%
% Introduced first in SolidGeometry 4.5
%
% See also: radofT, PLofT
%
% [T0,PS]=TofPLpath(PL)
% === INPUT PARAMETERS ===
% PL: Point list path
% === OUTPUT RESULTS ======
% T0: List of T2 homogenoues transformation matrices
% PS: pose list
%
% EXAMPLE:
% TofPLpath(PLsample(9))
%
% See also: radofT, PLofT
%
%
% Copyright 2019 Tim C. Lueth

GPLofPoseCPL(PS,CPLE,GPL,m,exactCPL)- returs grid points for an effector identical to to checkfourbar3Poseattachpermutation

GPLofPoseCPL(PS,CPLE,GPL,m,exactCPL)% GPLofPoseCPL(PS,CPLE,GPL,m,exactCPL) - returs grid points for an effector identical to to checkfourbar3Poseattachpermutation
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-19 as class: KINEMATICS AND FRAMES)
%
% =======================================================================
% OBSOLETE (2021-12-15) - USE 'GPLauxgridpointsCPS2' INSTEAD
% =======================================================================
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ GPLauxgridpointsCPS2 ] ; GPLauxgridpointsCPS,
% GPLauxgridpointsCPS2, center3Poseeffektorgrid
%
% GPL=GPLofPoseCPL(PS,[CPLE,GPL,m,exactCPL])
% === INPUT PARAMETERS ===
% PS: Pose; only PS.A and PS.B are used
% CPLE: optional CPLE or size of square
% GPL: Grid point list relative to origin or resolutin
% m: CPLE buffer buffer size or exact CPL
% exactCPL: false==outer boundary; true==exact CPLE; default is false
% === OUTPUT RESULTS ======
% GPL: Just grid point list for effector or another pose related contour
%
% EXAMPLE:
% PS=Posesample(7); PS.CPLE=PLsquare(6,3);
% GPLofPoseCPL(PS)
%
%
% See also: [ GPLauxgridpointsCPS2 ] ; GPLauxgridpointsCPS,
% GPLauxgridpointsCPS2, center3Poseeffektorgrid
%
%
% Copyright 2019-2021 Tim C. Lueth

CPSui(CPS,col,linw);- interactive fnct to create and modify CPLS (Only one Contur)

CPSui(CPS,col,linw);% CPSui(CPS,col,linw); - interactive fnct to create and modify CPLS (Only one Contur)
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-17 as class: CLOSED POLYGON LISTS)
%
% Left Mouse button => Set remove and shift points by
% Right Mouse button => Shift at edges, Rotate at corners
% Middle Mouse Button => exit
% More or less: CPL=VLui(CPL,'','',col,'',linw); (Status of: 2019-06-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: VLui, CPSlineui, CPLui, PLui, PLsquareui, PLcircleui, VLFLui,
% SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
% CPS=CPSui([CPS,col,linw]);
% === INPUT PARAMETERS ===
% CPS: Optional polyshape
% col: Optional color; default is 'r'
% linw: optional line width; default is 2
% === OUTPUT RESULTS ======
% CPS: Final CPS
%
% EXAMPLE:
% cla; CPLui()
% cla; CPSui(polyshape(CPLsample(3)))
% cla; CPSui(polyshape(CPLsample(3)),'b',3)
%
% See also: VLui, CPSlineui, CPLui, PLui, PLsquareui, PLcircleui, VLFLui,
% SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
%
% Copyright 2019 Tim C. Lueth

CPLui(CPL,col,linw);- interactive fnct to create and modify CPLS (Only one Contur)

CPLui(CPL,col,linw);% CPLui(CPL,col,linw); - interactive fnct to create and modify CPLS (Only one Contur)
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-17 as class: CLOSED POLYGON LISTS)
%
% Left Mouse button => Set remove and shift points by
% Right Mouse button => Shift at edges, Rotate at corners
% Middle Mouse Button => exit
% More or less: CPL=VLui(CPL,'','',col,'',linw); (Status of: 2019-06-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: VLui, CPSlineui, CPSui, PLui, PLsquareui, PLcircleui, VLFLui,
% SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
% CPL=CPLui(CPL,[col,linw]);
% === INPUT PARAMETERS ===
% CPL: Optional CPL; default is [];
% col: Optional color; default is 'r-'
% linw: optional line width; default is 2
% === OUTPUT RESULTS ======
% CPL: Final CPL
%
% EXAMPLE:
% cla; CPLui()
% cla; CPLui(CPLsample(3))
% cla; CPLui(CPLsample(3),'b-',3)
%
% See also: VLui, CPSlineui, CPSui, PLui, PLsquareui, PLcircleui, VLFLui,
% SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
%
% Copyright 2019 Tim C. Lueth

CPLinsertpoint(CPL,p,tol)- inserts a point at an appropriate condition into a CPL

CPLinsertpoint(CPL,p,tol)% CPLinsertpoint(CPL,p,tol) - inserts a point at an appropriate condition into a CPL
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-17 as class: CLOSED POLYGON LISTS)
%
% This fnctn is extremely hard to test for errors.
% ea is the entry of the best fitting contour
% eaa is the complete list for all contours
% c si mind dist_s dist_e
% (Status of: 2019-03-17)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CVLpointdistancetoedge, mirroringatline3D
%
% [CPLN,ea,eaa,ok]=CPLinsertpoint(CPL,p,[tol])
% === INPUT PARAMETERS ===
% CPL: CPL
% p: point
% tol: tolerance for inserting a new point
% === OUTPUT RESULTS ======
% CPLN: New CPL with integrated Point
% ea: information on contour the point was inserted
% eaa: information on all contours ov CPL
% ok: false if the point was to near
%
% EXAMPLE:
% close all; SGfigure; CPL=CPLsample(7); CPLplot(CPL); view(0,90);
% shg; axis(BBgrow(axis,1.1));CPLplot(CPL); p=ginput(1); CPL=CPLinsertpoint(CPL,p,1); cla; CPLplot(CPL,'c*-',2);
%
%
% See also: CVLpointdistancetoedge, mirroringatline3D
%
%
% Copyright 2019 Tim C. Lueth

mirroringatline3D(P1,ev,p)- mirrors a point at a straight line in 3D

mirroringatline3D(P1,ev,p)% mirroringatline3D(P1,ev,p) - mirrors a point at a straight line in 3D
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-16 as class: ANALYTICAL GEOMETRY)
%
% Should be renamed into VLmirroratline (Status of: 2019-03-16)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLcross2Lines, PLcrossCPLline, mirroringatline2D
%
% [mp,do,cp,ov,dz]=mirroringatline3D(P1,ev,p)
% === INPUT PARAMETERS ===
% P1: Point on line
% ev: direction vector
% p: point to mirror
% === OUTPUT RESULTS ======
% mp: mirror point
% do: distance to straight line (wrt to ev)
% cp: crossing point on line
% ov: orthogonal vector to straight line from p to cp
% dz: distance of cp from P1
%
% EXAMPLE:
% mirroringatline3D([0 0 0],[1 0 0],[2 1 3])
% mirroringatline3D([0 0 0],[0 1 0],[2 1 3])
% mirroringatline3D([0 0 0],[0 0 1],[2 1 3])
%
% See also: PLcross2Lines, PLcrossCPLline, mirroringatline2D
%
%
% Copyright 2019 Tim C. Lueth

BBgrow(bb,m)- increases the size of a Boundary Box

BBgrow(bb,m)% BBgrow(bb,m) - increases the size of a Boundary Box
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-16 as class: AUXILIARY PROCEDURES)
%
% in contrast to BBaddtolerance , this fnctn BBgrowdoes not add a
% tolerance but magnify the BB.
% this fnctn is NOT able to handle lists of BBs yet! (Status of:
% 2020-01-11)
%
% Introduced first in SolidGeometry 4.5
%
% See also: axis, BBofSG, BBaddtolerance
%
% nbb=BBgrow(bb,m)
% === INPUT PARAMETERS ===
% bb: bounding box or axis
% m: growing factor
% === OUTPUT RESULTS ======
% nbb: new bounding box
%
% EXAMPLE:
% BBgrow([0 1 0 1 ],1) % unchanged
% BBgrow([0 1 0 1 ],2) % magnified around the center
% BBgrow([0 1 0 1 0 1],2) % magnified around the center
%
% See also: axis, BBofSG, BBaddtolerance
%
%
% Copyright 2019-2020 Tim C. Lueth

circ2poly(n,r)- ratio of polygon radius between if turned pi/n radiands

circ2poly(n,r)% circ2poly(n,r) - ratio of polygon radius between if turned pi/n radiands
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-13 as class: ANALYTICAL GEOMETRY)
%
% same as dofn (Status of: 2019-03-13)
%
% Introduced first in SolidGeometry 4.5
%
% See also: dofn, sofrd, phiofsr, nofrd
%
% m=circ2poly(n,[r])
% === INPUT PARAMETERS ===
% n: number of polygon edges/corners
% r: optional radius
% === OUTPUT RESULTS ======
% m: magnification >1
%
% EXAMPLE:
% circ2poly(6)
%
% See also: dofn, sofrd, phiofsr, nofrd
%
%
% Copyright 2019 Tim C. Lueth

PLofPosecouplercurve(PS,aps,npnt,ncur)- returns the path and the matrix list of the pose movement

PLofPosecouplercurve(PS,aps,npnt,ncur)% PLofPosecouplercurve(PS,aps,npnt,ncur) - returns the path and the matrix list of the pose movement
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-09 as class: KINEMATICS AND FRAMES)
%
% This fnctn is important to understand
% 1st: that the coupler curve PL0 is in fact just the position movement
% of the pose but for understanding the movement the HT-List T0 is even
% more important
% 2nd: Although all points on the effector execute exactly the same
% motion/rotation (T0), their relative position to the origin of the pose
% resulted in a changed path, but they all have the same rotational
% motion!
% 3rd: It will be possible to search for two points in the immediate
% neighbourhood (attachment points) for each path of motion, which
% execute a circular path if the transformation matrix is included. Thus
% the corresponding fourbar linkage can also be constructed from a
% movement path.
% (Status of: 2019-03-27)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Posefourbarplotcouplercurve,
% checkfourbar3Poseattachpermutation, FourBarLinkageofCouplercurve,
% Posefourbarselectcouplercurve
%
% [PL0,T0,wcr,TA0,TB0,TA1,TB1]=PLofPosecouplercurve(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 ======
% PL0: Point list of Coupler Points Movement
% T0: Transformation matrix list of Coupler Points Movement
% wcr: angle list of crank returned by invkinplan2
% TA0: Transformation matrix list of joint A0 (only rotation)
% TB0: Transformation matrix list of joint B0 (only rotation)
% TA1: Transformation matrix list of Attachment point A1 (circular
% Movement)
% TB1: Transformation matrix list of Attachment point B1 (circular
% Movement)
%
% EXAMPLE:
% PS=Posesample(7);PS.CPLE = PLsquare([6 4]); checkfourbar3Poseattachpermutation(PS); PS=ans;
% close all; PLofPosecouplercurve(PS,1,'',7);
%
% See also: Posefourbarplotcouplercurve,
% checkfourbar3Poseattachpermutation, FourBarLinkageofCouplercurve,
% Posefourbarselectcouplercurve
%
%
% Copyright 2019 Tim C. Lueth

PLmeancluster(PL,res)- converts a point list into a mean values point list

PLmeancluster(PL,res)% PLmeancluster(PL,res) - converts a point list into a mean values point list
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-08 as class: ANALYTICAL GEOMETRY)
%
% clusters points of a list by a simple grid resolution. In contrast to
% simple using rounddiv, the mean value of the points that belong to the
% same grid point is calculated and replaces the original coordinates of
% the List
% either us iconofCPL or CPLdisteuclidcontur before PLmeancluster (Status
% of: 2019-06-30)
%
% Introduced first in SolidGeometry 4.5
%
% See also: iconofCPL, rounddiv, unique, CPLofdrawing, CPLdisteuclidcontur
%
%
%
% [PLM,ia,ib,PLR]=PLmeancluster(PL,[res])
% === INPUT PARAMETERS ===
% PL: point or verteex list [n x m]
% res: resolution four rounding; default is 0.5 (will be changed in
% future)
% === OUTPUT RESULTS ======
% PLM: Point list with mean values
% ia: index of short list in original list
% ib: index of original list in short list
% PLR: Point list with grid rounded points
%
% EXAMPLE:
% PLmeancluster(rand(1000,2));
% PLmeancluster(rand(1000,2),3);
% [PLM,ia,ib]=PLmeancluster(rand(1000,3)); PLM(ia,:) % returns the shortened PL list
% PLmeancluster(CPLaddauxpoints(CPLsample(29),.3),.3) $ Downsamplint to 0.3
%
%
% See also: iconofCPL, rounddiv, unique, CPLofdrawing, CPLdisteuclidcontur
%
%
%
%
% Copyright 2019 Tim C. Lueth

backspstr(str)- returns a backspace character string to remove the given string

backspstr(str)% backspstr(str) - returns a backspace character string to remove the given string
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-07 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: fprintfvec
%
% bs=backspstr(str)
% === INPUT PARAMETERS ===
% str: string to remove
% === OUTPUT RESULTS ======
% bs: backspaces to remove string
%
% EXAMPLE:
% backspstr('this is a test')
%
% See also: fprintfvec
%
%
% Copyright 2019 Tim C. Lueth

SGofCPLcommandui(CLINE)- Simple commandline based 2.5 solid modeler for the use of a caliper

SGofCPLcommandui(CLINE)% SGofCPLcommandui(CLINE) - Simple commandline based 2.5 solid modeler for the use of a caliper
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-07 as class: PARAMETRIC DESIGN)
%
% First a Contour is designed; afterwards the contour is extruded; and
% set below the already designed existing solid; ATTENTION IF YOU MELT
% THE PARTS AFTERWARDS AVOID edges with same planes
%
% SGofCPLcommands supports the following commands, separated by commas:
% See publishable tutorial VLFL_EXP45.m
%
% === CPL shape commands =================================
% b x-size y-size [d] => Box as rectangle or displace trapaze
% c diameter x-coord y-coord => Cylinder
% cs phi r-outer r-inner offset => Cylinder segment with angle
% co r-outer length r-inner => Cylinder oval segment with optional
% holes
% d diameter x-coord y-coord n-faces => Drilling hole at x/y with n edges
% g diameter teeth-nr x-coord y-coord => Gear
% ms diameter-1 diameter-2 => Motor shaft contour
%
% === CPL manipulation commands =================================
% move x-coord y-coord => Move the CPL relatively
% cp x-coord y-coord => Center point change
% ch distance radius => Convex hull in distance with optional radius
% dupc x-copies y copies distance => Duplicates contour in as x y
% pattern
% dupr radius number offset => Duplicates contour radial in n copies
%
% === CPL stack commands =================================
% enter => current CPL is shifted to the stack
% swap => current CPL is swaped with CPL on stack
% +/add => current CPL is added to stack CPL
% -/sub => current CPL is substracted from stack CPL
% rem => stack CPL ist substracted from current CPL
% xor => current CPL is intersected with stack CPL => avoid creates
% non manifold points/edges
% hs height => stack connection using height
%
% === CPL to solid commands =================================
% h height z-displacement => Height of the extruded solid
% hc height z-displacement => Height of extrusion with smoothed edges
% r angle pitch => Extrusion by rotation (degree) and optional pitch
%
% === SG element commands =================================
% scr mm length diameter => Screw/Cutter/Nut threat of diameter and
% length
% sph diameter end-angle => Sphere
%
% === SG manipulation commands =================================
% move x-coord y-coord => Move the solid relatively
% rotx degree => rotate around the x-axis
% roty degree => rotate around the y-axis
% rotz degree => rotate around the z-axis
% melt => Boolean addition of all solid elements
% text string => Add a string to the largest surface
% dupr number => Duplicates contour radial in n copies
% hollow wall => Creates a hollow solid
% shell wall distance => Creates a shell for the solid
% cutz z1 z2 => Cuts the solid at z1 and z2
%
% === SG save and restore commands =================================
% save name => saves the solid into name.SG
% load name => loads a solid from name.SG
% write name => saves the solid into File name.STL
% read name => reads the solid from File name.STL
%
% === SG stack commands =================================
% enter => current SG is shifted to the stack
% swap => current SG is swaped with SG on stack
% clear nr => Clear stack content 1..n
% +/add => current SG is added to stack SG
% -/sub => current SG is substracted from stack SG
% rem => stack SG is substracted from current SG
% xor => current SG is intersected with stack SG => avoid creates non
% manifold points/edges
% rel command parameter => current SG is move relatively to stack
%
% 2018-11-21 Tim Lueth (implementation) and Yilun Sun (requests)
% discussed the boolean RPN (reverse Polish Notation / Forth) concept
% using stacks
% (Status of: 2019-03-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGofCPLui, SGofCPLz, SGsurfacemeltbool, SGsurfacemeltbool,
% SGofCPLcommand
%
% SG=SGofCPLcommandui([CLINE])
% === INPUT PARAMETERS ===
% CLINE: CPL command string, use '?' for info
% === OUTPUT RESULTS ======
% SG: solid Geometry
%
% EXAMPLE:
% SGofCPLcommand('g 4 21, h 4'); % Gear with diameter 4mm, 21 teeth, height 4 mm
% SGofCPLcommand('g 4 21, h 4, c 3, h 1, move 5 0, b 40 10 ,h 2,b 25 10 , h 20')
% SGofCPLcommand('g 4 21, h 4, c 3, h 1, move 5 0, b 40 10 ,d 2.5 -15 0, d 2.5 +15 0, h 2,b 25 10 , h 20')
% SGofCPLcommand('g 4 21, h 4, c 3, h 1, move 5 0, b 15 8, h 4, b 40 10 ,d 2.5 -15 0, d 2.5 +15 0, h 2,b 25 10 , h 20')
% SGofCPLcommand('g 4 21, h 4, c 3, h 1, move 5 0, b 15 8, hc 4, b 40 10 ,d 2.5 -15 0, d 2.5 +15 0, hc 2,b 25 10 , hc 20')
% SGofCPLcommand('g 5 10, enter, b 10 30 10')
% SGofCPLcommand('g 5 10, enter, b 10 30 10')
% SGofCPLcommand('g 5 10, enter, b 10 30 10, xor, h 4')
%
% See also: SGofCPLui, SGofCPLz, SGsurfacemeltbool, SGsurfacemeltbool,
% SGofCPLcommand
%
%
% Copyright 2019 Tim C. Lueth

keyboardlineeditor(h,CLINE,NLINE,RLINE,CRNUM);- implements a text editor for interactive programming

keyboardlineeditor(h,CLINE,NLINE,RLINE,CRNUM);% keyboardlineeditor(h,CLINE,NLINE,RLINE,CRNUM); - implements a text editor for interactive programming
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-07 as class: USER INTERFACE)
%
% This is a very powerful keyboard input editor. With it you can
% interactively write texts line by line over several lines. You can move
% the cursor within one line or over several lines.
% The fnctn returns its necessary input parameters as output parameters,
% making it possible to restart the editor over and over again.
% The fnctn is used within the SGofCPLcommandui to analyze and draw the
% drawing chain after each space character. (Status of: 2019-03-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: getkeyboardchar, SGofCPLcommandui
%
% [c,LR,CLINE,NLINE,RLINE]=keyboardlineeditor(h,[CLINE,NLINE,RLINE,CRNUM]
% );
% === INPUT PARAMETERS ===
% h: handle to figure the keyboard is attached to
% CLINE: Textbuffer, Text line or empty
% NLINE: Textbuffer behind current line; or empty
% RLINE: Textbuffer, same line but right hand of cursor
% CRNUM: uint8 character list of escape characters; default is 13 (CR)
% === OUTPUT RESULTS ======
% c: last pressed key
% LR: Text row left of cursor
% CLINE: Complete text buffer including current line
% NLINE: Rest of text buffer after current line
% RLINE: Current text line rifht hand of cursor
%
% EXAMPLE:
% SGfigure; h=figure; keyboardlineeditor(h,'just edit this line','','',[13 65]) % 'A' will stop
%
% See also: getkeyboardchar, SGofCPLcommandui
%
%
% Copyright 2019 Tim C. Lueth

getkeyboardchar(bycallbackfnct)- wait for keyboardkey pressed

getkeyboardchar(bycallbackfnct)% getkeyboardchar(bycallbackfnct) - wait for keyboardkey pressed
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-07 as class: USER INTERFACE)
%
% this fnctn implements the two possibilities of getting a keyboardchar
% as uint8 that are supported by Matlab either by
% ginput(1) or
% callback fnctn in gcf
% the callback fnctn is able to return also special keys such as pageup
% or pagedown. in this case the uint8 vector does contain more than one
% element
% CNTRL-C interrupts both fnctns (Status of: 2019-03-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: ginput, getkeyboardcharpause, waitforfigurekeyboardchar
%
% c=getkeyboardchar([bycallbackfnct])
% === INPUT PARAMETERS ===
% bycallbackfnct: if true, a call bakc fnctn is used, if false ginput;
% default is true;
% === OUTPUT RESULTS ======
% c:
%
% EXAMPLE:
% close all; getkeyboardchar(false), char(ans)
% close all; getkeyboardchar(true), char(ans)
%
% See also: ginput, getkeyboardcharpause, waitforfigurekeyboardchar
%
%
% Copyright 2019-2020 Tim C. Lueth

CPLfft(CPL,nf,np)- returns a fourier frequency reduced contour shape

CPLfft(CPL,nf,np)% CPLfft(CPL,nf,np) - returns a fourier frequency reduced contour shape
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-04 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLBezier, CPLremstraightAmin
%
% CPLR=CPLfft(CPL,[nf,np])
% === INPUT PARAMETERS ===
% CPL: Contour
% nf: Number of used frequencies
% np: number of points of the CPL; default is 100;
% === OUTPUT RESULTS ======
% CPLR: Resulting Contour
%
% EXAMPLE:
% CPLfft(CPLsample(6))
% CPLfft(PLtransT(PLsquare(4,3),TofR(rot(10),[30 30])),20);
% CPLremstraightAmin(CPLfft(PLtransT(PLsquare(4,3),TofR(rot(10),[30 30])),20),.01);
%
% See also: CPLBezier, CPLremstraightAmin
%
%
% Copyright 2019 Tim C. Lueth

iconofCPL(CPL,graysc,m,turn)- creates an grayscale image/icon of a contour

iconofCPL(CPL,graysc,m,turn)% iconofCPL(CPL,graysc,m,turn) - creates an grayscale image/icon of a contour
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-04 as class: IMAGES)
%
% This fnctn is useful either for creating icon for the user interface or
% for patter recogniton of hand drawing sketches (Status of: 2019-03-08)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofimage, PLmeancluster, imageoftext, imSetofchars
%
% [I,PL]=iconofCPL(CPL,[graysc,m,turn])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon line
% graysc: true= greyscale; false=binary
% m: size of icon; default is 16
% turn: true == transform tp eigenvectors; default is true
% === OUTPUT RESULTS ======
% I: Image of size [m x m]; maximum intensity [0..1]
% PL: PL optional point list for all values of I==0 (binary)
%
% EXAMPLE:
% iconofCPL(CPLsample(3),'','',false)
% iconofCPL(CPLsample(3),'',21,false)
% iconofCPL(CPLsample(3),true,21,false)
% iconofCPL(CPLsample(3))
%
% See also: CPLofimage, PLmeancluster, imageoftext, imSetofchars
%
%
% Copyright 2019 Tim C. Lueth

CPLofCPS(CPS);- returns a CPL from a CPS or an array of polyshapes

CPLofCPS(CPS);% CPLofCPS(CPS); - returns a CPL from a CPS or an array of polyshapes
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-03 as class: CLOSED POLYGON LISTS)
%
% same as CPLofpolyshape.
% All polyshape fnctns will be replaced by CPS fnctn to support
% (CPL,CPLS, polyshape and polygons) (Status of: 2019-03-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofpolyshape
%
% CPL=CPLofCPS(CPS);
% === INPUT PARAMETERS ===
% CPS): CPS or polyshape
% === OUTPUT RESULTS ======
% CPL: CPL
%
% See also: CPLofpolyshape
%
%
% Copyright 2019 Tim C. Lueth

digitofnum(n,d)- returns the digit at a specific position

digitofnum(n,d)% digitofnum(n,d) - returns the digit at a specific position
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-02 as class: AUXILIARY PROCEDURES)
%
% uses the same rule for digit as rounddiv
% -1= 10^+1
% 0= 10^0
% 1= 10^-1 (Status of: 2019-06-30)
%
% Introduced first in SolidGeometry 4.5
%
% See also: round, numstr2vec, vec2numstr
%
% h=digitofnum(n,d)
% === INPUT PARAMETERS ===
% n: number
% d: digit of number
% === OUTPUT RESULTS ======
% h: digit value
%
% EXAMPLE:
% o=567.891
% digitofnum(o,-2)
% digitofnum(o,+2)
%
% See also: round, numstr2vec, vec2numstr
%
%
% Copyright 2019 Tim C. Lueth

whoisIP (ipstr)- opens a www browser calling a www page for whi is ip address

whoisIP (ipstr)% whoisIP (ipstr) - opens a www browser calling a www page for whi is ip address
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-01 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: whoisPID, whoisTCP, lastlogins, userIP
%
% whoisIP([ipstr])
% === INPUT PARAMETERS ===
% ipstr: ip address
%
% EXAMPLE:
% whoisIP('192.187.200.116')
% [i,e]=userip; whoisIP(e)
%
%
% See also: whoisPID, whoisTCP, lastlogins, userIP
%
%
% Copyright 2019-2020 Tim C. Lueth

Posefourbarselectui(PS,ord)- interactive tool to plot poses and to select two attachment/base points for a fourbar linkage

Posefourbarselectui(PS,ord)% Posefourbarselectui(PS,ord) - interactive tool to plot poses and to select two attachment/base points for a fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-01 as class: KINEMATICS AND FRAMES)
%
% ATTENTION THIS FNCTN IS ABLE TO MODIFY THE POSE STRUCT AS LONG AS THE
% WINDOW IS OPEN!
% The pose struct must contain the following information
% PS.A - Starting Points
% PS.B - End Points
% PS.CPLE = Contour of the effector
%
% THIS FNCTN REMOVES / MODIFIES EXISTING FIELDS: 'A0','B0','A1','B1'
% PS.GPL = Grid Point list inside the effector
% PS.GAP = Grid Point Attachment List created by
% checkfourbar3Poseattachpermutation (Status of: 2019-03-01)
%
% Introduced first in SolidGeometry 4.5
%
% See also: checkfourbar3Poseattachpermutation
%
% PS=Posefourbarselectui(PS,[ord])
% === INPUT PARAMETERS ===
% PS: Posestruct
% ord: Optional required order such as 123
% === OUTPUT RESULTS ======
% PS: New PS.GPL = Grid Point list, PS.GAP = Grid Point Attachment List
%
% EXAMPLE:
% PS=Posesample(7), Posefourbarselectui(PS);
% PS=checkfourbar3Poseattachpermutation(PS,3), Posefourbarselectui(PS);
% PS=checkfourbar3Poseattachpermutation(PS,PLsquare(6,2)), Posefourbarselectui(PS);
% CPL=[PLsquare(6,4);nan nan;PLsquare(3,2)];
% PS=checkfourbar3Poseattachpermutation(PS,CPL,.4,'',true), Posefourbarselectui(PS);
%
% See also: checkfourbar3Poseattachpermutation
%
%
% Copyright 2019 Tim C. Lueth

GPLauxgridpointsCPS(CL,dx,dy)- returns for a given 2D contour point list auxiliary points to define a plane surface

GPLauxgridpointsCPS(CL,dx,dy)% GPLauxgridpointsCPS(CL,dx,dy) - returns for a given 2D contour point list auxiliary points to define a plane surface
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-01 as class: AUXILIARY PROCEDURES)
%
% This fnctn replaces GPLauxgridpointsCL and GPLauxgridpointsPLEL!
% The fnctn is based on a cartesian meshgrid that us reshaped to form a
% new points list. The fnctn uses insideCPS to generate the final index
% list
% 1=inside CPL 0=on CPL -1=Outside CPL (Status of: 2021-12-01)
%
% Introduced first in SolidGeometry 4.5
%
% See also: RLaddauxpoints, RLdelauxpoints, GPLauxgridpointsCL,
% PLELaddauxpoints, GPLauxgridpointsPLEL, GPLauxgridpointsCPS2
%
% [GPL,k,X,Y]=GPLauxgridpointsCPS(CL,dx,[dy])
% === INPUT PARAMETERS ===
% CL: Contour list 2D [x y]
% dx: Maximum auxiliary points in x
% dy: Maximum auxiliary points in y
% === OUTPUT RESULTS ======
% GPL: Grid point list
% k: index whether k is inside or outside; use k=reshape(k,size(X))
% X: X grid used for calucaltion
% Y: Y grid used for calucaltion
%
% EXAMPLE:
% CPL=[PLsquare(6,4);nan nan;PLsquare(3,2)];
% GPLauxgridpointsCPS(CPL,0.5)
%
% See also: RLaddauxpoints, RLdelauxpoints, GPLauxgridpointsCL,
% PLELaddauxpoints, GPLauxgridpointsPLEL, GPLauxgridpointsCPS2
%
%
% Copyright 2019-2021 Tim C. Lueth

insideCPS(CPL,PL);- tests whether a point list is inside of a CPL polyshape or CPS

insideCPS(CPL,PL);% insideCPS(CPL,PL); - tests whether a point list is inside of a CPL polyshape or CPS
% (by Tim Lueth, VLFL-Lib, 2019-MÄR-01 as class: ANALYZING PROCEDURES)
%
% SLOW FNCTN FOR SINGLE POINTS - Use distanceVLtoVLEL to search on
% Contours
% Replaces insideC, insidePLEL, insideinsidePLELdelaunay (which is TL's
% implementation of insideCPS)
% In contrast to insideC, this fnctn supports and uses the polyshape
% concept with several regions and holes: if there is no need for inside
% and on contour use "isinterior" directly
% +1 means point is inside
% -1 means point is outside
% 0 means point is on the contour (Status of: 2020-10-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: distanceVLtoVLEL, insideC, isinterior, insidePLEL,
% insidePLELdelaunay
%
% k=insideCPS(CPL,PL);
% === INPUT PARAMETERS ===
% CPL: Vertex list of the contour
% PL: Point to check
% === OUTPUT RESULTS ======
% k: +1==inside, -1==outside, 0== on the contour
%
% EXAMPLE:
% CPL=[PLsquare(6,4);nan nan;PLsquare(3,2)];
% insideCPS(CPL,[-1 -1; -1 0; -1 1.5; -1 2.5; -1 -2])
% insideCPS(CPL,[-1 -1; -1 0; -1 1.5; -1 2.5; -1 -2]+[-2 0])
%
% See also: distanceVLtoVLEL, insideC, isinterior, insidePLEL,
% insidePLELdelaunay
%
%
% Copyright 2019-2020 Tim C. Lueth

CPLharbour(CPL,inside,d)- returns the inner contour of an area limited by line type areas

CPLharbour(CPL,inside,d)% CPLharbour(CPL,inside,d) - returns the inner contour of an area limited by line type areas
% (by Tim Lueth, VLFL-Lib, 2019-FEB-28 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLfillin, CPLfillinside, CPLfillgap
%
% [CPLN,ps]=CPLharbour(CPL,[inside,d])
% === INPUT PARAMETERS ===
% CPL: CPL or Polyshape
% inside: true = inside; false = outside area
% d: distance to bridge
% === OUTPUT RESULTS ======
% CPLN: CPLN
% ps: polyshape
%
% EXAMPLE:
% CPLharbour(CPLsample(29));
% CPLharbour(CPLsample(29),false);
% CPLharbour(CPLsample(29),false,0);
% CPLharbour(CPLsample(18),false,-1);
%
% See also: CPLconvexhull, CPLconvexhulldelaunay, delaunayofCPL,
% CPLfillin, CPLfillinside, CPLfillgap
%
%
% Copyright 2019-2020 Tim C. Lueth

L1L2RofBasenAttachmentpoints(A0,B0,A1,B1)- returns dimensions from base points and attachment points

L1L2RofBasenAttachmentpoints(A0,B0,A1,B1)% L1L2RofBasenAttachmentpoints(A0,B0,A1,B1) - returns dimensions from base points and attachment points
% (by Tim Lueth, VLFL-Lib, 2019-FEB-27 as class: KINEMATICS AND FRAMES)
%
% It is important to understand that the positions of the base and
% attachment points of the coupler already contain an implicit
% information about the elbow configuration. While the length values for
% l1,l2,r,d can be determined trivially, this does not apply to the elbow
% configuration.
% (Status of: 2019-02-27)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLfourbarlinkage2, fourBarLinkageplotanimui,
% L1L2RofBasenAttachmentpoints
%
%
% [l1,l2,r,eb,d]=L1L2RofBasenAttachmentpoints(A0,B0,A1,B1)
% === INPUT PARAMETERS ===
% A0: Base Point A0
% B0: Base Point B0
% A1: Attachment Point A1
% B1: Attachment Point B1
% === OUTPUT RESULTS ======
% l1: length of swing
% l2: length of coupler
% r: length of crank
% eb: ellbow down (1) or ellbow up(2)
% d: distance between the base points
%
% EXAMPLE:
% L1L2RofBasenAttachmentpoints([0 0;10 0; 4 +5; 9 5]); [l1,l2,r,eb]=L1L2RofBasenAttachmentpoints([0 0;10 0; 4 +5; 9 5])
% L1L2RofBasenAttachmentpoints([0 0;10 0; 4 -5; 9 5]); [l1,l2,r,eb]=L1L2RofBasenAttachmentpoints([0 0;10 0; 4 -5; 9 5])
%
% See also: CPLfourbarlinkage2, fourBarLinkageplotanimui,
% L1L2RofBasenAttachmentpoints
%
%
%
% Copyright 2019 Tim C. Lueth

checkfourbar3Poseattachpermutation(PS,CPLE,GPL,m,exactCPL)- returns only subset of permutations of grid points to achieve a real fourbar linkage solution

checkfourbar3Poseattachpermutation(PS,CPLE,GPL,m,exactCPL)% checkfourbar3Poseattachpermutation(PS,CPLE,GPL,m,exactCPL) - returns only subset of permutations of grid points to achieve a real fourbar linkage solution
% (by Tim Lueth, VLFL-Lib, 2019-FEB-27 as class: KINEMATICS AND FRAMES)
%
% currently slow since not optimized fnctn
% This fnctn can be used without calling center3Poseeffektorgrid before
% since it has almost the same input parameters
% Adds the Fields
% GPL - if not existing already
% GAL - List of Solutions
% A0L - List of crank base point wrt to GAL
% B0L - List of swing base point wrt to GAL
%
% %% CONVERT GAL TO FOURBARS A0 B0 A1 B1 GPLA GPLB
% A0=PS.A0L(k,:); B0=PS.B0L(k,:);
% GPLA=PS.GPL(PS.GAL(k,1),:); GPLB=PS.GPL(PS.GAL(k,2),:);
% T=TofPose(PS); A1=PLtransT(GPLA,T(:,:,1)); B1=PLtransT(GPLB,T(:,:,1));
% (Status of: 2021-12-08)
%
% Introduced first in SolidGeometry 4.5
%
% See also: isincirclesegment, center3Poseeffektorgrid,
% Posefourbarplotcouplercurve, checkfourbar2Poseattachpermutation,
% checkfourbar1Poseattachpermutation, Posetransui
%
% [PS,C,R,P1,P2,P3,ei,mi]=checkfourbar3Poseattachpermutation(PS,[CPLE,GPL
% ,m,exactCPL])
% === INPUT PARAMETERS ===
% PS: Pose; only PS.A and PS.B are used
% CPLE: optional CPLE or size of square
% GPL: Grid point list relative to origin or resolutin
% m: CPLE buffer buffer size or exact CPL
% exactCPL: false==outer boundary; true==exact CPLE; default is false
% === OUTPUT RESULTS ======
% PS: [i j ellbow segment startangle endangle]
% C: Grid point list relative to origin size of GPL
% R: Radius of circle for each grid point size of GPL
% P1: Grid point list relative to pose 1 size of GPL
% P2: Grid point list relative to pose 2 size of GPL
% P3: Grid point list relative to pose 3 size of GPL
% ei: index of Grid points with solution
%
% EXAMPLE:
% PS=Posesample(7); PS.CPLE=PLsquare(6,3);
% [GPL,ki]=GPLauxgridpointsCL(PS.CPLE,0.5,.5); GPL=GPL(ki==1,:);
% checkfourbar3Poseattachpermutation(PS,'',GPL)
% checkfourbar3Poseattachpermutation(Posesample(7))
% checkfourbar3Poseattachpermutation(Posesample(7),4)
% checkfourbar3Poseattachpermutation(Posesample(7),4,5)
%
%
% See also: isincirclesegment, center3Poseeffektorgrid,
% Posefourbarplotcouplercurve, checkfourbar2Poseattachpermutation,
% checkfourbar1Poseattachpermutation, Posetransui
%
%
% Copyright 2019-2021 Tim C. Lueth

exp_2019_02_27_call_by_reference (A)- Experiment to show how to implement call by reference in matlab

exp_2019_02_27_call_by_reference (A)% exp_2019_02_27_call_by_reference (A) - Experiment to show how to implement call by reference in matlab
% (by Tim Lueth, VLFL-Lib, 2019-FEB-27 as class: LANGUAGE PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: assignin, inputname, dbstack, iscalledbycmdline
%
% exp_2019_02_27_call_by_reference(A)
% === INPUT PARAMETERS ===
% A: Input Parameter that will be changed into a string by this fnctn
%
% EXAMPLE:
% A=123; exp_2019_02_27_call_by_reference(A); A
%
% See also: assignin, inputname, dbstack, iscalledbycmdline
%
%
% Copyright 2019 Tim C. Lueth

center3Poseeffektorgrid(A,B,CPLE,GPL,m,exactCPL)- returns the rotations centers for grid points of the effector contour

center3Poseeffektorgrid(A,B,CPLE,GPL,m,exactCPL)% center3Poseeffektorgrid(A,B,CPLE,GPL,m,exactCPL) - returns the rotations centers for grid points of the effector contour
% (by Tim Lueth, VLFL-Lib, 2019-FEB-26 as class: KINEMATICS AND FRAMES)
%
% if called without results it calculates the possible solutions.
% For real fourbar linkage design task,
% it makes more sense to call 'checkfourbar3Poseattachpermutation'
% directly which has almost the same input parameters
% (Status of: 2019-03-02)
%
% Introduced first in SolidGeometry 4.5
%
% See also: center3Pose, center3Poseui, checkfourbar3Poseattachpermutation
%
% [GPL,S,P1,P2,P3]=center3Poseeffektorgrid(A,B,[CPLE,GPL,m,exactCPL])
% === INPUT PARAMETERS ===
% A: Start point or Pose
% B: End Point or Pose
% CPLE: Optional contour or size of squared box
% GPL: number of point (integer) or distance (if not integer)
% m: distance to outer contour; default is 0
% exactCPL: true if no outer boundary but exact CPLE is used
% === OUTPUT RESULTS ======
% GPL: Center Point and Radius
% S: Grid Coordinates relative to CPLE
% P1: Grid Coordinates relative to Pose 1
% P2: Grid Coordinates relative to Pose 2
% P3: Grid Coordinates relative to Pose 3
%
% EXAMPLE:
% fname=loadweb('Posebasecabinet.APD',true); PS=PosereadAPD(fname)
% center3Poseeffektorgrid(PS);
%
% center3Poseeffektorgrid(Posesample(7));
% center3Poseeffektorgrid(Posesample(11));
%
%
% See also: center3Pose, center3Poseui, checkfourbar3Poseattachpermutation
%
%
% Copyright 2019 Tim C. Lueth

KDWofXY(A1,B1,TP)- returns two line distances of points and an angle and a displacement of a straigt line line from two points

KDWofXY(A1,B1,TP)% KDWofXY(A1,B1,TP) - returns two line distances of points and an angle and a displacement of a straigt line line from two points
% (by Tim Lueth, VLFL-Lib, 2019-FEB-26 as class: ANALYTICAL GEOMETRY)
%
% This fnctn calculates wrt to the origin the values of K, D, W from two
% attachment points
% Since the original concept for 3 Pose syntheses of fourbar linkages by
% Tim Lueth was based on poses, and attachment point were introduced
% later, it was necessary to convert the concept of pose shift/
% displacement to the concept of attachment points (Status of: 2021-12-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: KDWPosevariation, KDWofPoseattachments,
% TofPoseattachmentpoints, B1ofA1
%
% [K,D,W]=KDWofXY(A1,B1,[TP])
% === INPUT PARAMETERS ===
% A1: Point of attachment point A1 wrt to origin
% B1: Point of attachment point B1 wrt to origin
% TP: Optional Pose Coordinate System wrt to Origin; default is origin;
% eye(4);
% === OUTPUT RESULTS ======
% K: distance of A1 and B1 along the origin of a straight line
% D: displacement of the line wrt to the origin
% W: turning angle of the line relative to x-axis
%
% EXAMPLE:
% KDWofXY([1 0],[0 1]); [K,D,W]=KDWofXY([1 0],[0 1])
% KDWofXY([0 1],[1 0]); [K,D,W]=KDWofXY([0 1],[1 0])
% KDWofXY([1 0],[0 1],TofR(rot(pi/2),[0 0]))
%
%
% See also: KDWPosevariation, KDWofPoseattachments,
% TofPoseattachmentpoints, B1ofA1
%
%
% Copyright 2019-2021 Tim C. Lueth

stripfields(S,Fieldnames)- removes a list of fields from a struct

stripfields(S,Fieldnames)% stripfields(S,Fieldnames) - removes a list of fields from a struct
% (by Tim Lueth, VLFL-Lib, 2019-FEB-25 as class: LANGUAGE PROCEDURES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: retainfields, rmfield, isfield
%
% S=stripfields(S,[Fieldnames])
% === INPUT PARAMETERS ===
% S: struct
% Fieldnames: 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: retainfields, rmfield, isfield
%
%
% Copyright 2019 Tim C. Lueth

KDWofPoseattachments(A,B,A1,B1)- returns the values for K, D, and W for given attachment points

KDWofPoseattachments(A,B,A1,B1)% KDWofPoseattachments(A,B,A1,B1) - returns the values for K, D, and W for given attachment points
% (by Tim Lueth, VLFL-Lib, 2019-FEB-24 as class: KINEMATICS AND FRAMES)
%
% PS.A1 has the format (x y Pose#)
% PS.B1 has the format (x y Pose#)
% (Status of: 2021-12-04)
%
% Introduced first in SolidGeometry 4.5
%
% See also: KDWPosevariation, KDWofXY, TofPoseattachmentpoints, B1ofA1
%
% [K,D,W,err]=KDWofPoseattachments([A,B,A1,B1])
% === INPUT PARAMETERS ===
% A: Pose including PS.A, PS.B, PS.A1, PS.B1
% B: optional Pose Values for End Points
% A1: Attachment Point for A1 [X Y Pose#]
% B1: Attachment Point for B1 [X Y Pose#]
% === OUTPUT RESULTS ======
% K: [ka kb] on pose line as values relativ distance to pose starting
% point
% D: displacement parallel to pose orientation
% W: turning angle BEFORE displacement realtive to origin
% err: error value
%
% EXAMPLE:
% PS=Posesample(7); PS.A1=[0 1 1]; PS.B1=[2 1 1];
% KDWofPoseattachments(PS); [K,D,W,err]=KDWofPoseattachments(PS)
%
%
% See also: KDWPosevariation, KDWofXY, TofPoseattachmentpoints, B1ofA1
%
%
% Copyright 2019-2021 Tim C. Lueth

fourBarLinkageanimate(A0,B0,A1,B1,TP,CPLE)- animates a fourbarlinkage based on 4 Points, a Frame, and a Contour

fourBarLinkageanimate(A0,B0,A1,B1,TP,CPLE)% fourBarLinkageanimate(A0,B0,A1,B1,TP,CPLE) - animates a fourbarlinkage based on 4 Points, a Frame, and a Contour
% (by Tim Lueth, VLFL-Lib, 2019-FEB-23 as class: KINEMATICS AND FRAMES)
%
% new programmed for SG-Lib 5.1. In contrast to fourBarLinkageplotanim
% this fnctn works with A0, B0, A1, B1, and an optinal frame and CPLE
% (Status of: 2021-12-15)
%
% Introduced first in SolidGeometry 4.5
%
% See also: fourBarplotPoints, CPLfourbarcontour, CPLofA1B1P,
% fourBarLinkageplotanim, fourBarLinkageplotanimui
%
% h=fourBarLinkageanimate(A0,B0,A1,B1,[TP,CPLE])
% === INPUT PARAMETERS ===
% A0: Base Point A0 on ground link; or CPL [A0;B0;B1;A1]
% B0: Base Point B0 on ground link
% A1: Attachment Point A1 crank-coupler
% B1: Attachment Point B1 follower-coupler
% TP: Frame of Pose
% CPLE: Contour relative to Pose
% === OUTPUT RESULTS ======
% h: handle to graphics objects
%
% EXAMPLE:
% SGfigure; fourBarLinkageanimate([0 0],[ 100 0], [-100 100], [200 100])
% fourBarLinkageanimate([0 0],[ 100 0], [-100 100], [200 100],TofP([50 150]));
% SGfigure; fourBarLinkageanimate([0 0],[ 100 0], [-100 100], [200 100],TofR(rot(pi/10),[50 150]));
% SGfigure; fourBarLinkageanimate([0 0],[ 100 0], [0 100], [101 100],TofR(rot(pi/10),[50 150]));
% SGfigure; fourBarLinkageanimate([6 79],[2 130],[17 64], [60 134],[17 64-35]); % Mercader
%
% See also: fourBarplotPoints, CPLfourbarcontour, CPLofA1B1P,
% fourBarLinkageplotanim, fourBarLinkageplotanimui
%
%
% Copyright 2019-2022 Tim C. Lueth

mirroringatline(P1,ev,p)- mirrors a point at a straight line in 2D

mirroringatline(P1,ev,p)% mirroringatline(P1,ev,p) - mirrors a point at a straight line in 2D
% (by Tim Lueth, VLFL-Lib, 2019-FEB-22 as class: ANALYTICAL GEOMETRY)
%
% Should be renamed into PLmirroratline (Status of: 2019-03-16)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLcross2Lines, PLcrossCPLline, mirroringatline3D,
% mirroringatline2D
%
% [mp,do,cp,ov]=mirroringatline(P1,ev,p)
% === INPUT PARAMETERS ===
% P1: Point on line
% ev: direction vector
% p: point to mirror
% === OUTPUT RESULTS ======
% mp: mirror point
% do: distance to straight line (wrt to ev)
% cp: crossing point on line
% ov: orthogonal vector to straight line from p to cp
%
% EXAMPLE:
% mirroringatline([0 0],+[-1 -6],[1 1])
%
% See also: PLcross2Lines, PLcrossCPLline, mirroringatline3D,
% mirroringatline2D
%
%
% Copyright 2019 Tim C. Lueth

poletriangle3Pose(A,B)- calculates the edges of the pole triangle of three poses

poletriangle3Pose(A,B)% poletriangle3Pose(A,B) - calculates the edges of the pole triangle of three poses
% (by Tim Lueth, VLFL-Lib, 2019-FEB-22 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: center3Pose
%
% [PL,A123,A0,R]=poletriangle3Pose(A,B)
% === INPUT PARAMETERS ===
% A: Point List for A; or Pose struct
% B: Point List for B if A is not pose struct
% === OUTPUT RESULTS ======
% PL: Point List [P12;P23;P31]
% A123: Zero Point
% A0: Center of A0
% R: Radius (Distance A1-A0, A2-A0, A3-A0)
%
% EXAMPLE:
% poletriangle3Pose(Posesample(7))
% PS=Posesample(7); poletriangle3Pose(PS.A,PS.B)
%
% See also: center3Pose
%
%
% Copyright 2019 Tim C. Lueth

pastego (h,hgca)- inserts graphics objects into the current axis gca

pastego (h,hgca)% pastego (h,hgca) - inserts graphics objects into the current axis gca
% (by Tim Lueth, VLFL-Lib, 2019-FEB-22 as class: USER INTERFACE)
%
% copy and paste for graphics objects by introducing a figure CLIPBOARD
% (Status of: 2021-12-05)
%
% Introduced first in SolidGeometry 4.5
%
% See also: findobj, copyobj, copygo, copyfig, snapplot, PRplot,
% copyplot, snapnow, drawnow, smbdrawnow, pushgcf, popgcf
%
% pastego([h,hgca])
% === INPUT PARAMETERS ===
% h: object handles to insert
% hgca: axis to insert and list of tyes
%
% EXAMPLE:
% figure(111); cla; CPLplotasPS(PLcircle(10)); CPLplot(PLcircle(20),'b-'); textVL(PLcircle(15)); SGplot(SGbox(5));
% h=copygo('line','text')
% figure(111); h=copygo('line','text')
% figure(123); cla; pastego(h);
%
%
% See also: findobj, copyobj, copygo, copyfig, snapplot, PRplot,
% copyplot, snapnow, drawnow, smbdrawnow, pushgcf, popgcf
%
%
% Copyright 2019-2021 Tim C. Lueth

copygo(ca)- copies graphics objects of a type list from an axis similar to findobj and copyobj

copygo(ca)% copygo(ca) - copies graphics objects of a type list from an axis similar to findobj and copyobj
% (by Tim Lueth, VLFL-Lib, 2019-FEB-22 as class: USER INTERFACE)
%
% copy and paste for graphics objects by introducing a figure CLIPBOARD
% (Status of: 2021-12-05)
%
% Introduced first in SolidGeometry 4.5
%
% See also: findobj, copyobj, pastego, copyfig, snapplot, PRplot,
% copyplot, snapnow, drawnow, smbdrawnow, pushgcf, popgcf
%
% h=copygo([ca])
% === INPUT PARAMETERS ===
% ca: axis to copy from
% === OUTPUT RESULTS ======
% h: handle to graphics objects
%
% EXAMPLE:
% figure(111); cla; CPLplotasPS(PLcircle(10)); CPLplot(PLcircle(20),'b-'); textVL(PLcircle(15)); SGplot(SGbox(5));
% h=copygo('line','text')
% figure(111); h=copygo('line','text')
% figure(123); cla; pastego(h);
%
%
% See also: findobj, copyobj, pastego, copyfig, snapplot, PRplot,
% copyplot, snapnow, drawnow, smbdrawnow, pushgcf, popgcf
%
%
% Copyright 2019-2021 Tim C. Lueth

KDWPoseinsideCPL(CPL,d,m)- creates a grid point list and the values for KDW

KDWPoseinsideCPL(CPL,d,m)% KDWPoseinsideCPL(CPL,d,m) - creates a grid point list and the values for KDW
% (by Tim Lueth, VLFL-Lib, 2019-FEB-21 as class: KINEMATICS AND FRAMES)
%
% may be better use checkfourbar3Poseattachpermutation directly
% very slow fnctn (Status of: 2019-02-22)
%
% Introduced first in SolidGeometry 4.5
%
% See also: KDWPosevariation
%
% [KDW,GPL]=KDWPoseinsideCPL(CPL,[d,m])
% === INPUT PARAMETERS ===
% CPL: Effektor Contour of a Pose
% d: distance between the grid points; default is s/20
% m: either buffer around CPL or explicit contour for grid area
% === OUTPUT RESULTS ======
% KDW: [K D W] for GPL
% GPL: GPL inside contour
%
% EXAMPLE:
% fname=loadweb('Posebasecabinet.APD',true); PS=PosereadAPD(fname)
% KDWPoseinsideCPL(PS,10)
%
% See also: KDWPosevariation
%
%
% Copyright 2019 Tim C. Lueth

Poseplotspace(PS);- plot the different contours of a pose in different colors

Poseplotspace(PS);% Poseplotspace(PS); - plot the different contours of a pose in different colors
% (by Tim Lueth, VLFL-Lib, 2019-FEB-20 as class: KINEMATICS AND FRAMES)
%
% CPLM - BLUE Mounting Area for base points in
% CPLB - BLACK - Background contours to understand the szene
% CPLW - RED - Work Space or Prohibited Area depending (Status of:
% 2019-02-20)
%
% Introduced first in SolidGeometry 4.5
%
% See also: Poseplot, Poseui, Poseofimageui
%
% h=Poseplotspace(PS);
% === INPUT PARAMETERS ===
% PS): Pose struct containing CPLM, CPLW, CPLB
% === OUTPUT RESULTS ======
% h: handle to graphics objects
%
% EXAMPLE: loadweb ('Posebasecabinet.mat')
% SGfigure; Poseplotspace(PS);
% SGfigure; Poseplotspace(PS); Poseplot(PS);
%
% See also: Poseplot, Poseui, Poseofimageui
%
%
% Copyright 2019 Tim C. Lueth

elem2cols(elem)- converts elements of a list into an array

elem2cols(elem)% elem2cols(elem) - converts elements of a list into an array
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: AUXILIARY PROCEDURES)
%
% =======================================================================
% OBSOLETE (2022-04-30) - USE 'array2cell' INSTEAD
% =======================================================================
%
% check also array2cell(a.folder)
% Some fnctns such as 'findobj' return a cell list of objects as
% separated results. Accessing structured properties/methods of those
% objects is possible by
% a) using the "get command' which returns a cell list for instance
% "get(h,'Shape')"
% b) use the property name directly similar to a struct, or instance
% "h.Shape"
% In the second case (b) the property methods is called repeated times
% for each element of the object list which returns several individual
% results.
% This fnctn converts the results list into an array of the same class
% type
% (Status of: 2022-04-30)
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ array2cell ] ; squeeze, elem2rows, get, elem2array,
% arrayof, cell2class, class2cell, array2cell
%
% vec=elem2cols([elem])
% === INPUT PARAMETERS ===
% elem: results list of several elements
% === OUTPUT RESULTS ======
% vec: array of same type as elem{1} filled with elem{:}
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); h=findobj(gca,'type','polygon')
% h.Shape % creates 4 results
% get(h,'Shape') % creates a cell list with 4 entries
% elem2cols(h.Shape) % converts the 4 results in an class type array with 4 elements
%
% See also: [ array2cell ] ; squeeze, elem2rows, get, elem2array,
% arrayof, cell2class, class2cell, array2cell
%
%
% Copyright 2019-2022 Tim C. Lueth

elem2rows(elem)- converts elements of a list into an array

elem2rows(elem)% elem2rows(elem) - converts elements of a list into an array
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: AUXILIARY PROCEDURES)
%
% =======================================================================
% OBSOLETE (2022-04-30) - USE 'array2cell' INSTEAD
% =======================================================================
%
% check also array2cell(a.folder)
% Some fnctns such as 'findobj' return a cell list of objects as
% separated results. Accessing structured properties/methods of those
% objects is possible by
% a) using the "get command' which returns a cell list for instance
% "get(h,'Shape')"
% b) use the property name directly similar to a struct, or instance
% "h.Shape"
% In the second case (b) the property methods is called repeated times
% for each element of the object list which returns several individual
% results.
% This fnctn converts the results list into an array of the same class
% type
% (Status of: 2022-04-30)
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ array2cell ] ; squeeze, elem2cols, get, elem2array,
% arrayof, cell2class, class2cell, array2cell
%
% vec=elem2rows([elem])
% === INPUT PARAMETERS ===
% elem: results list of several elements
% === OUTPUT RESULTS ======
% vec: array of same type as elem{1} filled with elem{:}
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); h=findobj(gca,'type','polygon')
% h.Shape % creates 4 results
% get(h,'Shape') % creates a cell list with 4 entries
% elem2array(h.Shape) % converts the 4 results in an class type array with 4 elements
% cell2class(get(h,'Shape')) % returns the same result as elem2arry from the get result
%
% See also: [ array2cell ] ; squeeze, elem2cols, get, elem2array,
% arrayof, cell2class, class2cell, array2cell
%
%
% Copyright 2019-2022 Tim C. Lueth

diffangle2D(NL1,NL2,normfirst)- returns the angle between two vectors including sign

diffangle2D(NL1,NL2,normfirst)% diffangle2D(NL1,NL2,normfirst) - returns the angle between two vectors including sign
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: ANALYTICAL GEOMETRY)
%
% =======================================================================
% OBSOLETE (2019-02-25) - USE 'acos2' INSTEAD
% =======================================================================
%
% may be not the first implementation
% exactly the same as acos2 (Status of: 2019-02-24)
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ acos2 ] ; diffangle
%
% [w,a]=diffangle2D(NL1,NL2,[normfirst])
% === INPUT PARAMETERS ===
% NL1: Vector list 1
% NL2: Vector list 1
% normfirst: default is true;
% === OUTPUT RESULTS ======
% w: result from -pi .. + pi
% a: area between both vectors
%
% EXAMPLE:
% a1=acos([0 1]*[1 0]'), a2=acos([1 0]*[0 01]'), diffangle2D([0 1],[1 0]), diffangle2D([1 0],[0 1])
% tic; diffangle2D(rand(10,2),rand(10,2)), toc
%
% See also: [ acos2 ] ; diffangle
%
%
% Copyright 2019 Tim C. Lueth

acos2(NL1,NL2,normfirst)- 2D fnct: returns the angle between two vectors including sign

acos2(NL1,NL2,normfirst)% acos2(NL1,NL2,normfirst) - 2D fnct: returns the angle between two vectors including sign
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: ANALYTICAL GEOMETRY)
%
% may be not the first implementation - works only in 2D
% Similar to atan2, this fnctn returns angles between -pi .. + pi
% in contrast to acos, acos2 return for two vectors or vector list with 2
% Coordinates
% the angle difference but uses a sign to show right hand (pos) or left
% hand (neg) (Status of: 2019-02-25)
%
% Introduced first in SolidGeometry 4.5
%
% See also: diffangle
%
% [w,a]=acos2(NL1,NL2,[normfirst])
% === INPUT PARAMETERS ===
% NL1: Vector list 1
% NL2: Vector list 1
% normfirst: default is true;
% === OUTPUT RESULTS ======
% w: result from -pi .. + pi
% a: area between both vectors
%
% EXAMPLE:
% a1=acos([0 1]*[1 0]'), a2=acos([1 0]*[0 01]'), acos2([0 1],[1 0]), acos2([1 0],[0 1])
% tic; acos2(rand(10,2),rand(10,2)), toc
%
% See also: diffangle
%
%
% Copyright 2019-2020 Tim C. Lueth

select2d(styp)- interactive drawing of a square and return of the overlapping elements

select2d(styp)% select2d(styp) - interactive drawing of a square and return of the overlapping elements
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: USER INTERFACE)
%
% It is an advanced version of PLsquareui
% (Status of: 2019-02-16)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLsquareui, select3d
%
% [CPL,hpol,hsel]=select2d([styp])
% === INPUT PARAMETERS ===
% styp: 'polygon' or 'line'
% === OUTPUT RESULTS ======
% CPL: CPL of the square
% hpol: handle to overlapped and selected polygons
% hsel: handle to overlapped and selected lines
%
% EXAMPLE: SGfigure; CPLplot(CPLsample(29),'b-'); CPLplot(CPLsample(10),'g-'); CPSplot(PLcircle(4)); CPSplot(PLcircle(4)+[25 0],'b');
% [a,b,c]=select2d('line'); pause(1); set(c,'Selected','off');
% [a,b,c]=select2d('poly'); pause(1); set(b,'Selected','off');
%
% See also: PLsquareui, select3d
%
%
% Copyright 2019 Tim C. Lueth

CPSofgcalines(h,si)- converts all or selected lines graphcis objects into CPS structs using a line thickness

CPSofgcalines(h,si)% CPSofgcalines(h,si) - converts all or selected lines graphcis objects into CPS structs using a line thickness
% (by Tim Lueth, VLFL-Lib, 2019-FEB-16 as class: CLOSED POLYGON LISTS)
%
% Supports points, open lines and closed lines (Status of: 2019-02-16)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPSofgca, CCPSofgcalines, PLplot, CPLplot
%
% CPS=CPSofgcalines([h,si])
% === INPUT PARAMETERS ===
% h: handle or gca
% si: optional line thickness in mm such as 0.35, 0.5, .7mm
% === OUTPUT RESULTS ======
% CPS: CPS struct with an array of ps
%
% EXAMPLE:
% close all;
% SGfigure; for i=1:10; PLplot(rand(1,2)*10); end; CPLplot(PLcircle(10),'b-'); PLplot(PLcircle(5),'g-');
% CPSofgcalines
% CPSofgcalines(.3)
%
% See also: CPSofgca, CCPSofgcalines, PLplot, CPLplot
%
%
% Copyright 2019 Tim C. Lueth

PLsquareui()- allows to draw interactively a square in the current graphics area

PLsquareui()% PLsquareui() - allows to draw interactively a square in the current graphics area
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 4.5
%
% See also: select3D, select2D, VLui, CPSlineui, CPLui, CPSui, PLui,
% PLcircleui, VLFLui, SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
% CPL=PLsquareui([])
% === OUTPUT RESULTS ======
% CPL: PL of a square
%
% EXAMPLE:
% SGfigure; CPSplot(CPLsample(29)); PL=PLsquareui; CPLplot(PL,'r--',2);
%
% See also: select3D, select2D, VLui, CPSlineui, CPLui, CPSui, PLui,
% PLcircleui, VLFLui, SGui, CPLsplitui, Poseofimageui, Poseui, SGTui
%
%
% Copyright 2019 Tim C. Lueth

textCPS(CPS,c,s,nt,lb)- writes text descriptors to CLPS

textCPS(CPS,c,s,nt,lb)% textCPS(CPS,c,s,nt,lb) - writes text descriptors to CLPS
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: VISUALIZATION)
%
% Introduced first in SolidGeometry 4.5
%
% See also: textT, textP, textVL, textCVL, textVLFL, VLFLfaceNormalplot,
% textVL
%
% h=textCPS(CPS,[c,s,nt,lb])
% === INPUT PARAMETERS ===
% CPS: CPS
% c: color
% s: size
% nt: selector
% lb: text
% === OUTPUT RESULTS ======
% h: handle to text
%
% EXAMPLE:
% SGfigure; CPSplot(CPLsample(29)); CPS=CPSofgca; textCPS(CPS)
%
% See also: textT, textP, textVL, textCVL, textVLFL, VLFLfaceNormalplot,
% textVL
%
%
% Copyright 2019 Tim C. Lueth

fprintfvec (fh,X,fs)- auxiliary fnct for writing ALL vector elements in ONE SINGLE row!

fprintfvec (fh,X,fs)% fprintfvec (fh,X,fs) - auxiliary fnct for writing ALL vector elements in ONE SINGLE row!
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: FILE HANDLING)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PosewriteAPD, fprintfvec2, str2codelines, sprintfvec
%
% fprintfvec([fh,X,fs])
% === INPUT PARAMETERS ===
% fh: file handle
% X: vector
% fs: num format; default is '%d'
%
% EXAMPLE:
% fprintfvec(1,[ 1 2 3 4 5 6 7 8; 1 2 3 4 5 6 7 8]*pi,'%.2f')
% fprintfvec(1,[ 1 2 3 4 5 6 7 8; 1 2 3 4 5 6 7 8]*pi,'%d')
%
% See also: PosewriteAPD, fprintfvec2, str2codelines, sprintfvec
%
%
% Copyright 2019-2020 Tim C. Lueth

PosereadAPD(fname)- reads in a pose struct for syntheses tasks

PosereadAPD(fname)% PosereadAPD(fname) - reads in a pose struct for syntheses tasks
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: expname, Posesample, PosewriteAPD
%
% [PS,fname]=PosereadAPD([fname])
% === INPUT PARAMETERS ===
% fname: file name for read
% === OUTPUT RESULTS ======
% PS: struct with poses content
% fname: full file name used
%
% EXAMPLE:
% PS=Posesample(10)
% PosewriteAPD(PS); clear PS
% PS=PosereadAPD
%
%
% See also: expname, Posesample, PosewriteAPD
%
%
% Copyright 2019 Tim C. Lueth

PosewriteAPD(PS,fname)- writes a pose struct as ascii text file

PosewriteAPD(PS,fname)% PosewriteAPD(PS,fname) - writes a pose struct as ascii text file
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: expname, Posesample, PosereadAPD
%
% [fullname]=PosewriteAPD(PS,[fname])
% === INPUT PARAMETERS ===
% PS: Pose
% fname: filename default is expname
% === OUTPUT RESULTS ======
% [fullname]: full file name for read
%
% EXAMPLE:
% PS=Posesample(10)
% PosewriteAPD(PS); uiopen(desktopdir([expname '.APD']),1);
%
% See also: expname, Posesample, PosereadAPD
%
%
% Copyright 2019 Tim C. Lueth

CPSdiffarea(CPLA,CPLB)- return the norm difference between two polyshape areas by xor

CPSdiffarea(CPLA,CPLB)% CPSdiffarea(CPLA,CPLB) - return the norm difference between two polyshape areas by xor
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: CLOSED POLYGON LISTS)
%
% To analyze which ideal geometry fits best in CPLidealshape, CPSdiffarea
% is used to calulate the difference of the areas (Status of: 2019-02-15)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLidealshape
%
% a=CPSdiffarea(CPLA,CPLB)
% === INPUT PARAMETERS ===
% CPLA: Closed Polygon or Polyshape A
% CPLB: Closed Polygon or Polyshape B
% === OUTPUT RESULTS ======
% a: resulting area
%
% See also: CPLidealshape
%
%
% Copyright 2019 Tim C. Lueth

CPSremovearea(CPS,sline)- removes CPS/polyshape regions of small area

CPSremovearea(CPS,sline)% CPSremovearea(CPS,sline) - removes CPS/polyshape regions of small area
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLremstraightAmin, CPLremstraight, CPLremovearea,
% imofimsketch
%
% [CPSN,CPRA]=CPSremovearea(CPS,[sline])
% === INPUT PARAMETERS ===
% CPS: Original CPS/polyhsape
% sline: minimal length (not area)
% === OUTPUT RESULTS ======
% CPSN: remaining polyshapes
% CPRA: Removed polyshapes
%
% EXAMPLE:
% I=imofimsketch(imreadlastchanged); CPS=polyshape(CPLofimage(I)); cla; plot(CPS)
% CPSremovearea(CPS)
%
% See also: CPLremstraightAmin, CPLremstraight, CPLremovearea,
% imofimsketch
%
%
% Copyright 2019 Tim C. Lueth

CPSofpolygon(h)- returns a struct called Colored PolyShape (CPS) similar to a polygon array object

CPSofpolygon(h)% CPSofpolygon(h) - returns a struct called Colored PolyShape (CPS) similar to a polygon array object
% (by Tim Lueth, VLFL-Lib, 2019-FEB-15 as class: CLOSED POLYGON LISTS)
%
% Matlab introduced new classes polygon as graphics object and polyshape
% as geometric object.
% Nevertheless, SG-Lib usees either CPL, polyshapes or colored polyshapes
% that consist
% ps polyshape array
% fc facecolor array
% fa facealpha array
% ec edgecolor array
% similar to poygon (Status of: 2019-02-16)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLplotasPS, CPSofgca
%
% CPS=CPSofpolygon(h)
% === INPUT PARAMETERS ===
% h: handle to polygon
% === OUTPUT RESULTS ======
% CPS: struct with ps, fc, fa, ec
%
%
% EXAMPLE:
% SGfigure; CPLplotasPS(PLcircle(10),'','FaceColor','g','FaceAlpha',1);
% shg; CPSofgca
%
% See also: CPLplotasPS, CPSofgca
%
%
% Copyright 2019 Tim C. Lueth

fourBarLinkageplotanimui(l1,l2,r,A0,tmove,elup,transl,ka)- plots and animates the movement interactively of a fourbar linkage

fourBarLinkageplotanimui(l1,l2,r,A0,tmove,elup,transl,ka)% fourBarLinkageplotanimui(l1,l2,r,A0,tmove,elup,transl,ka) - plots and animates the movement interactively of a fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-FEB-14 as class: VISUALIZATION)
%
% THERE ARE MORE THAN 8 PARAMETER!
% 9th parameter is CPLE Effector Contour, CPLE must be in TPA1B1
% 10th parameter 'angle' is an optional with [wmin wmax]
% Important fnctn for simulating the movement of forbarlinkages.There is
% a ninth parameter, the CPL-shape of the tool attached to the coupler
% position at [ka w d]. By default this CPL is a L-shaped ccordinate
% system.
% (Status of: 2021-12-05)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLfourbarlinkage, fourBarLinkageplotanim,
% fourBarLinkageplot, CPLfourbarlinkage2
%
% h=fourBarLinkageplotanimui([l1,l2,r,A0,tmove,elup,transl,ka])
% === INPUT PARAMETERS ===
% l1: length of link1 at Base B0
% l2: length of link2 / coupler
% r: radius of crank at Base A0
% A0: distance, A0-B0, Position of A0 or List [A0;B0]
% tmove: time to animate; default is 2 sec
% elup: elbow up (true) elbow down (false); default is false;
% transl: transparancey for swept volume (0..1); default is 0;
% ka: either ka or[ka w] or [ka w disp]
% === PROPERTY NAMES =====
% 'alpha' : optional angle limitation [wmin wmax]
% === OUTPUT RESULTS ======
% h: handle to last graphics objects
%
% EXAMPLE:
% axis([-100 100 -100 100]); h=fourBarLinkageplotanim (50,70,50,[30 30; 35 35],10,true); shg
% axis([-100 100 -100 100]); h=fourBarLinkageplotanim (50,70,50,[30 30; 35 35],10,false); shg
% SGfigure; fourBarLinkageplotanimui(70,40,40,[0 0; 0 110]);
%
% See also: CPLfourbarlinkage, fourBarLinkageplotanim,
% fourBarLinkageplot, CPLfourbarlinkage2
%
%
% Copyright 2019-2021 Tim C. Lueth

updategco(h,PL)- updates an graphics object with new coordiantes

updategco(h,PL)% updategco(h,PL) - updates an graphics object with new coordiantes
% (by Tim Lueth, VLFL-Lib, 2019-FEB-14 as class: VISUALIZATION)
%
% used in fourBarLinkageplotanimui (Status of: 2019-02-15)
%
% Introduced first in SolidGeometry 4.5
%
% See also: fourBarLinkageplotanimui
%
% updategco([h,PL])
% === INPUT PARAMETERS ===
% h: handle to graphics object
% PL: new point list
%
% EXAMPLE:
% SGfigure; h=PLplot(PLcircle(10),'b--',4); updategco(h,PLsquare(4,5));
%
% See also: fourBarLinkageplotanimui
%
%
% Copyright 2019 Tim C. Lueth

PLplotlineseg(PL,s,c,w,vec,a)- plots a line using PLplot in distance separated segments

PLplotlineseg(PL,s,c,w,vec,a)% PLplotlineseg(PL,s,c,w,vec,a) - plots a line using PLplot in distance separated segments
% (by Tim Lueth, VLFL-Lib, 2019-FEB-13 as class: USER INTERFACE)
%
% used to plot lines with poles in infitity (Status of: 2019-02-13)
%
% Introduced first in SolidGeometry 4.5
%
% See also: VLELplots, CPLplot, PLplot, VLplot
%
% h=PLplotlineseg(PL,[s,c,w,vec,a])
% === INPUT PARAMETERS ===
% PL: Point list
% s: segment number or distances
% c: color
% w: line
% vec: vector tip size
% a: transparancy; default is 0;
% === OUTPUT RESULTS ======
% h: handle
%
% EXAMPLE:
% cla; PLplotlineseg(PL,2,'r*-'); axis tight
% a=0:.1:4*pi; PL=[a' sin(a')]; SGfigure; PLplot(PL,'r.-'); PLplotlineseg(PL+[0 2],3,'b.-',2);shg
% a=0:.1:4*pi; PL=[a' tan(a')]; SGfigure; PLplot(PL,'r.-'); PLplotlineseg(PL+[0 2],3,'b.-',2); axis([0 4*pi -10 10]); drawnow;
% a=0:.01:4*pi; PL=[a' tan(a')]; figure;; PLplotlineseg(PL+[0 2],40.1,'b.-',2); drawnow; view(0,90);
%
% See also: VLELplots, CPLplot, PLplot, VLplot
%
%
% Copyright 2019 Tim C. Lueth

KDWPosevariation(PS,nk,nd,dw)- returns three variant lists for center3Pose as a first recommendation

KDWPosevariation(PS,nk,nd,dw)% KDWPosevariation(PS,nk,nd,dw) - returns three variant lists for center3Pose as a first recommendation
% (by Tim Lueth, VLFL-Lib, 2019-FEB-13 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: center3Pose
%
% [K,D,W]=KDWPosevariation(PS,[nk,nd,dw])
% === INPUT PARAMETERS ===
% PS: Pose to be searched using center3Pose
% nk: number if k variants; default is
% nd: number of d variants; default is 5
% dw: degree resolution ; default is 15
% === OUTPUT RESULTS ======
% K: List for k values; default are 40.
% D: List for d values; default are 5
% W: List for values; ; default are 24 for 15 degree
%
% EXAMPLE:
% PS=Posesample(7);
% [K,D,W]=KDWPosevariation(PS); center3Pose(PS.A,PS.B,K,D,W);S=ans; whos S
% hideingca('text'); hideingca('polygon');
%
% See also: center3Pose
%
%
% Copyright 2019 Tim C. Lueth

hideingca(gotype,hide);- simply hide (set visibiliy to off) or delete graphics objects of a specific type

hideingca(gotype,hide);% hideingca(gotype,hide); - simply hide (set visibiliy to off) or delete graphics objects of a specific type
% (by Tim Lueth, Video-Lib, 2019-FEB-13 as class: USER INTERFACE)
%
% used in SGfigure since SG 4.5 to toogle the view of patches, lines,
% text and polygons (Status of: 2019-02-13)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGfigure, findingca
%
% h=hideingca(gotype,[hide]);
% === INPUT PARAMETERS ===
% gotype: type such as 'line', 'text','polygon' etc.
% hide: 'hide', 'delete', 'clear' 'invisible', visible' 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));
%
% See also: SGfigure, findingca
%
%
% Copyright 2019 Tim C. Lueth

BBofCPS(CPS)- returns the bounding box for a polyshape or CPS

BBofCPS(CPS)% BBofCPS(CPS) - returns the bounding box for a polyshape or CPS
% (by Tim Lueth, VLFL-Lib, 2019-FEB-12 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPL, BBofPS, BBofSGcutT
%
% bb=BBofCPS(CPS)
% === INPUT PARAMETERS ===
% CPS: Colored polyshape struct or polyshape
% === OUTPUT RESULTS ======
% bb: bounding box
%
% EXAMPLE:
% ps=polyshape(PLcircle(10)), BBofCPS(ps)
%
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPL, BBofPS, BBofSGcutT
%
%
% Copyright 2019 Tim C. Lueth

CPSsimilaritymap(CPS,tol)- converts an array of CPS or polyshapes into a cell list of similar CPS

CPSsimilaritymap(CPS,tol)% CPSsimilaritymap(CPS,tol) - converts an array of CPS or polyshapes into a cell list of similar CPS
% (by Tim Lueth, VLFL-Lib, 2019-FEB-11 as class: CLOSED POLYGON LISTS)
%
% This is not a fast procedure; the more boundaries exist, the more time
% is required. (Status of: 2019-02-12)
%
% Introduced first in SolidGeometry 4.5
%
% See also: turningdist
%
% [S,pso,T2,psc,ps]=CPSsimilaritymap(CPS,[tol])
% === INPUT PARAMETERS ===
% CPS: CPS struct or array of polyshape array
% tol: tolerance for turningdist; default is 1e-7 ~ eps2
% === OUTPUT RESULTS ======
% S: cell list of similar boundaries n x .....
% pso: array of different shape: n elements
% T2: List of 3x3 transformation matrix related to ps
% psc: array of different shape n elements
% ps: full array of boundary contour
%
% EXAMPLE:
% SGfigure;
% for i=1:3; CPLplotasPS(PLtransR(CPLsample(34),rot(randminv([-pi,pi])))+randminv(1,2,[-10 10])); end
% for i=1:4; CPLplotasPS(PLtransR(CPLsample(33),rot(randminv([-pi,pi])))+randminv(1,2,[-20 20])); end
% CPS=CPSofgca; CPSsimilaritymap(CPS), CPSsimilaritymap(CPS.ps)
%
%
% See also: turningdist
%
%
% Copyright 2019 Tim C. Lueth

CPSplot(CPS,fc,fa,ec,lw)- plots a colored polygon from a CPS struct, a polyshape or a CPL

CPSplot(CPS,fc,fa,ec,lw)% CPSplot(CPS,fc,fa,ec,lw) - plots a colored polygon from a CPS struct, a polyshape or a CPL
% (by Tim Lueth, VLFL-Lib, 2019-FEB-11 as class: CLOSED POLYGON LISTS)
%
% should support CPS struct, and polyshape and CPL
% the plot command changes the colors of plotted polyshapes
% CPSplot plats always the default colors (Status of: 2022-01-30)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLanimateTL, CPSofgca, CCPSofgcalines, PLplot, CPLplot
%
% h=CPSplot(CPS,[fc,fa,ec,lw])
% === INPUT PARAMETERS ===
% CPS: CPS or ps
% fc: optional FaceColor
% fa: optional FaceAlpha
% ec: optional EdgeColor
% lw: optional Edge Line Width
% === OUTPUT RESULTS ======
% h: handle to polygon graphics object
%
% EXAMPLE:
% close all; SGfigure; CPLplot(PLcircle(10)); CPSplot(PLcircle(10),'b',.2,'g',2); CPS=CPSofgca
% cla; CPSplot(CPS); shg
% cla; CPSplot(CPS.ps); shg
%
% See also: CPLanimateTL, CPSofgca, CCPSofgcalines, PLplot, CPLplot
%
%
% Copyright 2019-2022 Tim C. Lueth

CPSouterboundary(CPS)- returns the outer boundary as CPS or polyshape

CPSouterboundary(CPS)% CPSouterboundary(CPS) - returns the outer boundary as CPS or polyshape
% (by Tim Lueth, VLFL-Lib, 2019-FEB-11 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPSplot
%
% CPSN=CPSouterboundary(CPS)
% === INPUT PARAMETERS ===
% CPS: CPS or polyshape
% === OUTPUT RESULTS ======
% CPSN: CPS or polyshape of outer boundary
%
% See also: CPSplot
%
%
% Copyright 2019 Tim C. Lueth

CPSofgca(h)- returns a struct called Colored PolyShape (CPS) similar to a polygon array object

CPSofgca(h)% CPSofgca(h) - returns a struct called Colored PolyShape (CPS) similar to a polygon array object
% (by Tim Lueth, VLFL-Lib, 2019-FEB-11 as class: CLOSED POLYGON LISTS)
%
% Matlab introduced new classes polygon as graphics object and polyshape
% as geometric object.
% Nevertheless, SG-Lib usees either CPL, polyshapes or colored polyshapes
% that consist
% ps polyshape array
% fc facecolor array
% fa facealpha array
% ec edgecolor array
% similar to poygon (Status of: 2019-02-11)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLplotasPS, CPSofpolygon
%
% CPS=CPSofgca([h])
% === INPUT PARAMETERS ===
% h: optional handle to implement CPSofpolygon
% === OUTPUT RESULTS ======
% CPS: struct with ps, fc, fa, ec
%
%
% EXAMPLE:
% SGfigure; CPSplot(CPLsample(29),'b',.1,'g',2)
% shg; CPSofgca
%
% See also: CPLplotasPS, CPSofpolygon
%
%
% Copyright 2019 Tim C. Lueth

Poseofimageui(I)- interactive fnct to defines three poses in a drawing image

Poseofimageui(I)% Poseofimageui(I) - interactive fnct to defines three poses in a drawing image
% (by Tim Lueth, Video-Lib, 2019-FEB-10 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PoseofCPLui, VLui, Poseui, Poseplot, Poseplotspace
%
% [PS,CPLB]=Poseofimageui(I)
% === INPUT PARAMETERS ===
% I: image with a hand sketch or a simple drawing, or also a Pose in a
% second try
% === OUTPUT RESULTS ======
% PS: Pose struct with start points, end points B and effektor CPL
% CPLB: separated Background contour that was not processed as pose
%
% EXAMPLE:
% loadweb ('Posewheelchairimage.mat')
% I=imofimsketch(Posewheelchairimage); % important step!
% PS=Poseofimageui(I)
% PS=Poseofimageui(PS)
%
% See also: PoseofCPLui, VLui, Poseui, Poseplot, Poseplotspace
%
%
% Copyright 2019-2020 Tim C. Lueth

SGarrow(l,h,s1,w)- returns a SG for an arrow

SGarrow(l,h,s1,w)% SGarrow(l,h,s1,w) - returns a SG for an arrow
% (by Tim Lueth, VLFL-Lib, 2019-FEB-10 as class: SURFACES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGcone, SGsphere, SGbox, SGlinkage, SGtext, SGspherelink
%
% SG=SGarrow(l,[h,s1,w])
% === INPUT PARAMETERS ===
% l: length or [start point; end point]
% h: diameter
% s1: tip size
% w: true or Radius for bending
% === OUTPUT RESULTS ======
% SG: Solid geoemtry of an arrow in z-direction
%
% EXAMPLE:
% SGarrow(100)
% SGarrow(20,5)
% SGarrow([10 10 10;20 20 20],5)
% SGarrow(10,1,1,true) % creates a circular arrow
% SGarrow(10,1,1,20) % circular arrow with radius 20
%
% See also: SGcone, SGsphere, SGbox, SGlinkage, SGtext, SGspherelink
%
%
% Copyright 2019-2020 Tim C. Lueth

PLarrow(l,h,s1)- returns a point list for an arrow

PLarrow(l,h,s1)% PLarrow(l,h,s1) - returns a point list for an arrow
% (by Tim Lueth, VLFL-Lib, 2019-FEB-10 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: PLcircle, PLcircseg, PLevolvente, PLgearDIN, PLhelix,
% PLkidney, PLrand, PLspiral, PLsquare, PLstar, PLcircleoval, PLtubbing
%
% PL=PLarrow(l,[h,s1])
% === INPUT PARAMETERS ===
% l: length (x=[0..l]) or [A0;B0] Start point and End point
% h: height in mm; default is 10%
% s1: tip size in mm; default is h
% === OUTPUT RESULTS ======
% PL: Point list (open) of arrow
%
% EXAMPLE:
% PLarrow(20);
% PLarrow(20,5);
% PLarrow(20,5,10);
% PLarrow([10 10;-20 20])
% PLarrow([10 10;20 +15],2,3)
%
% See also: PLcircle, PLcircseg, PLevolvente, PLgearDIN, PLhelix,
% PLkidney, PLrand, PLspiral, PLsquare, PLstar, PLcircleoval, PLtubbing
%
%
% Copyright 2019 Tim C. Lueth

imofimsketch(I)- uses an imbinarize filter to improve images before contourfind

imofimsketch(I)% imofimsketch(I) - uses an imbinarize filter to improve images before contourfind
% (by Tim Lueth, VLFL-Lib, 2019-FEB-10 as class: IMAGES)
%
% the filter was found in the matlab documentation (Status of: 2019-02-10)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLofimage, imreadlastchanged
%
% IN=imofimsketch(I)
% === INPUT PARAMETERS ===
% I: Image of a scan or sketch of drawings or letters
% === OUTPUT RESULTS ======
% IN: improved image
%
% EXAMPLE:
% imofimsketch(rgbsketch);
%
% See also: CPLofimage, imreadlastchanged
%
%
% Copyright 2019 Tim C. Lueth

CPLremovearea(CPL,sline)- removes CPLs of small area using the polyshape class

CPLremovearea(CPL,sline)% CPLremovearea(CPL,sline) - removes CPLs of small area using the polyshape class
% (by Tim Lueth, VLFL-Lib, 2019-FEB-10 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLremstraightAmin, CPLremstraight, imofimsketch,
% CPLremoveregionsholes
%
% CPLN=CPLremovearea(CPL,[sline])
% === INPUT PARAMETERS ===
% CPL: Original CPL
% sline: minimal length (not area)
% === OUTPUT RESULTS ======
% CPLN: CPL without removed areas
%
% EXAMPLE:
% I=rgbsketch; imshow(I); shg;
% imshow(imofimsketch(I));shg
% CPLremovearea(CPLofimage(I))
% CPLremovearea(CPLofimage(imofimsketch(I)))
%
% See also: CPLremstraightAmin, CPLremstraight, imofimsketch,
% CPLremoveregionsholes
%
%
% Copyright 2019 Tim C. Lueth

elem2cell()- converts elements of a list into a cell list

elem2cell()% elem2cell() - converts elements of a list into a cell list
% (by Tim Lueth, VLFL-Lib, 2019-FEB-10 as class: AUXILIARY PROCEDURES)
%
% =======================================================================
% OBSOLETE (2022-04-30) - USE 'array2cell' INSTEAD
% =======================================================================
%
% elem2cell is mainly the same as {varargin}'
% (lost knowhow from 2018-12-28 to 2019-02-10), x=array2cell(varargin)',
% y=x{1}', vec=y
% Some fnctns such as 'findobj' return a cell list of objects as
% separated results. Accessing structured properties/methods of those
% objects is possible by
% a) using the "get command' which returns a cell list for instance
% "get(h,'Shape')"
% b) use the property name directly similar to a struct, or instance
% "h.Shape"
% In the second case (b) the property methods is called repeated times
% for each element of the object list which returns several individual
% results.
% This fnctn converts the results list into a cell list of the same class
% type
% (Status of: 2022-02-26)
%
% Introduced first in SolidGeometry 4.5
%
% See also: [ array2cell ] ; squeeze, elem2cols, elem2rows, get,
% elem2array, arrayof, cell2class, class2cell, array2cell
%
% vec=elem2cell([])
% === OUTPUT RESULTS ======
% vec: array of same type as elem{1} filled with elem{:}
%
% EXAMPLE:
% CPLplot(CPLsample(25))
% h=findobj(gca,'Type','line')
% elem2cell(h.LineStyle) % auxilary fuction
% {h.LineStyle}' % matlab code
%
%
%
% See also: [ array2cell ] ; squeeze, elem2cols, elem2rows, get,
% elem2array, arrayof, cell2class, class2cell, array2cell
%
%
% Copyright 2019-2022 Tim C. Lueth

colorsofCPLofimage(CPL,I)- returns the original colors of the contours in an image

colorsofCPLofimage(CPL,I)% colorsofCPLofimage(CPL,I) - returns the original colors of the contours in an image
% (by Tim Lueth, FileMaker, 2019-FEB-09 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGshowcolors, CPLofimage, imreadlastchanged,
% CPLofouterregionboundary
%
% [coli,cols]=colorsofCPLofimage(CPL,I)
% === INPUT PARAMETERS ===
% CPL: Contour created by CPLofimage(I)
% I: Image
% === OUTPUT RESULTS ======
% coli: list of colors wrt to separateNaN
% cols: color list of each point of CPL
%
% EXAMPLE:
% I=imreadlastchanged; CPLofimage(I,1); CPL=ans; CPLofouterregionboundary(CPL); CPL=ans;
% colorsofCPLofimage(CPL,I);
%
% See also: SGshowcolors, CPLofimage, imreadlastchanged,
% CPLofouterregionboundary
%
%
% Copyright 2019 Tim C. Lueth

CPLofouterregionboundary(CPL,sline)- returns the outer boundary of regions of CPL

CPLofouterregionboundary(CPL,sline)% CPLofouterregionboundary(CPL,sline) - returns the outer boundary of regions of CPL
% (by Tim Lueth, VLFL-Lib, 2019-FEB-09 as class: SLICES)
%
% Find out the difference to CPLfillinside
% CPSplot(CPLfillinside(CPLsample(12)))
% CPSplot(CPLofouterregionboundary(CPLsample(12))) (Status of: 2021-12-01)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLfillinside, CPLgrow, CPLbuffer
%
% CPLN=CPLofouterregionboundary(CPL,[sline])
% === INPUT PARAMETERS ===
% CPL: Closed polygon line
% sline: additional line thickness; default is 1% of BB of CPL
% === OUTPUT RESULTS ======
% CPLN: outer boundary of regions
%
% EXAMPLE:
% CPSplot(CPLfillinside(CPLsample(12)))
% CPSplot(CPLofouterregionboundary(CPLsample(12)))
%
% See also: CPLfillinside, CPLgrow, CPLbuffer
%
%
% Copyright 2019-2021 Tim C. Lueth

CPLsplitui(CPLA)- splits a CPL interactively into two CPLs

CPLsplitui(CPLA)% CPLsplitui(CPLA) - splits a CPL interactively into two CPLs
% (by Tim Lueth, VLFL-Lib, 2019-FEB-09 as class: CLOSED POLYGON LISTS)
%
% same as CPLsplitbool (Status of: 2019-06-22)
%
% Introduced first in SolidGeometry 4.5
%
% See also: CPLsplitbool, VLui, CPSlineui, CPLui, CPSui, PLui,
% PLsquareui, PLcircleui, VLFLui, SGui, Poseofimageui, Poseui, SGTui
%
% [CPLA,CPLB,CPLC]=CPLsplitui(CPLA)
% === INPUT PARAMETERS ===
% CPLA: Original Contour
% === OUTPUT RESULTS ======
% CPLA: contour left after removal (BLUE)
% CPLB: removed contour (RED)
% CPLC: contour used to cut (DASHED)
%
% EXAMPLE:
% imreadlastchanged;I=ans; CPLofimage(I); CPL=ans; CPLsplitui(CPL);
%
% See also: CPLsplitbool, VLui, CPSlineui, CPLui, CPSui, PLui,
% PLsquareui, PLcircleui, VLFLui, SGui, Poseofimageui, Poseui, SGTui
%
%
% Copyright 2019 Tim C. Lueth

imreadlastchanged(iext,idir)- reads in the last modified image of a directory

imreadlastchanged(iext,idir)% imreadlastchanged(iext,idir) - reads in the last modified image of a directory
% (by Tim Lueth, VLFL-Lib, 2019-FEB-09 as class: IMAGES)
%
% fnctn useful to read in snapshot save on the desktop directory (Status
% of: 2022-05-18)
%
% Introduced first in SolidGeometry 4.5
%
% See also: lasttouchedSG, CPLofdrawing, imreadui
%
% [im,fullnam]=imreadlastchanged([iext,idir])
% === INPUT PARAMETERS ===
% iext: image extensionsl default is {'*.png' '*.jpg' '*.tif'}
% idir: image directory; default is desktopdir
% === OUTPUT RESULTS ======
% im: image read in by image read
% fullnam: full filename
%
% EXAMPLE:
% imreadlastchanged
%
% See also: lasttouchedSG, CPLofdrawing, imreadui
%
%
% Copyright 2019-2022 Tim C. Lueth

SGkeyboardgetkey(hf)- returns the last key pressed

SGkeyboardgetkey(hf)% SGkeyboardgetkey(hf) - returns the last key pressed
% (by Tim Lueth, VLFL-Lib, 2019-FEB-07 as class: USER INTERFACE)
%
% This fnctn automatically installs call back fnctn "SGkeyboardCallback"
% (Status of: 2019-02-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGkeyboardCallback
%
% [key,lastkey]=SGkeyboardgetkey([hf])
% === INPUT PARAMETERS ===
% hf: optional window handle; default is gcf
% === OUTPUT RESULTS ======
% key: key pressed
% lastkey: last key pressed
%
% EXAMPLE:
% close all; for i=1:100; a=SGkeyboardgetkey; if~isempty(a); fprintf(2,'%s ',a.key); end; pause(.1); end; commandwindow;
% SGfigure; for i=1:100; a=SGkeyboardgetkey; if~isempty(a); fprintf(2,'%s ',a.key); end; pause(.1); end;commandwindow;
%
% See also: SGkeyboardCallback
%
%
% Copyright 2019 Tim C. Lueth

SGkeyboardCallback(src,event)- used as KeyPressFcn-Callback within SG-Library

SGkeyboardCallback(src,event)% SGkeyboardCallback(src,event) - used as KeyPressFcn-Callback within SG-Library
% (by Tim Lueth, VLFL-Lib, 2019-FEB-07 as class: USER INTERFACE)
%
% This fnctn helps to have easier access to pressed keyboard keys. It is
% automatically installed by the fnctn "SGkeyboardgetkey". It requires an
% open figure window. (Status of: 2019-02-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGkeyboardgetkey, RRRun
%
% SGkeyboardCallback(src,event)
% === INPUT PARAMETERS ===
% src: src of callback events
% event: result of callback events
%
% EXAMPLE:
% SGfigure; rotate3d off; set(gcf,'KeyPressFcn',@SGkeyboardCallback);
% SGfigure; for i=1:100; a=SGkeyboardgetkey; if~isempty(a); cla; textVL([.5 .5],'',24,'',a.key); end; pause(.1); end;commandwindow;
%
%
% See also: SGkeyboardgetkey, RRRun
%
%
% Copyright 2019 Tim C. Lueth

vecnormr(VL)- returns for a vector list (rows) the vectnorm result

vecnormr(VL)% vecnormr(VL) - returns for a vector list (rows) the vectnorm result
% (by Tim Lueth, VLFL-Lib, 2019-FEB-07 as class: ANALYTICAL GEOMETRY)
%
% Since 2017b there is a vecnorm fnctn, unfortunatley for column format
% This fnctn is almost the same speed as than vecnorm(VL,2,2) for small
% VL.
% (Status of: 2019-02-07)
%
% Introduced first in SolidGeometry 4.5
%
% See also: vecnorm
%
% LL=vecnormr(VL)
% === INPUT PARAMETERS ===
% VL: vector [n x 2] or [n x 3] as rows
% === OUTPUT RESULTS ======
% LL: vector norm of the rows
%
% EXAMPLE:
% v=rand(10,2), vecnormr(v)
% tic; a=vecnormr(rand(1e7,3)); toc
% tic; a=vecnorm(rand(1e7,3),2,2); toc
%
% See also: vecnorm
%
%
% Copyright 2019-2020 Tim C. Lueth

vec2number(ord)- converst a vector row into a number for vector elemetns of 1 to 9

vec2number(ord)% vec2number(ord) - converst a vector row into a number for vector elemetns of 1 to 9
% (by Tim Lueth, VLFL-Lib, 2019-FEB-06 as class: ANALYTICAL GEOMETRY)
%
% Introduced first in SolidGeometry 4.5
%
% See also: round, number2vec, digitofnum
%
% [z,s]=vec2number(ord)
% === INPUT PARAMETERS ===
% ord: vector of integer between 1 and 9
% === OUTPUT RESULTS ======
% z: number
% s: string of number
%
% EXAMPLE:
% vec2number([1 2 3])
% [a,b]=vec2number([1 2 3])
%
% See also: round, number2vec, digitofnum
%
%
% Copyright 2019 Tim C. Lueth

isincirclesegment(cseg,WL)- returns whether an angle or a angle list is inside an angle interval

isincirclesegment(cseg,WL)% isincirclesegment(cseg,WL) - returns whether an angle or a angle list is inside an angle interval
% (by Tim Lueth, VLFL-Lib, 2019-FEB-04 as class: ANALYTICAL GEOMETRY)
%
% frustrating testing lead to this ugly fnctn....... (Status of:
% 2021-12-14)
%
% Introduced first in SolidGeometry 4.5
%
% See also: isintriangle, isInterior, CPLcrosscircseg, angleshift,
% angleinterv, cplot
%
% ins=isincirclesegment(cseg,WL)
% === INPUT PARAMETERS ===
% cseg: angle interval; second values must be larger than first value
% WL: angle list
% === OUTPUT RESULTS ======
% ins: logical table which angle is inside
%
% EXAMPLE:
% a=randminv([0-2*pi 2*pi]); isincirclesegment ([a a+randminv([0 2*pi])],randminv(10,1,[-pi pi]));
% a=randminv([0-2*pi 2*pi]); wlim=[a a+randminv([0 2*pi])], isincirclesegment (wlim,[randminv(10,1,[-pi pi]); wlim']);
%
% See also: isintriangle, isInterior, CPLcrosscircseg, angleshift,
% angleinterv, cplot
%
%
% Copyright 2019-2021 Tim C. Lueth

BBofPose(PS)- returns the bounding box of a Pose

BBofPose(PS)% BBofPose(PS) - returns the bounding box of a Pose
% (by Tim Lueth, VLFL-Lib, 2019-FEB-04 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: BBofVL, BBofSG, BBofCPS, BBofCPL, BBofPS, BBofSGcutT, BBgrow,
% BBaddtolerance
%
% bb=BBofPose(PS)
% === INPUT PARAMETERS ===
% PS: Closed Polygon Line
% === OUTPUT RESULTS ======
% bb: bb [xmin xmax ymin ymax]
%
% EXAMPLE:
% BBofPose(Posesample(7)); Poseplot(Posesample(7));
%
% See also: BBofVL, BBofSG, BBofCPS, BBofCPL, BBofPS, BBofSGcutT, BBgrow,
% BBaddtolerance
%
%
% Copyright 2019-2022 Tim C. Lueth

checkfourbarsegment(l1,l2,r,A0,PL,na)- calculates the angle intervals for a fourbar linkage and appoint point to the intervall

checkfourbarsegment(l1,l2,r,A0,PL,na)% checkfourbarsegment(l1,l2,r,A0,PL,na) - calculates the angle intervals for a fourbar linkage and appoint point to the intervall
% (by Tim Lueth, VLFL-Lib, 2019-FEB-01 as class: KINEMATICS AND FRAMES)
%
% wres return no, one or two angle intervalls for the fourbar linkage.
% For a point of CRANK Positions (not Poses), s returns the segment
% The fnctn "realfourbarsolutions" analyzes the result of "invkinplan2"
% to detect a rotation, segment or two separated segments.
% In contrast to that
% The fnctn "checkfourbarsegment" returns the angle areas for on or two
% segments
% (Status of: 2019-05-05)
%
% Introduced first in SolidGeometry 4.5
%
% See also: invkinplan2, miofPLA0B0, realfourbarsolutions, invkinplan2,
% shiftindexofinvkinplan2
%
% [wres,s,WL,ord,PL1,PL2]=checkfourbarsegment([l1,l2,r,A0,PL,na])
% === INPUT PARAMETERS ===
% l1: l1 of swing arm
% l2: l2 of swing arm
% r: r of crank
% A0: Distance or A0 or [A0;B0]
% PL: Points list to check or Pose with field A for PL
% na: number of points for plotting contours PL1 and PL2
% === PROPERTY NAMES =====
% 'silent' : if used, there will be no singularity warning
% === OUTPUT RESULTS ======
% wres: false or empty or [seg_min seg_max] or [seg1_min seg1_max
% seg_2min seg_2max]
% s: list of angle segment per point zero, one or two
% WL: angles of Points
% ord: order of points
% PL1: PLR-CYAN CONTOUR Point list for rotation of complete segment 1
% (blue, cyan)
% PL2: PLR=YELL CONTOUR Point list for rotation of complete segment 2
% (yellow)
%
% EXAMPLE:
% checkfourbarsegment(40,10,30,30,randminv(10,2,[-1 1])+[-30 0]);
% close all; checkfourbarsegment(40,10,30,30,1000*randminv(50,2,[-1 1])+[-30 0])
% close all; [a,b]=checkfourbarsegment(40,10,30,30,randminv(10,2,[-1 1])+[-30 0])
% testfunctTL('checkfourbarsegment(60,40,51,[0 0;#1 #2])',[-50 0 +50],[-50 0 +50]);
% testfunctTL('checkfourbarsegment(60,40,200,[#1 #2;0 0])',[-95 10 +95],[-95 10 +95]);
%
% See also: invkinplan2, miofPLA0B0, realfourbarsolutions, invkinplan2,
% shiftindexofinvkinplan2
%
%
% Copyright 2019 Tim C. Lueth

checkfourbarNPose(A,B,S,dws,k,pl)- checks whether a fourbar joint solution exists for results of center3Pose

checkfourbarNPose(A,B,S,dws,k,pl)% checkfourbarNPose(A,B,S,dws,k,pl) - checks whether a fourbar joint solution exists for results of center3Pose
% (by Tim Lueth, VLFL-Lib, 2019-FEB-01 as class: KINEMATICS AND FRAMES)
%
% r= S(ka,4); % radius of crank
% l1=S(kb,4); % radius of follower
% l2=S(kb,1)-S(ka,1); % length of coupler
% do=S(ka,5); % displacement of coupler
% wo=S(ka,6); % Angle deviation before displacement
% A0=S(ka,2:3); % Base of crank
% B0=S(kb,2:3); % Base of follower
% d=norm(A0-B0); % distance between both bases
%
% ======================================================================
% THIS FNCTN IS PART OF THE SEQUENCE
% 1. Create Poses as List of Startpoints A and Endpoints B uses
% Posesample or Poseui:
% >> PS=Poseui(3,.2); SGfigure; Poseplot(PS);
% >> PS.A=[-0.00 0.00; 0.00 1.00; 1.00 3.00]; PS.B=[ 1.00 0.00; 1.00
% 1.00; 1.71 2.29];
% 2. Calculate a set of parameter variations for possible Solutions:
% >> center3Pose(PS.A,PS.B,-20:20,-20:5:20,-3:.2:3); S=ans; whos C;
% 3. Calculate and analyze all possible permutations of the parameter
% variation:
% >> checkfourbar3Posepermutation(PS.A,PS.B,S); FP=ans;
% >> checkfourbar3Pose(PS.A,PS.B,S); % if there is only one assembly
% 4. Limit the Solution to your needs by limiting the permutations, for
% example
% FULL ROTATION 'u',0 DIMENSION 'l1l2rd',[5 8]
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'','u',0,'l1l2rd',[2 4]);
% OR FULL ROTATION 'u',0 BASES INSIDE AN AREA
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'','cpl',PLcircle(2)+[3
% 3],'l1l2rd',[0 3]);
% ======================================================================
% All those fnctns are based on
% invkinplan2 - that calculates both configurations for a planar 2bar
% linkage (Status of: 2019-02-01)
%
% Introduced first in SolidGeometry 4.5
%
% See also: center3Pose, checkfourbar3Pose, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
% [ci,perr,werr,oci]=checkfourbarNPose(A,B,S,[dws,k,pl])
% === INPUT PARAMETERS ===
% A: Starting Points of 3 Poses
% B: Ending Points of 3 Poses
% S: Solutions comming from center3Pose
% dws: selected pair of distance and angle
% k: selected values for k; default are first and last of S
% pl: length of pose
% === OUTPUT RESULTS ======
% ci: configuration for pose of a fourbar linkage
% perr:
% werr:
% oci:
%
% EXAMPLE:
% PS.A=[10.50 -4.38; 3.50 -10.50; -5.25 -10.50]; PS.B=[ 9.79 -5.08; 2.50 -10.50; -5.96 -9.79];
% center3Pose(PS.A,PS.B,[-10 00],0,-pi/4); S=ans, CPLplot(CPLsample(4)); checkfourbar3Pose(PS.A,PS.B,S,'verbose
%
% See also: center3Pose, checkfourbar3Pose, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
%
% Copyright 2019 Tim C. Lueth

center4Pose(A,B,k,dall,wall,CPL);- return center points for 3 poses (position and orientation)

center4Pose(A,B,k,dall,wall,CPL);% center4Pose(A,B,k,dall,wall,CPL); - return center points for 3 poses (position and orientation)
% (by Tim Lueth, VLFL-Lib, 2019-JAN-31 as class: ANALYTICAL GEOMETRY)
%
% The center4Pose fnctn uses the center3Pose fnctn to calculate in the
% following way:
% The center3Pose fnctn searches the center of rotation/circle center for
% the three starting points of a pose. The fnctn also searches for the
% center of rotation/circle center for the three end points of a pose.
% These rotation centers are the attachment points for the crank and for
% the four-joint swingarm, while the distance between the attachment
% points defines the minimum length of the coupling. For the three pose
% synthesis, however, the later can freely choose the coupling length,
% since each point along the pose lines can theoretically be chosen as
% attachment points for the crank and for the swingarm. This is not the
% case with four pose synthesis. In four-pose synthesis, a point must be
% found on the coupling line where the circular arc of the three-point
% synthesis a selected k runs randomly on the first three coupling lines
% through the corresponding k-point on the fourth coupling line. This can
% be approximated by a numerical search. If it is possible to find at
% least two such points, at least one can realize a coupling. Whether all
% four poses are reachable in the same joint configuration and whether
% all four poses are reachable in the same angular segment and in the
% correct order can only be checked afterwards.
% ======================================================================
% center3Pose is a very powerful fnctn for the design of fourbar linkages
% under a variety of optimization criterias.
% k stands for the distance of the coupler point to the poses
% r stands for the radius of the crank
% C stands for the base of the crank
% d stands for the distance of coupler to pose
% w stand for angle deviation of coupler to pose
% e stands for the distance error of the found solution
% For a fourbar linkage it is necessary to select two k points to get two
% center points for crank and follower.
% ======================================================================
% THIS FNCTN IS PART OF THE SEQUENCE
% 1. Create Poses as List of Startpoints A and Endpoints B uses
% Posesample or Poseui:
% >> PS=Poseui(3,.2); SGfigure; Poseplot(PS);
% >> PS.A=[-0.00 0.00; 0.00 1.00; 1.00 3.00]; PS.B=[ 1.00 0.00; 1.00
% 1.00; 1.71 2.29];
% 2. Calculate a set of parameter variations for possible Solutions:
% >> center3Pose(PS.A,PS.B,-20:20,-20:5:20,-3:.2:3); S=ans; whos C;
% 3. Calculate and analyze all possible permutations of the parameter
% variation:
% >> checkfourbar3Posepermutation(PS.A,PS.B,S); FP=ans;
% >> checkfourbar3Pose(PS.A,PS.B,S); % if there is only one assembly
% 4. Limit the Solution to your needs by limiting the permutations, for
% example
% FULL ROTATION 'u',0 DIMENSION 'l1l2rd',[5 8]
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'','u',0,'l1l2rd',[2 4]);
% OR FULL ROTATION 'u',0 BASES INSIDE AN AREA
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'','cpl',PLcircle(2)+[3
% 3],'l1l2rd',[0 3]);
% ======================================================================
% All those fnctns are based on
% invkinplan2 - that calculates both configurations for a planar 2bar
% linkage (Status of: 2019-01-31)
%
% Introduced first in SolidGeometry 4.5
%
% See also: center3P, center3Pose, center3Poseconditions,
% checkfourbar3Pose, checkallfourbar3Poses, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
% [S,rs,Sall,PSall,dw]=center4Pose([A,B,k,dall,wall,CPL]);
% === INPUT PARAMETERS ===
% A: List of at least 3 points that define a pose
% B: List of at least 3 points that define a direction in combination
% with A
% k: list of checking values for a point along the line A+k*(B-A)/|(B-A)|
% dall: displacement orthogonal to pose line; default is 0
% wall: turning angle of the pose relative to pose; default is 0;
% CPL: Optional area for solutions
% === OUTPUT RESULTS ======
% S: [k C r d w]
% rs: real solutions if CPL is used
% Sall: All Solutions S=Sall(rs,:)
% PSall: All Poses
% dw:
%
% EXAMPLE:
% PS=Posesample(7), center3Pose(PS.A,PS.B,[-20:20])
% PS=Posesample(10), center3Pose(PS.A,PS.B,[-20:20])
% PS=Posesample(10), center4Pose(PS.A,PS.B,[-20:20])
%
% PS=Posesample(10); PS.B(4,:)=PS.B(4,:)+[0 0]; SGfigure; Poseplot(PS);
% center4Pose(PS.A,PS.B,[-200:.1:200]); axis([-10 40 -20 20])
%
% See also: center3P, center3Pose, center3Poseconditions,
% checkfourbar3Pose, checkallfourbar3Poses, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
%
% Copyright 2019 Tim C. Lueth

SGcolorseparation(SG,sel)- returns a cell list or SG separated by colors

SGcolorseparation(SG,sel)% SGcolorseparation(SG,sel) - returns a cell list or SG separated by colors
% (by Tim Lueth, VLFL-Lib, 2019-JAN-30 as class: SURFACES)
%
% Introduced first in SolidGeometry 4.5
%
% See also: SGsurfaces, SGseparate, surfacesofSG, SGsurfaceselect,
% SGsurfaceplot, SGcolorfaces
%
% SGC=SGcolorseparation(SG,[sel])
% === INPUT PARAMETERS ===
% SG: struct with fields; VL, FL, FC
% sel: selector; list of chars or a list of rgb values [0..1 0..1 0..1]
% === OUTPUT RESULTS ======
% SGC: cell list or colored Solid Geometry
%
% EXAMPLE:
% SGcolorseparation(A,[1 0 0])
% SGcolorseparation(A,'rg')
%
% See also: SGsurfaces, SGseparate, surfacesofSG, SGsurfaceselect,
% SGsurfaceplot, SGcolorfaces
%
%
% Copyright 2019 Tim C. Lueth

PoseofT(T,CPL)- returns pose struct from a list of HT matrices either 3x3 or 4x4

PoseofT(T,CPL)% PoseofT(T,CPL) - returns pose struct from a list of HT matrices either 3x3 or 4x4
% (by Tim Lueth, VLFL-Lib, 2019-JAN-30 as class: KINEMATICS AND FRAMES)
%
% can be used to create poses from the result of CPSsimilaritymap or
% Poseofimageui
% (Status of: 2019-02-12)
%
% Introduced first in SolidGeometry 4.5
%
% See also: TofPose, poseofT, CPSsimilaritymap, Poseofimageui
%
% PS=PoseofT(T,[CPL])
% === INPUT PARAMETERS ===
% T: List of transformation matrix either [3*n x 3], [3,3,n]
% [4*n,4],[4,4,n]
% CPL: Optional Contour to save as PS.CPLE
% === OUTPUT RESULTS ======
% PS: Pose = PS.A, PS.B (X-axis) PS.C (y-axis)
%
% EXAMPLE:
% PS=Posesample(7), T=TofPose(PS), poseofT(T)
%
% See also: TofPose, poseofT, CPSsimilaritymap, Poseofimageui
%
%
% Copyright 2019 Tim C. Lueth

fcreationdate(fname)- returns the creation date for a file or file list

fcreationdate(fname)% fcreationdate(fname) - returns the creation date for a file or file list
% (by Tim Lueth, VLFL-Lib, 2019-JAN-29 as class: FILE HANDLING)
%
% for all system commands see
% dir('/usr/bin/*')'
% dir('/usr/bin/*')
% s=datenum('01-jan-2019'); XXXXX(elem2array(XXXXX{:,6})>s,:) (Status of:
% 2022-05-18)
%
% Introduced first in SolidGeometry 4.5
%
% See also: creationdatefile, dir, ls, lasttouchedSG
%
% crdat=fcreationdate(fname)
% === INPUT PARAMETERS ===
% fname: file name or file wildcard
% === OUTPUT RESULTS ======
% crdat: creation date or cell list
%
% EXAMPLE:
% fcreationdate('PL*.m'); XXXXX=ans
% s=datenum('01-jan-2017'); XXXXX(elem2array(XXXXX{:,6})>s,:)
%
% See also: creationdatefile, dir, ls, lasttouchedSG
%
%
% Copyright 2019-2022 Tim C. Lueth
RapidWeaver Icon

Last Change Oct 2023 for SG-Lib 5.3