Home > matGeom > geom3d > hypot3.m

hypot3

PURPOSE ^

HYPOT3 Diagonal length of a cuboidal 3D box .

SYNOPSIS ^

function h = hypot3(dx, dy, dz)

DESCRIPTION ^

HYPOT3 Diagonal length of a cuboidal 3D box .

   h = hypot3(a, b, c)
   computes the quantity sqrt(a^2 + b^2 + c^2), by avoiding roundoff
   errors.

   Example
     % Compute diagonal of unit cube
     hypot3(1, 1, 1)
     ans =
          1.7321

     % Compute more complicated diagonal
     hypot3(3, 4, 5)
     ans = 
         7.0711
          
   See also
   hypot, vectorNorm3d

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = hypot3(dx, dy, dz)
0002 %HYPOT3 Diagonal length of a cuboidal 3D box .
0003 %
0004 %   h = hypot3(a, b, c)
0005 %   computes the quantity sqrt(a^2 + b^2 + c^2), by avoiding roundoff
0006 %   errors.
0007 %
0008 %   Example
0009 %     % Compute diagonal of unit cube
0010 %     hypot3(1, 1, 1)
0011 %     ans =
0012 %          1.7321
0013 %
0014 %     % Compute more complicated diagonal
0015 %     hypot3(3, 4, 5)
0016 %     ans =
0017 %         7.0711
0018 %
0019 %   See also
0020 %   hypot, vectorNorm3d
0021 
0022 % ------
0023 % Author: David Legland
0024 % E-mail: david.legland@inrae.fr
0025 % Created: 2012-04-29, using Matlab 7.9.0.529 (R2009b)
0026 % Copyright 2012-2024 INRA - Cepia Software Platform
0027 
0028 h = hypot(hypot(dx, dy), dz);

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022