[brlcad-commits] SF.net SVN: brlcad:[40367] brlcad/trunk/include/vmath.h
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <eri...@us...> - 2010-08-30 14:00:12
|
Revision: 40367 http://brlcad.svn.sourceforge.net/brlcad/?rev=40367&view=rev Author: erikgreenwald Date: 2010-08-30 14:00:05 +0000 (Mon, 30 Aug 2010) Log Message: ----------- add DIST_PT_PT_SQ() to avoid sqrt if unneeded Modified Paths: -------------- brlcad/trunk/include/vmath.h Modified: brlcad/trunk/include/vmath.h =================================================================== --- brlcad/trunk/include/vmath.h 2010-08-30 13:30:45 UTC (rev 40366) +++ brlcad/trunk/include/vmath.h 2010-08-30 14:00:05 UTC (rev 40367) @@ -301,10 +301,11 @@ #define DIST_PT_PLANE(_pt, _pl) (VDOT(_pt, _pl) - (_pl)[W]) /** @brief Compute distance between two points. */ -#define DIST_PT_PT(a, b) sqrt(\ +#define DIST_PT_PT_SQ(a, b) \ ((a)[X]-(b)[X])*((a)[X]-(b)[X]) + \ ((a)[Y]-(b)[Y])*((a)[Y]-(b)[Y]) + \ - ((a)[Z]-(b)[Z])*((a)[Z]-(b)[Z])) + ((a)[Z]-(b)[Z])*((a)[Z]-(b)[Z]) +#define DIST_PT_PT(a, b) sqrt(DIST_PT_PT_SQ(a,b)) /** @brief set translation values of 4x4 matrix with x, y, z values. */ #define MAT_DELTAS(_m, _x, _y, _z) { \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |