gdiam.h
Go to the documentation of this file.
1 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
2  * gdiam.h -
3  * Implmeents an algorithm for computing a diameter,
4  *
5  * Copyright 2000 Sariel Har-Peled (ssaarriieell@cs.uiuc.edu)
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; either version 2, or (at your option) any
10  * later version.
11  *
12  * Code is based on the paper:
13  * A Practical Approach for Computing the Diameter of a Point-Set.
14  * Sariel Har-Peled (http://www.uiuc.edu/~sariel)
15 \*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
16 
17 #pragma once
18 
19 #define GDIAM_DIM 3
20 using gdiam_real = double;
25 using gdiam_point_cnt = const gdiam_real*;
26 
27 #ifndef __MINMAX_DEFINED
28 #define __MINMAX_DEFINED
29 
30 /*
31 template <class T> const inline T& min( const T& t1, const T& t2 )
32 {
33  return t1>t2 ? t2 : t1;
34 }
35 
36 template <class T> inline T& max( const T& t1, const T& t2 )
37 {
38  return t1>t2 ? t1 : t2;
39 }
40 */
41 
42 template <class T>
43 inline T
44 min(T t1, T t2)
45 {
46  return t1 > t2 ? t2 : t1;
47 }
48 
49 template <class T>
50 inline T
51 max(T t1, T t2)
52 {
53  return t1 > t2 ? t1 : t2;
54 }
55 #endif /* MIN_MAX */
56 
57 template <class T>
58 inline void
60 {
61  T tmp = a;
62 
63  a = b;
64  b = tmp;
65 }
66 
67 inline gdiam_real
69 {
70  return sqrt(pnt[0] * pnt[0] + pnt[1] * pnt[1] + pnt[2] * pnt[2]);
71 }
72 
73 inline void
75 {
76  gdiam_real len = pnt_length(pnt);
77 
78  if (len == 0.0)
79  {
80  return;
81  }
82 
83  pnt[0] /= len;
84  pnt[1] /= len;
85  pnt[2] /= len;
86 }
87 
88 inline void
90 {
91  dest[0] = src[0];
92  dest[1] = src[1];
93  dest[2] = src[2];
94 }
95 
96 inline void
98 {
99  dst[0] = dst[1] = dst[2] = 0;
100 }
101 
102 inline void
104 {
105  printf("(%g, %g, %g)\n", pnt[0], pnt[1], pnt[2]);
106 }
107 
108 inline gdiam_real
110 {
111  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
112 }
113 
114 inline void
116 {
117  out[0] = a[1] * b[2] - a[2] * b[1];
118  out[1] = -(a[0] * b[2] - a[2] * b[0]);
119  out[2] = a[0] * b[1] - a[1] * b[0];
120 }
121 
122 inline gdiam_real
124 {
125  gdiam_real valx = (p[0] - q[0]);
126  gdiam_real valy = (p[1] - q[1]);
127 
128  return sqrt(valx * valx + valy * valy);
129 }
130 
131 inline gdiam_real
133 {
134  gdiam_real valx = (p[0] - q[0]);
135  gdiam_real valy = (p[1] - q[1]);
136  gdiam_real valz = (p[2] - q[2]);
137 
138  return sqrt(valx * valx + valy * valy + valz * valz);
139 }
140 
141 inline gdiam_real
143 {
144  gdiam_real valx = (p[0] - q[0]);
145  gdiam_real valy = (p[1] - q[1]);
146  gdiam_real valz = (p[2] - q[2]);
147 
148  gdiam_real len, proj_len;
149 
150  len = sqrt(valx * valx + valy * valy + valz * valz);
151 
152  proj_len = dir[0] * valx + dir[1] * valy + dir[2] * valz;
153 
154  return sqrt(len * len - proj_len * proj_len);
155 }
156 
157 inline void
159 {
160  pnt[0] = x;
161  pnt[1] = y;
162  pnt[2] = z;
163 }
164 
165 inline void
167 {
168  pnt[0] = x;
169  pnt[1] = y;
170  pnt[2] = z;
171 
172  pnt_normalize(pnt);
173 }
174 
175 inline bool
177 {
178  // Assuming here the GDIAM_DIM == 3 !!!!
179  return ((p[0] == q[0]) && (p[1] == q[1]) && (p[2] == q[2]));
180 }
181 
182 inline void
184 {
185  dest[0] += coef * vec[0];
186  dest[1] += coef * vec[1];
187  dest[2] += coef * vec[2];
188 }
189 
191 {
192 public:
195 
196  GPointPair() : p(), q()
197  {
198  distance = 0.0;
199  }
200 
201  void
202  init(const gdiam_point _p, const gdiam_point _q)
203  {
204  p = _p;
205  q = _q;
206  distance = pnt_distance(p, q);
207  }
208 
209  void
210  init(const gdiam_point _p, const gdiam_point _q, const gdiam_point proj)
211  {
212  p = _p;
213  q = _q;
214  distance = pnt_distance(p, q, proj);
215  }
216 
217  void
218  init(const gdiam_point pnt)
219  {
220  distance = 0;
221  p = q = pnt;
222  }
223 
224  void
226  {
227  gdiam_real new_dist;
228 
229  new_dist = pnt_distance(_p, _q);
230 
231  if (new_dist <= distance)
232  {
233  return;
234  }
235 
236  //printf( "new_dist: %g\n", new_dist );
237  distance = new_dist;
238  p = _p;
239  q = _q;
240  }
241 
242  void
243  update_diam_simple(const gdiam_point _p, const gdiam_point _q, const gdiam_point dir)
244  {
245  gdiam_real new_dist;
246 
247  new_dist = pnt_distance(_p, _q, dir);
248 
249  if (new_dist <= distance)
250  {
251  return;
252  }
253 
254  distance = new_dist;
255  p = _p;
256  q = _q;
257  }
258 
259  void
260  update_diam(const gdiam_point _p, const gdiam_point _q)
261  {
262  //update_diam_simple( p, _p );
263  //update_diam_simple( p, _q );
264  //update_diam_simple( q, _p );
265  //update_diam_simple( q, _q );
266  update_diam_simple(_p, _q);
267  }
268 
269  void
270  update_diam(const gdiam_point _p, const gdiam_point _q, const gdiam_point dir)
271  {
272  //update_diam_simple( p, _p );
273  //update_diam_simple( p, _q );
274  //update_diam_simple( q, _p );
275  //update_diam_simple( q, _q );
276  update_diam_simple(_p, _q, dir);
277  }
278 
279  void
281  {
282  //update_diam_simple( p, pp.p );
283  //update_diam_simple( p, pp.q );
284  //update_diam_simple( q, pp.p );
285  //update_diam_simple( q, pp.q );
286  update_diam_simple(pp.p, pp.q);
287  }
288 };
289 
290 class GBBox
291 {
292 private:
293  gdiam_real min_coords[GDIAM_DIM];
294  gdiam_real max_coords[GDIAM_DIM];
295 
296 public:
297  void
298  init(const GBBox& a, const GBBox& b)
299  {
300  for (int ind = 0; ind < GDIAM_DIM; ind++)
301  {
302  min_coords[ind] = min(a.min_coords[ind], b.min_coords[ind]);
303  max_coords[ind] = max(a.max_coords[ind], b.max_coords[ind]);
304  }
305  }
306 
307  void
308  dump() const
309  {
310  gdiam_real prod, diff;
311 
312  prod = 1.0;
313  printf("__________________________________________\n");
314 
315  for (int ind = 0; ind < GDIAM_DIM; ind++)
316  {
317  printf("%d: [%g...%g]\n", ind, min_coords[ind], max_coords[ind]);
318  diff = max_coords[ind] - min_coords[ind];
319  prod *= diff;
320  }
321 
322  printf("volume = %g\n", prod);
323  printf("\\__________________________________________\n");
324  }
325 
326  void
327  center(gdiam_point out) const
328  {
329  for (int ind = 0; ind < GDIAM_DIM; ind++)
330  {
331  out[ind] = (min_coords[ind] + max_coords[ind]) / 2.0;
332  }
333  }
334 
335  gdiam_real
336  volume() const
337  {
338  gdiam_real prod, val;
339 
340  prod = 1;
341 
342  for (int ind = 0; ind < GDIAM_DIM; ind++)
343  {
344  val = length_dim(ind);
345  prod *= val;
346  }
347 
348  return prod;
349  }
350 
351  void
353  {
354  for (int ind = 0; ind < GDIAM_DIM; ind++)
355  {
356  min_coords[ind] = 1e20;
357  max_coords[ind] = -1e20;
358  }
359  }
360 
361  /*
362  void dump() const {
363  printf( "---(" );
364  for (int ind = 0; ind < GDIAM_DIM; ind++ ) {
365  printf( "[%g, %g] ",
366  min_coords[ ind ],
367  max_coords[ ind ] );
368  }
369  printf( ")\n" );
370  }*/
371 
372  const gdiam_real&
373  min_coord(int coord) const
374  {
375  return min_coords[coord];
376  }
377 
378  const gdiam_real&
379  max_coord(int coord) const
380  {
381  return max_coords[coord];
382  }
383 
384  void
385  bound(const gdiam_point pnt)
386  {
387  //cout << "bounding: " << pnt << "\n";
388  for (int ind = 0; ind < GDIAM_DIM; ind++)
389  {
390  if (pnt[ind] < min_coords[ind])
391  {
392  min_coords[ind] = pnt[ind];
393  }
394 
395  if (pnt[ind] > max_coords[ind])
396  {
397  max_coords[ind] = pnt[ind];
398  }
399  }
400  }
401 
402  gdiam_real
403  length_dim(int dim) const
404  {
405  return max_coords[dim] - min_coords[dim];
406  }
407 
408  int
410  {
411  int dim = 0;
412  gdiam_real len = length_dim(0);
413 
414  for (int ind = 1; ind < GDIAM_DIM; ind++)
415  if (length_dim(ind) > len)
416  {
417  len = length_dim(ind);
418  dim = ind;
419  }
420 
421  return dim;
422  }
423 
424  gdiam_real
426  {
427  return length_dim(getLongestDim());
428  }
429 
430  gdiam_real
431  get_diam() const
432  {
433  gdiam_real sum, val;
434 
435  sum = 0;
436 
437  for (int ind = 0; ind < GDIAM_DIM; ind++)
438  {
439  val = length_dim(ind);
440  sum += val * val;
441  }
442 
443  return sqrt(sum);
444  }
445 
446  // in the following we assume that the length of dir is ONE!!!
447  // Note that the following is an overestaime - the diameter of
448  // projection of a cube, is bounded by the length of projections
449  // of its edges....
450  gdiam_real
452  {
453  gdiam_real sum, coord;
454  gdiam_real prod, val;
455 
456  //printf( "get_diam_proj: " );
457  sum = 0;
458 
459  for (int ind = 0; ind < GDIAM_DIM; ind++)
460  {
461  coord = length_dim(ind);
462  //printf( "coord[%d]: %g\n",ind, coord );
463  prod = coord * dir[ind];
464  val = coord * coord - prod * prod;
465  assert(val >= 0);
466  sum += sqrt(val);
467  }
468 
469  //printf( "sum: %g, %g\n", sum, get_diam() );
470 
471  // sum = squard diameter of the bounding box
472  // prod = length of projection of the diameter of cube on the
473  // direction.
474 
475  return get_diam();
476  }
477 
478  gdiam_real
479  get_min_coord(int dim) const
480  {
481  return min_coords[dim];
482  }
483 
484  gdiam_real
485  get_max_coord(int dim) const
486  {
487  return max_coords[dim];
488  }
489 };
490 
491 // gdiam_bbox is the famous - arbitrary orieted bounding box
493 {
494 private:
495  gdiam_point_t dir_1, dir_2, dir_3;
496  bool f_init;
497 
498 public:
502 
504  {
505  f_init = false;
506  }
507 
508  gdiam_bbox(const gdiam_bbox& other)
509  {
510  for (int i = 0; i < 3; i++)
511  {
512  dir_1[i] = other.dir_1[i];
513  dir_2[i] = other.dir_2[i];
514  dir_3[i] = other.dir_3[i];
515  }
516 
517  low_1 = other.low_1;
518  low_2 = other.low_2;
519  low_3 = other.low_3;
520 
521  high_1 = other.high_1;
522  high_2 = other.high_2;
523  high_3 = other.high_3;
524 
525  f_init = other.f_init;
526  }
527 
528  gdiam_bbox&
529  operator=(const gdiam_bbox& other)
530  {
531  for (int i = 0; i < 3; i++)
532  {
533  dir_1[i] = other.dir_1[i];
534  dir_2[i] = other.dir_2[i];
535  dir_3[i] = other.dir_3[i];
536  }
537 
538  low_1 = other.low_1;
539  low_2 = other.low_2;
540  low_3 = other.low_3;
541 
542  high_1 = other.high_1;
543  high_2 = other.high_2;
544  high_3 = other.high_3;
545 
546  f_init = other.f_init;
547 
548  return *this;
549  }
550 
551  gdiam_real
552  volume() const
553  {
554  gdiam_real len1, len2, len3;
555 
556  len1 = (high_1 - low_1);
557  len2 = (high_2 - low_2);
558  len3 = (high_3 - low_3);
559 
560  return len1 * len2 * len3;
561  }
562 
563  void
565  {
566  gdiam_point_t pnt_tmp;
567 
568  if ((high_1 - low_1) > (high_3 - low_3))
569  {
572 
573  memcpy(pnt_tmp, dir_1, sizeof(dir_1));
574  //pnt_tmp = dir_1;
575  memcpy(dir_1, dir_3, sizeof(dir_3));
576  //dir_1 = dir_3;
577  memcpy(dir_3, pnt_tmp, sizeof(dir_3));
578  //dir_3 = pnt_tmp;
579  }
580 
581  if ((high_2 - low_2) > (high_3 - low_3))
582  {
585 
586  pnt_copy(pnt_tmp, dir_2);
587  pnt_copy(dir_2, dir_3);
588  pnt_copy(dir_3, pnt_tmp);
589  }
590  }
591 
593  get_dir(int ind)
594  {
595  if (ind == 0)
596  {
597  return dir_1;
598  }
599 
600  if (ind == 1)
601  {
602  return dir_2;
603  }
604 
605  if (ind == 2)
606  {
607  return dir_3;
608  }
609 
610  assert(false);
611 
612  return NULL;
613  }
614 
615  void
616  combine(gdiam_point out, double a_coef, double b_coef, double c_coef)
617  {
618  for (int ind = 0; ind < GDIAM_DIM; ind++)
619  out[ind] = a_coef * dir_1[ind] + b_coef * dir_2[ind] + c_coef * dir_3[ind];
620  }
621 
622  void
623  dump_vertex(double sel1, double sel2, double sel3) const
624  {
625  gdiam_real coef1, coef2, coef3;
626 
627  //printf( "selection: (%g, %g, %g)\n", sel1, sel2, sel3 );
628  coef1 = low_1 + sel1 * (high_1 - low_1);
629  coef2 = low_2 + sel2 * (high_2 - low_2);
630  coef3 = low_3 + sel3 * (high_3 - low_3);
631 
632  //printf( "coeficients: (%g, %g, %g)\n",
633  // coef1, coef2, coef3 );
634 
635  gdiam_point_t pnt;
636  pnt_zero(pnt);
637 
638  //printf( "starting...\n" );
639  //pnt_dump( pnt );
640  pnt_scale_and_add(pnt, coef1, dir_1);
641  //pnt_dump( pnt );
642  pnt_scale_and_add(pnt, coef2, dir_2);
643  //pnt_dump( pnt );
644  pnt_scale_and_add(pnt, coef3, dir_3);
645  //pnt_dump( pnt );
646 
647  pnt_dump(pnt);
648  }
649 
650  void
651  dump() const
652  {
653  printf("-----------------------------------------------\n");
654  dump_vertex(0, 0, 0);
655  dump_vertex(0, 0, 1);
656  dump_vertex(0, 1, 0);
657  dump_vertex(0, 1, 1);
658  dump_vertex(1, 0, 0);
659  dump_vertex(1, 0, 1);
660  dump_vertex(1, 1, 0);
661  dump_vertex(1, 1, 1);
662  printf("volume: %g\n", volume());
663  printf("Directions:\n");
664  pnt_dump(dir_1);
665  pnt_dump(dir_2);
666  pnt_dump(dir_3);
667  printf("prods: %g, %g, %g\n",
668  pnt_dot_prod(dir_1, dir_2),
669  pnt_dot_prod(dir_1, dir_3),
670  pnt_dot_prod(dir_2, dir_3));
671 
672  printf("--------------------------------------------------\n");
673  //printf( "range_1: %g... %g\n", low_1, high_1 );
674  //printf( "range_2: %g... %g\n", low_2, high_2 );
675  //printf( "range_3: %g... %g\n", low_3, high_3 );
676  //printf( "prd: %g\n", pnt_dot_prod( dir_1, dir_2 ) );
677  //printf( "prd: %g\n", pnt_dot_prod( dir_2, dir_3 ) );
678  //printf( "prd: %g\n", pnt_dot_prod( dir_1, dir_3 ) );
679  }
680 
681  void
682  init(const GBBox& bb)
683  {
684  pnt_init(dir_1, 1, 0, 0);
685  pnt_init(dir_2, 0, 1, 0);
686  pnt_init(dir_3, 0, 0, 1);
687 
688  low_1 = bb.min_coord(0);
689  high_1 = bb.max_coord(0);
690 
691  low_2 = bb.min_coord(1);
692  high_2 = bb.max_coord(1);
693 
694  low_3 = bb.min_coord(2);
695  high_3 = bb.max_coord(2);
696  f_init = true;
697  }
698 
699  void
700  init(const gdiam_point _dir_1, const gdiam_point _dir_2, const gdiam_point _dir_3)
701  {
702  memset(this, 0, sizeof(gdiam_bbox));
703 
704  pnt_copy(dir_1, _dir_1);
705  pnt_copy(dir_2, _dir_2);
706  pnt_copy(dir_3, _dir_3);
707  pnt_normalize(dir_1);
708  pnt_normalize(dir_2);
709  pnt_normalize(dir_3);
710 
711  if ((!(fabs(pnt_dot_prod(dir_1, dir_2)) < 1e-6)) ||
712  (!(fabs(pnt_dot_prod(dir_1, dir_3)) < 1e-6)) ||
713  (!(fabs(pnt_dot_prod(dir_2, dir_3)) < 1e-6)))
714  {
715  printf("should be all close to zero: %g, %g, %g\n",
716  pnt_dot_prod(dir_1, dir_2),
717  pnt_dot_prod(dir_1, dir_3),
718  pnt_dot_prod(dir_2, dir_3));
719  pnt_dump(_dir_1);
720  pnt_dump(_dir_2);
721  pnt_dump(_dir_3);
722  fflush(stdout);
723  fflush(stderr);
724  assert(fabs(pnt_dot_prod(dir_1, dir_2)) < 1e-6);
725  assert(fabs(pnt_dot_prod(dir_1, dir_3)) < 1e-6);
726  assert(fabs(pnt_dot_prod(dir_2, dir_3)) < 1e-6);
727  }
728 
729  // The following reduce the error by slightly improve the
730  // orthoginality of the third vector. Doing to the second
731  // vector is not efficient...
732  pnt_scale_and_add(dir_3, -pnt_dot_prod(dir_3, dir_1), dir_1);
733  pnt_scale_and_add(dir_3, -pnt_dot_prod(dir_3, dir_2), dir_2);
734  pnt_normalize(dir_3);
735  //printf( "__should be all close to zero: %g, %g, %g\n",
736  // pnt_dot_prod( dir_1, dir_2 ),
737  // pnt_dot_prod( dir_1, dir_3 ),
738  // pnt_dot_prod( dir_2, dir_3 ) );
739  }
740 
741  void
742  bound(const gdiam_point pnt)
743  {
744  gdiam_real prod_1, prod_2, prod_3;
745 
746  prod_1 = pnt_dot_prod(dir_1, pnt);
747  prod_2 = pnt_dot_prod(dir_2, pnt);
748  prod_3 = pnt_dot_prod(dir_3, pnt);
749 
750  if (!f_init)
751  {
752  f_init = true;
753  low_1 = high_1 = prod_1;
754  low_2 = high_2 = prod_2;
755  low_3 = high_3 = prod_3;
756  return;
757  }
758 
759  if (prod_1 < low_1)
760  {
761  low_1 = prod_1;
762  }
763 
764  if (prod_2 < low_2)
765  {
766  low_2 = prod_2;
767  }
768 
769  if (prod_3 < low_3)
770  {
771  low_3 = prod_3;
772  }
773 
774  if (prod_1 > high_1)
775  {
776  high_1 = prod_1;
777  }
778 
779  if (prod_2 > high_2)
780  {
781  high_2 = prod_2;
782  }
783 
784  if (prod_3 > high_3)
785  {
786  high_3 = prod_3;
787  }
788  }
789 
790  // compute the coordinates as if the bounding box is unit cube of
791  // the grid
792  void
794  {
795  out[0] = (pnt_dot_prod(dir_1, in) - low_1) / (high_1 - low_1);
796  out[1] = (pnt_dot_prod(dir_2, in) - low_2) / (high_2 - low_2);
797  out[2] = (pnt_dot_prod(dir_3, in) - low_3) / (high_3 - low_3);
798  }
799 };
800 
801 GPointPair gdiam_approx_diam(gdiam_point* start, int size, gdiam_real eps);
802 GPointPair gdiam_approx_diam(gdiam_point* start, int size, gdiam_real eps);
803 gdiam_real gdiam_approx_diam(gdiam_real* start, int size, gdiam_real eps);
806 gdiam_bbox gdiam_approx_const_mvbb(gdiam_point* start, int size, gdiam_real eps, GBBox* p_ap_bbox);
807 gdiam_point* gdiam_convert(gdiam_real* start, int size);
808 gdiam_bbox gdiam_approx_mvbb(gdiam_point* start, int size, gdiam_real eps);
809 gdiam_bbox gdiam_approx_mvbb_grid(gdiam_point* start, int size, int grid_size);
811 gdiam_approx_mvbb_grid_sample(gdiam_point* start, int size, int grid_size, int sample_size);
813 gdiam_approx_mvbb_grid_sample(gdiam_real* start, int size, int grid_size, int sample_size);
814 
815 
817 
818 
819 /* gdiam.h - End of File ------------------------------------------*/
GPointPair::GPointPair
GPointPair()
Definition: gdiam.h:196
gdiam_bbox::volume
gdiam_real volume() const
Definition: gdiam.h:552
pnt_init
void pnt_init(gdiam_point pnt, gdiam_real x, gdiam_real y, gdiam_real z)
Definition: gdiam.h:158
pnt_zero
void pnt_zero(gdiam_point dst)
Definition: gdiam.h:97
GPointPair::init
void init(const gdiam_point _p, const gdiam_point _q)
Definition: gdiam.h:202
GBBox::get_diam_proj
gdiam_real get_diam_proj(gdiam_point dir) const
Definition: gdiam.h:451
pnt_distance_2d
gdiam_real pnt_distance_2d(gdiam_point_2d p, gdiam_point_2d q)
Definition: gdiam.h:123
GPointPair::p
gdiam_point p
Definition: gdiam.h:194
GBBox::get_min_coord
gdiam_real get_min_coord(int dim) const
Definition: gdiam.h:479
gdiam_bbox::low_2
gdiam_real low_2
Definition: gdiam.h:500
gdiam_bbox::bound
void bound(const gdiam_point pnt)
Definition: gdiam.h:742
gdiam_bbox::high_1
gdiam_real high_1
Definition: gdiam.h:499
gdiam_approx_mvbb_grid
gdiam_bbox gdiam_approx_mvbb_grid(gdiam_point *start, int size, int grid_size)
Definition: gdiam.cpp:2632
gdiam_bbox::low_1
gdiam_real low_1
Definition: gdiam.h:499
gdiam_approx_const_mvbb
gdiam_bbox gdiam_approx_const_mvbb(gdiam_point *start, int size, gdiam_real eps, GBBox *p_ap_bbox)
Definition: gdiam.cpp:1311
gdiam_bbox::init
void init(const gdiam_point _dir_1, const gdiam_point _dir_2, const gdiam_point _dir_3)
Definition: gdiam.h:700
GBBox::getLongestEdge
gdiam_real getLongestEdge() const
Definition: gdiam.h:425
gdiam_bbox
Definition: gdiam.h:492
pnt_length
gdiam_real pnt_length(const gdiam_point pnt)
Definition: gdiam.h:68
gdiam_generate_orthonormal_base
void gdiam_generate_orthonormal_base(gdiam_point in, gdiam_point out1, gdiam_point out2)
Definition: gdiam.cpp:1421
gdiam_point
gdiam_real * gdiam_point
Definition: gdiam.h:24
gdiam_bbox::gdiam_bbox
gdiam_bbox()
Definition: gdiam.h:503
GBBox::center
void center(gdiam_point out) const
Definition: gdiam.h:327
GBBox::max_coord
const gdiam_real & max_coord(int coord) const
Definition: gdiam.h:379
gdiam_bbox::dump
void dump() const
Definition: gdiam.h:651
GPointPair::update_diam
void update_diam(const gdiam_point _p, const gdiam_point _q)
Definition: gdiam.h:260
pnt_copy
void pnt_copy(gdiam_point_t dest, gdiam_point_t src)
Definition: gdiam.h:89
gdiam_real
double gdiam_real
Definition: gdiam.h:20
gdiam_bbox::low_3
gdiam_real low_3
Definition: gdiam.h:501
pnt_dump
void pnt_dump(gdiam_point_cnt pnt)
Definition: gdiam.h:103
GBBox::length_dim
gdiam_real length_dim(int dim) const
Definition: gdiam.h:403
gdiam_bbox::combine
void combine(gdiam_point out, double a_coef, double b_coef, double c_coef)
Definition: gdiam.h:616
gdiam_bbox::gdiam_bbox
gdiam_bbox(const gdiam_bbox &other)
Definition: gdiam.h:508
gdiam_approx_diam
GPointPair gdiam_approx_diam(gdiam_point *start, int size, gdiam_real eps)
Definition: gdiam.cpp:1234
gdiam_approx_diam_pair
GPointPair gdiam_approx_diam_pair(gdiam_real *start, int size, gdiam_real eps)
Definition: gdiam.cpp:1285
GBBox::bound
void bound(const gdiam_point pnt)
Definition: gdiam.h:385
armarx::ctrlutil::a
double a(double t, double a0, double j)
Definition: CtrlUtil.h:45
GBBox::get_diam
gdiam_real get_diam() const
Definition: gdiam.h:431
gdiam_point_2d
gdiam_real * gdiam_point_2d
Definition: gdiam.h:23
GBBox::init
void init(const GBBox &a, const GBBox &b)
Definition: gdiam.h:298
pnt_distance
gdiam_real pnt_distance(gdiam_point p, gdiam_point q)
Definition: gdiam.h:132
GBBox::get_max_coord
gdiam_real get_max_coord(int dim) const
Definition: gdiam.h:485
pnt_cross_prod
void pnt_cross_prod(const gdiam_point a, const gdiam_point b, const gdiam_point out)
Definition: gdiam.h:115
GBBox
Definition: gdiam.h:290
gdiam_bbox::get_dir
gdiam_point get_dir(int ind)
Definition: gdiam.h:593
max
T max(T t1, T t2)
Definition: gdiam.h:51
GPointPair::update_diam_simple
void update_diam_simple(const gdiam_point _p, const gdiam_point _q)
Definition: gdiam.h:225
gdiam_approx_mvbb
gdiam_bbox gdiam_approx_mvbb(gdiam_point *start, int size, gdiam_real eps)
Definition: gdiam.cpp:2529
GBBox::min_coord
const gdiam_real & min_coord(int coord) const
Definition: gdiam.h:373
pnt_dot_prod
gdiam_real pnt_dot_prod(gdiam_point_cnt a, gdiam_point_cnt b)
Definition: gdiam.h:109
q
#define q
GBBox::getLongestDim
int getLongestDim() const
Definition: gdiam.h:409
GPointPair::q
gdiam_point q
Definition: gdiam.h:194
pnt_scale_and_add
void pnt_scale_and_add(gdiam_point dest, gdiam_real coef, gdiam_point_cnt vec)
Definition: gdiam.h:183
gdiam_point_cnt
const gdiam_real * gdiam_point_cnt
Definition: gdiam.h:25
GBBox::init
void init()
Definition: gdiam.h:352
gdiam_bbox::get_normalized_coordinates
void get_normalized_coordinates(gdiam_point in, gdiam_point out)
Definition: gdiam.h:793
gdiam_bbox::high_2
gdiam_real high_2
Definition: gdiam.h:500
GPointPair::distance
gdiam_real distance
Definition: gdiam.h:193
gdiam_bbox::set_third_dim_longest
void set_third_dim_longest()
Definition: gdiam.h:564
GfxTL::sqrt
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
Definition: VectorXD.h:704
gdiam_approx_diam_pair_UDM
GPointPair gdiam_approx_diam_pair_UDM(gdiam_real *start, int size, gdiam_real eps)
Definition: gdiam.cpp:1298
GBBox::dump
void dump() const
Definition: gdiam.h:308
gdiam_point_2d_t
gdiam_real gdiam_point_2d_t[2]
Definition: gdiam.h:22
pnt_isEqual
bool pnt_isEqual(const gdiam_point p, const gdiam_point q)
Definition: gdiam.h:176
GPointPair::init
void init(const gdiam_point _p, const gdiam_point _q, const gdiam_point proj)
Definition: gdiam.h:210
gdiam_exchange
void gdiam_exchange(T &a, T &b)
Definition: gdiam.h:59
gdiam_point_t
gdiam_real gdiam_point_t[GDIAM_DIM]
Definition: gdiam.h:21
GPointPair::update_diam
void update_diam(const gdiam_point _p, const gdiam_point _q, const gdiam_point dir)
Definition: gdiam.h:270
gdiam_bbox::dump_vertex
void dump_vertex(double sel1, double sel2, double sel3) const
Definition: gdiam.h:623
GBBox::volume
gdiam_real volume() const
Definition: gdiam.h:336
gdiam_convert
gdiam_point * gdiam_convert(gdiam_real *start, int size)
Definition: gdiam.cpp:1266
GDIAM_DIM
#define GDIAM_DIM
Definition: gdiam.h:19
gdiam_bbox::high_3
gdiam_real high_3
Definition: gdiam.h:501
pnt_normalize
void pnt_normalize(gdiam_point pnt)
Definition: gdiam.h:74
gdiam_bbox::operator=
gdiam_bbox & operator=(const gdiam_bbox &other)
Definition: gdiam.h:529
T
float T
Definition: UnscentedKalmanFilterTest.cpp:38
gdiam_approx_mvbb_grid_sample
gdiam_bbox gdiam_approx_mvbb_grid_sample(gdiam_point *start, int size, int grid_size, int sample_size)
Definition: gdiam.cpp:2803
min
T min(T t1, T t2)
Definition: gdiam.h:44
GPointPair::init
void init(const gdiam_point pnt)
Definition: gdiam.h:218
GPointPair::update_diam
void update_diam(GPointPair &pp)
Definition: gdiam.h:280
GPointPair
Definition: gdiam.h:190
GPointPair::update_diam_simple
void update_diam_simple(const gdiam_point _p, const gdiam_point _q, const gdiam_point dir)
Definition: gdiam.h:243
pnt_init_normalize
void pnt_init_normalize(gdiam_point pnt, gdiam_real x, gdiam_real y, gdiam_real z)
Definition: gdiam.h:166
gdiam_bbox::init
void init(const GBBox &bb)
Definition: gdiam.h:682