by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - 4Bar/Linkages
Introduced first in SolidGeometry 5.1, Creation date: 2021-12-15, Last change: 2025-09-15
See Also: PosetransrelCPLE
, GPLauxgridpointsCPS2
PS=PosetransrelGPL(PS,[ng,nn])
PS: | Pose | |
ng: | optional number of grid points | |
nn: | selected grid point; default is nearest |
PS: | Resulting Pose |
PosetransrelGPL(Posesample(12)); % GPL unchanged, just shifted to nearest Grid point
PosetransrelGPL(Posesample(12),'','1); % GPL unchanged, just shifted to Grid point 1
PosetransrelGPL(Posesample(12),30); % New GPL with 30 entries and nearst is selected
This function, PosetransrelGPL, is designed to shift poses into an effector grid point. It is part of the SG-Library and was introduced in SolidGeometry 5.1. The function takes in a pose and optionally a number of grid points and a selected grid point, and returns the resulting pose.
ng and nn using the getfuncparams function.ng is not empty, update the grid points of PS using GPLauxgridpointsCPS2 with the current pose's CPLE and ng.T from the pose PS using TofPose.PS.GPL using the transformation matrix T to get P1.nn is empty, find the nearest grid point to the current position by calculating the Euclidean distance and selecting the minimum.PLN by transforming the selected grid point back using the inverse of the transformation matrix.TN with the new position PLN.PS using PosetransrelCPLE with the new transformation matrix TN.SGfigure, Poseplotspace, Poseplot, PLplot, and CPSplot.