Last change of this documentation page: 2022-06-02 of SolidGeometry 3.8
VLdistance(VL)- returns a distance list - but is different from VLnorm

VLdistance(VL)% VLdistance(VL) - returns a distance list - but is different from VLnorm
% (by Tim Lueth, VLFL-Lib, 2017-MAI-24 as class: ANALYTICAL GEOMETRY)
%
% Version 4.0 is 10-20 times faster than 3.9
% VLnorm - vertex normal vector; not defined for the first value
% VLdistance - vertex distance vector; not defined for the last value
% The results seem to be circulated by one
% VLdistance is looking forward
% VLnorm is looking backward (Status of: 2017-07-09)
%
% Introduced first in SolidGeometry 3.8
%
% See also: NLnorm, VLangle
%
% [DL,DVL]=VLdistance(VL)
% === INPUT PARAMETERS ===
% VL: Vertex list
% === OUTPUT RESULTS ======
% DL: Distance list
% DVL: Distance vector list
%
% EXAMPLE:
% VLnorm(VLsample(3))
% VLdistance(VLsample(3))
%
% See also: NLnorm, VLangle
%

PLof3dist(d1,d2,d3,srt)- creates a 3P Tracker geometry using the given distances

PLof3dist(d1,d2,d3,srt)% PLof3dist(d1,d2,d3,srt) - creates a 3P Tracker geometry using the given distances
% (by Tim Lueth, VLFL-Lib, 2017-MAI-24 as class: ANALYTICAL GEOMETRY)
%
% Introduced first in SolidGeometry 3.8
%
% See also: cross2circ, tangent2circ, PLchordof2PR, crossz
%
% [PL,n,d3]=PLof3dist(d1,d2,[d3,srt])
% === INPUT PARAMETERS ===
% d1: distance in x
% d2: radius at second point
% d3: radius at third/first point point;
% srt: sort by length; default is false
% === OUTPUT RESULTS ======
% PL: Point list
% n: area of triangle
% d3: d3
%
% EXAMPLE:
% PLof3dist(35,30,45)
% PLof3dist(35,30,45,true)
%
% See also: cross2circ, tangent2circ, PLchordof2PR, crossz
%
%
% Copyright 2017-2018 Tim C. Lueth

SGspherelink(Lz,R1,R2,olap)- returns a spherical link

SGspherelink(Lz,R1,R2,olap)% SGspherelink(Lz,R1,R2,olap) - returns a spherical link
% (by Tim Lueth, VLFL-Lib, 2017-MAI-18 as class: SURFACES)
%
% This fnctn is helpful to design more natural shaped links (Status of:
% 2021-03-11)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGsphere, SGcylinder, SGrodlink
%
% SGC=SGspherelink(Lz,[R1,R2,olap])
% === INPUT PARAMETERS ===
% Lz: Length in Z
% R1: Upper radial values [Rx Ry Rz]; default is L/4
% R2: lower radial values [Rx Ry Rz]; default is R1
% olap: overlap of the three solids; default is 1e-3;
% === OUTPUT RESULTS ======
% SGC: Final solid
%
% EXAMPLE:
% SGspherelink(20,[5 5 5]); % Pill shape
% SGspherelink(20,[5 5 0]); % Cylinder shape
% SGspherelink(20,[5 2 0]); % Rod
% SGspherelink(20,[5 5 10],[5 5 0]); % Jules Verne Moon Rocket Shape
% SGspherelink(450,[400 200 80],[300 150 0]); % Torso shape
%
% See also: SGsphere, SGcylinder, SGrodlink
%
%
% Copyright 2017-2021 Tim C. Lueth

CVLzofSGslices(SG,n,l,thre)- returns a stack of slices as CVL (CPL including z) of a SG

CVLzofSGslices(SG,n,l,thre)% CVLzofSGslices(SG,n,l,thre) - returns a stack of slices as CVL (CPL including z) of a SG
% (by Tim Lueth, VLFL-Lib, 2017-MAI-15 as class: SLICES)
%
% RENAMED IN SG-Lib 5.0 from "CVLofSGslices" to "CVLzofSGslices"
% This fnctn is useful for creating 3D printing strategies over several
% slices. It also helps to reconstruct solids. The slicer fnctns differ a
% little bit:
% -CPLofSGslice - Single Slice
% -CPLofSGslice2 - Slices in a list of z values
% -CPLofSGslice3 - Slicing in 3 dimensions at the same time, several
% slices (returns also CVL)
% -CVLzofSGslices - Slices in z (return CVL)
% -CVLzofSGsliceauto - Slices automatically in z (return CVL)
% -SGslicer - Basic fnctn behind all of the above (Status of: 2020-08-26)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLofSGslice3, CVLzaddauxpoints, CVLzofSGsliceauto, CVLzplot,
% CVLzplotasCPS, CVLzplotui, CVLzremovearea, CVLzremoveslices,
% CVLzreplace, CVLzseparate, CVLzsimplifyAmin, CVLzsweep
%
% CVL=CVLzofSGslices(SG,[n,l,thre])
% === INPUT PARAMETERS ===
% SG: Solid Geometry
% n: number of slices; default is 10; if n is real, n is the slice
% distance
% l: optional limit for contour order; default is ''
% thre: reduction at top and bottom; default is 1e-2
% === OUTPUT RESULTS ======
% CVL: CVLz of the slices including the relevant c coordinate
%
% EXAMPLE:
% CVLzofSGslices(SGsample(23),50)
% CVLzofSGslices(SGsample(25),50); view(0,0) % All contours
% CVLzofSGslices(SGsample(25),50,0); view(0,0) % Most outward contour
% CVLzofSGslices(SGsample(25),50,1); view(0,0) % Outward plus 1st inner
% CVLzofSGslices(SGsample(25),50,2); view(0,0) % Outward plus 1st and 2nd inner
% CVLzofSGslices(SGsample(25),1.001,1); view(0,0) % slicing distance is 1 mm
%
% See also: CPLofSGslice3, CVLzaddauxpoints, CVLzofSGsliceauto, CVLzplot,
% CVLzplotasCPS, CVLzplotui, CVLzremovearea, CVLzremoveslices,
% CVLzreplace, CVLzseparate, CVLzsimplifyAmin, CVLzsweep
%
%
% Copyright 2017-2020 Tim C. Lueth

SGunitecells(SGc)- converts all cells into one solid geometry

SGunitecells(SGc)% SGunitecells(SGc) - converts all cells into one solid geometry
% (by Tim Lueth, VLFL-Lib, 2017-MAI-15 as class: SURFACES)
%
% Quick and Dirty - Does not support frames yet
% (Status of: 2017-05-19)
%
% See also: SGcat, SGcat2, VLFLofSG, SGofVLFL
%
% SG=SGunitecells(SGc)
% === INPUT PARAMETERS ===
% SGc: {SGA; SGB; SGC;}
% === OUTPUT RESULTS ======
% SG: SG.VL, SG.FL
%
% EXAMPLE:
% SGunitecells(SGsample(22))
% SGunitecells(SGsample(23))
%

PLofimcontourc(I,cent,pixs)- returns the centers of pixel coordinates in an image

PLofimcontourc(I,cent,pixs)% PLofimcontourc(I,cent,pixs) - returns the centers of pixel coordinates in an image
% (by Tim Lueth, VLFL-Lib, 2017-MAI-14 as class: CLOSED POLYGON LISTS)
%
% See also: CPLcontourc
%
% PL=PLofimcontourc(I,[cent,pixs])
% === INPUT PARAMETERS ===
% I: Image
% cent: true= image origin is in center; default is false
% pixs: size of a pixel; default is [1 1]
% === OUTPUT RESULTS ======
% PL: Coordinate list of contour centers
%
% EXAMPLE:
% I=imageofVLprojection(VL,[100 100],[0 -100 0],[0 100 0],4);
% PLofimcontourc(I,true,1/4)
%

centerCPL(CPL)- returns the center of all contours of a CPL

centerCPL(CPL)% centerCPL(CPL) - returns the center of all contours of a CPL
% (by Tim Lueth, VLFL-Lib, 2017-MAI-14 as class: CLOSED POLYGON LISTS)
%
% This fnctn helps to find fiducial marker center in xray images (Status
% of: 2018-08-27)
%
% Introduced first in SolidGeometry 3.8
%
% See also: centerPL, CPLcontourc, CPLdisttopoint, circlearoundPL
%
% PL=centerCPL(CPL)
% === INPUT PARAMETERS ===
% CPL: Closed Polygon list with several PL's
% === OUTPUT RESULTS ======
% PL: List of center of CPL using centerPL
%
% EXAMPLE:
% VL=50*rand(10,3)-25;
% I=imageofVLprojection(VL,[100 100],[0 -100 0],[0 100 0],4);
% CPL=CPLcontourc(double(I),1);
% centerCPL(CPL)
%
% See also: centerPL, CPLcontourc, CPLdisttopoint, circlearoundPL
%
%
% Copyright 2017-2019 Tim C. Lueth

VLofimsegthres(I)- returns a VL of segmented points within an image

VLofimsegthres(I)% VLofimsegthres(I) - returns a VL of segmented points within an image
% (by Tim Lueth, VLFL-Lib, 2017-MAI-12 as class: ANALYTICAL GEOMETRY)
%
% This fnctn helps to find the center of features islands within an image
% (Status of: 2017-05-14)
%
% Introduced first in SolidGeometry 3.8
%
% [VLC,VLs,VL,S]=VLofimsegthres(I)
% === INPUT PARAMETERS ===
% I: Logical Image
% === OUTPUT RESULTS ======
% VLC: Vertex List of centers
% VLs: size of features
% VL: All feature poits
% S: index list for features
%
% EXAMPLE:
% VL=50*rand(10,3)-25;
% I=imageofVLprojection(VL,[100 100],[0 -100 0],[0 100 0],4);
% VLofimsegthres(I<200);
%

Tofcam(pc,pt,cup)- returns HT matrix of camera and target for a given camera point, target point, and camera up vector

Tofcam(pc,pt,cup)% Tofcam(pc,pt,cup) - returns HT matrix of camera and target for a given camera point, target point, and camera up vector
% (by Tim Lueth, VLFL-Lib, 2017-MAI-11 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 3.8
%
% See also: TofPcam, Tofgca, camplot, camset, Tofgca, tcamera, camofT
%
% [T,Tt,va,ax]=Tofcam(pc,pt,cup)
% === INPUT PARAMETERS ===
% pc: point of camera; default is campos
% pt: point of target; default is camtarget
% cup: cup direction ; rough; default is camup
% === OUTPUT RESULTS ======
% T: Transformation of camera
% Tt: Transformation of target
% va: current camera angle
% ax: current axis values
%
% EXAMPLE:
% SGfigure; SGplot(SGsample(1)); pause; Tofcam
% T=Tofcam; R=T(1:3,1:3)', planeaxis=max(abs(R(1:3,3)))~=abs(R(1:3,3)), % planar main axis
%
% See also: TofPcam, Tofgca, camplot, camset, Tofgca, tcamera, camofT
%
%
% Copyright 2017-2021 Tim C. Lueth

imageofVLprojection(VL,isize,pc,pt,pixnum,cup)- returns an image of a VL projection using the matlab camera view concept

imageofVLprojection(VL,isize,pc,pt,pixnum,cup)% imageofVLprojection(VL,isize,pc,pt,pixnum,cup) - returns an image of a VL projection using the matlab camera view concept
% (by Tim Lueth, VLFL-Lib, 2017-MAI-11 as class: ANALYTICAL GEOMETRY)
%
% To get a real projection image using the graphics camera parameter it
% is absolutely necessary to switch to perspective mode first (this is
% part of this fnctn) before taking a snapshot (getframe);
% >> set(gca,'Projection','perspective');
% The image size in mm defines the opening angle: 2*tan(alpha)=x/2 /
% norm(pc-pt)
% The angle alpha is the complete opening angle, same for both dimensions.
% Therefor the target screen height is x = 2 * tan (alpha/2) *
% norm(pc-pt) (Status of: 2017-05-12)
%
% Introduced first in SolidGeometry 3.8
%
% See also: imwarpT
%
% [I,Ic,pixs,Tc,Tt,C]=imageofVLprojection([VL,isize,pc,pt,pixnum,cup])
% === INPUT PARAMETERS ===
% VL: Vertex list; default is a square for testing
% isize: image size [x y] centered; this defines the view angle
% pc: position of camera; default is [0 +100 0];
% pt: position of screen; default is [0 -100 0];
% pixnum: pixels of image; default is isize;
% cup: cup vector; default is [1 0 0]
% === OUTPUT RESULTS ======
% I: Grey scale matrix [0..1]
% Ic: Color Matrix struct I.cdata
% pixs: pixel size in mm; scaling
% Tc: HT matrix of camera position
% Tt: HT matrix of target position
% C: SG of the perspective cone in space
%
% EXAMPLE:
% imageofVLprojection('',[200 200],[0 -400 0],[0 100 0],1); % Original
% imageofVLprojection('',[200 200],[0 -400 0],[0 100 0],2); % Dots smaller
% imageofVLprojection('',[200 200],[0 -400 0],[0 200 0],2); % Dots outward
% imageofVLprojection('',[200 200],[0 -400 0],[0 600 0],2); % Dots out
% imageofVLprojection(100*rand(10,3)-50,[200 200],[0 -400 0],[0 600 0]);
%
% See also: imwarpT
%
%
% Copyright 2017-2018 Tim C. Lueth

imwarpT(I,T,scal,cent,fc)- warps an image related to a give transformation matrix

imwarpT(I,T,scal,cent,fc)% imwarpT(I,T,scal,cent,fc) - warps an image related to a give transformation matrix
% (by Tim Lueth, VLFL-Lib, 2017-MAI-10 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VLwarpgrid, warp, imwarp, imageofVLprojection
%
% h=imwarpT(I,[T,scal,cent,fc])
% === INPUT PARAMETERS ===
% I: image or image size [r c]
% T: Transformation matrix
% scal: scaling factor
% cent: true if centered; default is false
% fc: frame color such as 'b-'; default is '';
% === OUTPUT RESULTS ======
% h: handle to image
%
% EXAMPLE:
% I=imread('cameraman.tif');
% imwarpT(I,TofR(rot(pi/6,pi/6,pi/6)));
% imwarpT(I,TofR(rot(pi/6,pi/3,pi/6)));
% SGfigure; imwarpT(I,TofR(rot(pi/6,pi/6,pi/6)),[0.1 0.1],true);
% SGfigure; imwarpT(I,eye(4),[0.1 0.1],true,'b-'); show
%
% See also: VLwarpgrid, warp, imwarp, imageofVLprojection
%

VLwarpgrid(siz,T,scal)- creates a meshgrid for warping an image

VLwarpgrid(siz,T,scal)% VLwarpgrid(siz,T,scal) - creates a meshgrid for warping an image
% (by Tim Lueth, VLFL-Lib, 2017-MAI-10 as class: USER INTERFACE)
%
% See also: imwarpT
%
% [VL,XL,YL,ZL]=VLwarpgrid([siz,T,scal])
% === INPUT PARAMETERS ===
% siz: image or image size [r c]
% T: Transformation matrix
% scal: scaling factor
% === OUTPUT RESULTS ======
% VL: Vertex list
% XL: warp grid X
% YL: warp grid Y
% ZL: warp grid Z
%
% EXAMPLE:
% I=imread('cameraman.tif');
% VLwarpgrid(I,TofR(rot(pi/6,0,0)));;
%

PLofVLprojection(VL,pc,pt,cup,sc,isize)- returns image point on a target screen

PLofVLprojection(VL,pc,pt,cup,sc,isize)% PLofVLprojection(VL,pc,pt,cup,sc,isize) - returns image point on a target screen
% (by Tim Lueth, VLFL-Lib, 2017-MAI-07 as class: ANALYTICAL GEOMETRY)
%
% Fnctn to simulate a c-arm or central projection to a flat screen
% (Status of: 2017-05-09)
%
% See also: TofcamVLPL
%
% [PL,T,VLT,Tc]=PLofVLprojection([VL,pc,pt,cup,sc,isize])
% === INPUT PARAMETERS ===
% VL: Vertex list
% pc: camera center
% pt: target image origin
% cup: camera up center; default is [0 0 1]
% sc: image scaling (pixel size); default is [1 1]
% isize: image size; default is 512 512
% === OUTPUT RESULTS ======
% PL: Point List in image coordinate system
% T: T matrix of image coordinate system
% VLT: Position of the projektion points in VL's system
% Tc: T matrix of camera coordinate system
%
% EXAMPLE:
% PLofVLprojection(VLsample(7),[0 -50 0],[0 20 30],[1 0 0])
% PLofVLprojection(VLsample(7),[0 -50 0],[0 20 30],[0 0 1])
% VL=10*rand(10,3), PLofVLprojection(VL)
%

TofVLprojection()- returns the HT matrix of camera based on a VL and Projection image PL

TofVLprojection()% TofVLprojection() - returns the HT matrix of camera based on a VL and Projection image PL
% (by Tim Lueth, VLFL-Lib, 2017-MAI-06 as class: ANALYTICAL GEOMETRY)
%
% =======================================================================
% OBSOLETE (2017-05-12) - USE FAMILY 'TofcamVLPL' INSTEAD
% =======================================================================
%
% exactly the same as TofcamVLPL (Status of: 2017-05-07)
%
% [T,K,s,azxz]=TofVLprojection([])
% === OUTPUT RESULTS ======
% T:
% K:
% s:
% azxz:
%

Tofgca- returns the HT matrix of the current camera position

Tofgca% Tofgca - returns the HT matrix of the current camera position
% (by Tim Lueth, VLFL-Lib, 2017-MAI-02 as class: ANALYTICAL GEOMETRY)
%
% Tofgca returns the current axis's camera values as HT Matrix
% Tofcam returns either for given or the current axis's camera values as
% HT Matrix (Status of: 2017-05-11)
%
% See also: showcam, Tofcam
%
% [T,Tt,va,ax]=Tofgca
% === OUTPUT RESULTS ======
% T: HT matrix of camera coordinate system
% Tt: HT of target coordinate system
% va: current camera angle
% ax: current camera axis
%
% EXAMPLE: Just try
% SGfigure; SGplot(SGsample(1)); pause (1); Tofgca; pause(1); axis tight;
% view(-30,30)
%

showcam- draws a copy of the current figure including the current camera situation

showcam% showcam - draws a copy of the current figure including the current camera situation
% (by Tim Lueth, VLFL-Lib, 2017-MAI-01 as class: VISUALIZATION)
%
% See also: Tofgca, camset, campos, camplot
%
% showcam
%
% EXAMPLE:
% SGfigure; SGmodelOR(1)
% showcam
%

exp_2017_05_01- EXPERIMENT that visuaize the current projection situation

exp_2017_05_01% exp_2017_05_01 - EXPERIMENT that visuaize the current projection situation
% (by Tim Lueth, VLFL-Lib, 2017-MAI-01 as class: USER INTERFACE)
%
% Final fnctn called: showcam (Status of: 2017-05-01)
%
% See also: camset, camplot
%
% exp_2017_05_01
%

SGof2CPLsz(CPA,CPB,z,stype,ctype)- returns a solid defined by 2 contours and height

SGof2CPLsz(CPA,CPB,z,stype,ctype)% SGof2CPLsz(CPA,CPB,z,stype,ctype) - returns a solid defined by 2 contours and height
% (by Tim Lueth, VLFL-Lib, 2017-APR-24 as class: SURFACES)
%
% This fnctn is the same as SGof2CPLz but supports more than one contour!
% The optimal result depends on the expectations of the user. Consider
% different options for stype carefully:
% "number" of points, i.e. 1:nmax
% "length" of contour, i.e. 0:sum(edge length)
% "angle" of contour, i.e. 0:sum(abs(edge angle))
% "center" of contour, i.e. 0:360 degree
% also the starting point ctype ('rot' or 'min');
% Quite optimal procedure to find the walls between two planar contours
% without adding new points. The number of faces is na+nb.
% The resulting vertex list SG:
% SG.VL=[VLaddz(CPA,0);VLaddz(CPB,z)];
% SG.FL=[FLA;FLB;FLW];
% (Status of: 2017-06-12)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGof2SGT, SGof2T, SGof2CVL, SGof2CPLz, SGofCPLzchamfer,
% SGof2CPLzheurist, SGof2CPLzbranch
%
% [SG,FLW,FLA,FLB]=SGof2CPLsz([CPA,CPB,z,stype,ctype])
% === INPUT PARAMETERS ===
% CPA: ONE bottom Contour
% CPB: ONE top Contour
% z: height of the solid
% stype: "number", "length", "angle", "center"; default is "length"
% ctype: "rot" or "miny"; default is "rot"
% === OUTPUT RESULTS ======
% SG: Solid Geoemtry; VL=[CPA;CPB]
% FLW: Face list of Wall
% FLA: Face list of CPA
% FLB: Face list of CPB
%
% EXAMPLE:
% CPA=[PLcircle(5.1,16);NaN NaN; PLcircle(2,4)];
% CPB=[PLstar(5,16,[],[],[],0.5);NaN NaN; PLcircle(2)];
% SGof2CPLsz(CPA,CPB,5)
%
% See also: SGof2SGT, SGof2T, SGof2CVL, SGof2CPLz, SGofCPLzchamfer,
% SGof2CPLzheurist, SGof2CPLzbranch
%

exp_2017_04_24- EXPERIMENT to create drawing templates with prismatic angles =>

exp_2017_04_24% exp_2017_04_24 - EXPERIMENT to create drawing templates with prismatic angles =>
% (by Tim Lueth, VLFL-Lib, 2017-APR-24 as class: EXPERIMENTS)
%
% EXPERIMENT to create a fnctn for drawing templates (Zeichen schablone)
% Resulting fnctns are
% 1. SGof2CPLsz
% (Status of: 2017-04-24)
%
% exp_2017_04_24
%

BBofCPL(CPL,zmax,d)- returns the bounding box of a CPL

BBofCPL(CPL,zmax,d)% BBofCPL(CPL,zmax,d) - returns the bounding box of a CPL
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPS, BBofPS, BBofSGcutT
%
% bb=BBofCPL(CPL,[zmax,d])
% === INPUT PARAMETERS ===
% CPL: Closed Polygon Line
% zmax:
% d:
% === OUTPUT RESULTS ======
% bb: bb [xmin xmax ymin ymax]
%
% See also: CPLofBB, BBofVL, BBofSG, BBofCPS, BBofPS, BBofSGcutT
%
%
% Copyright 2017-2019 Tim C. Lueth

CPLofmeshgrid(X,Y,d)- returns two grid line templates

CPLofmeshgrid(X,Y,d)% CPLofmeshgrid(X,Y,d) - returns two grid line templates
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGdrawingtemplateofCPL
%
% [CPL,PLX,PLY,PL]=CPLofmeshgrid(X,Y,[d])
% === INPUT PARAMETERS ===
% X: List of X values
% Y: List of Y values
% d: optional thichness of CPL; default is 0
% === OUTPUT RESULTS ======
% CPL: Complete list of lines
% PLX: Only X lines
% PLY: Only Y lines
% PL: Point List (unique)
%
% EXAMPLE:
% CPLtemplateofCPL(CPLofmeshgrid([0 15 25 35 45 55 65],0:8:8*22),1,true);
% SGdrawingtemplateofCPL(CPLofmeshgrid([0 15 25 35 45 55 65],8*[0 1 6 8 13 15 20 23]),1)
% SGdrawingtemplateofCPL(B,1)
%
% See also: SGdrawingtemplateofCPL
%
%
% Copyright 2017-2021 Tim C. Lueth

CPLunitesorted(CPL)- returns sorted and added closed polygons

CPLunitesorted(CPL)% CPLunitesorted(CPL) - returns sorted and added closed polygons
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: CLOSED POLYGON LISTS)
%
% ..have the impression to have implemented this fnctn already several
% times in different manner.. (Status of: 2017-04-23)
%
% See also: CPLsortinout, CPLpolybool
%
% CPLN=CPLunitesorted(CPL)
% === INPUT PARAMETERS ===
% CPL: Closed Polygon Line
% === OUTPUT RESULTS ======
% CPLN: systematically ordered and Boolean operated CPL
%
% EXAMPLE:
% A=[0 0; 10 0;NaN NaN;5 -5; 5 +5]
% CPLunitesorted(CPLtemplateofCPL(A))
%

CPLtemplateofCPL(CPL,pen,un)- returns a template for a given CPL

CPLtemplateofCPL(CPL,pen,un)% CPLtemplateofCPL(CPL,pen,un) - returns a template for a given CPL
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: CLOSED POLYGON LISTS)
%
% Attention: This fnctn distinguishs between open and closed PL / CPLs
% for obvious reasons. Threfor close a PL such as PLcircle or PLstar by
% CPLofPL. (Status of: 2018-08-20)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLgrow, PLgrow, CPLofmeshgrid
%
% CPN=CPLtemplateofCPL(CPL,[pen,un])
% === INPUT PARAMETERS ===
% CPL: CPL separated by NaN NaN
% pen: diameter of template
% un: if true; contours are united; default is false;
% === OUTPUT RESULTS ======
% CPN:
%
% EXAMPLE:
% A=[0 0; 10 0;NaN NaN;5 -5; 5 +5]; CPLtemplateofCPL(A,2,false)
% A=[0 0; 10 0;NaN NaN;5 -5; 5 +5]; CPLtemplateofCPL(A,2,true)
% CPLtemplateofCPL(PLsample(1))
% CPLtemplateofCPL(PLsample(2))
% CPLtemplateofCPL(PLsample(11),12)
% CPLtemplateofCPL(CPLoftext('s'))
% CPLtemplateofCPL(PLgearDIN(1,13))
%
% See also: CPLgrow, PLgrow, CPLofmeshgrid
%
%
% Copyright 2017-2021 Tim C. Lueth

PLsample(n)- returns a 2D PL list similar to VLsample

PLsample(n)% PLsample(n) - returns a 2D PL list similar to VLsample
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: ANALYTICAL GEOMETRY)
%
% For many fnctns it is helpful to have a sample point list (Status of:
% 2021-03-30)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLoftext, CPLsample, SGsample, VLsample, VLFLsample,
% CSGsample, SGerrorsample, SGfischertechniksample, SGcmdsample,
% testfunctTL, permutevector, VLsampletriangles, CVLzsample
%
% PL=PLsample([n])
% === INPUT PARAMETERS ===
% n: sample of Point List
% === OUTPUT RESULTS ======
% PL: returns PL if n>0
%
% See also: CPLoftext, CPLsample, SGsample, VLsample, VLFLsample,
% CSGsample, SGerrorsample, SGfischertechniksample, SGcmdsample,
% testfunctTL, permutevector, VLsampletriangles, CVLzsample
%
%
% Copyright 2017-2021 Tim C. Lueth

SGdrawingtemplateofCPL(CPLU,pen,unt,wall,height,dmin,lnk,top)- Creates a 3D printable drawing template - slow but helpful

SGdrawingtemplateofCPL(CPLU,pen,unt,wall,height,dmin,lnk,top)% SGdrawingtemplateofCPL(CPLU,pen,unt,wall,height,dmin,lnk,top) - Creates a 3D printable drawing template - slow but helpful
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: MODELING PROCEDURES)
%
% When creating templates from a line drawing, a contour is moved
% outwards and inwards: CPLgrow. This can lead to self-overlaps of
% contours. Accordingly, the out-contour of the grown contour and the
% inner contour of the fringed contour must be used: CPLsortinout. The
% fnctn is: CPLtemplateofCPL. Insulated contours are then connected:
% CPLunitesorted. Overlapping contours are preserved by auxiliary points.
% (Status of: 2017-04-25)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLtemplateofCPL, CPLofmeshgrid
%
% SG=SGdrawingtemplateofCPL(CPLU,[pen,unt,wall,height,dmin,lnk,top])
% === INPUT PARAMETERS ===
% CPLU: Linienzeichnung
% pen: pen diameter
% unt: if true; crossings are united; default is false
% wall: wall thickness; default is 1.5mm
% height: height of template; default is 1.5mm
% dmin: diameter to support crossing points
% lnk: if true, solids are connected; default is false
% top: upper pen diameter; default is width;
% === OUTPUT RESULTS ======
% SG: SG of a drawing template
%
% EXAMPLE:
% A=[0 0; 10 0;NaN NaN;5 -5; 5 +5]; SGdrawingtemplateofCPL(A,1,false);
% A=[0 0; 10 0;NaN NaN;5 -5; 5 +5]; SGdrawingtemplateofCPL(A,1,true);
% SGdrawingtemplateofCPL([0 0; 10 0])
% SGdrawingtemplateofCPL(PLgearDIN(1,10))
%
% See also: CPLtemplateofCPL, CPLofmeshgrid
%
%
% Copyright 2017-2021 Tim C. Lueth

PLsplitpointsofCPL(CPL)- returns splitpoints created by delaunaytriangulation

PLsplitpointsofCPL(CPL)% PLsplitpointsofCPL(CPL) - returns splitpoints created by delaunaytriangulation
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: CLOSED POLYGON LISTS)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLsplitpoints
%
% SPL=PLsplitpointsofCPL(CPL)
% === INPUT PARAMETERS ===
% CPL: CPL separated by NaN
% === OUTPUT RESULTS ======
% SPL: List of splitpoints created by delaunaytriangulation
%
% EXAMPLE:
% PLsplitpointsofCPL(CPLsample(16))
% PLsplitpointsofCPL([PLcircle(10);nan nan;PLcircle(10)+4])
%
% See also: CPLsplitpoints
%
%
% Copyright 2017-2018 Tim C. Lueth

SGcopyVL(SG,VL,fuse)- returns a cell list of copies or a fused Solid of SG an positions of VL

SGcopyVL(SG,VL,fuse)% SGcopyVL(SG,VL,fuse) - returns a cell list of copies or a fused Solid of SG an positions of VL
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: SURFACES)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGboxing, SGcopypatternXYZ, SGpatternRotz, SGcopyrotZ,
% SGarrangeSG, SGarrangeSGC, SGCaddSGn, SGCaddSG, SGstackn, SGsurfaces
%
% SGC=SGcopyVL(SG,VL,[fuse])
% === INPUT PARAMETERS ===
% SG: Solid Geometry
% VL: Coordiantes for creating a copy of SG
% fuse: if true; SG is struct not cell; default is true
% === OUTPUT RESULTS ======
% SGC: cell list of SG
%
% EXAMPLE: Create copies at ten random positions
% SGcopyVL(SGbox([4,4,10]),100*rand(10,3)) % single solid with 10 closed surface
% SGcopyVL(SGbox([4,4,10]),100*rand(10,3),false) % 10 separated cells
%
% See also: SGboxing, SGcopypatternXYZ, SGpatternRotz, SGcopyrotZ,
% SGarrangeSG, SGarrangeSGC, SGCaddSGn, SGCaddSG, SGstackn, SGsurfaces
%
%
% Copyright 2017-2020 Tim C. Lueth

lastwarnTL- returns information on the last warnings

lastwarnTL% lastwarnTL - returns information on the last warnings
% (by Tim Lueth, VLFL-Lib, 2017-APR-23 as class: AUXILIARY PROCEDURES)
%
% For a programmer, who wants to know which warning should be switched
% off. Fnctn uses
% lastwarn for last warning detected
% warning('query','last') for last trown warning
% (Status of: 2018-08-20)
%
% Introduced first in SolidGeometry 3.8
%
% See also: lastwarnoff, lastwarn
%
% [d,a,b]=lastwarnTL
% === OUTPUT RESULTS ======
% d: Last warning shown on screen
% a: Message of Last ID detected
% b: Last ID detected
%
% EXAMPLE:
% lastwarnTL
% warning('off','last');
%
% See also: lastwarnoff, lastwarn
%
%
% Copyright 2017-2020 Tim C. Lueth

ginput2Dcircle(gr,ax)- returns by user interaction center and radius of a circle

ginput2Dcircle(gr,ax)% ginput2Dcircle(gr,ax) - returns by user interaction center and radius of a circle
% (by Tim Lueth, VLFL-Lib, 2017-APR-20 as class: USER INTERFACE)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VLui, select2d, PLeditui, CPLui, CPSui, PLcircleui
%
% [cc,cr,h]=ginput2Dcircle([gr,ax])
% === INPUT PARAMETERS ===
% gr: grid resolution; default is 1
% ax: axis of the screen; default is
% === OUTPUT RESULTS ======
% cc: center of circle
% cr: radius of circle
% h: handle to graphic
%
% See also: VLui, select2d, PLeditui, CPLui, CPSui, PLcircleui
%
%
% Copyright 2017-2019 Tim C. Lueth

SGofpatch(gh,fuse)- returns a SG from a patch

SGofpatch(gh,fuse)% SGofpatch(gh,fuse) - returns a SG from a patch
% (by Tim Lueth, VLFL-Lib, 2017-APR-19 as class: SURFACES)
%
% See also: patchofSG, SGplot, reducepatch, reducepatchSG
%
% SG=SGofpatch([gh,fuse])
% === INPUT PARAMETERS ===
% gh: handle to patch; default is patchofgca
% fuse: if true; create only one SG; default is false;
% === OUTPUT RESULTS ======
% SG: Solid Geoemtry; single or cells
%

patchofSG(SG,realp)- creates a patch struct of a solid geometry

patchofSG(SG,realp)% patchofSG(SG,realp) - creates a patch struct of a solid geometry
% (by Tim Lueth, VLFL-Lib, 2017-APR-19 as class: USER INTERFACE)
%
% Matlab has different data models for the handling of surface models:
% patch, triangulation, delaunaytriangulation, poly2fv etc.
% SUPPORTS also with cells of solids an returns a list
% ATTENTION: A patch is only valid if the figure is not closed. So in
% case that you want to use a patch for surface reduction, copy it
% afterwards into a SG using 'SGofpatch'; It is similar to SGplot (Status
% of: 2017-06-17)
%
% See also: SGofpatch, SGplot, SGreduceVLFL
%
% h=patchofSG(SG,[realp])
% === INPUT PARAMETERS ===
% SG: Soldid Geometry;
% realp: true=real patch; default is false
% === OUTPUT RESULTS ======
% h: handle to patch struct or patch class
%
% EXAMPLE:
% a=patchofSG(SGsample(17))
% a=patchofSG(SGsample(17),true)
%

patchofgca(gh)- returns all patches of the current graphics axis

patchofgca(gh)% patchofgca(gh) - returns all patches of the current graphics axis
% (by Tim Lueth, VLFL-Lib, 2017-APR-19 as class: USER INTERFACE)
%
% simple macro: h=findall(gh,'type','patch'); (Status of: 2017-04-19)
%
% See also: SGofpatch, patchofSG, SGplot, reducepatch
%
% h=patchofgca([gh])
% === INPUT PARAMETERS ===
% gh: gca or gcf; default gca
% === OUTPUT RESULTS ======
% h: handle / handle array
%

reducepatchSG(h,f)- reduces either one or all patches of the current axis

reducepatchSG(h,f)% reducepatchSG(h,f) - reduces either one or all patches of the current axis
% (by Tim Lueth, VLFL-Lib, 2017-APR-18 as class: SURFACES)
%
% =======================================================================
% OBSOLETE (2017-06-17) - USE FAMILY 'SGreduceVLFL' INSTEAD
% =======================================================================
%
% exactly the same as reducepatch, but works with several path arrays and
% has default values (Status of: 2017-06-16)
%
% See also: [ SGreduceVLFL ] ; reducepatch, daspect
%
% h=reducepatchSG([h,f])
% === INPUT PARAMETERS ===
% h: handle; default is findall(gca,'type','patch') or SG
% f: reduction factor; default is 0.5
% === OUTPUT RESULTS ======
% h: handle or list of handle of gca or SG
%
% EXAMPLE:
% SGsphere(10); reducepatchSG('',0.1); show
% SGsphere(10); reducepatchSG('',500); show
% SGbox([30,20,10]); pause(1); reducepatchSG('',0.5); show
%

SGofVMisosurface(V,vs,cl)- returns a surface model by the marching cubes

SGofVMisosurface(V,vs,cl)% SGofVMisosurface(V,vs,cl) - returns a surface model by the marching cubes
% (by Tim Lueth, VLFL-Lib, 2017-APR-18 as class: VOXELS)
%
% This fnctn is an original Matlab fnctn just a little bit modified to
% close surfaces. The fnctn is very similar of SGofVMmarchcube but
% definitely slower. Main problem is the unclear method that is
% implemented by Matlab. (Status of: 2019-02-04)
%
% Introduced first in SolidGeometry 3.8
%
% See also: smooth3, VLFLofVMdelaunay, VLFLofVMmarchcube, TR3ofVM,
% SGofVMmarchcube, SGofVMdelaunay
%
% SG=SGofVMisosurface(V,[vs,cl])
% === INPUT PARAMETERS ===
% V: Logical Volume Model
% vs: voxel size, optional
% cl: closes open facets by adding empty planes; default is true
% === OUTPUT RESULTS ======
% SG: Vertex list
%
% EXAMPLE: [V,vs]=VMreaddicomdir('AIM_DICOMFILES');
% [a,as]=VMresize(V,[0.5 0.5 0.5],vs);
% SG=SGofVMisosurface(a>1400,as);
% SGcut(SG,40);
% c=CPLofSGslice3(SG,20);
% PLFLofCPLdelaunay(c);
% PLFLofCPLpoly(c)
%
% SGofVMisosurface(smooth3(VM>8000))
%
% See also: smooth3, VLFLofVMdelaunay, VLFLofVMmarchcube, TR3ofVM,
% SGofVMmarchcube, SGofVMdelaunay
%
%
% Copyright 2017-2021 Tim C. Lueth

TtransT(T1,T0,tinv)- returns a matrix multiplication of a (list of) homogenous transformation matrix

TtransT(T1,T0,tinv)% TtransT(T1,T0,tinv) - returns a matrix multiplication of a (list of) homogenous transformation matrix
% (by Tim Lueth, VLFL-Lib, 2017-APR-18 as class: ANALYTICAL GEOMETRY)
%
% Complete redesign at 2019-03-30 - Consider using SGtransrelT
% ATTENTION: THE SECOND PARAMETER IS THE ORIGINAL FRAME LIST !!!
% THE FIRST PARAMETER IS TO TRANSFORMATION MATRIX
% For simple cases you can simply write T=T1*T2:
% [ R1*R2, t1 + R1*t2]
% [ 0, 1] (Status of: 2021-03-13)
%
% Introduced first in SolidGeometry 3.8
%
% See also: TofPose, TofPLpath, SGtransrelT
%
% TN=TtransT(T1,T0,[tinv])
% === INPUT PARAMETERS ===
% T1: Transformation matrix to transform or matrix list
% T0: Original transformation matrix or matrix list
% tinv: if true; T0 will be interverted first
% === OUTPUT RESULTS ======
% TN: T1*T0 (!!)
%
% EXAMPLE:
% PS.A=PLcircle(10,36); PS.B=PS.A*2; T0=TofPose(PS), BBofT(T0)
% TtransT(TofP([100 0]),T0)
% TtransT(TofR(rot(pi/2)),T0)
%
% See also: TofPose, TofPLpath, SGtransrelT
%
%
% Copyright 2017-2022 Tim C. Lueth

isatleastVer(name,TB)- checks the minimal version/release number of matlab

isatleastVer(name,TB)% isatleastVer(name,TB) - checks the minimal version/release number of matlab
% (by Tim Lueth, VLFL-Lib, 2017-APR-18 as class: AUXILIARY PROCEDURES)
%
% Introduced first in SolidGeometry 3.8
%
% See also: verTL, verOSX, ver, iscalledbycmdline
%
% is=isatleastVer(name,[TB])
% === INPUT PARAMETERS ===
% name: Release name 'R2017a'
% TB: Toolbox name ;default is 'Matlab'
% === OUTPUT RESULTS ======
% is: true or false
%
% EXAMPLE:
% isatleastVer('R2017b')
% isatleastVer('R2017a')
%
% See also: verTL, verOSX, ver, iscalledbycmdline
%
%
% Copyright 2017-2021 Tim C. Lueth

verTL(name)- returns the currently used Matlab Release

verTL(name)% verTL(name) - returns the currently used Matlab Release
% (by Tim Lueth, VLFL-Lib, 2017-APR-18 as class: AUXILIARY PROCEDURES)
%
% More simple to use than 'ver' (Status of: 2021-12-26)
%
% Introduced first in SolidGeometry 3.8
%
% See also: verTL, verOSX, ver, isatleastVer, iscalledbycmdline
%
% v=verTL(name)
% === INPUT PARAMETERS ===
% name: Tool to search for
% === OUTPUT RESULTS ======
% v: RElease such as 'R2017a'; empty if missing;
%
% EXAMPLE:
% ver
% verTL('Matlab')
% verTL('Matlabasasdasd')
% verTL('Mapping Toolbox')
%
%
% See also: verTL, verOSX, ver, isatleastVer, iscalledbycmdline
%
%
% Copyright 2017-2021 Tim C. Lueth

VMwindowplot(V,cax,minv,maxv)- plots a voxel model using the window caxis function

VMwindowplot(V,cax,minv,maxv)% VMwindowplot(V,cax,minv,maxv) - plots a voxel model using the window caxis fnctn
% (by Tim Lueth, VLFL-Lib, 2017-APR-12 as class: VOXELS)
%
% shows only the voxels within the specified intensity interval and voxel
% intervall (Status of: 2017-04-17)
%
% See also: VMplot, VMcaxis
%
% VX=VMwindowplot(V,[cax,minv,maxv])
% === INPUT PARAMETERS ===
% V: Voxel model
% cax: [cmin cmax];
% minv: minimum voxel value; values <0 are precentage
% maxv: maximum voxel value; values <0 are precentage
% === OUTPUT RESULTS ======
% VX:
%
% EXAMPLE:
% VMwindowplot(V,[400 1200],0.2,0.7);
% SGofVMmarchcube(VX)
%

VMcaxis(cax)- adjustes the caxis of the VMplot diagram

VMcaxis(cax)% VMcaxis(cax) - adjustes the caxis of the VMplot diagram
% (by Tim Lueth, VLFL-Lib, 2017-APR-12 as class: VOXELS)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VMplot, VMwindowplot
%
% cax=VMcaxis([cax])
% === INPUT PARAMETERS ===
% cax: [cmin cmax]; default is min and max of the current! surfaces
% === OUTPUT RESULTS ======
% cax: selected Values if called without input paramter
%
% EXAMPLE:
% VMplot(VM)
% VMcaxis
%
% See also: VMplot, VMwindowplot
%
%
% Copyright 2017-2019 Tim C. Lueth

numofstrtab(tok,strtab)- returns a row number of a cell list of strings

numofstrtab(tok,strtab)% numofstrtab(tok,strtab) - returns a row number of a cell list of strings
% (by Tim Lueth, VLFL-Lib, 2017-APR-09 as class: AUXILIARY PROCEDURES)
%
% See also: SGmodelOR
%
% nr=numofstrtab(tok,strtab)
% === INPUT PARAMETERS ===
% tok: string to compare with;
% strtab: cell list; frist col = string
% === OUTPUT RESULTS ======
% nr: cell list row, col 2: end
%
% EXAMPLE:
% strtab={'spine',1; 'torso',2; 'carm', 3;'table',4};
% numofstrtab ('TORSO',strtab);
%

SGmodelOR(part)- returns solid model of OR device models

SGmodelOR(part)% SGmodelOR(part) - returns solid model of OR device models
% (by Tim Lueth, VLFL-Lib, 2017-APR-07 as class: SURFACES)
%
% The following (Status of: 2017-04-17)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGsample, CPLsample, VLSample
%
% SG=SGmodelOR(part)
% === INPUT PARAMETERS ===
% part:
% === OUTPUT RESULTS ======
% SG: Solid geometry of part
%
% See also: SGsample, CPLsample, VLSample
%

CELofEL(EL)- returns a corrected succeding EL for a single contour

CELofEL(EL)% CELofEL(EL) - returns a corrected succeding EL for a single contour
% (by Tim Lueth, VLFL-Lib, 2017-APR-07 as class: EDGE LISTS)
%
% branches are not alloweed, i.e.
% - two terminals and m links
% - or n links (Status of: 2018-08-20)
%
% Introduced first in SolidGeometry 3.8
%
% See also: treeNodesofEL
%
% [CEL,CHN]=CELofEL(EL)
% === INPUT PARAMETERS ===
% EL: unsorted but correct edge list
% === OUTPUT RESULTS ======
% CEL: Sorted Edge list of Contour or Line of Nodes
% CHN: Chain [n x 1] with nodes
%
% EXAMPLE:
% CELofEL([100 1; 100 2; 3 2; 1 3])
%
% See also: treeNodesofEL
%
%
% Copyright 2017-2019 Tim C. Lueth

ELsort(EIL)- returns a increasing sorted edge list separated by NaN

ELsort(EIL)% ELsort(EIL) - returns a increasing sorted edge list separated by NaN
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: AUXILIARY PROCEDURES)
%
% Does replace sortEL. Branches are not allowed! Use ELsortFE for a
% complete processing.
% This fnctn is able to handle NaN separated Edge lists and orders them
% upwards from frist to last and left to right. In addition the chains
% are linked together
% woNaN can be used ti remove the NaN NaN separators later. (Status of:
% 2018-04-18)
%
% Introduced first in SolidGeometry 3.8
%
% See also: ELsortFE, ELunsort, ELuniqueofFL, CELofEL, woNaN, ELremove
%
% EIL=ELsort(EIL)
% === INPUT PARAMETERS ===
% EIL: Edge List
% === OUTPUT RESULTS ======
% EIL: Edge List
%
% See also: ELsortFE, ELunsort, ELuniqueofFL, CELofEL, woNaN, ELremove
%
%
% Copyright 2017-2018 Tim C. Lueth

FEofVLFL(VL,FL,ang,esort)- returns FE and optional VL of a solid geometry or of gca

FEofVLFL(VL,FL,ang,esort)% FEofVLFL(VL,FL,ang,esort) - returns FE and optional VL of a solid geometry or of gca
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: SURFACES)
%
% ATTENTION: Matlabs feature edges need not to have the same direction
% even if there is only feature edge contour. To create a closed polygon
% CVL you have to resort the edges first. (Status of: 2020-09-11)
%
% Introduced first in SolidGeometry 3.8
%
% See also: FEofSG, VLFLofgca, FEplot, ELsort, ELreconnect
%
% [FE,VL]=FEofVLFL([VL,FL,ang,esort])
% === INPUT PARAMETERS ===
% VL: Vertex list if empty; VLFLofgca is used
% FL: Facet List
% ang: angle; default is 0.4 ~ pi/8
% esort: sort edges; default is true
% === OUTPUT RESULTS ======
% FE: Feature edge list
% VL: Vertex list for embedded SG
%
% EXAMPLE:
% [VL,FL]=VLFLsample(4);
% FEofVLFL(VL,FL);
%
% See also: FEofSG, VLFLofgca, FEplot, ELsort, ELreconnect
%
%
% Copyright 2017-2020 Tim C. Lueth

treeNodesofEL(EL)- returns the tree structure from a given edge list

treeNodesofEL(EL)% treeNodesofEL(EL) - returns the tree structure from a given edge list
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: EDGE LISTS)
%
% Fnctn removes lines with Nan first: In a list there are:
% - single used points (Terminals)
% - doubled used points (Links)
% - three or more times used points (Branches)
% (Status of: 2018-08-20)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CELofEL
%
% [vi,vc,bi,ti,li]=treeNodesofEL(EL)
% === INPUT PARAMETERS ===
% EL: Edge list
% === OUTPUT RESULTS ======
% vi: list of vertices [vi n]
% vc: vertes use counter [bi ti li]
% bi: branch index
% ti: terminal index
% li: link index
%
% EXAMPLE:
% A=SGbox([30,20,10]); EL=FEofSG(A); treeNodesofEL(EL)
%
% See also: CELofEL
%
%
% Copyright 2017-2019 Tim C. Lueth

VLremsuccident(VL)- removes succeding identical rows in a list

VLremsuccident(VL)% VLremsuccident(VL) - removes succeding identical rows in a list
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: AUXILIARY PROCEDURES)
%
% Fnctn is able to handle doubled nan too! It was designed for open PL
% ways returns a PL/VL since last and frist point are succeeding points
% and the first remains. (Status of: 2019-06-30)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CVLremstraight
%
% [SVL,ii]=VLremsuccident(VL)
% === INPUT PARAMETERS ===
% VL: list of numeric rows
% === OUTPUT RESULTS ======
% SVL: decimated list
% ii: removed indices in original list
%
% EXAMPLE:
% CPL=rounddiv(CPLaddauxpoints(CPLoftext('test'),1),1)
% VLremsuccident(CPL)
%
% See also: CVLremstraight
%
%
% Copyright 2017-2019 Tim C. Lueth

CVLremstraight (CVL,de,al)- returns straight points on a line depending on distance and agle

CVLremstraight (CVL,de,al)% CVLremstraight (CVL,de,al) - returns straight points on a line depending on distance and agle
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: ANALYTICAL GEOMETRY)
%
% able to handel CPL
% checks identical points (1),(end)
% removes identical succeeding points
% removes points nearby
% removes angle points less than one degree (Status of: 2019-06-30)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VLremsuccident, eps2
%
% CVLremstraight(CVL,[de,al])
% === INPUT PARAMETERS ===
% CVL: Contour verteex list
% de: default is 1e-6;
% al: default is 1 degree; will be changed in future to eps2
%
% EXAMPLE:
% CPL=rounddiv(CPLaddauxpoints(CPLoftext('test'),1),1)
% CVLremstraight(CPL)
%
% See also: VLremsuccident, eps2
%
%
% Copyright 2017-2019 Tim C. Lueth

FEofSG(SG,ang)- returns FE and optional VL of a solid geometry or of gca

FEofSG(SG,ang)% FEofSG(SG,ang) - returns FE and optional VL of a solid geometry or of gca
% (by Tim Lueth, VLFL-Lib, 2017-APR-06 as class: SURFACES)
%
% ATTENTION: Matlabs feature edges need not to have the same direction
% even if there is only feature edge contour. To create a closed polygon
% CVL you have to resort the edges first. (Status of: 2017-07-07)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VLFLofgca, FEplot, ELsort, ELreconnect
%
% [FE,VL]=FEofSG([SG,ang])
% === INPUT PARAMETERS ===
% SG: if empty; VLFLofgca is used
% ang: angle; default is 0.4 ~ pi/8
% === OUTPUT RESULTS ======
% FE: Feature edge list
% VL: Vertex list for embedded SG
%
% EXAMPLE:
% FEofSG(SGsample(3))
% A=SGsample(19); FEofSG(A); EL=ans; VLELplots(A.VL,EL,'r-',4,2);
% view(80,-10)
% A=SGsample(19); FEofSG(A); EL=ELsort(ans); VLELplots(A.VL,EL,'r-',4,2);
% view(80,-10)
%
% See also: VLFLofgca, FEplot, ELsort, ELreconnect
%
%
% Copyright 2017 Tim C. Lueth

viewdimensioning(a,b,crossp,alpha)- changes the view parameter for an engineering view

viewdimensioning(a,b,crossp,alpha)% viewdimensioning(a,b,crossp,alpha) - changes the view parameter for an engineering view
% (by Tim Lueth, VLFL-Lib, 2017-APR-05 as class: USER INTERFACE)
%
% This fnctn works similar to view but allows to add a crossing point to
% see only a crossing plane;
% Nevertheless such a crossing plane requires in fact a real slicing of
% the sold at the right possition (Status of: 2020-07-14)
%
% Introduced first in SolidGeometry 3.8
%
% See also: view, PLdimensioning, CVLdimclassifier, SGdimensioning4,
% SGTdimensioning
%
% [CPL,CVL,X]=viewdimensioning([a,b,crossp,alpha])
% === INPUT PARAMETERS ===
% a: view angle a
% b: view angle b
% crossp: optional crossing point / plane
% alpha: alpha value
% === OUTPUT RESULTS ======
% CPL: Contour Point list x y 0
% CVL: Contour vertex list x y z
% X: Crossing Solid
%
% EXAMPLE:
% SGfigure(SGsample(17)); CPL=viewdimensioning(0,0,[0 0 0]); PLdimensioning(CPL);
% SGfigure(SGsample(17)); CPL=viewdimensioning(-90,0,[0 0 0]); PLdimensioning(CPL);
%
% close all; SGfigure(SGsample(17)); view(-30,30);
% view(0,90)
% viewdimensioning(0,-90,[0 0 15],0.1)
% [a,b,c]=viewdimensioning(0,-90,[0 0 15],0.1);
% SGplot(c); CVLplot(b,'b-',3);
%
% See also: view, PLdimensioning, CVLdimclassifier, SGdimensioning4,
% SGTdimensioning
%
%
% Copyright 2017-2020 Tim C. Lueth

CVLdimclassifier(OVL)- analyses contours and classifies different drawing elements

CVLdimclassifier(OVL)% CVLdimclassifier(OVL) - analyses contours and classifies different drawing elements
% (by Tim Lueth, VLFL-Lib, 2017-APR-04 as class: USER INTERFACE)
%
% This fnctn returns simple points that should be dimensioned. They do
% not specify a contour. In addition the fnctn also returns a list of
% radial centers and radius
% [cx cy cz] is the center of a circle;
% deg is the length of the circle
% (Status of: 2020-07-14)
%
% Introduced first in SolidGeometry 3.8
%
% See also: PLdimensioning, SGdimensioning4, SGTdimensioning
%
% [DVL,RL,RIL,Rnv]=CVLdimclassifier(OVL)
% === INPUT PARAMETERS ===
% OVL: Contour vertex List
% === OUTPUT RESULTS ======
% DVL: List for dimensioning
% RL: [cx cy cz Nr deg R vx vy vz]
% RIL: Points
% Rnv: List of normal vectors related to RL
%
% EXAMPLE:
% CVLdimclassifier(PLradialEdges(CPLofPL(PLsquare(30,20)),4));
%
%
% See also: PLdimensioning, SGdimensioning4, SGTdimensioning
%
%
% Copyright 2017-2020 Tim C. Lueth

expname(pfix)- returns a filename with the current date

expname(pfix)% expname(pfix) - returns a filename with the current date
% (by Tim Lueth, VLFL-Lib, 2017-APR-04 as class: FILE HANDLING)
%
% Introduced first in SolidGeometry 3.8
%
% See also: desktopdir, pcodedirTL, smbFilename, smbPSLibname, workdir,
% matlabtoolboxdir, matlabdir
%
% fname=expname([pfix])
% === INPUT PARAMETERS ===
% pfix: prefix default is 'EXP-'
% === OUTPUT RESULTS ======
% fname: file or directory name
%
% EXAMPLE:
% dir ([desktopdir expname])
%
% See also: desktopdir, pcodedirTL, smbFilename, smbPSLibname, workdir,
% matlabtoolboxdir, matlabdir
%
%
% Copyright 2017-2018 Tim C. Lueth

PLdimensioning(CPL)- plots a measurement ruler under a CPL

PLdimensioning(CPL)% PLdimensioning(CPL) - plots a measurement ruler under a CPL
% (by Tim Lueth, VLFL-Lib, 2017-APR-04 as class: USER INTERFACE)
%
% WORK in progress. Does support
% - removal of points on straight lines
% - holes and radial corners
% (Status of: 2020-07-14)
%
% Introduced first in SolidGeometry 3.8
%
% See also: CPLsortinout, CVLdimclassifier, view, viewdimensioning,
% SGdimensioning4, SGTdimensioning
%
% h=PLdimensioning(CPL)
% === INPUT PARAMETERS ===
% CPL: CPL or PL
% === OUTPUT RESULTS ======
% h: handle to drawings
%
% EXAMPLE:
% PLdimensioning(CPLsample(3));
% PLdimensioning(CPLofPL(PLradialEdges(PLsquare(30,20),4)));
% PLdimensioning(CPLofPL(PLradialEdges(CPLofPL(PLsquare(30,20)),4)));
% PLdimensioning([CPLofPL(PLradialEdges(CPLofPL(PLsquare(30,20)),4));NaN NaN;PLcircle(5)]);
%
% See also: CPLsortinout, CVLdimclassifier, view, viewdimensioning,
% SGdimensioning4, SGTdimensioning
%
%
% Copyright 2017-2020 Tim C. Lueth

SGsurfacehistogram(B,si,be)- plots a surface area histogram of selected surfaces

SGsurfacehistogram(B,si,be)% SGsurfacehistogram(B,si,be) - plots a surface area histogram of selected surfaces
% (by Tim Lueth, VLFL-Lib, 2017-APR-04 as class: SURFACES)
%
% This fnctn is useful to analyze imported STL files generated by a CSG
% modeler such as Catia.
% Rounded edges or broken corners makes it difficult to analyze fnctnal
% surface manually. This fnctn helps to get a feeling for the CSG-to-STL
% conversion strategy. (Status of: 2017-04-04)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGsurfaceplot, SGsurfaces
%
% SGsurfacehistogram(B,[si,be])
% === INPUT PARAMETERS ===
% B: Solid Geoemtry
% si: surface index wrt SGsurfaces; default ''
% be: histogram bin edges; default is be=[0 0.1 0.2 0.3 0.4 0.5 0.6 1.0];
%
%
% EXAMPLE:
% SGsurfacehistogram(SGsample(17))
% SGsurfacehistogram(SGsample(17),'',1:10)
%
% See also: SGsurfaceplot, SGsurfaces
%

SGisconvex(SG)- returns whether a solid is convex

SGisconvex(SG)% SGisconvex(SG) - returns whether a solid is convex
% (by Tim Lueth & Felix Schoppa, VLFL-Lib, 2017-APR-03 as class: SURFACES)
%
% WORK IN PROGRESS (2017-04-03)
% A solid is convex if all normal vectors of the vertices have the same
% direction, i.e.if the angle between vector from center line to vertex
% and verte normal vector is less than 90 degree (pi/2);
% (Status of: 2017-04-03)
%
% c=SGisconvex(SG)
% === INPUT PARAMETERS ===
% SG: Solid Geometry
% === OUTPUT RESULTS ======
% c: true if convex, false if not
%

SGsurfaces(SG,slct)- returns a cell list of separated CLOSED surfaces similar to SGseparate

SGsurfaces(SG,slct)% SGsurfaces(SG,slct) - returns a cell list of separated CLOSED surfaces similar to SGseparate
% (by Tim Lueth, VLFL-Lib, 2017-APR-03 as class: SURFACES)
%
% SGsurfaces and SGseparate analyse independent closed surfaces.
% SGanalyzeGroupParts analyses penetration of surfaces.
% For open surfaces use surfacesofSG (Status of: 2019-12-09)
%
% Introduced first in SolidGeometry 3.8
%
% See also: SGseparate, VLFLregions, SGsurfaceplot, SGsurfacehistogram,
% SGpacking, SGwriteSeparatedSTL, SGanalyzeGroupParts, surfacesofSG
%
% [SGC,n,BB]=SGsurfaces(SG,[slct])
% === INPUT PARAMETERS ===
% SG: Solid geoemtry as single struct
% slct: surface index; default is all; SGseparate shows all
% === OUTPUT RESULTS ======
% SGC: cell list of solid geometry structs
% n: length of cell list
% BB: cell list of bounding boxes; see SGseparate
%
% EXAMPLE:
% SGsurfaces(SGsample(17))
% SGwriteSeparatedSTL(SGsurfaces(SGsample(17)))
% SGpacking(SGsurfaces(SGsample(17)))
%
% See also: SGseparate, VLFLregions, SGsurfaceplot, SGsurfacehistogram,
% SGpacking, SGwriteSeparatedSTL, SGanalyzeGroupParts, surfacesofSG
%
%
% Copyright 2017-2021 Tim C. Lueth

VMintensityscale(V,cax)- returns an intensity scaled voxel image

VMintensityscale(V,cax)% VMintensityscale(V,cax) - returns an intensity scaled voxel image
% (by Tim Lueth, VLFL-Lib, 2017-APR-02 as class: VOXELS)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VMplot, VMmontage, VMresize, VMnoisethreshold
%
% [c,V]=VMintensityscale(V,[cax])
% === INPUT PARAMETERS ===
% V: Voxel mode
% cax: desired intensity interval; default is [0 1]
% === OUTPUT RESULTS ======
% c: [minc maxc]
% V: scaled to 0 to 1
%
% EXAMPLE:
% load AIM.mat
% VMintensityscale(V)
%
% See also: VMplot, VMmontage, VMresize, VMnoisethreshold
%
%
% Copyright 2017-2019 Tim C. Lueth

getprojectionimage(pc,vdist,vwidth,cupv)- returns a single projection image of gca

getprojectionimage(pc,vdist,vwidth,cupv)% getprojectionimage(pc,vdist,vwidth,cupv) - returns a single projection image of gca
% (by Tim Lueth, VLFL-Lib, 2017-APR-02 as class: ANALYTICAL GEOMETRY)
%
% See also: getgcapixelsize, projectionimage
%
% I=getprojectionimage(pc,vdist,vwidth,cupv)
% === INPUT PARAMETERS ===
% pc: camera position [-x y z] with direction through [0 0 0]
% vdist: distance of the screen behind [0 0 0]
% vwidth: length of the screen in y and z
% cupv: camera up vector; default is [0 -1 0]
% === OUTPUT RESULTS ======
% I: Image calculated by getframe and getgcapixelsize
%

getgcapixelsize- returns the position of the gca in the current figure

getgcapixelsize% getgcapixelsize - returns the position of the gca in the current figure
% (by Tim Lueth, VLFL-Lib, 2017-APR-02 as class: USER INTERFACE)
%
% This fnctn is required if getframe(gca) does not work anymore.
% In this case try getframe(gcf,getgcapixelsize) (Status of: 2017-04-02)
%
% See also: setgcapixelsize
%
% rect=getgcapixelsize
% === OUTPUT RESULTS ======
% rect: [left bottom width height] in pixels
%
% EXAMPLE:
% subplot(2,2,2)
% rect=getgcapixelsize
% I=getframe(gcf,rect); figure(3333); imshow(I.cdata);
%

projectionimage(pc,vdist,vwidth,pixel,w)- returns a central projection image by using Matlabs view commands

projectionimage(pc,vdist,vwidth,pixel,w)% projectionimage(pc,vdist,vwidth,pixel,w) - returns a central projection image by using Matlabs view commands
% (by Tim Lueth, Video-Lib, 2017-APR-02 as class: ANALYTICAL GEOMETRY)
%
% this fnctn returns a projection image of the current gca. The
% projections is always done in relation to the point [0 0 0]; The target
% is always
%
% It changes a lot of view parameter such as lighting shading etc.
% It can be used to create virtual conebeam images (Status of: 2017-04-02)
%
% See also: setgcapixelsize, VLprojection
%
% [I,cax,pc]=projectionimage(pc,vdist,vwidth,[pixel,w])
% === INPUT PARAMETERS ===
% pc: camera view point
% vdist: camera target point
% vwidth: virtual screen width
% pixel: pixel size of virtual screen
% w: single angle value or list an angles; default is 0
% === OUTPUT RESULTS ======
% I: Image of pixel size or image stack
% cax: color axis [min max]
% pc: center point or list of center points
%
% EXAMPLE:
% SGfigure; SGsample(17); view(-30,30);
% projectionimage([0 0 -10],10,200,512,0:pi/32:2*pi-1e-3); % central
% beam projection
% [I,ca]=projectionimage([0 0 -10],10,200,512,0:pi/32:2*pi-1e-3);
% projectionimage([0 0 -100000],10,200,512); % parallel projection
%

setgcapixelsize(siz)- sets the current gca to a default pixelsize

setgcapixelsize(siz)% setgcapixelsize(siz) - sets the current gca to a default pixelsize
% (by Tim Lueth, VLFL-Lib, 2017-APR-01 as class: ANALYTICAL GEOMETRY)
%
% This fnctn is helpful if projections should be calculated on pixel
% level as used in conebeam or ct projections (Status of: 2017-04-01)
%
% See also: getgcapixelsize
%
% ns=setgcapixelsize(siz)
% === INPUT PARAMETERS ===
% siz: [ x y], i.e. [c r]
% === OUTPUT RESULTS ======
% ns: [x y], i.e. [c r]
%
% EXAMPLE:
% setgcapixelsize([512 512])
%

VLprojection(SG,VL,ez,cent)- returns projected vertex lists on a surface/solid for given vertex list

VLprojection(SG,VL,ez,cent)% VLprojection(SG,VL,ez,cent) - returns projected vertex lists on a surface/solid for given vertex list
% (by Tim Lueth, VLFL-Lib, 2017-APR-01 as class: EXPERIMENTS)
%
% The projection surface is given as a solid. Now either by parallel
% projection or central projection the resulting vertex posions on the
% surface are returned. Also the distance and the index of the hit
% triangles are returned. It is important to understand that the use of
% EL or FL needs an additional handling, since in this case additional
% points have to be created similar to SGbool.
% There is also another possibility to calculate projections on
% pixel/voxel accuracy using view and axes. (Status of: 2020-01-09)
%
% Introduced first in SolidGeometry 3.8
%
% See also: VLFLpprojectPL, VLFLpprojectPLEL, intersectstriangle,
% crosspointVLFL, crosspointVLFL2, crosspointsVLFLofT
%
% [VLN,DL,fi]=VLprojection([SG,VL,ez,cent])
% === INPUT PARAMETERS ===
% SG: SG.VL, SG.FL; solid or surface as projection plane
% VL: CPL,CVL or VL as vertex list to project
% ez: beam direction (cent=false) or beam origin (cent=true)
% cent: central (true) or parallel projection (false); default = false;
% === OUTPUT RESULTS ======
% VLN: Projected vertex list
% DL: Distance list for each vertex
% fi: facet index list for each point
%
% EXAMPLE: Try central and parallel projection
% SG=SGtransP(SGbox([80,80,5]),[0 0 40]); VL=VLaddz(CPLsample(12));
% VLprojection(SG,VL,[0 0 1],false) % parallel projection
% VLprojection(SG,VL,[0 0 -30],true) % central projection
%
% See also: VLFLpprojectPL, VLFLpprojectPLEL, intersectstriangle,
% crosspointVLFL, crosspointVLFL2, crosspointsVLFLofT
%
%
% Copyright 2017-2020 Tim C. Lueth

exp_2017_03_30(A)- show the bounding box faces that are touched by the solid

exp_2017_03_30(A)% exp_2017_03_30(A) - show the bounding box faces that are touched by the solid
% (by Tim Lueth, VLFL-Lib, 2017-MÄR-30 as class: EXPERIMENTS)
%
% If STL files have been created using CATIA sometimes the Solids are
% rotated slightly. This can be corrected by detecting plane surfaces and
% adjust them by inverse transformation of the plane coordinate system.
% Nevertheless, it is difficult to see
% This fnctn is an example how to visualize the problem (Status of:
% 2017-03-30)
%
% [XL,YL,ZL]=exp_2017_03_30(A)
% === INPUT PARAMETERS ===
% A: Solid
% === OUTPUT RESULTS ======
% XL: List of coordinate that define the X-plane
% YL: List of coordinate that define the Y-plane
% ZL: List of coordinate that define the Z-plane
%
RapidWeaver Icon

Last Change Oct 2023 for SG-Lib 5.3