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