~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/geomstat/state/state_hull.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/sysfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 
 12 void    state_hull(State * state, Vec3 * centre, float *radius)
 13 {
 14     Vec3    vmin = {Vec3_id};
 15     Vec3    vmax = {Vec3_id};
 16     int     i;
 17     int    *type = state->type->data;
 18     void  **geom = state->geom->data;
 19 
 20     vmin = vec3(1e10, 1e10, 1e10);
 21     vmax = vec3(-1e10, -1e10, -1e10);
 22 
 23     for (i = 0; i < state->maxindex; i++)
 24     {
 25         switch (type[i])
 26         {
 27         case POINT3:
 28             {
 29                 Point3 *point = (Point3 *) geom[i];
 30 
 31                 vec3_extend_hull(&vmin, &vmax, point->p);
 32             }
 33             break;
 34         case LINE3:
 35             {
 36                 Line3  *line = (Line3 *) geom[i];
 37 
 38                 vec3_extend_hull(&vmin, &vmax, line->p1);
 39                 vec3_extend_hull(&vmin, &vmax, line->p2);
 40             }
 41             break;
 42         case PLANE:
 43             {
 44                 Plane  *plane = (Plane *) geom[i];
 45 
 46                 vec3_extend_hull(&vmin, &vmax, plane->p);
 47             }
 48             break;
 49         }
 50     }
 51     *centre = vec3_times(0.5, vec3_sum(vmin, vmax));
 52     *radius = (float)(0.45 * vec3_dist(vmin, vmax));
 53 }
 54 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.