X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fkmath.h;h=bb30f05d683f8caf073e37e742ef6bb5c706ed8f;hp=48370267f1f9d92740bded47f363b83e3a4dde78;hb=f4a23943110823118f35756dd41fbd6707f04511;hpb=b5857e74e5735455b5ef11cbea5044ae7b2e8a0d diff --git a/include/kmath.h b/include/kmath.h index 4837026..bb30f05 100644 --- a/include/kmath.h +++ b/include/kmath.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: kmath.h,v 1.13 2000/06/15 19:07:10 kevin Exp $ +** $Id: kmath.h,v 1.14 2000/06/17 20:12:14 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -64,6 +64,9 @@ template inline T clamp (T value, T lowerBounds, T upperBounds) { return (value >= upperBounds ? upperBounds : (value <= lowerBounds ? lowerBounds : value )); } +template +inline T lineLength (T x1, T y1, T x2, T y2) +{ return static_cast( sqrt ((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)) ); } /* clip.cpp */ int clip_rect(double *x1, double *y1, double *x2, double *y2, const double rect[4]);