// ------------------------------------------------------------------------ // This program is complementary material for the book: // // Frank Nielsen // // Visual Computing: Geometry, Graphics, and Vision // // ISBN: 1-58450-427-7 // // Charles River Media, Inc. // // // All programs are available at http://www.charlesriver.com/visualcomputing/ // // You may use this program for ACADEMIC and PERSONAL purposes ONLY. // // // The use of this program in a commercial product requires EXPLICITLY // written permission from the author. The author is NOT responsible or // liable for damage or loss that may be caused by the use of this program. // // Copyright (c) 2005. Frank Nielsen. All rights reserved. // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // File: SmallEnclosingBall.cpp // // Description: Approximate the smallest enclosing ball of a high-dimensional // point set using Badoui and Clarkson's algorithm. // ------------------------------------------------------------------------ #include "stdafx.h" #include // dimension const int d=100; using namespace std; inline double drand() { return (double)rand()/(double)RAND_MAX; } // d-dimensional point set class PointdD{ public: double coord[d]; double Distance(PointdD p) { double result=0.0; for(int i=0;idistmax) {winner=i;distmax=dist;} } radius=distmax; // Update for(i=0;i