No BSD License
-
SpringLab(modelname)
init model
-
ret=cameratoolbarnokeys(varar...
CAMERATOOLBARNOKEYS Interactively manipulate camera, without intercepting key press events.
-
Edg=BuildEdgFromTes(Tes)
-
K=FEMBuildKtemp(X,Tes,lambda,...
-
[X,Tes,Srf]=VolLoader(filenam...
[X,Tes,Srf]=VolLoader(filename)
-
b=ComputeBarys_3(MidPoint,Edg...
-
select3d(obj)
-
tf=IsNear(a,b,tol)
ISNEAR True Where Nearly Equal.
-
View all files
from
SpringLab
by Ofek Shilon
Interactive RT simulation of elastic bodies
|
| b=ComputeBarys_3(MidPoint,EdgePoints)
|
function b=ComputeBarys_3(MidPoint,EdgePoints)
%receives a column 3-vector MidPoint and a matrix EdgePoints whos columns
% are the 3 triangle points. Returns a column 3-vector b of the barycentric
% coordinates.
if ~(size(EdgePoints)==[3 3] & numel(MidPoint)==3)
error('improper input sizes to ObtainBarys_3')
elseif all(IsNear( cross( EdgePoints(:,3)- EdgePoints(:,1), ...
EdgePoints(:,2)- EdgePoints(:,1)), [0;0;0], 100*eps))
error('thou have just sent an almost linear face to compute for barys.')
end
FarFromZero= ~IsNear(zeros(3),EdgePoints);
if all(all(FarFromZero)) % no column is near the zero vector
b=EdgePoints\MidPoint;
else
D= 2*min(min(EdgePoints))-1;
b= (EdgePoints - D(ones(3)) ) \ (MidPoint - D(ones(3,1)) ) ;
end
|
|
Contact us at files@mathworks.com