New in SG-Lib 4.5

New in SG-Lib 4.5

Last change of this page: 2019-02-10

exp_2019_01_27_chair- EXPERIMENT TO EXPLAIN THE DESIGN OF PATIENT INDIVIDUAL KINEMATIC OPTIMIZED CHAIRS
% exp_2019_01_27_chair - EXPERIMENT TO EXPLAIN THE DESIGN OF PATIENT INDIVIDUAL KINEMATIC OPTIMIZED CHAIRS
% (by Tim Lueth, VLFL-Lib, 2019-JAN-27 as class: EXPERIMENTS)
%
% Introduced first in SolidGeometry 4.4
%
% exp_2019_01_27_chair
%
%
% Copyright 2019 Tim C. Lueth
poseofPSanalyze(XX,i)- returns a Pose and a CPL from an analyzeed 3 Pose Polygon
% poseofPSanalyze(XX,i) - returns a Pose and a CPL from an analyzeed 3 Pose Polygon
% (by Tim Lueth, VLFL-Lib, 2019-JAN-27 as class: KINEMATICS AND FRAMES)
%
% Auxiliary fnctn to automatically select contours and creates poses from
% them (Status of: 2019-01-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: PSanalyze, TofPose, Posesample, Poseplot, Posenorm, Poseui,
% poseofPSanalyz
%
% [PS,CPL]=poseofPSanalyze(XX,i)
% === INPUT PARAMETERS ===
% XX: Result of PSanalyze
% i: optional selection if there several polygon as set of at least 3
% copies
% === OUTPUT RESULTS ======
% PS: PS.A start points PS.B end Point PS.CPL moving CPL.
% CPL: Kontour of a CPL that exist at least 3 times
%
% EXAMPLE:
% XX=PSanalyze; XX.id
% poseofPSanalyze(XX); PS=ans;
%
%
% See also: PSanalyze, TofPose, Posesample, Poseplot, Posenorm, Poseui,
% poseofPSanalyz
%
%
% Copyright 2019 Tim C. Lueth
CPLsplitbool(CPLA,CPLC);- returns a CPL that is split into two pre more parts by a second contour
% CPLsplitbool(CPLA,CPLC); - returns a CPL that is split into two pre more parts by a second contour
% (by Tim Lueth, VLFL-Lib, 2019-JAN-27 as class: CLOSED POLYGON LISTS)
%
% This fnctn is helpful in combination with a interactive selected
% contour. (Status of: 2019-02-09)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLbool, CPLboolpshape, CPLmeltbool, CPLsplitui
%
% [CPLA,CPLB,CPLC]=CPLsplitbool(CPLA,[CPLC]);
% === INPUT PARAMETERS ===
% CPLA: CPL to be splitted
% CPLC: CPL that overlaps with CPLA
% === OUTPUT RESULTS ======
% CPLA: CPLA minus CPLB (BLUE)
% CPLB: XOR of CPLA and CPLC (RED)
% CPLC: CPLC used to cut; if interactive mode was used;
%
% EXAMPLE: loadweb chair.mat
% SGfigure; CPLplot(cplchair,'b-',3);
% VLui; CPLc=ans(:,1:2); CPLplot(CPLc,'r-');
% CPLsplitbool(cplchair,CPLc);
%
% See also: CPLbool, CPLboolpshape, CPLmeltbool, CPLsplitui
%
%
% Copyright 2019 Tim C. Lueth
CPLfourbarlinkage2(P1,P2,P3,P4,P5,R12,CPLX,dw)- creates for a specified fourbar linkage the cpls for crank, coupler, swing
% CPLfourbarlinkage2(P1,P2,P3,P4,P5,R12,CPLX,dw) - creates for a specified fourbar linkage the cpls for crank, coupler, swing
% (by Tim Lueth, VLFL-Lib, 2019-JAN-22 as class: CLOSED POLYGON LISTS)
%
% The same fnctn as the original of 2018-12-17 but in this version P5 has
% the definition from k=0 means P2 and k=norm(P3-P2) means P2 and the
% dimension is in millimeter. Therfore P5 is completely defined in a mm
% coordinate system realative to the coupler point P2
% 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;
% 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]);
%
% (Status of: 2019-01-25)
%
% Introduced first in SolidGeometry 4.4
%
% See also: invkinplan2, CPLfourbarlinkage, center3Pose,
% checkfourbar3Posepermutation
%
% [CPL1,CPL2,CPLR,CPL,R12,CPLX,TX,dt]=CPLfourbarlinkage2([P1,P2,P3,P4,P5,
% R12,CPLX,dw])
% === INPUT PARAMETERS ===
% P1: Position of Crank Center
% P2: Position of TCP (end of coupler)
% P3: Position of link 1 (start of coupler)
% P4: Position of Base of link 1 (2R robot base)
% P5: Position of POI in mm or [POI delta x]
% R12: Ro and Ri Outer and inner Radius
% CPLX: Contour of the Shape linked to POI
% dw: displacement and turning angle wrt to center3Pose
% === OUTPUT RESULTS ======
% CPL1: CPL of swing, 2R-robot link 1
% CPL2: CPL of coupler, 2R-robot link 2
% CPLR: CPL of crank, radial position specification
% CPL: complete contour for sweeping
% R12: [Ro and Ri] Outer and inner Radius
% CPLX: CPL of Final Contour
% TX: Final transformation matrix
%
% EXAMPLE:
% CPLfourbarlinkage2('','','','',20);
% CPLfourbarlinkage2('','','','',0);
% CPLfourbarlinkage2('','','','',-40);
% CPLfourbarlinkage2('','','','',+80);
% CPLfourbarlinkage2('','','','',[+20 20]);
% CPLfourbarlinkage2('','','','',[+20 20],'',CPLsample(34)*10);
%
%
% See also: invkinplan2, CPLfourbarlinkage, center3Pose,
% checkfourbar3Posepermutation
%
%
% Copyright 2019 Tim C. Lueth
checkfourbar3Posepermutation(A,B,S,dws)- calculates from a center3pose solution all possible permutations and the fourbar parameters
% checkfourbar3Posepermutation(A,B,S,dws) - calculates from a center3pose solution all possible permutations and the fourbar parameters
% (by Tim Lueth, VLFL-Lib, 2019-JAN-20 as class: KINEMATICS AND FRAMES)
%
% FP contains the complete solution list for all permutations w.r.t. to
% the specified conditions
% [L1 L2 R D C U A0 B0 iA iB kA kBd w]
% Results can be animated by
% >>
% fourBarLinkageplotanim(FP(l,1),FP(l,2),FP(l,3),[FP(l,7:8);FP(l,9:10)],'
% ',FP(l,5)==2,[],[FP(l,13), FP(l,16) FP(l,15)]);
%
% 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;
% 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]);
% (Status of: 2019-01-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: center3Pose, checkfourbar3Pose, checkfourbar3Posepermutation
%
%
% [FP,FPall]=checkfourbar3Posepermutation(A,B,S,[dws])
% === INPUT PARAMETERS ===
% A: Pose starting points
% B: Pose end points
% S: Solutions created by center3Pose
% dws: distance and angle; default is first
% === PROPERTY NAMES =====
% 'L1' : Interval for L1; default is [0 inf]
% 'L2' : Interval for L12; default is [0 inf]
% 'R' : Interval for R; default is [0 inf]
% 'D' : Interval for D; default is [0 inf]
% 'C' : Interval for elbow-config C; default is [1 2]
% 'U' : Values for rotation [0 1 10 11]
% 'ka' : Interval for kA; default is [0 inf]
% 'kb' : Interval for kB; default is [0 inf]
% 'x' : ?
% 'y' : ?
% 'CPLA' : ?
% 'CPLB' : ?
% === OUTPUT RESULTS ======
% FP: Existing Solution list [L1 L2 R D C U A0 B0 iA iB kA kBd w]
% FPall: Table containing all possible parameters
%
% EXAMPLE:
% center3Pose(PS.A,PS.B,[-20:.1:20],'',0); S=ans; CPLplot(CPLsample(4)); FP=checkfourbar3Posepermutation(PS.A,PS.B,S);
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'');
% checkfourbar3Posepermutation(PS.A,PS.B,FP,'','l1rd',[4 12]);
%
%
% See also: center3Pose, checkfourbar3Pose, checkfourbar3Posepermutation
%
%
%
% Copyright 2019 Tim C. Lueth
exp_2019_01_16_4barcases- EXPERIMENT THAT SHOWS THE MAIN CONFIGURATIONS OF A FOURBAR LINKAGE
% exp_2019_01_16_4barcases - EXPERIMENT THAT SHOWS THE MAIN CONFIGURATIONS OF A FOURBAR LINKAGE
% (by Tim Lueth, VLFL-Lib, 2019-JAN-16 as class: EXPERIMENTS)
%
% Educational Purpose
% This fnctn shows the most common configurations of a fourbarlinkage for
% educational purpose (Status of: 2019-01-16)
%
% Introduced first in SolidGeometry 4.4
%
% See also: invkinplan2, fourBarLinkageplotanim
%
% exp_2019_01_16_4barcases
%
% See also: invkinplan2, fourBarLinkageplotanim
%
%
% Copyright 2019 Tim C. Lueth
CPLgripperjaw(CPL,P0,CPL0,hg)- creates a contour for a gripper design
% CPLgripperjaw(CPL,P0,CPL0,hg) - creates a contour for a gripper design
% (by Tim Lueth, VLFL-Lib, 2019-JAN-16 as class: CLOSED POLYGON LISTS)
%
% This fnctn can be used to create a first design for a gripper jaw for a
% known contour. The first parameter is the contour to be gripped at the
% zero line Y=0; the second parameter is the relative position P0 of the
% TCP or the attachment point of the gripper to a kinematic system. The
% third parameter is the contour around the attachment points P0. The
% fourth parameter h0 describes how deep the gripper should plunge into
% the contour to be gripped under Y=0 line. Y=0-h0
% The fifth parameter describes whether the gripper should only represent
% the convex hull of the object. (Status of: 2019-01-18)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLfourbarlinkage
%
% [CPLF,CPLF0]=CPLgripperjaw([CPL,P0,CPL0,hg])
% === INPUT PARAMETERS ===
% CPL: Object contour to be grasped (Orange)
% P0: Position of TCP
% CPL0: Contour around TCP (green)
% hg: depth of gripper jaw into the object
% === OUTPUT RESULTS ======
% CPLF: Final Gripper Jaw Contour (red contour)
% CPLF0: Final Gripper Jaw Contour (red contour) with origin in P0
%
% EXAMPLE:
% CPLgripperjaw(CPLsample(4)-[0 9],[0 5],PLsquare(30,2),5)
% CPLgripperjaw(CPLsample(21)-[0 9],[0 30],PLsquare(30,2),0);
% CPLgripperjaw(CPLsample(21)-[0 9],[0 30],PLsquare(30,2),0,true);
% CPLgripperjaw(PLsquare(20,2)-[0,1],[0 10],PLcircle(4));
% [a,b]=CPLgripperjaw; SGfigure; CPLplot(a,'r-');CPLplot(b,'-b')
%
% See also: CPLfourbarlinkage
%
%
% Copyright 2019 Tim C. Lueth
realfourbarsolutions(rs,mtyp)- creates an index list to map fourbarlinkage solution points to movement types
% realfourbarsolutions(rs,mtyp) - creates an index list to map fourbarlinkage solution points to movement types
% (by Tim Lueth, VLFL-Lib, 2019-JAN-15 as class: KINEMATICS AND FRAMES)
%
% This fnctn analyzes the results of the invkinplan2 fnctn for a circular
% path and generates an index list with which all invkinplan2 results can
% be mapped for a motion simulation. (Status of: 2019-01-16)
%
% Introduced first in SolidGeometry 4.4
%
% See also: miofPLA0B0, invkinplan2
%
% [nni,seg]=realfourbarsolutions(rs,[mtyp])
% === INPUT PARAMETERS ===
% rs: real solution flag of invkinplan2
% mtyp: 'forw', 'backw', 'alt'
% === OUTPUT RESULTS ======
% nni: mapping index for PL, B1, B2, W, U of invkinplan2
% seg: 0 = closed movement, 1 = one segment, 2 - two segments
%
% EXAMPLE:
% invkinplan2(70,40,[50 -65 0]); [~,~,B1,B2,rs,PL]=invkinplan2(70,40,[50 -65 0]);
% [nni,seg]=realfourbarsolutions(rs,'forw'), PLA=PL(nni(seg==1),:), PLB=PL(nni(seg==2),:)
% PLplot(PLA,'c',4); PLplot(PLB,'y',4); shg;
%
% [~,~,B1,B2,rs,PL]=invkinplan2(70,40,[50 -65 0]);
% [nni,seg]=realfourbarsolutions(rs,'forw'), PLA=PL(nni(seg==1),:), PLB=PL(nni(seg==2),:)
% ns=max(seg); for i=1:ns; PLi=PL(nni(seg==i),:), PLplot(PLi,colofn(i+1,'bcy'),4); end; shg; view(0,90);
%
% See also: miofPLA0B0, invkinplan2
%
%
% Copyright 2019 Tim C. Lueth
miofPLA0B0(PL,A0,B0)- returns the index of the minimal relative angle to the axis between A0 and B0
% miofPLA0B0(PL,A0,B0) - returns the index of the minimal relative angle to the axis between A0 and B0
% (by Tim Lueth, VLFL-Lib, 2019-JAN-14 as class: KINEMATICS AND FRAMES)
%
% This fnctn is used to find the circshift index for the point list of a
% fourbar-linkage. The original PL describes a circle around P0 starting
% at 0 degrees to 360 degrees. However, it makes more sense to rotate the
% PL relative to the axis A0B0. Therefore all results of invkinplan2 have
% to be circshifted.
% This auxiliary fnctn is used in fourBarLinkageplotanim. (Status of:
% 2019-01-16)
%
% Introduced first in SolidGeometry 4.4
%
% See also: invkinplan2, fourBarLinkageplotanim
%
% mi=miofPLA0B0(PL,A0,B0)
% === INPUT PARAMETERS ===
% PL: Point List (A1) of a fourbar linkage
% A0: Base Point A0
% B0: Base Point B0
% === OUTPUT RESULTS ======
% mi: shift index for PL=circshift(PL,-mi)
%
% EXAMPLE:
% miofPLA0B0(PLcircle(10),[0 0],[10 10])
% miofPLA0B0(PLcircle(10)+[5 4],[5 4],[10 10])
% % mi=miofPLA0B0(PL,A0,B0); PL=circshift(PL,-mi); B1=circshift(B1,-mi);
%
%
% See also: invkinplan2, fourBarLinkageplotanim
%
%
% Copyright 2019 Tim C. Lueth
checkfourbarcouplerlength(B1,B2,PL,l2chk,tol)- checks the solutions of invkinplan2 for a fourbar linkage calculation
% checkfourbarcouplerlength(B1,B2,PL,l2chk,tol) - checks the solutions of invkinplan2 for a fourbar linkage calculation
% (by Tim Lueth, VLFL-Lib, 2019-JAN-13 as class: KINEMATICS AND FRAMES)
%
% for some unexpected and unclear reasons, the inverse kinematic
% equations have some numerical instability. This fnctn was implemented
% and is used within invkinplan2 to warn if the calculations contains
% numerical errors. (Status of: 2019-01-13)
%
% Introduced first in SolidGeometry 4.4
%
% See also: invkinplan2
%
% [ok,ind1,ind2,err,r1,r2]=checkfourbarcouplerlength(B1,B2,PL,[l2chk,tol])
% === INPUT PARAMETERS ===
% B1: REAL Solutions of joint 1 configuration ellbow down
% B2: REAL Solutions of joint 1 configuration ellbow up
% PL: REAL Point list for TCP
% l2chk: expected length of link 2
% tol: tolerance default is 1e-7 , i.e. eps2
% === OUTPUT RESULTS ======
% ok: true of there is no problem
% ind1: index of B1 with problem
% ind2: index of B2 with problem
% err: maximum accoured error
% r1: average link length l2 for configuration ellbow down
% r2: average link length l2 for configuration ellbow up
%
% EXAMPLE:
% [~,~,B1,B2,rs,PL]=invkinplan2(70,40,[40 -110 0 120]); B1=B1(rs,:); B2=B2(rs,:); PL=PL(rs,:); checkfourbarcouplerlength(B1,B2,PL,40)
%
% See also: invkinplan2
%
%
% Copyright 2019 Tim C. Lueth
center3Poseconditions(S,)- returns a reduced Solution matrix for the given S values of
% center3Poseconditions(S,) - returns a reduced Solution matrix for the given S values of
% (by Tim Lueth, VLFL-Lib, 2019-JAN-13 as class: KINEMATICS AND FRAMES)
%
% =======================================================================
% OBSOLETE (2019-01-26) - USE 'checkfourbar3Posepermutation' INSTEAD
% =======================================================================
%
% The condition independent on the displacement and turning angle are
% Radius - To limit the radius of Crank and Swing
% Area - To define the base point area from the design point of view
%
% The condition that on the displacement and turning angle are
% Pair Distance - To limit the distance of a pair of base points
% Exist 4bar - there exist a fourbar configuration solution
%
% The sequence of 3 Pose synthesis calculation of fourbar linkages is:
% 1. center3Pose - calculates a 3D array of solutions for 3 poses
% 2. center3Poseconditions, - reduces solutions f.e. radius,area
% 3. checkfourbar3Poses - analyses the configuration of the solution
% 4. checkallfourbar3Poses - analyses all solutions's configurations
% The shape of a linkage is created by:
% A) CPLfourbarlinkage - creates 2D contours of the links
% B) CPLgripperjaw - creates 2D contour of a gripper that grasps an object
% and animated by:
% B) fourBarLinkageplot - shows several solutions for two configurations
% C) fourBarLinkageplotanim - animates the movement of a complete contour
% All those fnctns are based on
% invkinplan2 - that calculates both configurations for a planar 2bar
% linkage
% (Status of: 2019-01-26)
%
% Introduced first in SolidGeometry 4.4
%
% See also: [ checkfourbar3Posepermutation ] ; center3Pose,
% checkfourbar3Poses
%
% S=center3Poseconditions(S,[])
% === INPUT PARAMETERS ===
% S: Original Solution list from center3Pose
% === PROPERTY NAMES =====
% 'r' : maximal Radius [Rmax] or [Rmin Rmax] - RED ERRORS
% 'area' : CPL of the allowed area for Centers - BLUE ERRORS
% 'pair' : Distance of base point pairs [dmax] or [dmin dmax]
% === OUTPUT RESULTS ======
% S: Solution list with removed lines that do not fullful the conditions
%
% EXAMPLE:
% PS.A=[-3.88 10.85; -3.88 12.40; 10.08 17.05]; PS.B=[ -2.88 10.85; -2.88 12.40; 11.04 16.79];
% center3Pose(PS.A,PS.B,-10:40); S=ans, CPLplot(CPLsample(4));
% center3Poseconditions(S,'r',[10 60]), CPLplot(CPLsample(4)); Poseplot(PS)
%
% See also: [ checkfourbar3Posepermutation ] ; center3Pose,
% checkfourbar3Poses
%
%
% Copyright 2019 Tim C. Lueth
fourBarLinkageplot(l1,l2,r,A0,np)- plots and animates the movement of a fourbar linkage
% fourBarLinkageplot(l1,l2,r,A0,np) - plots and animates the movement of a fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-JAN-12 as class: VISUALIZATION)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLfourbarlinkage, fourBarLinkageplotanim
%
% h=fourBarLinkageplot([l1,l2,r,A0,np])
% === INPUT PARAMETERS ===
% l1: length of link1 at Base B0
% l2: length of link2 / coupler
% r: radius of crank at Base A0 or Point List around A0
% A0: distance, A0-B0, Position of A0 or List [A0;B0]
% np: number of points on the crank circle
% === OUTPUT RESULTS ======
% h: handle to last graphics objects
%
% EXAMPLE:
% SGfigure; axis([-100 100 -100 100]); h=fourBarLinkageplot (50,70,50,[30 30; 35 35]); shg
% SGfigure; axis([-100 100 -100 100]); h=fourBarLinkageplot (50,70,50,[30 30; 35 35],10); shg
% SGfigure; axis([-100 100 -100 100]); h=fourBarLinkageplot (100,70,40,100,50); shg
% SGfigure; fourBarLinkageplot(4,4,PLcircle(3,3)+[-4 0]); shg
%
% See also: CPLfourbarlinkage, fourBarLinkageplotanim
%
%
% Copyright 2019 Tim C. Lueth
fourBarLinkageplotanim(l1,l2,r,A0,tmove,elup,transl,ka)- plots and animates the movement of a fourbar linkage
% fourBarLinkageplotanim(l1,l2,r,A0,tmove,elup,transl,ka) - plots and animates the movement of a fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2019-JAN-12 as class: VISUALIZATION)
%
% 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: 2019-01-26)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLfourbarlinkage, fourBarLinkageplot, CPLfourbarlinkage2
%
% h=fourBarLinkageplotanim([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]
% === 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; fourBarLinkageplotanim(70,40,40,[0 0; 0 110]);
%
% See also: CPLfourbarlinkage, fourBarLinkageplot, CPLfourbarlinkage2
%
%
% Copyright 2019 Tim C. Lueth
checkallfourbar3Poses(A,B,Sall,CPL)- checks whether a fourbar joint solution exists for results of center3Pose
% checkallfourbar3Poses(A,B,Sall,CPL) - checks whether a fourbar joint solution exists for results of center3Pose
% (by Tim Lueth, VLFL-Lib, 2019-JAN-10 as class: KINEMATICS AND FRAMES)
%
% =======================================================================
% OBSOLETE (2019-01-26) - USE 'checkfourbar3Posepermutation' INSTEAD
% =======================================================================
%
% 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
%
% The sequence of 3 Pose synthesis calculation of fourbar linkages is:
% 1. center3Pose - calculates a 3D array of solutions for 3 poses
% 2. center3Poseconditions, - reduces solutions f.e. radius,area
% 3. checkfourbar3Poses - analyses the configuration of the solution
% 4. checkallfourbar3Poses - analyses all solutions's configurations
% The shape of a linkage is created by:
% A) CPLfourbarlinkage - creates 2D contours of the links
% B) CPLgripperjaw - creates 2D contour of a gripper that grasps an object
% and animated by:
% B) fourBarLinkageplot - shows several solutions for two configurations
% C) fourBarLinkageplotanim - animates the movement of a complete contour
% All those fnctns are based on
% invkinplan2 - that calculates both configurations for a planar 2bar
% linkage
%
% (Status of: 2019-01-24)
%
% Introduced first in SolidGeometry 4.4
%
% See also: [ checkfourbar3Posepermutation ] ; center3Pose,
% checkfourbar3Pose, Posesample, Poseplot, TofPose, Posenorm, Poseui
%
% [C,SNN]=checkallfourbar3Poses(A,B,Sall,[CPL])
% === INPUT PARAMETERS ===
% A: Starting Points of 3 Poses
% B: Ending Points of 3 Poses
% Sall: Solutions comming from center3Pose
% CPL: selected pair of distance and angle
% === OUTPUT RESULTS ======
% C: configuration for pose of a fourbar linkage
% SNN:
%
% 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: [ checkfourbar3Posepermutation ] ; center3Pose,
% checkfourbar3Pose, Posesample, Poseplot, TofPose, Posenorm, Poseui
%
%
% Copyright 2019 Tim C. Lueth
TofPose(Pose,B)- returns 3x3 HT matrices for planar transformation in 2D from pose list
% TofPose(Pose,B) - returns 3x3 HT matrices for planar transformation in 2D from pose list
% (by Tim Lueth, VLFL-Lib, 2019-JAN-05 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: Posesample, Poseplot, Posenorm, Poseui, center3Pose,
% checkfourbar3Pose, poseofPSanalyze
%
% Ti=TofPose(Pose,[B])
% === INPUT PARAMETERS ===
% Pose: Either structu unsing PS.A and PS.B or Point list [n x 2]
% B: Either empty Pose end points as Point list [n x 2]
% === OUTPUT RESULTS ======
% Ti: Transformation Matrix from each Pose; ex = B(i,:)-A(i,:)
%
% EXAMPLE:
% Pose=Posesample(7), TofPose(Pose.A,Pose.B)
%
% See also: Posesample, Poseplot, Posenorm, Poseui, center3Pose,
% checkfourbar3Pose, poseofPSanalyze
%
%
% Copyright 2019 Tim C. Lueth
Posenorm(PS,l,ka)- changes the length of pose vectors to a common length and shifts the start point
% Posenorm(PS,l,ka) - changes the length of pose vectors to a common length and shifts the start point
% (by Tim Lueth, VLFL-Lib, 2019-JAN-05 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: Posesample, Poseplot, TofPose, Poseui, center3Pose,
% checkfourbar3Pose
%
% [PS,e,o]=Posenorm(PS,[l,ka])
% === INPUT PARAMETERS ===
% PS: Pose.A and Pose.B
% l: desired length; default is 1
% ka: starting offset relative to A
% === OUTPUT RESULTS ======
% PS: Adjusted Pose.A and Pose.B
% e: direction vector
% o: orthogonal vector
%
% EXAMPLE:
% Posenorm(Posesample(7))
% Posenorm(Posesample(7),10)
% Posenorm(Posesample(7),10,-10)
% [a,b,c]=Posenorm(PS,10)
%
% See also: Posesample, Poseplot, TofPose, Poseui, center3Pose,
% checkfourbar3Pose
%
%
% Copyright 2019 Tim C. Lueth
Poseui(m,res,ax)- returns a pose struct
% Poseui(m,res,ax) - returns a pose struct
% (by Tim Lueth, VLFL-Lib, 2019-JAN-05 as class: USER INTERFACE)
%
% Pose.A = Start Points of pose
% Pose.B = End Points of pose (Status of: 2019-01-05)
%
% Introduced first in SolidGeometry 4.4
%
% See also: Posesample, Poseplot, TofPose, Posenorm, center3Pose,
% checkfourbar3Pose
%
% Pose=Poseui([m,res,ax])
% === INPUT PARAMETERS ===
% m: number of poses; default is 3
% res: resolution; default is 2% of sofBB
% ax: axis; default is unchanged
% === OUTPUT RESULTS ======
% Pose: Pose.A = Start Points of pose, Pose.B = End Points of pose
%
% EXAMPLE:
% CPLsample(4); Poseui('',1)
%
% See also: Posesample, Poseplot, TofPose, Posenorm, center3Pose,
% checkfourbar3Pose
%
%
% Copyright 2019 Tim C. Lueth
Poseplot(PS,l,col,CPLP,k,ts)- plots a pose struct
% Poseplot(PS,l,col,CPLP,k,ts) - plots a pose struct
% (by Tim Lueth, VLFL-Lib, 2019-JAN-02 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: Posesample, TofPose, Posenorm, Poseui, center3Pose,
% checkfourbar3Pose, poseofPSanalyze
%
% h=Poseplot(PS,[l,col,CPLP,k,ts])
% === INPUT PARAMETERS ===
% PS: PS.A = Starting Points, PS.B = End Points
% l: optional length
% col: optional color
% CPLP: optional shape contour
% k: displacement along axis; default is 0
% ts: text size of descriptor; default is 0
% === OUTPUT RESULTS ======
% h: handle to plot
%
% EXAMPLE:
% PS=Posesample(1); SGfigure; Poseplot(PS);
% close all; Poseplot(Posesample(10),100,'r-*',PLcircle(5),5,16); pause(1); delete(ans)
%
% See also: Posesample, TofPose, Posenorm, Poseui, center3Pose,
% checkfourbar3Pose, poseofPSanalyze
%
%
% Copyright 2019 Tim C. Lueth
Posesample(n)- creates sample poses for the pose syntheses of linkages
% Posesample(n) - creates sample poses for the pose syntheses of linkages
% (by Tim Lueth, VLFL-Lib, 2019-JAN-02 as class: KINEMATICS AND FRAMES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLoftext, CPLsample, SGsample, VLsample, PLsample,
% VLFLsample, CSGsample, SGerrorsample, SGfischertechniksample,
% SGcmdsample, testfunctTL, permutevector
%
% PS=Posesample([n])
% === INPUT PARAMETERS ===
% n: selection number
% === OUTPUT RESULTS ======
% PS: PS.A = list of start point; PS.B=list of end points
%
% EXAMPLE:
% Posesample
% Posesample(1)
%
% See also: CPLoftext, CPLsample, SGsample, VLsample, PLsample,
% VLFLsample, CSGsample, SGerrorsample, SGfischertechniksample,
% SGcmdsample, testfunctTL, permutevector
%
%
% Copyright 2019 Tim C. Lueth
checkfourbar3Pose(A,B,S,dws,k,pl)- checks whether a fourbar joint solution exists for results of center3Pose
% checkfourbar3Pose(A,B,S,dws,k,pl) - checks whether a fourbar joint solution exists for results of center3Pose
% (by Tim Lueth, VLFL-Lib, 2019-JAN-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-01-31)
%
% Introduced first in SolidGeometry 4.4
%
% See also: checkfourbarsegment, center3Pose, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
% [ci,s,ord,corg]=checkfourbar3Pose(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
% s: rotation segment for earch pose
% ord: movement order of poses; right-hand-rule
% corg: original configuration for each pose
%
% EXAMPLE:
% PS=Posesample(7);
% center3Pose(PS.A,PS.B,[0 1],0,0); S=ans, CPLplot(CPLsample(4)); checkfourbar3Pose(PS.A,PS.B,S)
% center3Pose(PS.A,PS.B,[0 3],0,0); S=ans, CPLplot(CPLsample(4)); checkfourbar3Pose(PS.A,PS.B,S)
% center3Pose(PS.A,PS.B,[-3 3],0,0); S=ans, CPLplot(CPLsample(4)); checkfourbar3Pose(PS.A,PS.B,S)
%
% See also: checkfourbarsegment, center3Pose, Posesample, Poseplot,
% TofPose, Posenorm, Poseui
%
%
% Copyright 2019 Tim C. Lueth
center3Pose(A,B,k,dall,wall,CPL);- return center points for 3 poses (position and orientation)
% center3Pose(A,B,k,dall,wall,CPL); - return center points for 3 poses (position and orientation)
% (by Tim Lueth, VLFL-Lib, 2019-JAN-01 as class: ANALYTICAL GEOMETRY)
%
% 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;
% 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-19)
%
% Introduced first in SolidGeometry 4.4
%
% See also: center3P, center3Poseconditions, checkfourbar3Pose,
% checkallfourbar3Poses, Posesample, Poseplot, TofPose, Posenorm, Poseui
%
% [S,rs,Sall,PSall,dw]=center3Pose([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:
% k=-2:0.2:2; center3Pose([0 0;6 0; 6 5],'',k)
% close all; k=-10:0.4:10; center3Pose([0 0;6 0; 6 5],'',k'); S=ans
% close all; center3Pose('','',-30:30,'','',PLsquare(10,8)+[-10 0]); S=ans
%
% See also: center3P, center3Poseconditions, checkfourbar3Pose,
% checkallfourbar3Poses, Posesample, Poseplot, TofPose, Posenorm, Poseui
%
%
% Copyright 2019 Tim C. Lueth
BBofPS(ps)- returns the bounding box of a polyshape
% BBofPS(ps) - returns the bounding box of a polyshape
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-31 as class: CLOSED POLYGON LISTS)
%
% 2018a - faster than the matlab implementation (Status of: 2018-12-31)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPL, BBofSGcutT
%
% bb=BBofPS(ps)
% === INPUT PARAMETERS ===
% ps: polyshape
% === OUTPUT RESULTS ======
% bb: bounding box
%
% EXAMPLE:
% ps=polyshape(CPLsample(33)); plot(ps)
% BBofPS(ps)
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPL, BBofSGcutT
%
%
% Copyright 2018 Tim C. Lueth
PSanalyze(ps)- classifies the polyshapes regions outer boundaries into equal shapes
% PSanalyze(ps) - classifies the polyshapes regions outer boundaries into equal shapes
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: CLOSED POLYGON LISTS)
%
% The polyshape is recursively separated into regions.
% S.id = identifier
% S.T = HT matrix
% S.ps = polyshape region
% S.cs = polyshape centerted at origin
% S.bs = polyshape region outer boundary (Status of: 2019-01-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: BBofPS, poseofPSanalyze
%
% S=PSanalyze([ps])
% === INPUT PARAMETERS ===
% ps: Polyshape
% === OUTPUT RESULTS ======
% S: struct containing each region
%
% EXAMPLE:
% SGfigure; load ('fourbar4Pose.mat'); cla; plot(ps); shg
% PSanalyze; S=ans
%
% See also: BBofPS, poseofPSanalyze
%
%
% Copyright 2018-2019 Tim C. Lueth
class2cell(objs)- converts an array of a class into a cell list of the same type
% class2cell(objs) - converts an array of a class into a cell list of the same type
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: get, elem2array, arrayof, cell2class, array2cell
%
% c=class2cell(objs)
% === INPUT PARAMETERS ===
% objs: object array of a class
% === OUTPUT RESULTS ======
% c: cell list of the class array
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps) % array of polyshape
% ps, cell2class(class2cell(ps))
%
% See also: get, elem2array, arrayof, cell2class, array2cell
%
%
% Copyright 2018 Tim C. Lueth
cell2class(cells)- converts a cell list of elements of the same class into an array of this class
% cell2class(cells) - converts a cell list of elements of the same class into an array of this class
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: AUXILIARY PROCEDURES)
%
% In more and more cases, the get command of matlab returns cell lists of
% specific classes, but the methods of those classes are unable to
% process cell lists. Therefor this fnctn converts a cell list into an
% array of the class type (Status of: 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: get, elem2array, arrayof, class2cell, array2cell
%
% x=cell2class(cells)
% === INPUT PARAMETERS ===
% cells: cell list of any class type
% === OUTPUT RESULTS ======
% x: resulting array of the class type
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); h=findobj(gca,'type','polygon')
% a=get(h,'Shape'), x=cell2class(a)
% cla; plot(x); shg
%
% See also: get, elem2array, arrayof, class2cell, array2cell
%
%
% Copyright 2018 Tim C. Lueth
elem2array(elem)- converts elements of a list into an array
% elem2array(elem) - converts elements of a list into an array
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: AUXILIARY PROCEDURES)
%
% 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: 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: get, arrayof, cell2class, class2cell, array2cell
%
% vec=elem2array([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: get, arrayof, cell2class, class2cell, array2cell
%
%
% Copyright 2018 Tim C. Lueth
arrayof(cobj,r,c)- returns an array of a class object
% arrayof(cobj,r,c) - returns an array of a class object
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: LANGUAGE PROCEDURES)
%
% Some class objects such as polyshape (2017b) are created by simply
% using the class name
% Nevertheless arrays of such objects have to be created by the repmat
% fnctn.
% Typically the matlab convention is <type>(<rows>,<cols>) for creating
% arrays for example
% zeros(20,3) or ones (10,10,10) or nan (4)
% This fnctn support the same conventions for class objects (Status of:
% 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: repmat, elem2array, cell2class, class2cell, array2cell
%
% clarr=arrayof(cobj,[r,c])
% === INPUT PARAMETERS ===
% cobj: class object
% r: rows
% c: cols
% === OUTPUT RESULTS ======
% clarr: array of class objects
%
% EXAMPLE:
% arrayof(polyshape,1,4)
% arrayof(polyshape,2)
% arrayof(polyshape,4,1)
%
% See also: repmat, elem2array, cell2class, class2cell, array2cell
%
%
% Copyright 2018 Tim C. Lueth
PSregions(PS)- returns the regions of a polyshape
% PSregions(PS) - returns the regions of a polyshape
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-30 as class: CLOSED POLYGON LISTS)
%
% This fnctn extends the concept of regions of a polyshape which is
% available only for scalar polyshapes to arrays and cells of polyshape.
% SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps),
% r=regions(ps) % fails!
% create polyshape arrays: (Status of: 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: PSofgca
%
% PSR=PSregions(PS)
% === INPUT PARAMETERS ===
% PS:
% === OUTPUT RESULTS ======
% PSR:
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps) % array of polyshape
% ps, ps=regions(ps); % fails
% ps=PSregions(ps) % works
%
% See also: PSofgca
%
%
% Copyright 2018 Tim C. Lueth
PSplot(ps,)- plots a polyshape but also a cell list of polyshapes
% PSplot(ps,) - plots a polyshape but also a cell list of polyshapes
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-29 as class: VISUALIZATION)
%
% This fnctn is required since currently the concept of polygon arrays
% and polyshape arrays seems to have less methods than the cell concept
% isa(ps,'polyshape'), isa(ps,'polygon') (Status of: 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: plot, PLplot, CPLplotasPS
%
% h=PSplot(ps,[])
% === INPUT PARAMETERS ===
% ps: polyshape or list of polyshapes
% === OUTPUT RESULTS ======
% h: handle to plat, ie. polygons
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14));
% ps=PSofgca(true)
% cla; PSplot(ps)
%
% See also: plot, PLplot, CPLplotasPS
%
%
% Copyright 2018 Tim C. Lueth
PSofgca(nocells)- return the polygons of current axis as polyshape(s)
% PSofgca(nocells) - return the polygons of current axis as polyshape(s)
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-29 as class: CLOSED POLYGON LISTS)
%
% This fnctn is required since currently the concept of polygon arrays
% and polyshape arrays seems to have less methods than the cell concept
% (Status of: 2018-12-29)
%
% Introduced first in SolidGeometry 4.4
%
% See also: VLFLofgca, VLofgca, SGofgca
%
% [ps,CPL]=PSofgca([nocells])
% === INPUT PARAMETERS ===
% nocells: false = separated as cells; true = only on polyspahe
% === OUTPUT RESULTS ======
% ps: polyshape of current axis
% CPL: closed polygon line of ps
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(34));
% PSofgca
%
% See also: VLFLofgca, VLofgca, SGofgca
%
%
% Copyright 2018 Tim C. Lueth
TofPL(PL)- returns a 2D HT matrix for a point list
% TofPL(PL) - returns a 2D HT matrix for a point list
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-28 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.4
%
% See also: TofR, TofVL, TPL, TofDPhiH, T3ofT2, T3P, T2P, TofP
%
% T=TofPL(PL)
% === INPUT PARAMETERS ===
% PL: Point list
% === OUTPUT RESULTS ======
% T: 3x3 HT matrix
%
% EXAMPLE:
% TofPL(CPLsample(14))
%
% See also: TofR, TofVL, TPL, TofDPhiH, T3ofT2, T3P, T2P, TofP
%
%
% Copyright 2018 Tim C. Lueth
array2cell()- convert object arrays into cell arrays
% array2cell() - convert object arrays into cell arrays
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-28 as class: AUXILIARY PROCEDURES)
%
% % 2018-12-28 by Tim Lueth
% fnctn c=array2cell(varargin)
%
% c=varargin';
%
% (Status of: 2018-12-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: get, elem2array, arrayof, cell2class, class2cell
%
% c=array2cell([])
% === OUTPUT RESULTS ======
% c:
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps) % array of polyshape
% ps, array2cell(ps)
%
% See also: get, elem2array, arrayof, cell2class, class2cell
%
%
% Copyright 2018 Tim C. Lueth
CPLofpolyshape(ps,ascell)- creates a CPL from an array of polyshapes
% CPLofpolyshape(ps,ascell) - creates a CPL from an array of polyshapes
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-28 as class: CLOSED POLYGON LISTS)
%
% for simple polyshapes it is possible to use ps.Vertices but for arrays
% of polyshapes, this fnctn is required (Status of: 2019-02-01)
%
% Introduced first in SolidGeometry 4.4
%
% See also: polyshape, CPLofPolygon
%
%
% CPL=CPLofpolyshape(ps,[ascell])
% === INPUT PARAMETERS ===
% ps: polyshape
% ascell: returns polyshape array elements as cell list
% === OUTPUT RESULTS ======
% CPL: CPL
%
% EXAMPLE:
% a=polyshape(PLcircle(10)), CPLofpolyshape(a)
%
% a=polyshape([PLcircle(4);nan nan;PLcircle(3)+[3 3]]); a=regions(a)
% CPLofpolyshape(a)
% CPLofpolyshape(a,true)
%
% See also: polyshape, CPLofPolygon
%
%
%
% Copyright 2018-2019 Tim C. Lueth
uipolygoncontextmenu- create the ui context menu for polygon
% uipolygoncontextmenu - create the ui context menu for polygon
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-27 as class: USER INTERFACE)
%
% This fnctn makes shure that the ui contect menu for polygons is the
% same for all polygons
% This fnctn is used by uipolygonSelectWindowButtonUp
% (Status of: 2018-12-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: uipolygonSelectWindowButtonUp,
% uipolygonmoveWindowButtonDownFcn, uipolygonselect
%
% cm=uipolygoncontextmenu
% === OUTPUT RESULTS ======
% cm: context menu
%
% EXAMPLE:
% h=findobj(gca,'Type','polygon','selected','on');
% cm=uipolygoncontextmenu; set(h,'UIContextMenu',cm);
%
%
%
% See also: uipolygonSelectWindowButtonUp,
% uipolygonmoveWindowButtonDownFcn, uipolygonselect
%
%
% Copyright 2018 Tim C. Lueth
uipolygonSelectWindowButtonUp(srch,cbdat)- MAIN CALLBACK FUNCT for a figure to make polygons movable if rotate3d is off
% uipolygonSelectWindowButtonUp(srch,cbdat) - MAIN CALLBACK FUNCT for a figure to make polygons movable if rotate3d is off
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-27 as class: USER INTERFACE)
%
% The concepts works as follows if rotate3d is off (mandatory):
% This callback fnctn uipolygonSelectWindowButtonUp is the Mouse Button
% Up fnctn and
% - deselects all polygons in the current figure BY CLICKING SOMEWHERE
% WHERE THERE IS NO POLYGON
% - select all polygons in the current figure BY DOUBLE CLICKING NEAR
% POLYGONS
% Selecting a polygon means:
% 1. show the selected mode; points a marked
% 2. Attach the fnctn uipolygonmoveWindowButtonDownFcn as Mouse Button
% Down fnctn to those polygons
% 3. A UIContextMenu is attached inside the fnctn
% uipolygonmoveWindowButtonDownFcn to polygons
% Deselecting a polygon means:
% 1. show the unselected mode; no points are marked
% 2. Remove the fnctn uipolygonmoveWindowButtonDownFcn as Mouse Button
% Down fnctn of those polygons
% 3. Still have the UIContextMenu existing
% HOW TO USE THESE FNCTNS
% Just add this fnctn as Button up fnctn to a figure window AFTER
% deselecting rotate3d
% rotate3d off;
% set(gcf,'WindowButtonUpFcn',@uipolygonSelectWindowButtonUp)
% Now, it is possible to select and move polygons.
% FUTURE:
% a) This concept could be extended to CPLs and CVL and SG
% b) the UIContextMenu could be extended to modify the shape by
% stretching/shrinking a polygon
% c) the UIContextMenu could be extended to add or remove points of a
% polygon
% d) the UIContextMenu could be extended to move points of a polygon
% (Status of: 2018-12-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: uipolygoncontextmenu, uipolygonmoveWindowButtonDownFcn
%
% uipolygonSelectWindowButtonUp(srch,cbdat)
% === INPUT PARAMETERS ===
% srch: source handle - not used yet
% cbdat: call back data - not used yet
%
% EXAMPLE:
% SGfigure; hold on; plot(polyshape(PLcircle(10,4))); plot(polyshape(PLcircle(10,8)+20));
% rotate3d off; set(gcf,'WindowButtonUpFcn',@uipolygonSelectWindowButtonUp)
%
% See also: uipolygoncontextmenu, uipolygonmoveWindowButtonDownFcn
%
%
% Copyright 2018 Tim C. Lueth
uipolygonmoveWindowButtonDownFcn(h,st)- callback fnct and interactive fnct to move and rotate polygons and to attach ui context menu
% uipolygonmoveWindowButtonDownFcn(h,st) - callback fnct and interactive fnct to move and rotate polygons and to attach ui context menu
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-26 as class: USER INTERFACE)
%
% This fnctn is typically installed automatically as callback fnctn for
% polygons by the figure fnctn uipolygonSelectWindowButtonUp.
%
% This fnctn can be used to move a polygon from the command line or to
% attach it as callback fnctn to a polygon (Status of: 2018-12-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: uipolygonSelectWindowButtonUp, uipolygoncontextmenu,
% uipolygonselect
%
% [h,hp]=uipolygonmoveWindowButtonDownFcn(h,st)
% === INPUT PARAMETERS ===
% h: calling fnctn
% st: calling event
% === OUTPUT RESULTS ======
% h: handle to polygon
% hp: gandle to all polygons
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14)); h=uipolygonselect([0 0 ]); set(h,'Selected','on');
% h=findobj(gca,'Type','polygon','selected','on'); set(h,'ButtonDownFcn',@uipolygonmoveWindowButtonDownFcn);
% rotate3d off
%
% See also: uipolygonSelectWindowButtonUp, uipolygoncontextmenu,
% uipolygonselect
%
%
% Copyright 2018 Tim C. Lueth
uipolygonselect(p)- returns the handles of the polygon near a point or the cursor position
% uipolygonselect(p) - returns the handles of the polygon near a point or the cursor position
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-26 as class: USER INTERFACE)
%
% This fnctn can be called to get the handles of polygons near the cursor
% or a point.
% It is possible to call the fnctn manually similar to select3d by
% ginput(1); uipolygonselect
% This fnctn is used in may callback fnctns (Status of: 2018-12-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: uipolygonSelectWindowButtonUp, uipolygoncontextmenu,
% uipolygonmoveWindowButtonDownFcn
%
% [h,hp,pins,pnv]=uipolygonselect(p)
% === INPUT PARAMETERS ===
% p: explicit point or use cursor position if p is empty
% === OUTPUT RESULTS ======
% h: handle of relative polygons
% hp: handle of all polygons
% pins: polygons in which p is located
% pnv: polygons, pi is near a vertex
%
% EXAMPLE:
% SGfigure; CPLplotasPS(CPLsample(14));
% uipolygonselect([10 -20]) % nothing to select
% uipolygonselect([10 -2]) % inside
% uipolygonselect % Checks current cursor position
% ginput(1); uipolygonselect % asks first for crosshair selction
%
%
% See also: uipolygonSelectWindowButtonUp, uipolygoncontextmenu,
% uipolygonmoveWindowButtonDownFcn
%
%
% Copyright 2018 Tim C. Lueth
CPLofPolygon(h,ascell);- returns the CPL of a graphics object type polygon
% CPLofPolygon(h,ascell); - returns the CPL of a graphics object type polygon
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-26 as class: CLOSED POLYGON LISTS)
%
% Auxiliary fnctn to convert the polygon graphics object handle into a
% CPL. Used in interactive fnctns such as uipolygoncontextmenu. (Status
% of: 2019-01-31)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLofpolyshape, uipolygoncontextmenu
%
% CPL=CPLofPolygon(h,[ascell]);
% === INPUT PARAMETERS ===
% h: handle to polygon
% ascell: if return as cell list or as array
% === OUTPUT RESULTS ======
% CPL: Closed Polygon line
%
% EXAMPLE:
% h=plot(polyshape(PLcircle(4)))
% CPLofPolygon(h)
% h=plot(polyshape([PLcircle(4);nan nan; PLcircle(4)+[5 5]])); shg
% CPLofPolygon(h)
%
% See also: CPLofpolyshape, uipolygoncontextmenu
%
%
% Copyright 2018-2019 Tim C. Lueth
CPLplotasPS(CPL,simp)- plots a CPL as polyshape using the plot(polyshape(CPL)) command
% CPLplotasPS(CPL,simp) - plots a CPL as polyshape using the plot(polyshape(CPL)) command
% (by Tim Lueth, Video-Lib, 2018-DEZ-26 as class: CLOSED POLYGON LISTS)
%
% plots as CPL as polyshape (simplify==false) instead of a contour line
% (Status of: 2018-12-26)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLplot, CPLfaceplot, CPLplotregions, CPLplotcolors,
% CPLplotinout
%
% h=CPLplotasPS(CPL,[simp])
% === INPUT PARAMETERS ===
% CPL: closed polygon line
% simp: true for simplify; false=unmodified; default is true;
% === OUTPUT RESULTS ======
% h: handle
%
% EXAMPLE: SGfigure;
% CPLplotasPS(CPLsample(14));
% CPLplotasPS(CPLsample(16));
%
% See also: CPLplot, CPLfaceplot, CPLplotregions, CPLplotcolors,
% CPLplotinout
%
%
% Copyright 2018 Tim C. Lueth
CPLplotinout(CPL,col)- plots the CPLs in colors depending in the enclosure level
% CPLplotinout(CPL,col) - plots the CPLs in colors depending in the enclosure level
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-23 as class: CLOSED POLYGON LISTS)
%
% plots the enclosing level using the colorstring 'rbgymcwk'
%
% (Status of: 2018-12-23)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLplot, CPLplotcolors, CPLplotregions
%
% h=CPLplotinout(CPL,[col])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon line
% col: line type; first char (color) is ignored
% === OUTPUT RESULTS ======
% h: handle to plot
%
% EXAMPLE:
% SGfigure; CPLplotinout(CPLsample(14))
% SGfigure; CPLplotinout(CPLsample(14),'?-.')
% SGfigure; CPLplotinout(CPLsample(14),'?-.',4)
%
% See also: CPLplot, CPLplotcolors, CPLplotregions
%
%
% Copyright 2018 Tim C. Lueth
exp_2018_12_22_CPL2CPLchain(CPL);- EXPERIMENT to analyze a CPL to identify links and revolute joints of a mechanism
% exp_2018_12_22_CPL2CPLchain(CPL); - EXPERIMENT to analyze a CPL to identify links and revolute joints of a mechanism
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-22 as class: EXPERIMENTS)
%
% This fnctn takes over the 2D sketch of a joint kinematics as CPL and
% analyzes the pivot points from the overlapping contours as well as the
% kinematic chain as edge list and the contours of three pins.
% The result are four strutures
% CCPL contains the contours of the links = [Outer contour; nan nan; base
% contour; nan nan; joint contour]
% EL contains a sorted edge list of the links that represents the
% kinematic chain
% DCPL it the shape of the connecting axis
% lm are the centers of the axis (Status of: 2018-12-24)
%
% Introduced first in SolidGeometry 4.4
%
% [CCPL,EL,DCPL,lm]=exp_2018_12_22_CPL2CPLchain([CPL]);
% === INPUT PARAMETERS ===
% CPL): CLosed Polygon line
% === OUTPUT RESULTS ======
% CCPL: cell list of link structures
% EL: edge list to connect the links
% DCPL: shape of the connecting joints
% lm: centers of the contours
%
% EXAMPLE:
% [~,~,~,CPL]=CPLfourbarlinkage('','','','',[0.2 20],'',CPLsample(34)*10);
% exp_2018_12_22_CPL2CPLchain(CPL)
%
%
% Copyright 2018 Tim C. Lueth
exp_2018_12_20_cuttingshape(k,rp,b,CPLT,CPLX)- EXPERIMENT to automatically cut a shape to fit into another shape during 4bar movement
% exp_2018_12_20_cuttingshape(k,rp,b,CPLT,CPLX) - EXPERIMENT to automatically cut a shape to fit into another shape during 4bar movement
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-20 as class: EXPERIMENTS)
%
% This fnctn rotates a Contour CPLT with a four-bar-linkage and cuts the
% contour so that a specified polygon CPLX is not left.
% (Status of: 2018-12-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_18_walking,
% exp_2018_12_19_walkingshape
%
% CPLT=exp_2018_12_20_cuttingshape([k,rp,b,CPLT,CPLX])
% === INPUT PARAMETERS ===
% k: position along the couple length of POI [0..1, 0..1]
% rp: radius relation to l1+l2
% b: base point [0 .. 1) with respect to minmal and maximal distance
% CPLT: Moving Contour attached to POI
% CPLX: Crossing Contour that limits the shape of CPLT
% === OUTPUT RESULTS ======
% CPLT: Optimized Contour that with maximum area within CPLX
%
% EXAMPLE:
% exp_2018_12_20_cuttingshape; a=ans
% exp_2018_12_20_cuttingshape('','','',a); b=ans
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_18_walking,
% exp_2018_12_19_walkingshape
%
%
% Copyright 2018 Tim C. Lueth
im2vec(Iset)- simply converts/reshapes an image into a 1 x n vector
% im2vec(Iset) - simply converts/reshapes an image into a 1 x n vector
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-19 as class: IMAGES)
%
% Introduced first in SolidGeometry 4.4
%
% Vec=im2vec(Iset)
% === INPUT PARAMETERS ===
% Iset: Image
% === OUTPUT RESULTS ======
% Vec: Vector
%
% EXAMPLE:
% imread('corn.tif',3); I=ans; whos I
% V=im2vec(I);
% whos V
%
%
% Copyright 2018-2019 Tim C. Lueth
exp_2018_12_19_walkingshape(k,rp,b,CPLT)- EXPERIMENT to show the swept hull of the links
% exp_2018_12_19_walkingshape(k,rp,b,CPLT) - EXPERIMENT to show the swept hull of the links
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-19 as class: EXPERIMENTS)
%
% This fnctn shows the swept area of a circumferential four bar linkage.
% (Status of: 2018-12-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: exp_2018_12_18_walking, exp_2018_12_20_cuttingshape,
% exp_2018_12_22_CPL2CPLchain
%
% [A,B,C,D,a,b,c,d]=exp_2018_12_19_walkingshape([k,rp,b,CPLT])
% === INPUT PARAMETERS ===
% k: position of the foot relative to the 4bar
% rp: radius of the crank relative to link 1
% b: position of base between minimum and maximum value
% CPLT: Contour attached to c
% === OUTPUT RESULTS ======
% A: Area touched by link 1
% B: Area touched by link 2
% C: Area touched by crank
% D: Area touched by contour CPLT
% a:
% b:
% c:
%
% EXAMPLE:
% exp_2018_12_19_walkingshape
% [~,~,~,~,a,b,c,d,]=exp_2018_12_19_walkingshape('',0.4)
% exp_2018_12_22_CPL2CPLchain([a;nan nan;c;nan nan;CPLmeltbool([b;nan nan;d])]);
%
% See also: exp_2018_12_18_walking, exp_2018_12_20_cuttingshape,
% exp_2018_12_22_CPL2CPLchain
%
%
% Copyright 2018 Tim C. Lueth
exp_2018_12_18_walking(k,r)- Walking fourbar
% exp_2018_12_18_walking(k,r) - Walking fourbar
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-18 as class: EXPERIMENTS)
%
% This fnctn shows the movement of the crosspoint (POI) of a
% four-bar-linkage (Status of: 2018-12-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_19_walkingshape,
% exp_2018_12_20_cuttingshape
%
% exp_2018_12_18_walking([k,r])
% === INPUT PARAMETERS ===
% k: position of the foot relative to the 4bar
% r: radius of the crank relative to link 1
%
% EXAMPLE:
% exp_2018_12_18_walking(-4)
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_19_walkingshape,
% exp_2018_12_20_cuttingshape
%
%
% Copyright 2018 Tim C. Lueth
CPLfourbarlinkage(P1,P2,P3,P4,P5,CPLX,dw)- creates for a specified fourbar linkage the cpls for crank, coupler, swing
% CPLfourbarlinkage(P1,P2,P3,P4,P5,CPLX,dw) - creates for a specified fourbar linkage the cpls for crank, coupler, swing
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-17 as class: CLOSED POLYGON LISTS)
%
% The same fnctn as the original of 2018-12-17 but in this version P5 has
% the definition from k=0 means P2 and k=norm(P3-P2) means P2 and the
% dimension is in millimeter. Therfore P5 is completely defined in a mm
% coordinate system realative to the coupler point P2 (Status of:
% 2018-12-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: invkinplan2, exp_2012_12_16_plan_2r_rob.mlx,
% exp_2018_12_18_walking, exp_2018_12_19_walkingshape,
% exp_2018_12_20_cuttingshape
%
% [CPL1,CPL2,CPLR,CPL,R12,CPLX,TX,dt]=CPLfourbarlinkage([P1,P2,P3,P4,P5,C
% PLX,dw])
% === INPUT PARAMETERS ===
% P1: Position of Crank Center
% P2: Position of TCP (end of coupler)
% P3: Position of link 1 (start of coupler)
% P4: Position of Base of link 1 (2R robot base)
% P5: Position of POI (0=P3 1= P2) or [POI delta x]
% CPLX: Ro and Ri Outer and inner Radius
% dw: Contour of the Shape linked to POI
% === OUTPUT RESULTS ======
% CPL1: CPL of swing, 2R-robot link 1
% CPL2: CPL of coupler, 2R-robot link 2
% CPLR: CPL of crank, radial position specification
% CPL: complete contour for sweeping
% R12: [Ro and Ri] Outer and inner Radius
% CPLX: CPL of Final Contour
% TX: Final transformation matrix
%
% EXAMPLE:
% CPLfourbarlinkage;
% CPLfourbarlinkage('','','','',0.5);
% CPLfourbarlinkage('','','','',-3);
% CPLfourbarlinkage('','','','',[0.5 20]);
% CPLfourbarlinkage('','','','',[0.5 20],'',CPLsample(34)*10);
%
%
% See also: invkinplan2, exp_2012_12_16_plan_2r_rob.mlx,
% exp_2018_12_18_walking, exp_2018_12_19_walkingshape,
% exp_2018_12_20_cuttingshape
%
%
% Copyright 2018-2019 Tim C. Lueth
exp_2018_12_16_plan_2r_rob- EXPERIMENT to explain relationship between planar 2R-robot and fourbar linkage
% exp_2018_12_16_plan_2r_rob - EXPERIMENT to explain relationship between planar 2R-robot and fourbar linkage
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-16 as class: TUTORIAL)
%
% This LiveScript explains the movements of a four-bar-linkage as the
% movement of a planar 2R robot that has a rotating joint at the
% base/frame point and between each of the two links. In order for the
% robot to become a four-bar linkage, the end point (TCP) of the robot
% must be forced onto a circular path. This requires a rotating crank.
% The TCP of the robot rotates on a circular path and the second link of
% the robot corresponds to the coupling of the four bar linkage. (Status
% of: 2018-12-22)
%
% Introduced first in SolidGeometry 4.4
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_18_walking,
% exp_2018_12_19_walkingshape, exp_2018_12_20_cuttingshape
%
% exp_2018_12_16_plan_2r_rob
%
% See also: exp_2012_12_16_plan_2r_rob.mlx, exp_2018_12_18_walking,
% exp_2018_12_19_walkingshape, exp_2018_12_20_cuttingshape
%
%
% Copyright 2018 Tim C. Lueth
randT(d)- return a random T matrix
% randT(d) - return a random T matrix
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-08 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: randminv
%
% T=randT([d])
% === INPUT PARAMETERS ===
% d: distance from original; default is 10..20
% === OUTPUT RESULTS ======
% T: HT Matrix
%
% EXAMPLE:
% randT
%
% See also: randminv
%
%
% Copyright 2018 Tim C. Lueth
SGshowcolors (n)- shows different colors to understand how to set rgb values
% SGshowcolors (n) - shows different colors to understand how to set rgb values
% (by Tim Lueth, VLFL-Lib, 2018-DEZ-03 as class: VISUALIZATION)
%
% This fnctn was more or less to test different colors of SGwrtiteSTL
% (Status of: 2018-12-04)
%
% Introduced first in SolidGeometry 4.4
%
% See also: camlightTL, VLFLplotlight, SGshadelight
%
% SGshowcolors(n)
% === INPUT PARAMETERS ===
% n:
%
% EXAMPLE: SGshowcolors (2)
% SGshowcolors (3)
% SGshowcolors (4)
%
% See also: camlightTL, VLFLplotlight, SGshadelight
%
%
% Copyright 2018 Tim C. Lueth
VLFL_EXP46- TUTORIAL 46 - Publishable Tutorial for creating a planetary gear using SGofCPLcommand
% VLFL_EXP46 - TUTORIAL 46 - Publishable Tutorial for creating a planetary gear using SGofCPLcommand
% (by Yilun Sun, VLFL-Lib, 2018-NOV-30 as class: TUTORIAL)
%
% Creates a planetary gear using the Solid Geometry Coding Language
% (SGC-Language). The tutorial was created by Yilun Sun.
% (Status of: 2018-12-12)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGofCPLcommand
%
% VLFL_EXP46
%
% See also: SGofCPLcommand
%
SGreadOBJ(FName,mag,check)- reads in an OBJ file
% SGreadOBJ(FName,mag,check) - reads in an OBJ file
% (by Tim Lueth, VLFL-Lib, 2018-NOV-30 as class: FILE HANDLING)
%
% Simply uses VLFLreadOBJ
% Since there are different formats in OBJ files
% currently only the format
% f v1 v2 v3
% and f v1/vn v2/vn v3/vn
% are supported (Status of: 2018-12-03)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGreadSTL, SGwriteSTL, VLFLwriteSTL, VLFLreadSTL, VLFLreadOBJ
%
% SG=SGreadOBJ([FName,mag,check])
% === INPUT PARAMETERS ===
% FName: File Name
% mag: magnification; default is 1
% check: checker; default is false
% === OUTPUT RESULTS ======
% SG: Solid Geometry
%
% See also: SGreadSTL, SGwriteSTL, VLFLwriteSTL, VLFLreadSTL, VLFLreadOBJ
%
%
% Copyright 2018 Tim C. Lueth
rgbofall(x)- return all different methods of matlab into a rgb set as type double
% rgbofall(x) - return all different methods of matlab into a rgb set as type double
% (by Tim Lueth, VLFL-Lib, 2018-NOV-29 as class: VISUALIZATION)
%
% Introduced first in SolidGeometry 4.4
%
% See also: rgb2char, char2rgb, rgb2bgr16
%
% rgb=rgbofall(x)
% === INPUT PARAMETERS ===
% x: input character 'b' or [255 0 0] etc.
% === OUTPUT RESULTS ======
% rgb: rgb value between 0 and 1
%
% EXAMPLE:
% rgbofall('y')
% rgbofall(['y','g'])
% rgbofall([255 0 64])
%
% See also: rgb2char, char2rgb, rgb2bgr16
%
%
% Copyright 2018 Tim C. Lueth
SGshadelight(nr)- sets shading and lightinhg
% SGshadelight(nr) - sets shading and lightinhg
% (by Tim Lueth, VLFL-Lib, 2018-NOV-29 as class: AUXILIARY PROCEDURES)
%
% In contrast to other calls, this fnctns shows an example result only if
% there is an output results
% For face coloring and shading only the combination values 1, 2, 4 are
% recommended.
% Interpolation and Gouraud shading create problems with coulored faces
% and are useful only in combination with colored vertices. (Status of:
% 2018-12-04)
%
% Introduced first in SolidGeometry 4.4
%
% See also: camlightTL, VLFLplotlight, SGshowcolors
%
% nr=SGshadelight(nr)
% === INPUT PARAMETERS ===
% nr: 1..9 for different shadings
% === OUTPUT RESULTS ======
% nr: use less parameter; used only for creating an example result
%
% EXAMPLE: A=SGshadelight(4)
%
% See also: camlightTL, VLFLplotlight, SGshowcolors
%
%
% Copyright 2018 Tim C. Lueth
rgb2bgr16(RGB)- converts a RGB 3 x 8 Bit color into a BGR 3 x 5 + 1 Bit = 16 Bit Value for STL attribute by color values
% rgb2bgr16(RGB) - converts a RGB 3 x 8 Bit color into a BGR 3 x 5 + 1 Bit = 16 Bit Value for STL attribute by color values
% (by Tim Lueth, VLFL-Lib, 2018-NOV-28 as class: VISUALIZATION)
%
% Support of VisCAM and SolidView Colors as attribute by Byte
% bits 0 to 4 are the intensity level for blue (0 to 31),
% bits 5 to 9 are the intensity level for green (0 to 31),
% bits 10 to 14 are the intensity level for red (0 to 31),
% bit 15 is 1 if the color is valid, or 0 if the color is not valid (as
% with normal STL files). (Status of: 2018-11-29)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGwriteSTL, SGwriteVRML, char2rgb, rgb2char
%
% bgr16=rgb2bgr16(RGB)
% === INPUT PARAMETERS ===
% RGB: [0..255 0..255 0.255] or 'r', 'y', 'b' etc.
% === OUTPUT RESULTS ======
% bgr16:
%
% EXAMPLE:
% rgb2bgr16('m')
% rgb2bgr16([255 0 0])
% rgb2bgr16([0.1 0.9 1.0])
%
% See also: SGwriteSTL, SGwriteVRML, char2rgb, rgb2char
%
%
% Copyright 2018 Tim C. Lueth
SGwriteVRML(SG,FNAME,ONAME,vcol)- Writen an STL Geometry in a VRML File Format.
% SGwriteVRML(SG,FNAME,ONAME,vcol) - Writen an STL Geometry in a VRML File Format.
% (by Tim Lueth & Alexandra Mercader, VLFL-Lib, 2018-NOV-27 as class:
% FILE HANDLING)
%
% This fnctn was required by Alexandra Mercader, to use the3-Printer of
% 2006 in combination with the starch powder and colored binder liquids.
% This printer is not able to use OBJ or STL Files that support the
% "materialize color convention" for integration color information into
% the geometries.
% The problem of using matlabs STL2vrml convter could be that this
% "materialize color convention" is may be not convertet. Therefor, the
% need could be to write the vrml exporter to integrate colors and many
% other features that are supported by VRML but not by STL such as
% separation of differeet solids.
% Matlab's stl2vrml converter comes from humusoft that made the product
% orbisnap
% On mac there is view3dscene-3.15.0-macosx available (Status of:
% 2018-11-28)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGwriteSTL
%
% fname=SGwriteVRML(SG,[FNAME,ONAME,vcol])
% === INPUT PARAMETERS ===
% SG: Solid Geoemtry
% FNAME: Optional Filename
% ONAME: optional Solid name; default is by username
% vcol: optional Color for the solid
% === OUTPUT RESULTS ======
% fname:
%
% EXAMPLE:
% A=SGbox([30,20,10]); A.col='g'; A.alpha=0.4; A
% fname=SGwriteVRML(A)
% openbydoubleclick(fname)
%
% See also: SGwriteSTL
%
%
% Copyright 2018 Tim C. Lueth
char2rgb(c)- returns a RGB value from a color character
% char2rgb(c) - returns a RGB value from a color character
% (by Tim Lueth, VLFL-Lib, 2018-NOV-26 as class: VISUALIZATION)
%
% SG-Lib 4.5 supports list of colors (Status of: 2019-01-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: rgb2char, rgb2bgr16
%
%
% rgb=char2rgb(c)
% === INPUT PARAMETERS ===
% c: color character
% === OUTPUT RESULTS ======
% rgb: [R G B] color
%
% EXAMPLE:
% char2rgb('r')
% char2rgb('krgbw')
%
% See also: rgb2char, rgb2bgr16
%
%
%
% Copyright 2018-2019 Tim C. Lueth
rgb2char(RGB)- returns a color character from an RGB value
% rgb2char(RGB) - returns a color character from an RGB value
% (by Tim Lueth, VLFL-Lib, 2018-NOV-26 as class: VISUALIZATION)
%
% SG-Lib 4.5 supports list of colors (Status of: 2019-01-30)
%
% Introduced first in SolidGeometry 4.4
%
% See also: char2rgb, rgb2bgr16
%
% c=rgb2char(RGB)
% === INPUT PARAMETERS ===
% RGB: [R G B] color
% === OUTPUT RESULTS ======
% c: color character
%
% EXAMPLE:
% rgb2char([255 255 0])
% rgb2char(char2rgb('krgbw'))
%
% See also: char2rgb, rgb2bgr16
%
%
% Copyright 2018-2019 Tim C. Lueth
VLFL_EXP45- Tutorial to demonstrate the power of SGofCPLcommand
% VLFL_EXP45 - Tutorial to demonstrate the power of SGofCPLcommand
% (by Tim Lueth, VLFL-Lib, 2018-NOV-25 as class: TUTORIAL)
%
% Tutorial zum Demonstrieren der Leistungsfähigkeit der Solid Geometry
% Coding Language -
% SGofCPLcommand, VLFL_EXP46 (Status of: 2018-12-12)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGofCPLcommand, VLFL_EXP46
%
% VLFL_EXP45
%
% See also: SGofCPLcommand, VLFL_EXP46
%
%
% Copyright 2018 Tim C. Lueth
CVL2periodic(CVL,tp)- converts a perodic spatial contour into three periodic discrete fnct
% CVL2periodic(CVL,tp) - converts a perodic spatial contour into three periodic discrete fnct
% (by Tim Lueth, VLFL-Lib, 2018-NOV-25 as class: ANALYTICAL GEOMETRY)
%
% This is an auxiliary fnctn for the analysis and synthesis of
% periodically repeating contours: number, length, angle.
% The topic of decomposing an orbital contour into a periodic fnctn is a
% problem very similar to the problem of correlating two curves. For this
% reason, it makes sense to take a closer look at the fnctns
% SGof2CPLzheurist, SGof2CPLs and PLcorrelate. It is possible to use the
% existing grid points of a coordinate axis:
% a) simply map to an angular revolution
% b) Map the total length of the contour to the angular revolution.
% c) map the total sum of the angles of the contour to the angular
% revolution
% In all three cases, additional interpolation values may have to be
% found to prepare the fnctn for Fourier decomposition. Points may also
% need to be removed.
% Another question is the "beginning" of the curve. If this is defined
% due to a maximum deflection of a value and if yes, which dimension is
% dominant or due to an angle relative to the center of the curve. It is
% about the discovery of the similarity of curves on the basis of initial
% criteria. (Status of: 2018-12-04)
%
% Introduced first in SolidGeometry 4.4
%
% See also: fourBarLinkage, fourBarLinkageCPL, SGof2CPLzheurist,
% SGof2CPLs, PLcorrelate
%
% [CPLx,CPLy,CPLz,t]=CVL2periodic(CVL,[tp])
% === INPUT PARAMETERS ===
% CVL: CPL or PL; only the first are used
% tp: time; default is 2* pi
% === OUTPUT RESULTS ======
% CPLx: CPL [t x]
% CPLy: CPL [t y]
% CPLz: CPL [t z]
% t: time vector
%
% EXAMPLE:
% CVL2periodic(PLcircle(30))
% CVL2periodic(PLcircle(30,6))
% CVL2periodic(CPLaddauxpoints(PLcircle(30,6),1))
% CVL2periodic(CPLaddauxpoints(PLsquare(10),1))
%
% See also: fourBarLinkage, fourBarLinkageCPL, SGof2CPLzheurist,
% SGof2CPLs, PLcorrelate
%
%
% Copyright 2018 Tim C. Lueth
SGscrewDIN(D,L,p,CPL)- returns a screw geometry related to DIN13
% SGscrewDIN(D,L,p,CPL) - returns a screw geometry related to DIN13
% (by Tim Lueth, VLFL-Lib, 2018-NOV-24 as class: PARAMETRIC DESIGN)
%
% complete new fnctn, written for SG-Lib 4.4 and SGofCPLcommand (Status
% of: 2018-11-24)
%
% Introduced first in SolidGeometry 4.4
%
% SG=SGscrewDIN(D,L,[p,CPL])
% === INPUT PARAMETERS ===
% D: Diameter (negative creates a screw cutter or nut)
% L: Length
% p: optional pitch
% CPL: if used in combination with negative D is a nut
% === OUTPUT RESULTS ======
% SG: Solid Geometry
%
% EXAMPLE:
% SGscrewDIN(32,50)
%
%
% Copyright 2018 Tim C. Lueth
exp_2018_11_24_SGcuterror- return a SG with two open boundaries resulting from SGcut
% exp_2018_11_24_SGcuterror - return a SG with two open boundaries resulting from SGcut
% (by Tim Lueth, VLFL-Lib, 2018-NOV-24 as class: EXPERIMENTS)
%
% This short fnctn creates an internal thread with the fnctns DIN13,
% PLthreadDIN and SGofCPLrota. After generation, the SG is watertight.
% Then the SG is cut with SGcut at two z- planes.
% After that there are unfortunately open edges at the upper edge and
% lower edge of the cut surface. This fnctn serves to generate a test
% body for searching and correcting this limit case for SGCut, since
% otherwise the SGcut fnctn works very reliably.
% Since similar errors also occur with other threads from IGES/STEP
% files, it makes sense to search for errors. (Status of: 2018-11-24)
%
% Introduced first in SolidGeometry 4.4
%
% SG=exp_2018_11_24_SGcuterror
% === OUTPUT RESULTS ======
% SG: Solid Geometry with two open edges resulting from SGcut
%
% EXAMPLE: exp_2018_11_24_SGerror
%
%
% Copyright 2018 Tim C. Lueth
PLthreadDIN(D,P)- Fnct to create the crosssection contour using DIN13 for a thread
% PLthreadDIN(D,P) - Fnct to create the crosssection contour using DIN13 for a thread
% (by Tim Lueth, VLFL-Lib, 2018-NOV-23 as class: CLOSED POLYGON LISTS)
%
% This fnctn is an extract of first SGthread fnctn!
% Attention: Every Pitch (also the one from DIN 13) will create
% overlapping facets if rotated using SGofCPLrota. The reason is the
% limited number polygon points of a circle or in this case a helix. This
% problem is solved in SGofCPLrota by default. (Status of: 2018-11-24)
%
% Introduced first in SolidGeometry 4.4
%
% See also: PLgearrackDIN, PLgearDIN, SGofCPLrota, SGcut
%
% [PLB,P,KD]=PLthreadDIN(D,[P])
% === INPUT PARAMETERS ===
% D: DIN diameter; negative values for nuts
% P: optional pitch, otherwise taken from DIN13
% === OUTPUT RESULTS ======
% PLB: CPL for the cross section if the thread
% P: Pitch of the tread
% KD: Core diameter of the core of bold or nut
%
% EXAMPLE:
% PLthreadDIN (+5)
% PLthreadDIN (-5)
% [PL,P]=PLthreadDIN(5); SGfigure; CPLplot(PL,'r-',2);
% SG=SGofCPLrota(PL,pi*6,false,'',3*P); SGfigure; view(-30,30); SGplot(SG);
% SGcut(SG,[P,3*P]);
%
% See also: PLgearrackDIN, PLgearDIN, SGofCPLrota, SGcut
%
%
% Copyright 2018 Tim C. Lueth
SGlim(VL,dim,lim,rat)- compresses the vertex coordinates outside a limit without changing the VL or FL
% SGlim(VL,dim,lim,rat) - compresses the vertex coordinates outside a limit without changing the VL or FL
% (by Tim Lueth, VLFL-Lib, 2018-NOV-22 as class: SURFACES)
%
% This is an auxiliary to "cut" the shape of a solid by simply
% compressing the coordianates outside by changing the scale outside the
% intervall.
% typically is rat 1000 to convert millimeter in micrometer but if values
% for ratio are 1; we see a elongation. (Status of: 2018-11-23)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGcut
%
% VLN=SGlim(VL,[dim,lim,rat])
% === INPUT PARAMETERS ===
% VL: Vertex list
% dim: dimension 1 2 3 ord 'x' 'y' 'z'
% lim: limit max or [min max]
% rat: compression ratio default is 1000;
% === OUTPUT RESULTS ======
% VLN:
%
% EXAMPLE:
% SGgearwormDIN(1,'','',CPLmotorshaft); A=ans; view(-30,30);
% SGlim(A,'y',[-18 18])
% SGlim(A,'x',[-5 5])
% SGlim(A,'y',[-18 18],.1)
%
% See also: SGcut
%
%
% Copyright 2018 Tim C. Lueth
SGfischertechnikaxle- A pluggable axle for edges and gears for Fischertechnik
% SGfischertechnikaxle - A pluggable axle for edges and gears for Fischertechnik
% (by Yilun Sun, VLFL-Lib, 2018-NOV-20 as class: MODELING PROCEDURES)
%
% Eine steckbare Achse für Ränder und Getriebe (Status of: 2018-11-20)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGfischertechniksample
%
% SG=SGfischertechnikaxle
% === OUTPUT RESULTS ======
% SG: SOlid Geometry
%
% EXAMPLE: SG1 = SGftpin;
% SGdimensioning(SG1,0,0,[0 0 0]);
% SGdimensioning(SG1,90,0,[1 0 0]);
%
% See also: SGfischertechniksample
%
PLELofCPLsplitpoints(CPL)- inserts split points into a CPL but does not change the direction of the CPL
% PLELofCPLsplitpoints(CPL) - inserts split points into a CPL but does not change the direction of the CPL
% (by Tim Lueth, VLFL-Lib, 2018-NOV-19 as class: CLOSED POLYGON LISTS)
%
% This fnctn replaces CPLsplitpoints and inserts by delaunaytriangulation
% splits points into contour without changing the direction of the edge
% lists. Overlapping contour still overlap.
% [PL,EL,FL]=PLELofCPLsplitpoints(PLB); TR=triangulation(FL,PL);
% EL=freeBoundary(TR);
% would return a corrected EL but still with non manifold vertices/points
% Use [a,b]=FLseparate(FL) to detect the separated surfaces and solve the
% non manifold vertices problem
%
% (Status of: 2018-11-19)
%
% Introduced first in SolidGeometry 4.4
%
% See also: PLELofCPL, FLseparate
%
% [PL,EL]=PLELofCPLsplitpoints(CPL)
% === INPUT PARAMETERS ===
% CPL: Closed Polygon List
% === OUTPUT RESULTS ======
% PL: POINT LIST
% EL: Edge List
%
% EXAMPLE:
% PLA=[PLcircle(4); nan nan; PLcircle(4)+3]; SGfigure; CVLplot(PLA);
% PLB=[PLcircle(4); nan nan; flipud(PLcircle(4)+3)]; SGfigure; CVLplot(PLB);
% PLELofCPLsplitpoints(PLA);
% PLELofCPLsplitpoints(PLB);
%
% See also: PLELofCPL, FLseparate
%
%
% Copyright 2018 Tim C. Lueth
SGprintervalues- sets some basic printer specific parameters for automatic design fncts
% SGprintervalues - sets some basic printer specific parameters for automatic design fncts
% (by Tim Lueth, VLFL-Lib, 2018-NOV-19 as class: LANGUAGE PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: nofrd
%
% val=SGprintervalues
% === OUTPUT RESULTS ======
% val: struct
%
% EXAMPLE:
% SGprintervalues
%
%
% See also: nofrd
%
%
% Copyright 2018 Tim C. Lueth
SGinspect (SG,vi,fi)- zooms to inspect specific vertices or facets
% SGinspect (SG,vi,fi) - zooms to inspect specific vertices or facets
% (by Tim Lueth, VLFL-Lib, 2018-NOV-18 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: zoompatch
%
% SGinspect(SG,[vi,fi])
% === INPUT PARAMETERS ===
% SG: Solid Geoemetry
% vi: vertex indices to inspect
% fi: facet indices to inspect
%
% See also: zoompatch
%
%
% Copyright 2018 Tim C. Lueth
VLFLreadOBJ(FName,mag,check)- reads in an OBJ file
% VLFLreadOBJ(FName,mag,check) - reads in an OBJ file
% (by Tim Lueth, VLFL-Lib, 2018-NOV-18 as class: FILE HANDLING)
%
% Since there are different formats in OBJ files
% currently only the format
% f v1 v2 v3
% and f v1/vn v2/vn v3/vn
% are supported (Status of: 2018-11-18)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGreadSTL, SGwriteSTL, VLFLwriteSTL, VLFLreadSTL
%
% [VL,FL]=VLFLreadOBJ([FName,mag,check])
% === INPUT PARAMETERS ===
% FName: File Name
% mag: magnification; default is 1
% check: checker; default is false
% === OUTPUT RESULTS ======
% VL: Vertex list
% FL: Facet list
%
% See also: SGreadSTL, SGwriteSTL, VLFLwriteSTL, VLFLreadSTL
%
%
% Copyright 2018 Tim C. Lueth
username- returns user name and host name using JAVA
% username - returns user name and host name using JAVA
% (by Daniel Shub, VLFL-Lib, 2018-NOV-17 as class: AUXILIARY PROCEDURES)
%
% ..found in the internet.. (Status of: 2018-11-17)
%
% See also: expname, smbFilename, smbPSLibname
%
% [user,host]=username
% === OUTPUT RESULTS ======
% user: user name
% host: host name
%
% EXAMPLE:
% [u,h]=username
%
% See also: expname, smbFilename, smbPSLibname
%
SGselect3d(SG,tx)- Interactive slection of a point, vertex, or facet in a axis
% SGselect3d(SG,tx) - Interactive slection of a point, vertex, or facet in a axis
% (by Tim Lueth, VLFL-Lib, 2018-NOV-16 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 4.4
%
% See also: select3d, SGhelptext
%
% [p,v,vi,f,fi,haxis]=SGselect3d([SG,tx])
% === INPUT PARAMETERS ===
% SG: Solid geometry; if empty gca is used
% tx: optional menue header
% === OUTPUT RESULTS ======
% p: point
% v: vertex
% vi: vertex index
% f: facet
% fi: facet index
% haxis: gca
%
% EXAMPLE:
% SGselect3d(SGsample(25),'test')
%
%
% See also: select3d, SGhelptext
%
%
% Copyright 2018 Tim C. Lueth
FSofSGfacet(SG,fi,alpha)- returns the facet index list of a Feature Surface for a given facet index
% FSofSGfacet(SG,fi,alpha) - returns the facet index list of a Feature Surface for a given facet index
% (by Tim Lueth, VLFL-Lib, 2018-NOV-16 as class: SURFACES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: FSnormalofSG, FSofSG, FSplot, FSselect
%
% [FIL,fcl]=FSofSGfacet(SG,fi,[alpha])
% === INPUT PARAMETERS ===
% SG: Solid Geoemtry
% fi: Facet index
% alpha: Alpha angle; default is .76
% === OUTPUT RESULTS ======
% FIL: Facet index list for one feature surface
% fcl: facet connectionlist
%
% EXAMPLE:
% FSofSGfacet(SGsample(25),210)
% FSofSGfacet(SGsample(25))
%
% See also: FSnormalofSG, FSofSG, FSplot, FSselect
%
%
% Copyright 2018 Tim C. Lueth
SGcutTa(SG,To,a,delta,bs)- inserts a revolute joint in the center of a solid
% SGcutTa(SG,To,a,delta,bs) - inserts a revolute joint in the center of a solid
% (by Tim Lueth, VLFL-Lib, 2018-NOV-15 as class: MODELING PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGcutTfischertechnik
%
% [C,A,B,Tc]=SGcutTa([SG,To,a,delta,bs])
% === INPUT PARAMETERS ===
% SG: Solid Geoemtry
% To: Position of the Joint
% a: alpha (amin, amax)
% delta: slot size
% bs: length and height of joint
% === OUTPUT RESULTS ======
% C: Joint Solid
% A: Solid with hole (green)
% B: Solid with pin (Yellow)
% Tc: Center transformation matrix
%
% EXAMPLE:
% SGcutTA(SGtransP(SGcylinder(6,50),[10 0 0]),TofR(rot(0,pi/2,0)))
%
% See also: SGcutTfischertechnik
%
%
% Copyright 2018 Tim C. Lueth
CVLzofSGsliceauto(SG,dz)- returns the slive with a significant z distance
% CVLzofSGsliceauto(SG,dz) - returns the slive with a significant z distance
% (by Tim Lueth, VLFL-Lib, 2018-NOV-13 as class: SLICES)
%
% same fnctn as CPLofSGsliceauto (Status of: 2018-12-15)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLofSGslice, CPLofSGslice2, CPLofSGslice3, CPLofSGsliceauto
%
% CVL=CVLzofSGsliceauto(SG,[dz])
% === INPUT PARAMETERS ===
% SG: Solid Geometry
% dz: minimal z change; default is soBB(SG)/50
% === OUTPUT RESULTS ======
% CVL: Closed Vertex List of all z values
%
% EXAMPLE:
% SGreadSTL; A=ans; SGrotateservo(A); B=ans
% CVLzofSGsliceauto(B);
%
%
% See also: CPLofSGslice, CPLofSGslice2, CPLofSGslice3, CPLofSGsliceauto
%
%
% Copyright 2018 Tim C. Lueth
CVLzsweep(CVL,)- returns a swept CVL z Contour and a 2.5d solid
% CVLzsweep(CVL,) - returns a swept CVL z Contour
% (by Tim Lueth, VLFL-Lib, 2018-NOV-13 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.4
%
% CVLn=CVLzsweep(CVL,[])
% === INPUT PARAMETERS ===
% CVL: CVL sliced Contour
% === OUTPUT RESULTS ======
% CVLn: Swept CVLz
%
% EXAMPLE:
% A=SGcmdsample('3156'); CVLzofSGautoslice(A); CVL=ans;
% CVLzsweep(CVL,pi/2)
%
%
% Copyright 2018 Tim C. Lueth
CPLrepair(OCPL)- returns a corrected polyshape contour
% CPLrepair(OCPL) - returns a corrected polyshape contour
% (by Tim Lueth, VLFL-Lib, 2018-NOV-12 as class: CLOSED POLYGON LISTS)
%
% This fnctn is nothing else polyshape but explains the principle of
% polyshape.
% PLA=[PLcircle(4); nan nan; PLcircle(4)+3];
% ps=polyshape(PLA,'Simplify',false); CPL=ps.Vertices; SGfigure;
% CVLplot(CPL);
% ps=polyshape(PLA,'Simplify',true); CPL=ps.Vertices; SGfigure;
% CVLplot(CPL);
%
% (Status of: 2018-11-13)
%
% Introduced first in SolidGeometry 4.4
%
% See also: CPLsplitpoints, CPLrecontour
%
% [CPL,NP]=CPLrepair(OCPL)
% === INPUT PARAMETERS ===
% OCPL: Original Contour line
% === OUTPUT RESULTS ======
% CPL: Closed
% NP:
%
% EXAMPLE:
% PLA=[PLcircle(4); nan nan; PLcircle(4)+3];
% CPLrepair(PLA); CVLplot(ans); view(0,90);
%
% See also: CPLsplitpoints, CPLrecontour
%
%
% Copyright 2018 Tim C. Lueth
CPLoftesthinge(rmin,delta,sx,sy,txt,h)- returns a shape and a Geometry for a flexible hinge with 180 degree radius
% CPLoftesthinge(rmin,delta,sx,sy,txt,h) - returns a shape and a Geometry for a flexible hinge with 180 degree radius
% (by Tim Lueth, , 2018-NOV-12)
%
% For designing test hinges with different Materials, this fnctn creates
% a coontour and a solid to test those.
% For brittle materials with a low mating limit:
% Select the radius as small as possible so that the stress path is as
% small as possible.
% 2. define the stiffness with the value delta, the thinner the more
% flexible
% 3 Do not design continuous hinge surfaces, otherwise further critical
% torsion stresses will be added, but parallelise in a yarnlike manner.
% (Status of: 2018-11-13)
%
% Introduced first in SolidGeometry 4.4
%
% [CPL,SG]=CPLoftesthinge([rmin,delta,sx,sy,txt,h])
% === INPUT PARAMETERS ===
% rmin: minimal radius; default is 0.5
% delta: Thickness of circle
% sx: size in x ; default is 10 mm
% sy: size in y ; default is 5 mm
% txt: text; default is rminand delta
% h: height of the solid; default is 1
% === OUTPUT RESULTS ======
% CPL: Closed Polygon line
% SG: Solid Geoemtry
%
% EXAMPLE:
% [a,b]=CPLoftesthinge(0.5,3.0,'','',' '); SGfigure; SGplot(b);
%
%
% Copyright 2018 Tim C. Lueth
CPLofSGhull(SG)- returns the outer contour of a solid
% CPLofSGhull(SG) - returns the outer contour of a solid
% (by Tim Lueth, VLFL-Lib, 2018-NOV-12 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 4.4
%
% [XY,XZ,YZ]=CPLofSGhull(SG)
% === INPUT PARAMETERS ===
% SG: Solid Geoemetry
% === OUTPUT RESULTS ======
% XY: Contour blue
% XZ: Contour green
% YZ: Contour red
%
% EXAMPLE:
% A=SGcmdsample('3156'); CPLofSGhull(A)
%
%
% Copyright 2018 Tim C. Lueth
RPofTrelT(TA,TB)- returns the frame T2 in relation to frame T1
% RPofTrelT(TA,TB) - returns the frame T2 in relation to frame T1
% (by Tim Lueth, VLFL-Lib, 2018-NOV-07 as class: ANALYTICAL GEOMETRY)
%
% simple fnctn T=inv(T1)*T2 or T1\T2;
% afterwards rotm2eul(T(1:3,1:3),'XYZ'); (Status of: 2018-11-07)
%
% Introduced first in SolidGeometry 4.4
%
% See also: TofR
%
% [R,P,A_T_B]=RPofTrelT(TA,TB)
% === INPUT PARAMETERS ===
% TA: Frame A
% TB: Frame B
% === OUTPUT RESULTS ======
% R: Rotation angles (euler) XYZ
% P: Distance
% A_T_B: Frame B relative to Frame A
%
% EXAMPLE:
% rotm2axang(rot(a))
% SG=SGbending(SGofCPLzdelaunayGrid(PL,4,2,2,2),40);
%
% See also: TofR
%
%
% Copyright 2018 Tim C. Lueth
SGcutTd(SG,T,d,ct)- removes a part out of a solid
% SGcutTd(SG,T,d,ct) - removes a part out of a solid
% (by Tim Lueth, VLFL-Lib, 2018-NOV-07 as class: SURFACES)
%
% Cuts out a block using a Transformation matrix and a slot size. In case
% of an interactive specification of the T matrix (TofPcam) it is
% possible to specify 'a'xial, 'c'oronal or 's'agittal as orientation.
% (Status of: 2018-11-08)
%
% Introduced first in SolidGeometry 4.4
%
% See also: SGcutT, BBofSGcutT, SGcut, SGcut2, SGcutBB, SGcutTCPL
%
% SGcutTd([SG,T,d,ct])
% === INPUT PARAMETERS ===
% SG: Solid Geoemtry
% T: cutting frame
% d: slot in size
% ct: orientation 'default' is '-a',; 'c', 's', 'a'
%
% See also: SGcutT, BBofSGcutT, SGcut, SGcut2, SGcutBB, SGcutTCPL
%
%
% Copyright 2018 Tim C. Lueth
randminv(r,c,rmin)- returns a random fnct that has a minimal value
% randminv(r,c,rmin) - returns a random fnct that has a minimal value
% (by Tim Lueth, VLFL-Lib, 2018-NOV-07 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 4.4
%
% See also: randsupp
%
% r=randminv(r,c,[rmin])
% === INPUT PARAMETERS ===
% r: rows
% c: cols
% rmin: minimal value or [rmin rmax]; default is [rmin 1]
% === OUTPUT RESULTS ======
% r: random matrix
%
% See also: randsupp
%
%
% Copyright 2018 Tim C. Lueth