BRL-CAD
human.c
Go to the documentation of this file.
1 /* H U M A N . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libged/human.c
21  *
22  * Generator for human models based on height, and other stuff eventually,
23  * and for the humanwizard plugin (mostly).
24  *
25  * Here is a description of where the bounding boxes should be
26  * pivoting for each joint during articulation:
27  *
28  * head.r and neck.r
29  * - The pivot point is located on the XY center of the top of the
30  * neck.r .
31  *
32  * neck.r and upperchest.r
33  * - The neck.r pivots from the top XY center of the upperchest.r .
34  *
35  * shoulder*.r
36  * - The shoulder*.r pivots around the X-axis in its XYZ center (half
37  * the distance in each axis to reach the center of the box).
38  *
39  * upperchest.r and lowerchest.r
40  * - No movement, but the upperchest.r is specifically centered above
41  * the lowerchest.r .
42  *
43  * shoulder*.r and lowerchest.r
44  * - No movement, but the shoulder*.r and upperchest.r align
45  * horizontally (along the X-axis) and are together centered over
46  * the lowerchest.r .
47  *
48  * lowerchest.r and hips.r
49  * - No movement, but the lowerchest.r is aligned specifically
50  * centered above the hips.r .
51  *
52  * hips.r and thigh*.r
53  * - There are two pivot points, one for the thighL.r and the other
54  * for the thighR.r . Divide the hips.r box in half in the X
55  * direction, and find the XY centers of each. These pivot points
56  * are at the base of the hips.r .
57  *
58  * thigh*.r and calf*.r
59  * - The pivot point occurs at the XY center of the thigh*.r base.
60  *
61  * calf*.r and foot*r
62  * - The pivot point of the foot*.r is located in XYZ center of the
63  * overlap, meaning half way across the X-axis, Y-axis, and Z-axis
64  * of all area of the foot*.r overlapped by the calf*.r.
65  *
66  * shoulder*.r and upperarm*.r
67  * - The pivot point occurs at the XY center of the top of the
68  * upperarm*.r .
69  *
70  * upperarm*.r and forearm*.r
71  * - The pivot point occurs at the XY center of the upperarm*.r base.
72  *
73  * forearm*.r and hand*.r
74  * - The pivot point occurs at the XY center of the forearm*.r base.
75  *
76  */
77 
78 #include "common.h"
79 
80 #include <stdio.h>
81 #include <stdlib.h>
82 #include <string.h>
83 #include <math.h>
84 #include <time.h>
85 
86 #include "bu/getopt.h"
87 #include "vmath.h"
88 #include "bn.h"
89 #include "raytrace.h"
90 #include "wdb.h"
91 #include "ged.h"
92 
93 /*
94  * Default height is 5 feet, 8 inches, arbitrarily
95  */
96 #define DEFAULT_HEIGHT_INCHES 68.0
97 #define DEFAULT_FILENAME "human.g"
98 #define DEFAULT_HUMANNAME "Body.c"
99 
100 #define MAXLENGTH 64 /*Maxlength of things like object names, filenames */
101 #define IN2MM 25.4 /*Convert an inch measurement to millimeters */
102 #define CM2MM 10.0 /*Convert centimeters to millimeters */
103 
104 char *progname = "Human Model";
107 
108 /** Human information structures */
109 /** Location of all joints on the body located here */
110 struct jointInfo
111 {
112  point_t headJoint;
113  point_t neckJoint;
116  point_t elbowJoint;
117  point_t wristJoint;
118  point_t abdomenJoint;
119  point_t pelvisJoint;
120  point_t leftThighJoint;
122  point_t kneeJoint;
123  point_t ankleJoint;
124 };
125 
126 
127 /** Information for building the head */
128 struct headInfo
129 {
132 
133  vect_t headVector;
134  vect_t neckVector;
135 };
136 
137 
138 /** All information needed to build the torso lies here */
139 struct torsoInfo
140 {
149 
152 };
153 
154 
155 /** All information needed to build the arms lie here */
156 struct armInfo
157 {
164 
165  vect_t armVector;
166  vect_t lArmDirection; /* Arm direction vectors */
172 };
173 
174 
175 /** All information needed to build the legs lies here */
176 struct legInfo
177 {
183 
184  vect_t thighVector;
185  vect_t calfVector;
186  vect_t footVector;
187  vect_t lLegDirection; /* Leg direction vectors */
193 };
194 
195 
196 enum sexes { male, female };
197 enum ethnicities { generic, white, black, hispanic, asian, other }; /* divisions taken from army demographic sheet */
198 
199 /*Top level struct that holds all body information */
201 {
202  fastf_t height; /* Height of person standing, inches */
203  int age; /* Age of person, (still relevant?) */
204  enum sexes sex; /* Sex of person */
205  enum ethnicities ethnicity; /* Ethnicity of person */
206 
207  /* Various part lengths */
208  struct headInfo head;
209  struct torsoInfo torso;
210  struct armInfo arms;
211  struct legInfo legs;
212  struct jointInfo joints;
213 
214  /* Various triggers */
215  int textread;
217  int verbread;
219 
220 };
221 
222 
223 HIDDEN void Auto(struct human_data_t *dude);
224 HIDDEN void RandAuto(struct human_data_t *dude);
225 
226 /**
227  * This function takes in a vector, then applies a new direction to it
228  * using x, y, and z degrees, and exports it to resultVect, and
229  * returns the distance of the vector.
230  */
232 setDirection(fastf_t *inVect, fastf_t *resultVect, fastf_t *outMatrix, fastf_t x, fastf_t y, fastf_t z)
233 {
234  vect_t outVect;
235  mat_t rotMatrix;
236  MAT_ZERO(rotMatrix);
237 
238  /*
239  * x y z placed inside rotation matrix and applied to vector.
240  * bn_mat_angles(rotMatrix, x, y, z) matrix rot in degrees
241  * MAT4X3VEC(outVect, rotMatrix, inVect);
242  */
243  bn_mat_angles(rotMatrix, x, y, z);
244  MAT3X3VEC(outVect, rotMatrix, inVect);
245 
246 /* Print rotation matrix
247  * int i = 0;
248  * for (i = 1; i <= 16; i++) {
249  * bu_log("%3.4f\t", rotMatrix[(i-1)]);
250  * if (i%4 == 0)
251  * bu_log("\n");
252  * }
253  */
254  VMOVE(resultVect, outVect);
255  /*return MAGNITUDE(outVect);*/
256  MAT_COPY(outMatrix, rotMatrix);
257  return *rotMatrix;
258 }
259 
260 
261 /**
262  * Create a bounding box around the individual part, this one has only
263  * 1 value for depth and width. Currently is a big mess, as the boxes
264  * don't want to rotate in the correct manner, and insist upon rotating
265  * around an incorrect vertex.
266  */
267 HIDDEN void
268 boundingBox(struct rt_wdb *file, char *name, fastf_t *startPoint, fastf_t *lengthVector, fastf_t partWidth, fastf_t *rotMatrix)
269 {
270  /* Make the arb8/rpp that will bound the part as it were straight up and down,
271  * And then rotate it to the current position as given in rotMatrix,
272  * followed by naming it by taking name, and cat-ing BOX to the end of it.
273  */
274  vect_t vects[8];
275  vect_t distance;
276  vect_t JVEC;
277  char newName[MAXLENGTH] = "a";
278  char debug[MAXLENGTH] = "a";
279  int i = 0;
280  int w=0;
281 
282  bu_strlcpy(newName, name, MAXLENGTH);
283  bu_strlcpy(debug, name, MAXLENGTH);
284  bu_strlcat(newName, "Box", MAXLENGTH);
285  bu_strlcat(debug, "Joint", MAXLENGTH);
286 
287  VADD2(distance, startPoint, lengthVector);
288  VSET(distance, distance[X], distance[Y], startPoint[Z]-lengthVector[Z]);
289 
290  VSET(vects[0], (-partWidth+startPoint[X]), (-partWidth+startPoint[Y]), (startPoint[Z]));
291  VSET(vects[1], (-partWidth+startPoint[X]), (partWidth+startPoint[Y]), (startPoint[Z]));
292  VSET(vects[2], (partWidth+startPoint[X]), (partWidth+startPoint[Y]), (startPoint[Z]));
293  VSET(vects[3], (partWidth+startPoint[X]), (-partWidth+startPoint[Y]), (startPoint[Z]));
294  VSET(vects[4], (-partWidth+startPoint[X]), (-partWidth+startPoint[Y]), (distance[Z]));
295  VSET(vects[5], (-partWidth+startPoint[X]), (partWidth+startPoint[Y]), (distance[Z]));
296  VSET(vects[6], (partWidth+startPoint[X]), (partWidth+startPoint[Y]), (distance[Z]));
297  VSET(vects[7], (partWidth+startPoint[X]), (-partWidth+startPoint[Y]), (distance[Z]));
298 
299  for (i = 0; i<8; i++) {
300  vects[i][Y]*=-1;
301  }
302 
303 /* Print rotation matrix */
304  for (w = 1; w <= 16; w++) {
305 
306 /*These z, y, x, rot matrices were for debugging purposes but didn't help. */
307  /*Z rotation matrix */
308 /* if (w == 1 || w == 2 || w == 5 || w == 6 || w == 11)
309  * rotMatrix[(w-1)] = rotMatrix[(w-1)] * -1;
310  */
311  /*Y rotation Matrix */
312 /* if (w == 1 || w == 3 || w == 6 || w == 9 || w == 11)
313  * rotMatrix[(w-1)] = rotMatrix[(w-1)] * -1;
314  */
315  /*X rotation Matrix */
316 /* if (w == 1 || w == 6 || w == 7 || w == 10 || w == 11)
317  * rotMatrix[(w-1)] = rotMatrix[(w-1)] * -1;
318  */
319 /*
320  * bu_log("%3.4f\t", rotMatrix[(w-1)]);
321  * if (w%4 == 0)
322  * bu_log("\n");
323  */
324  }
325 /* bu_log("-------------------------------+\n");
326  */
327 
328  MAT3X3VEC(JVEC, rotMatrix, lengthVector);
329  mk_trc_h(file, debug, startPoint, JVEC, 4, 1);
330  mk_arb8(file, newName, *vects);
331 }
332 
333 
334 /**
335  * Create a bounding rectangle around the individual part, and this
336  * one has 2 separate values for depth and width
337  */
338 HIDDEN void
339 boundingRectangle(struct rt_wdb *file, char *name, fastf_t *startPoint, fastf_t *lengthVector, fastf_t partWidth, fastf_t partDepth, fastf_t *UNUSED(rotMatrix))
340 {
341  /* Make the arb8/rpp that will bound the part as it were straight
342  * up and down, And then rotate it to the current position as
343  * given in rotMatrix, followed by naming it by taking name, and
344  * cat-ing BOX to the end of it.
345  */
346  vect_t vects[8];
347  vect_t distance;
348  char newName[MAXLENGTH] = "a";
349 
350  bu_strlcpy(newName, name, MAXLENGTH);
351  bu_strlcat(newName, "Box", MAXLENGTH);
352 
353  VADD2(distance, startPoint, lengthVector);
354  VSET(distance, distance[X], distance[Y], startPoint[Z]-lengthVector[Z]);
355 
356  /* Set first 4 points to be on the same plane as the starting point, and the last 4 points to be the distance vector point plane */
357 /*
358  * fastf_t length=findVector(partWidth, partWidth);
359  */
360  VSET(vects[0], (-partDepth+startPoint[X]), (-partWidth+startPoint[Y]), (startPoint[Z]));
361  VSET(vects[1], (-partDepth+startPoint[X]), (partWidth+startPoint[Y]), (startPoint[Z]));
362  VSET(vects[2], (partDepth+startPoint[X]), (partWidth+startPoint[Y]), (startPoint[Z]));
363  VSET(vects[3], (partDepth+startPoint[X]), (-partWidth+startPoint[Y]), (startPoint[Z]));
364  VSET(vects[4], (-partDepth+startPoint[X]), (-partWidth+startPoint[Y]), (distance[Z]));
365  VSET(vects[5], (-partDepth+startPoint[X]), (partWidth+startPoint[Y]), (distance[Z]));
366  VSET(vects[6], (partDepth+startPoint[X]), (partWidth+startPoint[Y]), (distance[Z]));
367  VSET(vects[7], (partDepth+startPoint[X]), (-partWidth+startPoint[Y]), (distance[Z]));
368 
369  mk_arb8(file, newName, *vects);
370 }
371 
372 
373 /******************************************/
374 /* */
375 /***** Body Parts, from the head down *****/
376 /* */
377 /******************************************/
378 
380 makeHead(struct rt_wdb (*file), char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
381 {
382  fastf_t head = dude->head.headSize / 2;
383  vect_t startVector, lengthVector;
384  point_t headFix;
385  mat_t rotMatrix;
386  /*Length vector is just the diameter of the head, currently*/
387  VSET(lengthVector, 0, 0, dude->head.headSize);
388  VSET(startVector, 0, 0, 0);
389  setDirection(startVector, dude->head.headVector, rotMatrix, direction[X], direction[Y], direction[Z]);
390  mk_sph(file, name, dude->joints.headJoint, head);
391 
392  VSET(headFix, dude->joints.headJoint[X], dude->joints.headJoint[Y], dude->joints.headJoint[Z]+head);
393 
394  if (showBoxes)
395  boundingBox(file, name, headFix, lengthVector, (lengthVector[Z]/2), rotMatrix);
396  return 0;
397 }
398 
399 
401 makeNeck(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
402 {
403  vect_t startVector;
404  mat_t rotMatrix;
405  VSET(startVector, 0, 0, dude->head.neckLength);
406  setDirection(startVector, dude->head.neckVector, rotMatrix, direction[X], direction[Y], direction[Z]);
407  VADD2(dude->joints.neckJoint, dude->joints.headJoint, dude->head.neckVector);
408  mk_rcc(file, name, dude->joints.headJoint, dude->head.neckVector, dude->head.neckWidth);
409 
410  if (showBoxes)
411  boundingBox(file, name, dude->joints.headJoint, startVector, dude->head.neckWidth, rotMatrix);
412  return dude->head.neckWidth;
413 }
414 
415 
417 makeUpperTorso(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
418 {
419  vect_t startVector;
420  vect_t a, b, c, d;
421  vect_t leftVector, rightVector;
422  mat_t rotMatrix;
423 
424  /* Set length of top torso portion */
425  VSET(startVector, 0, 0, dude->torso.topTorsoLength);
426  setDirection(startVector, dude->torso.topTorsoVector, rotMatrix, direction[X], direction[Y], direction[Z]);
427  VADD2(dude->joints.abdomenJoint, dude->joints.neckJoint, dude->torso.topTorsoVector);
428 
429  /* change shoulder joints to match up to torso */
430  VSET(leftVector, 0, (dude->torso.shoulderWidth+(dude->arms.upperArmWidth)), 0);
431  VSET(rightVector, 0, (dude->torso.shoulderWidth+(dude->arms.upperArmWidth))*-1, 0);
432 
433  VADD2(dude->joints.leftShoulderJoint, dude->joints.neckJoint, leftVector);
434  VADD2(dude->joints.rightShoulderJoint, dude->joints.neckJoint, rightVector);
435 
436  /*Take shoulder width, and abWidth and convert values to vectors for tgc */
437  VSET(a, (dude->torso.shoulderDepth), 0, 0);
438  VSET(b, 0, dude->torso.shoulderWidth, 0);
439  VSET(c, (dude->torso.abDepth), 0, 0);
440  VSET(d, 0, (dude->torso.abWidth), 0);
441 
442  /* Torso will be an ellipsoidal tgc, for more realistic shape */
443  mk_tgc(file, name, dude->joints.neckJoint, dude->torso.topTorsoVector, a, b, c, d);
444 
445  if (showBoxes)
446  boundingRectangle(file, name, dude->joints.neckJoint, startVector, dude->torso.shoulderWidth, (dude->torso.shoulderWidth/2), rotMatrix);
447  return dude->torso.abWidth;
448 }
449 
450 
452 makeLowerTorso(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
453 {
454  vect_t startVector, leftVector, rightVector;
455  vect_t a, b, c, d;
456  mat_t rotMatrix;
457 
458  VSET(startVector, 0, 0, dude->torso.lowTorsoLength);
459  setDirection(startVector, dude->torso.lowTorsoVector, rotMatrix, direction[X], direction[Y], direction[Z]);
460  VADD2(dude->joints.pelvisJoint, dude->joints.abdomenJoint, dude->torso.lowTorsoVector);
461 
462  /* Set locations of legs */
463  VSET(leftVector, 0, (dude->torso.pelvisWidth/2), 0);
464  VSET(rightVector, 0, ((dude->torso.pelvisWidth/2)*-1), 0);
465  VADD2(dude->joints.leftThighJoint, dude->joints.pelvisJoint, leftVector);
466  VADD2(dude->joints.rightThighJoint, dude->joints.pelvisJoint, rightVector);
467 
468  VSET(a, (dude->torso.abDepth), 0, 0);
469  VSET(b, 0, dude->torso.abWidth, 0);
470  VSET(c, (dude->torso.pelvisDepth), 0, 0);
471  VSET(d, 0, dude->torso.pelvisWidth, 0);
472 
473  mk_tgc(file, name, dude->joints.abdomenJoint, dude->torso.lowTorsoVector, a, b, c, d);
474 /*
475  * mk_trc_h(file, name, abdomenJoint, lowTorsoVector, abWidth, pelvisWidth);
476  */
477  if (showBoxes)
478  boundingRectangle(file, name, dude->joints.abdomenJoint, startVector, dude->torso.pelvisWidth, (dude->torso.pelvisWidth/2), rotMatrix);
479  return dude->torso.pelvisWidth;
480 }
481 
482 
484 makeShoulderJoint(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
485 {
486  vect_t startVector, lengthVector;
487  point_t leftFix, rightFix;
488  fastf_t shoulder;
489  mat_t rotMatrix;
490  VSET(startVector, 0, 0, dude->arms.upperArmWidth*2);
491  VSET(lengthVector, 0, 0, dude->arms.upperArmWidth);
492  shoulder = dude->arms.upperArmWidth;
493 
494  if (isLeft)
495  mk_sph(file, name, dude->joints.leftShoulderJoint, (dude->arms.upperArmWidth));
496  else
497  mk_sph(file, name, dude->joints.rightShoulderJoint, (dude->arms.upperArmWidth));
498 
499  if (showBoxes) {
500  if (isLeft) {
501  setDirection(startVector, lengthVector, rotMatrix, dude->arms.lArmDirection[X], dude->arms.lArmDirection[Y], dude->arms.lArmDirection[Z]);
502  VSET(leftFix, dude->joints.leftShoulderJoint[X], dude->joints.leftShoulderJoint[Y], (dude->joints.leftShoulderJoint[Z]-shoulder));
503  boundingBox(file, name, leftFix, lengthVector, (lengthVector[Z]/2), rotMatrix);
504  } else {
505  setDirection(startVector, lengthVector, rotMatrix, dude->arms.rArmDirection[X], dude->arms.rArmDirection[Y], dude->arms.rArmDirection[Z]);
506  VSET(rightFix, dude->joints.rightShoulderJoint[X], dude->joints.rightShoulderJoint[Y], (dude->joints.rightShoulderJoint[Z]-shoulder));
507  boundingBox(file, name, rightFix, lengthVector, (lengthVector[Z]/2), rotMatrix);
508  }
509  }
510  return dude->torso.shoulderWidth;
511 }
512 
513 
515 makeShoulder(struct rt_wdb *UNUSED(file), fastf_t UNUSED(isLeft), char *UNUSED(partName), struct human_data_t *UNUSED(dude), int UNUSED(showBoxes))
516 {
517  return 1;
518 }
519 
520 
522 makeUpperArm(struct rt_wdb *file, int isLeft, char *partName, struct human_data_t *dude, int showBoxes)
523 {
524  vect_t startVector;
525  mat_t rotMatrix;
526 
527  VSET(startVector, 0, 0, dude->arms.upperArmLength);
528  if (isLeft) {
529  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.lArmDirection[X], dude->arms.lArmDirection[Y], dude->arms.lArmDirection[Z]); /* set y to 180 to point down */
530  VADD2(dude->joints.elbowJoint, dude->joints.leftShoulderJoint, dude->arms.armVector);
531  mk_trc_h(file, partName, dude->joints.leftShoulderJoint, dude->arms.armVector, dude->arms.upperArmWidth, dude->arms.elbowWidth);
532  } else{
533  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.rArmDirection[X], dude->arms.rArmDirection[Y], dude->arms.rArmDirection[Z]); /* set y to 180 to point down */
534  VADD2(dude->joints.elbowJoint, dude->joints.rightShoulderJoint, dude->arms.armVector);
535  mk_trc_h(file, partName, dude->joints.rightShoulderJoint, dude->arms.armVector, dude->arms.upperArmWidth, dude->arms.elbowWidth);
536  }
537 
538 /* Vectors and equations for making TGC arms
539  * vect_t a, b, c, d;
540  * VSET(a, upperArmWidth, 0 , 0);
541  * VSET(b, 0, upperArmWidth, 0);
542  * VSET(c, ((elbowWidth*3)/4), 0, 0)
543  * VSET(d, 0, elbowWidth, 0);
544  *
545  * mk_tgc(file, partName, ShoulderJoint, armVector, a, b, c, d);
546  */
547 
548  if (showBoxes) {
549  if (isLeft)
550  boundingBox(file, partName, dude->joints.leftShoulderJoint, startVector, dude->arms.upperArmWidth, rotMatrix);
551  else
552  boundingBox(file, partName, dude->joints.rightShoulderJoint, startVector, dude->arms.upperArmWidth, rotMatrix);
553  }
554  return dude->arms.elbowWidth;
555 }
556 
557 
559 makeElbow(struct rt_wdb *file, int UNUSED(isLeft), char *name, struct human_data_t *dude)
560 {
561  vect_t a, b, c;
562  VSET(a, (dude->arms.elbowWidth), 0, 0);
563  VSET(b, 0, (dude->arms.elbowWidth), 0);
564  VSET(c, 0, 0, dude->arms.elbowWidth);
565 
566  mk_ell(file, name, dude->joints.elbowJoint, a, b, c);
567 /*
568  * mk_sph(file, name, dude->joints.elbowJoint, dude->arms.elbowWidth);
569  */
570  return dude->arms.elbowWidth;
571 }
572 
573 
575 makeLowerArm(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
576 {
577  vect_t startVector;
578  mat_t rotMatrix;
579 
580  VSET(startVector, 0, 0, dude->arms.lowerArmLength);
581  if (isLeft) {
582  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.lElbowDirection[X], dude->arms.lElbowDirection[Y], dude->arms.lElbowDirection[Z]);
583  VADD2(dude->joints.wristJoint, dude->joints.elbowJoint, dude->arms.armVector);
584  } else{
585  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.rElbowDirection[X], dude->arms.rElbowDirection[Y], dude->arms.rElbowDirection[Z]);
586  VADD2(dude->joints.wristJoint, dude->joints.elbowJoint, dude->arms.armVector);
587  }
588 
589 /* vectors for building a tgc arm (which looks weird when rotated) */
590 /* vect_t a, b, c, d;
591  *
592  * VSET(a, ((elbowWidth*3)/4), 0, 0);
593  * VSET(b, 0, (elbowWidth), 0);
594  * VSET(c, wristWidth, 0, 0);
595  * VSET(d, 0, wristWidth, 0);
596  *
597  * mk_tgc(file, name, elbowJoint, armVector, a, b, c, d);
598  */
599  mk_trc_h(file, name, dude->joints.elbowJoint, dude->arms.armVector, dude->arms.elbowWidth, dude->arms.wristWidth);
600 
601  if (showBoxes) {
602  if (isLeft)
603  boundingBox(file, name, dude->joints.elbowJoint, startVector, dude->arms.elbowWidth, rotMatrix);
604  else
605  boundingBox(file, name, dude->joints.elbowJoint, startVector, dude->arms.elbowWidth, rotMatrix);
606  }
607 
608  return dude->arms.wristWidth;
609 }
610 
611 
613 makeWrist(struct rt_wdb *file, int UNUSED(isLeft), char *name, struct human_data_t *dude)
614 {
615  mk_sph(file, name, dude->joints.wristJoint, dude->arms.wristWidth);
616  return dude->arms.wristWidth;
617 }
618 
619 
620 HIDDEN void
621 makeHand(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
622 {
623  mat_t rotMatrix;
624  vect_t startVector;
625  VSET(startVector, 0, 0, dude->arms.handLength);
626  if (isLeft) {
627  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.lWristDirection[X], dude->arms.lWristDirection[Y], dude->arms.lWristDirection[Z]);
628  } else{
629  setDirection(startVector, dude->arms.armVector, rotMatrix, dude->arms.rWristDirection[X], dude->arms.rWristDirection[Y], dude->arms.rWristDirection[Z]);
630  }
631 
632  mk_sph(file, name, dude->joints.wristJoint, dude->arms.wristWidth);
633 
634  if (showBoxes) {
635  boundingRectangle(file, name, dude->joints.wristJoint, startVector, dude->arms.handWidth, dude->arms.handLength, rotMatrix);
636  }
637 }
638 
639 
641 makeThighJoint(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude)
642 {
643  if (isLeft)
644  mk_sph(file, name, dude->joints.leftThighJoint, dude->legs.thighWidth);
645  else
646  mk_sph(file, name, dude->joints.rightThighJoint, dude->legs.thighWidth);
647 
648  return dude->legs.thighWidth;
649 }
650 
651 
653 makeThigh(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
654 {
655  vect_t startVector;
656  mat_t rotMatrix;
657  VSET(startVector, 0, 0, dude->legs.thighLength);
658 
659  if (isLeft) {
660  setDirection(startVector, dude->legs.thighVector, rotMatrix, dude->legs.lLegDirection[X], dude->legs.lLegDirection[Y], dude->legs.lLegDirection[Z]);
661  VADD2(dude->joints.kneeJoint, dude->joints.leftThighJoint, dude->legs.thighVector);
662  mk_trc_h(file, name, dude->joints.leftThighJoint, dude->legs.thighVector, dude->legs.thighWidth, dude->legs.kneeWidth);
663  } else{
664  setDirection(startVector, dude->legs.thighVector, rotMatrix, dude->legs.rLegDirection[X], dude->legs.rLegDirection[Y], dude->legs.rLegDirection[Z]);
665  VADD2(dude->joints.kneeJoint, dude->joints.rightThighJoint, dude->legs.thighVector);
666  mk_trc_h(file, name, dude->joints.rightThighJoint, dude->legs.thighVector, dude->legs.thighWidth, dude->legs.kneeWidth);
667  }
668  if (showBoxes) {
669  if (isLeft)
670  boundingBox(file, name, dude->joints.leftThighJoint, startVector, dude->legs.thighWidth, rotMatrix);
671  else
672  boundingBox(file, name, dude->joints.rightThighJoint, startVector, dude->legs.thighWidth, rotMatrix);
673  }
674  return dude->legs.kneeWidth;
675 }
676 
677 
679 makeKnee(struct rt_wdb *file, int UNUSED(isLeft), char *name, struct human_data_t *dude)
680 {
681  mk_sph(file, name, dude->joints.kneeJoint, dude->legs.kneeWidth);
682  return dude->legs.kneeWidth;
683 }
684 
685 
687 makeCalf(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
688 {
689  vect_t startVector;
690  mat_t rotMatrix;
691  VSET(startVector, 0, 0, dude->legs.calfLength);
692 
693 /*
694  * Find a better way of error checking to see if the legs go thru the ground.
695  * if (ankleJoint[Y] <= 0) {
696  * ankleJoint[Y] = ankleWidth;
697  * }
698  */
699  if (isLeft)
700  setDirection(startVector, dude->legs.calfVector, rotMatrix, dude->legs.lKneeDirection[X], dude->legs.lKneeDirection[Y], dude->legs.lKneeDirection[Z]);
701  else
702  setDirection(startVector, dude->legs.calfVector, rotMatrix, dude->legs.rKneeDirection[X], dude->legs.rKneeDirection[Y], dude->legs.rKneeDirection[Z]);
703 
704  VADD2(dude->joints.ankleJoint, dude->joints.kneeJoint, dude->legs.calfVector);
705  mk_trc_h(file, name, dude->joints.kneeJoint, dude->legs.calfVector, dude->legs.kneeWidth, dude->legs.ankleWidth);
706 
707  if (showBoxes) {
708  if (isLeft)
709  boundingBox(file, name, dude->joints.kneeJoint, startVector, dude->legs.kneeWidth, rotMatrix);
710  else
711  boundingBox(file, name, dude->joints.kneeJoint, startVector, dude->legs.kneeWidth, rotMatrix);
712  }
713  return dude->legs.ankleWidth;
714 }
715 
716 
718 makeAnkle(struct rt_wdb *file, int UNUSED(isLeftr), char *name, struct human_data_t *dude)
719 {
720  mk_sph(file, name, dude->joints.ankleJoint, dude->legs.ankleWidth);
721  return dude->legs.ankleWidth;
722 }
723 
724 
726 makeFoot(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
727 {
728  vect_t startVector, boxVector;
729  mat_t rotMatrix;
730  VSET(startVector, 0, 0, dude->legs.footLength);
731  VSET(boxVector, 0, 0, dude->legs.footLength + dude->legs.toeWidth);
732 
733  if (isLeft)
734  setDirection(startVector, dude->legs.footVector, rotMatrix, dude->legs.lFootDirection[X], dude->legs.lFootDirection[Y], dude->legs.lFootDirection[Z]);
735  else
736  setDirection(startVector, dude->legs.footVector, rotMatrix, dude->legs.rFootDirection[X], dude->legs.rFootDirection[Y], dude->legs.rFootDirection[Z]);
737 
738  mk_particle(file, name, dude->joints.ankleJoint, dude->legs.footVector, dude->legs.ankleWidth, dude->legs.toeWidth);
739 
740  if (showBoxes) {
741  if (isLeft)
742  boundingBox(file, name, dude->joints.ankleJoint, boxVector, dude->legs.toeWidth, rotMatrix);
743  else
744  boundingBox(file, name, dude->joints.ankleJoint, boxVector, dude->legs.toeWidth, rotMatrix);
745  }
746  return 0;
747 }
748 
749 
750 /**
751  * Make profile makes the head and neck of the body
752  */
753 HIDDEN void
754 makeProfile(struct rt_wdb (*file), char *suffix, struct human_data_t *dude, fastf_t *direction, int showBoxes)
755 {
756  char headName[MAXLENGTH]="Head.s";
757  char neckName[MAXLENGTH]="Neck.s";
758  bu_strlcat(headName, suffix, MAXLENGTH);
759  bu_strlcat(neckName, suffix, MAXLENGTH);
760  dude->head.neckLength = dude->head.headSize / 2;
761  makeHead(file, headName, dude, direction, showBoxes);
762  makeNeck(file, neckName, dude, direction, showBoxes);
763 }
764 
765 
766 /*
767  * Create all the torso parts, and set joint locations for each arm, and each leg.
768  */
769 HIDDEN void
770 makeTorso(struct rt_wdb (*file), char *suffix, struct human_data_t *dude, fastf_t *direction, int showBoxes)
771 {
772  char upperTorsoName[MAXLENGTH]="UpperTorso.s";
773  char lowerTorsoName[MAXLENGTH]="LowerTorso.s";
774  char leftShoulderName[MAXLENGTH]="LeftShoulder.s";
775  char rightShoulderName[MAXLENGTH]="RightShoulder.s";
776 
777  bu_strlcat(upperTorsoName, suffix, MAXLENGTH);
778  bu_strlcat(lowerTorsoName, suffix, MAXLENGTH);
779  bu_strlcat(leftShoulderName, suffix, MAXLENGTH);
780  bu_strlcat(rightShoulderName, suffix, MAXLENGTH);
781 
782  makeUpperTorso(file, upperTorsoName, dude, direction, showBoxes);
783 
784  makeShoulder(file, 1, leftShoulderName, dude, showBoxes);
785  makeShoulder(file, 0, rightShoulderName, dude, showBoxes);
786 
787  makeLowerTorso(file, lowerTorsoName, dude, direction, showBoxes);
788 }
789 
790 
791 /**
792  * Make the 3 components of the arm:the upper arm, the lower arm, and the hand.
793  */
794 HIDDEN void
795 makeArm(struct rt_wdb (*file), char *suffix, int isLeft, struct human_data_t *dude, int showBoxes)
796 {
797  char shoulderJointName[MAXLENGTH];
798  char upperArmName[MAXLENGTH];
799  char elbowName[MAXLENGTH];
800  char lowerArmName[MAXLENGTH];
801  char wristName[MAXLENGTH];
802  char handName[MAXLENGTH];
803 
804  if (isLeft) {
805  bu_strlcpy(shoulderJointName, "LeftShoulderJoint.s", MAXLENGTH);
806  bu_strlcpy(upperArmName, "LeftUpperArm.s", MAXLENGTH);
807  bu_strlcpy(elbowName, "LeftElbowJoint.s", MAXLENGTH);
808  bu_strlcpy(lowerArmName, "LeftLowerArm.s", MAXLENGTH);
809  bu_strlcpy(wristName, "LeftWristJoint.s", MAXLENGTH);
810  bu_strlcpy(handName, "LeftHand.s", MAXLENGTH);
811  } else{
812  bu_strlcpy(shoulderJointName, "RightShoulderJoint.s", MAXLENGTH);
813  bu_strlcpy(upperArmName, "RightUpperArm.s", MAXLENGTH);
814  bu_strlcpy(elbowName, "RightElbowJoint.s", MAXLENGTH);
815  bu_strlcpy(lowerArmName, "RightLowerArm.s", MAXLENGTH);
816  bu_strlcpy(wristName, "RightWristJoint.s", MAXLENGTH);
817  bu_strlcpy(handName, "RightHand.s", MAXLENGTH);
818  }
819 
820  bu_strlcat(shoulderJointName, suffix, MAXLENGTH);
821  bu_strlcat(upperArmName, suffix, MAXLENGTH);
822  bu_strlcat(elbowName, suffix, MAXLENGTH);
823  bu_strlcat(lowerArmName, suffix, MAXLENGTH);
824  bu_strlcat(wristName, suffix, MAXLENGTH);
825  bu_strlcat(handName, suffix, MAXLENGTH);
826 
827  makeShoulderJoint(file, isLeft, shoulderJointName, dude, showBoxes);
828  makeUpperArm(file, isLeft, upperArmName, dude, showBoxes);
829  makeElbow(file, isLeft, elbowName, dude);
830 
831  makeLowerArm(file, isLeft, lowerArmName, dude, showBoxes);
832  makeWrist(file, isLeft, wristName, dude);
833  makeHand(file, isLeft, handName, dude, showBoxes);
834 }
835 
836 
837 /**
838  * Create the leg to be length 'legLength' by making a thigh, calf, and foot to meet requirements.
839  */
840 HIDDEN void
841 makeLeg(struct rt_wdb (*file), char *suffix, int isLeft, struct human_data_t *dude, int showBoxes)
842 {
843  char thighJointName[MAXLENGTH];
844  char thighName[MAXLENGTH];
845  char kneeName[MAXLENGTH];
846  char calfName[MAXLENGTH];
847  char ankleName[MAXLENGTH];
848  char footName[MAXLENGTH];
849 
850  if (isLeft) {
851  bu_strlcpy(thighJointName, "LeftThighJoint.s", MAXLENGTH);
852  bu_strlcpy(thighName, "LeftThigh.s", MAXLENGTH);
853  bu_strlcpy(kneeName, "LeftKneeJoint.s", MAXLENGTH);
854  bu_strlcpy(calfName, "LeftCalf.s", MAXLENGTH);
855  bu_strlcpy(ankleName, "LeftAnkleJoint.s", MAXLENGTH);
856  bu_strlcpy(footName, "LeftFoot.s", MAXLENGTH);
857  } else{
858  bu_strlcpy(thighJointName, "RightThighJoint.s", MAXLENGTH);
859  bu_strlcpy(thighName, "RightThigh.s", MAXLENGTH);
860  bu_strlcpy(kneeName, "RightKneeJoint.s", MAXLENGTH);
861  bu_strlcpy(calfName, "RightCalf.s", MAXLENGTH);
862  bu_strlcpy(ankleName, "RightAnkleJoint.s", MAXLENGTH);
863  bu_strlcpy(footName, "RightFoot.s", MAXLENGTH);
864  }
865  bu_strlcat(thighJointName, suffix, MAXLENGTH);
866  bu_strlcat(thighName, suffix, MAXLENGTH);
867  bu_strlcat(kneeName, suffix, MAXLENGTH);
868  bu_strlcat(calfName, suffix, MAXLENGTH);
869  bu_strlcat(ankleName, suffix, MAXLENGTH);
870  bu_strlcat(footName, suffix, MAXLENGTH);
871 
872  makeThighJoint(file, isLeft, thighJointName, dude);
873  makeThigh(file, isLeft, thighName, dude, showBoxes);
874  makeKnee(file, isLeft, kneeName, dude);
875  makeCalf(file, isLeft, calfName, dude, showBoxes);
876  makeAnkle(file, isLeft, ankleName, dude);
877  makeFoot(file, isLeft, footName, dude, showBoxes);
878 }
879 
880 
881 /**
882  * Make the head, shoulders knees and toes, so to speak. Head, neck,
883  * torso, arms, hands, legs, feet. And dude, a very technical term,
884  * is the human_data in a shorter, more readable name
885  */
886 HIDDEN void
887 makeBody(struct rt_wdb (*file), char *suffix, struct human_data_t *dude, fastf_t *location, int showBoxes)
888 {
889  vect_t direction;
890  bu_log("Making Body\n");
891  /*
892  * Make sure that vectors, points, and widths are sent to each function
893  * for direction, location, and correct sizing, respectively.
894  */
895  bu_log("Setting Direction\n");
896  VSET(dude->joints.headJoint, location[X], location[Y], (location[Z]+((dude->height*IN2MM)-(dude->head.headSize/2))));
897  VSET(direction, 180, 0, 0); /*Make the body build down, from head to toe. Or else it's upsidedown */
898 
899  /**
900  * Head Parts
901  */
902  /*makeProfile makes the head and the neck */
903  makeProfile(file, suffix, dude, direction, showBoxes);
904 
905  /**
906  * Torso Parts
907  */
908  makeTorso(file, suffix, dude, direction, showBoxes);
909 
910  /**
911  * Arm Parts
912  */
913  /*The second argument is whether or not it is the left side, 1 = yes, 0 = no) */
914  makeArm(file, suffix, 1, dude, showBoxes);
915  makeArm(file, suffix, 0, dude, showBoxes);
916 
917  /**
918  * Leg Parts
919  */
920  makeLeg(file, suffix, 1, dude, showBoxes);
921  makeLeg(file, suffix, 0, dude, showBoxes);
922  bu_log("Body Built\n");
923 }
924 
925 
926 /**
927  * MakeArmy makes a square of persons n by n large, where n is the
928  * number of persons entered using -N if N is large (>= 20) Parts
929  * start disappearing, oddly enough.
930  */
931 HIDDEN void
932 makeArmy(struct rt_wdb (*file), struct human_data_t *dude, int number, int showBoxes)
933 {
934  point_t locations;
935  int x = 0;
936  int y = 0;
937  int num;
938  char testname[10]={'0'};
939  char suffix[MAXLENGTH];
940  VSET(locations, 0, 0, 0); /* Starting location */
941  num = 0.0;
942 
943  for (x = 0; x<number; x++) {
944  for (y=0; y<number; y++) {
945  sprintf(testname, "%d", num);
946  bu_strlcpy(suffix, testname, MAXLENGTH);
947  RandAuto(dude); /*Generates random heights for random height, and thus random size, creation. */
948  Auto(dude);
949  makeBody(file, suffix, dude, locations, showBoxes);
950  VSET(locations, (locations[X]- (dude->torso.shoulderWidth + dude->arms.upperArmWidth)*4), locations[Y], 0);
951  num++;
952  }
953  VSET(locations, 0, (locations[Y]- (dude->torso.shoulderWidth + dude->arms.upperArmWidth)*4), 0);
954  }
955 }
956 
957 
958 /* User inputs X, Y, Z coordinates for use in manual positioning */
959 HIDDEN void
961 {
962  int ret;
963  double scan[3];
964 
965  printf("X: ");
966  ret = scanf("%lf", &scan[X]);
967  if (ret != 1)
968  bu_log("Failed to get position value\n");
969  fflush(stdin);
970 
971  printf("Y: ");
972  ret = scanf("%lf", &scan[Y]);
973  if (ret != 1)
974  bu_log("Failed to get position value\n");
975  fflush(stdin);
976 
977  printf("Z: ");
978  ret = scanf("%lf", &scan[Z]);
979  if (ret != 1)
980  bu_log("Failed to get position value\n");
981  fflush(stdin);
982 
983  /* convert from double to fastf_t */
984  VMOVE(positions, scan);
985 }
986 
987 
988 /**
989  * User manual poses the human model by inputting absolute angles for
990  * limb positions.
991  */
992 HIDDEN void
994 {
995  vect_t positions;
996  printf("Manually Setting All limb Positions in degrees\n");
997  printf("Remember, a 180 value for Y means pointing down\nSo for your left arm, xyz of 0 180 0 would be on the side\n");
998  printf("Head is always at standing height, at origin\n");
999 
1000  printf("Left Arm\n");
1001  printf("Upper Arm\n");
1002  grabCoordinates(positions);
1003  VMOVE(dude->arms.lArmDirection, positions);
1004  printf("Lower Arm\n");
1005  grabCoordinates(positions);
1006  VMOVE(dude->arms.lElbowDirection, positions);
1007  printf("Hand\n");
1008  grabCoordinates(positions);
1009  VMOVE(dude->arms.lWristDirection, positions);
1010 
1011  printf("Right Arm\n");
1012  printf("Upper Arm\n");
1013  grabCoordinates(positions);
1014  VMOVE(dude->arms.rArmDirection, positions);
1015  printf("Lower Arm\n");
1016  grabCoordinates(positions);
1017  VMOVE(dude->arms.rElbowDirection, positions);
1018  printf("Hand\n");
1019  grabCoordinates(positions);
1020  VMOVE(dude->arms.rWristDirection, positions);
1021 
1022  printf("Left Leg\n");
1023  printf("Thigh\n");
1024  grabCoordinates(positions);
1025  VMOVE(dude->legs.lLegDirection, positions);
1026  printf("Calf\n");
1027  grabCoordinates(positions);
1028  VMOVE(dude->legs.lKneeDirection, positions);
1029  printf("Foot\n");
1030  grabCoordinates(positions);
1031  VMOVE(dude->legs.lFootDirection, positions);
1032 
1033  printf("Right Leg\n");
1034  printf("Thigh\n");
1035  grabCoordinates(positions);
1036  VMOVE(dude->legs.rLegDirection, positions);
1037  printf("Calf\n");
1038  grabCoordinates(positions);
1039  VMOVE(dude->legs.rKneeDirection, positions);
1040  printf("Foot\n");
1041  grabCoordinates(positions);
1042  VMOVE(dude->legs.rFootDirection, positions);
1043 }
1044 
1045 
1046 /* position limbs to fit stance input in command line (or just default to standing) */
1047 HIDDEN void
1048 setStance(fastf_t stance, struct human_data_t *dude)
1049 {
1050  vect_t downVect, forwardVect, rightVect, leftVect; /* generic vectors for holding temp values */
1051 
1052  /**
1053  * The stances are the way the body is positioned via
1054  * adjusting limbs and whatnot. THEY ARE:
1055  * 0: Standing
1056  * 1: Sitting
1057  * 2: Driving
1058  * 3: Arms Out
1059  * 4: The Letterman
1060  * 5: The Captain
1061  * #: and more as needed
1062  * 999: Custom (done interactively)
1063  */
1064 
1065  VSET(downVect, 0, 180, 0); /*straight down*/
1066  VSET(forwardVect, 0, 90, 0); /*forwards, down X axis */
1067  VSET(rightVect, 90, 0, 0); /*Right, down Y axis */
1068  VSET(leftVect, -90, 0, 0); /*Left, up Y axis */
1069 
1070  switch ((int)stance) {
1071  case 0:
1072  bu_log("Making it stand\n");
1073  VMOVE(dude->arms.lArmDirection, downVect);
1074  VMOVE(dude->arms.rArmDirection, downVect);
1075  VMOVE(dude->arms.lElbowDirection, downVect);
1076  VMOVE(dude->arms.rElbowDirection, downVect);
1077  VMOVE(dude->arms.lWristDirection, downVect);
1078  VMOVE(dude->arms.rWristDirection, downVect);
1079  VMOVE(dude->legs.lLegDirection, downVect);
1080  VMOVE(dude->legs.rLegDirection, downVect);
1081  VMOVE(dude->legs.lKneeDirection, downVect);
1082  VMOVE(dude->legs.rKneeDirection, downVect);
1083  VMOVE(dude->legs.lFootDirection, forwardVect);
1084  VMOVE(dude->legs.rFootDirection, forwardVect);
1085  bu_log("Standing\n");
1086  break;
1087  case 1:
1088  bu_log("Making it sit\n");
1089  VMOVE(dude->arms.lArmDirection, downVect);
1090  VMOVE(dude->arms.rArmDirection, downVect);
1091  VMOVE(dude->arms.lElbowDirection, downVect);
1092  VMOVE(dude->arms.rElbowDirection, downVect);
1093  VMOVE(dude->arms.lWristDirection, downVect);
1094  VMOVE(dude->arms.rWristDirection, downVect);
1095  VMOVE(dude->legs.lLegDirection, forwardVect);
1096  VMOVE(dude->legs.rLegDirection, forwardVect);
1097  VMOVE(dude->legs.lKneeDirection, downVect);
1098  VMOVE(dude->legs.rKneeDirection, downVect);
1099  VMOVE(dude->legs.lFootDirection, forwardVect);
1100  VMOVE(dude->legs.rFootDirection, forwardVect);
1101  break;
1102  case 2:
1103  bu_log("Making it Drive\n"); /* it's like sitting, but with the arms extended */
1104  VMOVE(dude->arms.lArmDirection, downVect);
1105  VMOVE(dude->arms.rArmDirection, downVect);
1106  VMOVE(dude->arms.lElbowDirection, forwardVect);
1107  VMOVE(dude->arms.rElbowDirection, forwardVect);
1108  VMOVE(dude->arms.lWristDirection, forwardVect);
1109  VMOVE(dude->arms.rWristDirection, forwardVect);
1110  VMOVE(dude->legs.lLegDirection, forwardVect);
1111  VMOVE(dude->legs.rLegDirection, forwardVect);
1112  VMOVE(dude->legs.lKneeDirection, downVect);
1113  VMOVE(dude->legs.rKneeDirection, downVect);
1114  VMOVE(dude->legs.lFootDirection, forwardVect);
1115  VMOVE(dude->legs.rFootDirection, forwardVect);
1116  break;
1117  case 3:
1118  bu_log("Making arms out (standing)\n");
1119  VMOVE(dude->arms.lArmDirection, leftVect);
1120  VMOVE(dude->arms.rArmDirection, rightVect);
1121  VMOVE(dude->arms.lElbowDirection, leftVect);
1122  VMOVE(dude->arms.rElbowDirection, rightVect);
1123  VMOVE(dude->arms.lWristDirection, leftVect);
1124  VMOVE(dude->arms.rWristDirection, rightVect);
1125  VMOVE(dude->legs.lLegDirection, downVect);
1126  VMOVE(dude->legs.rLegDirection, downVect);
1127  VMOVE(dude->legs.lKneeDirection, downVect);
1128  VMOVE(dude->legs.rKneeDirection, downVect);
1129  VMOVE(dude->legs.lFootDirection, forwardVect);
1130  VMOVE(dude->legs.rFootDirection, forwardVect);
1131  break;
1132  case 4: {
1133  vect_t larm4, rarm4, knee4, lleg4;
1134  bu_log("Making the Letterman\n");
1135  VSET(larm4, -32, 135, 0);
1136  VSET(rarm4, 32, 135, 0);
1137  VSET(knee4, 90, 5, 0);
1138  VSET(lleg4, 0, 75, 0);
1139  VMOVE(dude->arms.lArmDirection, larm4);
1140  VMOVE(dude->arms.rArmDirection, rarm4);
1141  VMOVE(dude->arms.lElbowDirection, larm4);
1142  VMOVE(dude->arms.rElbowDirection, rarm4);
1143  VMOVE(dude->arms.lWristDirection, larm4);
1144  VMOVE(dude->arms.rWristDirection, rarm4);
1145  VMOVE(dude->legs.lLegDirection, lleg4);
1146  VMOVE(dude->legs.rLegDirection, forwardVect);
1147  VMOVE(dude->legs.lKneeDirection, knee4);
1148  VMOVE(dude->legs.rKneeDirection, downVect);
1149  VMOVE(dude->legs.lFootDirection, forwardVect);
1150  VMOVE(dude->legs.rFootDirection, forwardVect);
1151  }
1152  break;
1153  case 5: {
1154  vect_t larm5, rarm5, llower5, rlower5;
1155  vect_t rthigh5;
1156  bu_log("Making the Captain\n");
1157  VSET(larm5, 45, 180, 5);
1158  VSET(rarm5, -45, 180, -5);
1159  VSET(llower5, -45, 180, 5);
1160  VSET(rlower5, 45, 180, -5);
1161  VSET(rthigh5, 0, 85, 0);
1162  VMOVE(dude->arms.lArmDirection, larm5);
1163  VMOVE(dude->arms.lElbowDirection, llower5);
1164  VMOVE(dude->arms.rArmDirection, rarm5);
1165  VMOVE(dude->arms.rElbowDirection, rlower5);
1166  VMOVE(dude->arms.lWristDirection, downVect);
1167  VMOVE(dude->arms.rWristDirection, downVect);
1168  VMOVE(dude->legs.lLegDirection, downVect);
1169  VMOVE(dude->legs.rLegDirection, rthigh5);
1170  VMOVE(dude->legs.lKneeDirection, downVect);
1171  VMOVE(dude->legs.rKneeDirection, downVect);
1172  VMOVE(dude->legs.lFootDirection, forwardVect);
1173  VMOVE(dude->legs.rFootDirection, forwardVect);
1174  }
1175  break;
1176 
1177  /*Following cases are tests */
1178  case 10: {
1179  vect_t test1;
1180  vect_t test2;
1181  vect_t test3;
1182  vect_t test4;
1183  vect_t test5;
1184  bu_log("Test1 15 degree incs\n");
1185  VSET(test1, 0, 0, 0);
1186  VSET(test2, 0, 15, 0);
1187  VSET(test3, 0, 30, 0);
1188  VSET(test4, 0, 45, 0);
1189  VSET(test5, 0, 60, 0);
1190  VMOVE(dude->arms.lArmDirection, test1);
1191  VMOVE(dude->arms.lElbowDirection, test1);
1192  VMOVE(dude->arms.rArmDirection, test2);
1193  VMOVE(dude->arms.rElbowDirection, test2);
1194  VMOVE(dude->arms.lWristDirection, test1);
1195  VMOVE(dude->arms.rWristDirection, test2);
1196  VMOVE(dude->legs.lLegDirection, test3);
1197  VMOVE(dude->legs.rLegDirection, test4);
1198  VMOVE(dude->legs.lKneeDirection, test3);
1199  VMOVE(dude->legs.rKneeDirection, test4);
1200  VMOVE(dude->legs.lFootDirection, test5);
1201  VMOVE(dude->legs.rFootDirection, test5);
1202  }
1203  break;
1204 
1205  /* Additional Positions go here*/
1206 
1207  case 999:
1208  /* interactive position-setter-thingermajiger */
1209  manualPosition(dude);
1210  break;
1211  default:
1212  bu_log("Bad Input, defaulting to Stand\n");
1213  VMOVE(dude->arms.lArmDirection, downVect);
1214  VMOVE(dude->arms.rArmDirection, downVect);
1215  VMOVE(dude->arms.lElbowDirection, downVect);
1216  VMOVE(dude->arms.rElbowDirection, downVect);
1217  VMOVE(dude->arms.lWristDirection, downVect);
1218  VMOVE(dude->arms.rWristDirection, downVect);
1219  VMOVE(dude->legs.lLegDirection, downVect);
1220  VMOVE(dude->legs.rLegDirection, downVect);
1221  VMOVE(dude->legs.lKneeDirection, downVect);
1222  VMOVE(dude->legs.rKneeDirection, downVect);
1223  VMOVE(dude->legs.lFootDirection, forwardVect);
1224  VMOVE(dude->legs.rFootDirection, forwardVect);
1225  break;
1226  }
1227  bu_log("Exiting stance maker\n");
1228 }
1229 
1230 
1231 /**
1232  * Auto Set all data for all parts, in inches
1233  */
1234 HIDDEN void
1235 Auto(struct human_data_t *dude)
1236 {
1237  bu_log("Auto Setting\n");
1238  bu_log("Height=%lf\n", dude->height);
1239  dude->torso.torsoLength = 0;
1240  dude->head.headSize = (dude->height / 8) * IN2MM;
1241  dude->arms.armLength = (dude->height / 2) * IN2MM;
1242  dude->legs.legLength = ((dude->height * 4) / 8) * IN2MM;
1243  dude->torso.torsoLength = ((dude->height * 3) / 8) * IN2MM;
1244  dude->torso.topTorsoLength = (dude->torso.torsoLength *5) / 8;
1245  dude->torso.lowTorsoLength = (dude->torso.torsoLength *3) / 8;
1246  dude->torso.shoulderWidth = (dude->height / 8) *IN2MM;
1247  dude->torso.shoulderDepth = (dude->torso.shoulderWidth/2);
1248  dude->torso.abWidth=(dude->height / 9) * IN2MM;
1249  dude->torso.abDepth = dude->torso.abWidth / 2;
1250  dude->torso.pelvisWidth=(dude->height / 8) * IN2MM;
1251  dude->torso.pelvisDepth = dude->torso.pelvisWidth/2;
1252  dude->legs.thighLength = dude->legs.legLength / 2;
1253  dude->legs.calfLength = dude->legs.legLength / 2;
1254  dude->legs.thighWidth = dude->legs.thighLength / 5;
1255  dude->legs.kneeWidth = dude->legs.thighLength / 6;
1256  dude->legs.ankleWidth = dude->legs.calfLength / 8;
1257  dude->arms.upperArmWidth = dude->arms.armLength / 12;
1258  dude->arms.elbowWidth = dude->arms.armLength / 13;
1259  dude->arms.wristWidth = dude->arms.armLength / 15;
1260  dude->legs.footLength = dude->legs.ankleWidth * 3;
1261  dude->legs.toeWidth = dude->legs.ankleWidth * 1.2;
1262  dude->arms.handLength = (dude->height / 16) * IN2MM;
1263  dude->arms.handWidth = (dude->height / 32) * IN2MM;
1264  dude->arms.upperArmLength = (dude->height / 4.5) * IN2MM;
1265  dude->arms.lowerArmLength = (dude->height / 4.5) * IN2MM;
1266  dude->head.neckWidth = dude->head.headSize / 4;
1267 }
1268 
1269 
1270 /**
1271  * Random height generator
1272  */
1273 HIDDEN void
1274 RandAuto(struct human_data_t *dude)
1275 {
1276  fastf_t val = 0;
1277  val = ((rand()%12)+54);
1278  dude->height = val;
1279 }
1280 
1281 
1282 /**
1283  * Manually Set all data for all parts, in inches
1284  */
1285 HIDDEN void
1286 Manual(struct human_data_t *dude)
1287 {
1288  int ret;
1289  double x=0; /* for stashing user input */
1290 
1291  bu_log("Manual Size Mode. All data to be entered is in inches\n");
1292 
1293  bu_log("HeadSize, radius\n");
1294  ret = scanf("%lf", &x);
1295  if (ret != 1)
1296  bu_log("Failed to get value\n");
1297  x=x*IN2MM;
1298  dude->head.headSize=x;
1299 
1300  bu_log("NeckLength\n");
1301  ret = scanf("%lf", &x);
1302  if (ret != 1)
1303  bu_log("Failed to get value\n");
1304  x=x*IN2MM;
1305  dude->head.neckLength=x;
1306 
1307  bu_log("NeckWidth, radius\n");
1308  ret = scanf("%lf", &x);
1309  if (ret != 1)
1310  bu_log("Failed to get value\n");
1311  x=x*IN2MM;
1312  dude->head.neckWidth=x;
1313 
1314  bu_log("Top Torso Length\n");
1315  ret = scanf("%lf", &x);
1316  if (ret != 1)
1317  bu_log("Failed to get value\n");
1318  x=x*IN2MM;
1319  dude->torso.topTorsoLength=x;
1320 
1321  bu_log("Shoulder Width\n");
1322  ret = scanf("%lf", &x);
1323  if (ret != 1)
1324  bu_log("Failed to get value\n");
1325  x=x*IN2MM;
1326  dude->torso.shoulderWidth=x;
1327 
1328  bu_log("Shoulder Depth\n");
1329  ret = scanf("%lf", &x);
1330  if (ret != 1)
1331  bu_log("Failed to get value\n");
1332  x=x*IN2MM;
1333  dude->torso.shoulderDepth=x;
1334 
1335  bu_log("Low Torso Length\n");
1336  ret = scanf("%lf", &x);
1337  if (ret != 1)
1338  bu_log("Failed to get value\n");
1339  x=x*IN2MM;
1340  dude->torso.lowTorsoLength=x;
1341 
1342  bu_log("Ab Width\n");
1343  ret = scanf("%lf", &x);
1344  if (ret != 1)
1345  bu_log("Failed to get value\n");
1346  x=x*IN2MM;
1347  dude->torso.abWidth=x;
1348 
1349  bu_log("Ab Depth\n");
1350  ret = scanf("%lf", &x);
1351  if (ret != 1)
1352  bu_log("Failed to get value\n");
1353  x=x*IN2MM;
1354  dude->torso.abDepth=x;
1355 
1356  bu_log("Pelvis Width\n");
1357  ret = scanf("%lf", &x);
1358  if (ret != 1)
1359  bu_log("Failed to get value\n");
1360  x=x*IN2MM;
1361  dude->torso.pelvisWidth=x;
1362 
1363  bu_log("Pelvis Depth\n");
1364  ret = scanf("%lf", &x);
1365  if (ret != 1)
1366  bu_log("Failed to get value\n");
1367  x=x*IN2MM;
1368  dude->torso.pelvisDepth=x;
1369 
1370  bu_log("Upper Arm Length\n");
1371  ret = scanf("%lf", &x);
1372  if (ret != 1)
1373  bu_log("Failed to get value\n");
1374  x=x*IN2MM;
1375  dude->arms.upperArmLength=x;
1376 
1377  bu_log("Upper Arm Width\n");
1378  ret = scanf("%lf", &x);
1379  if (ret != 1)
1380  bu_log("Failed to get value\n");
1381  x=x*IN2MM;
1382  dude->arms.upperArmWidth=x;
1383 
1384  bu_log("Lower Arm Length\n");
1385  ret = scanf("%lf", &x);
1386  if (ret != 1)
1387  bu_log("Failed to get value\n");
1388  x=x*IN2MM;
1389  dude->arms.lowerArmLength=x;
1390 
1391  bu_log("Elbow Width, radius\n");
1392  ret = scanf("%lf", &x);
1393  if (ret != 1)
1394  bu_log("Failed to get value\n");
1395  x=x*IN2MM;
1396  dude->arms.elbowWidth=x;
1397 
1398  bu_log("Wrist Width, radius\n");
1399  ret = scanf("%lf", &x);
1400  if (ret != 1)
1401  bu_log("Failed to get value\n");
1402  x=x*IN2MM;
1403  dude->arms.wristWidth=x;
1404 
1405  bu_log("Hand Length\n");
1406  ret = scanf("%lf", &x);
1407  if (ret != 1)
1408  bu_log("Failed to get value\n");
1409  x=x*IN2MM;
1410  dude->arms.handLength=x;
1411 
1412  bu_log("Hand Width\n");
1413  ret = scanf("%lf", &x);
1414  if (ret != 1)
1415  bu_log("Failed to get value\n");
1416  x=x*IN2MM;
1417  dude->arms.handWidth=x;
1418 
1419  bu_log("Thigh Length\n");
1420  ret = scanf("%lf", &x);
1421  if (ret != 1)
1422  bu_log("Failed to get value\n");
1423  x=x*IN2MM;
1424  dude->legs.thighLength=x;
1425 
1426  bu_log("Thigh Width, radius\n");
1427  ret = scanf("%lf", &x);
1428  if (ret != 1)
1429  bu_log("Failed to get value\n");
1430  x=x*IN2MM;
1431  dude->legs.thighWidth=x;
1432 
1433  bu_log("Knee Width, radius\n");
1434  ret = scanf("%lf", &x);
1435  if (ret != 1)
1436  bu_log("Failed to get value\n");
1437  x=x*IN2MM;
1438  dude->legs.kneeWidth=x;
1439 
1440  bu_log("Calf Length\n");
1441  ret = scanf("%lf", &x);
1442  if (ret != 1)
1443  bu_log("Failed to get value\n");
1444  x=x*IN2MM;
1445  dude->legs.calfLength=x;
1446 
1447  bu_log("Ankle Width, radius\n");
1448  ret = scanf("%lf", &x);
1449  if (ret != 1)
1450  bu_log("Failed to get value\n");
1451  x=x*IN2MM;
1452  dude->legs.ankleWidth=x;
1453 
1454  bu_log("Foot Length\n");
1455  ret = scanf("%lf", &x);
1456  if (ret != 1)
1457  bu_log("Failed to get value\n");
1458  x=x*IN2MM;
1459  dude->legs.footLength=x;
1460 
1461  bu_log("Toe Width, radius\n");
1462  ret = scanf("%lf", &x);
1463  if (ret != 1)
1464  bu_log("Failed to get value\n");
1465  x=x*IN2MM;
1466  dude->legs.toeWidth=x;
1467 
1469  dude->arms.armLength=dude->arms.upperArmLength + dude->arms.lowerArmLength + dude->arms.handLength;
1470  dude->legs.legLength=dude->legs.thighLength + dude->legs.calfLength;
1471  dude->height=0;
1472 
1473  dude->height=(dude->torso.torsoLength/IN2MM + dude->legs.legLength/IN2MM + dude->head.headSize/IN2MM);
1474 
1475  bu_log("Headsize=%lf\n", dude->head.headSize);
1476  bu_log("Neck Length=%lf\n", dude->head.neckLength);
1477  bu_log("Neck Width=%lf\n", dude->head.neckWidth);
1478 
1479  bu_log("Top Torso=%lf\n", dude->torso.topTorsoLength);
1480  bu_log("Low Torso=%lf\n", dude->torso.lowTorsoLength);
1481  bu_log("Shoulders=%lf\n", dude->torso.shoulderWidth);
1482  bu_log("ShoulderDepth=%lf\n", dude->torso.shoulderDepth);
1483  bu_log("Abs=%lf\n", dude->torso.abWidth);
1484  bu_log("AbDepth=%lf\n", dude->torso.abDepth);
1485  bu_log("Pelvis=%lf\n", dude->torso.pelvisWidth);
1486  bu_log("PelvisDepth=%lf\n", dude->torso.pelvisDepth);
1487  bu_log("Torso Length=%lf\n", dude->torso.torsoLength);
1488 
1489  bu_log("Upper Arm Width=%lf\n", dude->arms.upperArmWidth);
1490  bu_log("Upper Arm Length=%lf\n", dude->arms.upperArmLength);
1491  bu_log("Lower Arm Length=%lf\n", dude->arms.lowerArmLength);
1492  bu_log("Elbow Width=%lf\n", dude->arms.elbowWidth);
1493  bu_log("Wrist Width=%lf\n", dude->arms.wristWidth);
1494  bu_log("Hand Length=%lf\n", dude->arms.handLength);
1495  bu_log("Hand Width=%lf\n", dude->arms.handWidth);
1496  bu_log("Arm Length=%lf\n", dude->arms.armLength);
1497 
1498  bu_log("Thigh Length=%lf\n", dude->legs.thighLength);
1499  bu_log("Thigh Width=%lf\n", dude->legs.thighWidth);
1500  bu_log("Calf Length=%lf\n", dude->legs.calfLength);
1501  bu_log("Knee Width=%lf\n", dude->legs.kneeWidth);
1502  bu_log("Foot Length=%lf\n", dude->legs.footLength);
1503  bu_log("Ankle Width=%lf\n", dude->legs.ankleWidth);
1504  bu_log("Toe Width=%lf\n", dude->legs.toeWidth);
1505  bu_log("Leg Length=%lf\n", dude->legs.legLength);
1506  bu_log("Height=%lf\n", dude->height);
1507 }
1508 
1509 
1510 /**
1511  * Help message printed when -h/-? option is supplied
1512  */
1513 HIDDEN void
1514 show_help(const char *name, const char *optstr)
1515 {
1516  struct bu_vls str = BU_VLS_INIT_ZERO;
1517  const char *cp = optstr;
1518 
1519  while (cp && *cp != '\0') {
1520  if (*cp == ':' || *cp == 'h' || *cp == '?') {
1521  cp++;
1522  continue;
1523  }
1524  bu_vls_strncat(&str, cp, 1);
1525  cp++;
1526  }
1527 
1528  bu_log("Usage: %s [%s]\n", name, bu_vls_addr(&str));
1529  bu_log("options ('Set' means 1 argument required unless otherwise noted):\n");
1530  bu_log("\t-A\t\tAutoMake defaults\n");
1531  bu_log("\t-m\t\tManual sizing mode\n");
1532  bu_log("\t-H\t\tSet height (inches)\n");
1533  bu_log("\t-L or -l\tSet center point (inches), at body's feet (default 0 0 0; interactive input)\n");
1534  /* bu_log("\t-o\t\tSet output file name\n" */
1535  bu_log("\t-b\t\tShow bounding Boxes\n");
1536  bu_log("\t-n\t\tSet bounding region name (default Body.c )\n");
1537  bu_log("\t-N\t\tSet number to make (input will be squared by the program)\n");
1538  bu_log("\t-s\t\tSet stance to take; 0-Stand 1-Sit 2-Drive 3-Arms out 4-Letterman 5-Captain 999-Custom\n");
1539  bu_log("\t-p\t\tSet percentile (not implemented yet) 1-99\n");
1540  bu_log("\t-t\t\tSave bounding box information to file Stats.txt\n");
1541  bu_log("\t-T\t\tRead bounding box information from file Stats.txt\n");
1542  bu_log("\t-v\t\tSave verbose output of all data used to build human model, to file Verbose.txt\n");
1543  bu_log("\t-V\t\tRead verbose input of all data used to build human model, from file Verbose.txt\n");
1544  bu_log("\t 1 - 9, 0, =, and succeeding characters are used for wizard purposes, ignore them.\n");
1545  bu_log("\t Last word on command line is also top level object. No argument needed!\n");
1546 
1547  bu_vls_free(&str);
1548  return;
1549 }
1550 
1551 
1552 /**
1553  * User inputs the XYZ coordinates of the center point of the human model.
1554  */
1555 HIDDEN void
1557 {
1558  int ret;
1559  double x = 0.0 , y = 0.0 , z = 0.0 ;
1560 
1561  bu_log("Enter center point (inches)\n");
1562  bu_log("X: ");
1563  ret = scanf("%lf", &x);
1564  if (ret != 1)
1565  bu_log("Failed to get value\n");
1566  bu_log("Y: ");
1567  ret = scanf("%lf", &y);
1568  if (ret != 1)
1569  bu_log("Failed to get value\n");
1570  bu_log("Z: ");
1571  ret = scanf("%lf", &z);
1572  if (ret != 1)
1573  bu_log("Failed to get value\n");
1574  x*= IN2MM;
1575  y*= IN2MM;
1576  z*= IN2MM;
1577  VSET(location, x, y, z);
1578 }
1579 
1580 
1581 /* Process command line arguments, all 43 of them */
1582 HIDDEN int
1583 read_args(int argc, const char **argv, char *topLevel, struct human_data_t *dude, fastf_t *percentile, fastf_t *location, int *stance, int *troops, int *showBoxes)
1584 {
1585  int c;
1586  float height=0;
1587  int soldiers=0;
1588  int pose=0;
1589  int percent=50;
1590  double x = 0; /* for stashing user input */
1591  int have_name = 0;
1592 /* char *options="AbH:Llmn:N:O:o:p:s:tTvVw1:2:3:4:5:6:7:8:9:0:=:+:_:*:^:%:$:#:@:!:Q:~:Z:Y:W:h?"; */
1593  char *options="AbH:Llmn:N:p:s:tTvVw1:2:3:4:5:6:7:8:9:0:=:+:_:*:^:%:$:#:@:!:Q:~:Z:Y:W:h?";
1594 
1595  if (argc == 1 ) {
1596  show_help(*argv, options);
1597  printf("\n Program continues running:\n\n");
1598  }
1599 
1600  /* don't report errors (this is before bu_opterr was changed to 1 immed. below) */
1601  bu_opterr = 1;
1602  bu_optind = 1;
1603  while ((c=bu_getopt(argc, (char * const *)argv, options)) != -1) {
1604  /*bu_log("%c \n", c); Testing to see if args are getting read */
1605  switch (c) {
1606  case 'A':
1607  bu_log("AutoMode, making 50 percentile man\n");
1608  *percentile=50;
1609  Auto(dude);
1610  fflush(stdin);
1611  break;
1612 
1613  case 'b':
1614  *showBoxes = 1;
1615  bu_log("Drawing bounding boxes\n");
1616  fflush(stdin);
1617  break;
1618 
1619  case 'H':
1620  sscanf(bu_optarg, "%f", &height);
1621  if (height < 1) {
1622  bu_log("Impossible height, setting default height!\n");
1623  height = DEFAULT_HEIGHT_INCHES;
1624  }
1625  dude->height = height;
1626  bu_log("%.2f = height in inches\n", height);
1627  Auto(dude);
1628  fflush(stdin);
1629  break;
1630 
1631  case 'L':
1632  case 'l':
1633  bu_log("Location\n");
1634  getLocation(location);
1635  fflush(stdin);
1636  break;
1637 
1638  case 'm':
1639  bu_log("Manual Mode\n");
1640  Manual(dude);
1641  break;
1642 
1643  case 'n':
1644  memset(humanName, 0, MAXLENGTH);
1646  bu_strlcpy(topLevel, humanName, MAXLENGTH);
1647  have_name = 1;
1648  fflush(stdin);
1649  break;
1650 
1651  case 'N':
1652  sscanf(bu_optarg, "%d", &soldiers);
1653  if (soldiers <= 1) {
1654  bu_log("Only 1 person. Making 16\n");
1655  soldiers = 4;
1656  }
1657  bu_log("Auto %d (squared) troop formation\n", soldiers);
1658  *troops = (float)soldiers;
1659  fflush(stdin);
1660  break;
1661 /*
1662  * case 'o':
1663  * case 'O':
1664  * memset(filename, 0, MAXLENGTH);
1665  * bu_strlcpy(filename, bu_optarg, MAXLENGTH);
1666  * fflush(stdin);
1667  * have_name = 1;
1668  * break;
1669  */
1670  case 'p':
1671  sscanf(bu_optarg, "%d", &percent);
1672  if (percent < 1)
1673  percent=1;
1674  else if (percent > 99)
1675  percent=99;
1676  *percentile=percent;
1677  fflush(stdin);
1678  break;
1679 
1680  case 's':
1681  sscanf(bu_optarg, "%d", &pose);
1682  if (pose < 0)
1683  pose = 0;
1684  *stance = (float)pose;
1685  fflush(stdin);
1686  break;
1687 
1688  /*Output a text file with height x width x depth sizes for bounding boxes. */
1689  case 't':
1690  dude->textwrite=1;
1691  break;
1692 
1693  /*Input a text file with height x width x depth sizes for bounding boxes. */
1694  case 'T':
1695  dude->textread=1;
1696  break;
1697 
1698  /*Output a text file with all measurements of the human model */
1699  case 'v':
1700  dude->verbwrite=1;
1701  break;
1702 
1703  /*Input a text file with all measurements for a human model */
1704  case 'V':
1705  dude->verbread=1;
1706  break;
1707 
1708  /* These following arguments are for the wizard program, allowing easy access to each variable.
1709  * as they will only be callable by using a number (e.g. 1 = head, 2=neck width, 3=neck height etc.)
1710  * and should not be called otherwise
1711  */
1712  case '1':
1713  sscanf(bu_optarg, "%lf", &x);
1714  x*=IN2MM;
1715  dude->head.headSize = x;
1716  break;
1717  case '2':
1718  sscanf(bu_optarg, "%lf", &x);
1719  x*=IN2MM;
1720  dude->head.neckLength = x;
1721  break;
1722  case '3':
1723  sscanf(bu_optarg, "%lf", &x);
1724  x*=IN2MM;
1725  dude->head.neckWidth = x;
1726  break;
1727  case '4':
1728  sscanf(bu_optarg, "%lf", &x);
1729  x*=IN2MM;
1730  dude->torso.topTorsoLength=x;
1731  break;
1732  case '5':
1733  sscanf(bu_optarg, "%lf", &x);
1734  x*=IN2MM;
1735  dude->torso.lowTorsoLength=x;
1736  dude->torso.torsoLength = dude->torso.topTorsoLength + dude->torso.lowTorsoLength;
1737  break;
1738  case '6':
1739  sscanf(bu_optarg, "%lf", &x);
1740  x*=IN2MM;
1741  dude->torso.shoulderWidth=x;
1742  break;
1743  case '7':
1744  sscanf(bu_optarg, "%lf", &x);
1745  x*=IN2MM;
1746  dude->torso.abWidth=x;
1747  break;
1748  case '8':
1749  sscanf(bu_optarg, "%lf", &x);
1750  x*=IN2MM;
1751  dude->torso.pelvisWidth=x;
1752  break;
1753  case '9':
1754  sscanf(bu_optarg, "%lf", &x);
1755  x*=IN2MM;
1756  dude->arms.upperArmWidth=x;
1757  break;
1758  case '0':
1759  sscanf(bu_optarg, "%lf", &x);
1760  x*=IN2MM;
1761  dude->arms.upperArmLength=x;
1762  break;
1763  case '=':
1764  sscanf(bu_optarg, "%lf", &x);
1765  x*=IN2MM;
1766  dude->arms.lowerArmLength=x;
1767  break;
1768  case '+':
1769  sscanf(bu_optarg, "%lf", &x);
1770  x*=IN2MM;
1771  dude->arms.elbowWidth=x;
1772  break;
1773  case '_':
1774  sscanf(bu_optarg, "%lf", &x);
1775  x*=IN2MM;
1776  dude->arms.wristWidth=x;
1777  break;
1778  case 'Q':
1779  sscanf(bu_optarg, "%lf", &x);
1780  x*=IN2MM;
1781  dude->arms.handLength=x;
1782  dude->arms.armLength=dude->arms.upperArmLength + dude->arms.lowerArmLength + dude->arms.handLength;
1783  break;
1784  case '~':
1785  sscanf(bu_optarg, "%lf", &x);
1786  x*=IN2MM;
1787  dude->arms.handWidth=x;
1788  break;
1789  case '*':
1790  sscanf(bu_optarg, "%lf", &x);
1791  x*=IN2MM;
1792  dude->legs.thighLength=x;
1793  break;
1794  case '!':
1795  sscanf(bu_optarg, "%lf", &x);
1796  x*=IN2MM;
1797  dude->legs.thighWidth=x;
1798  break;
1799  case '^':
1800  sscanf(bu_optarg, "%lf", &x);
1801  x*=IN2MM;
1802  dude->legs.calfLength=x;
1803  dude->legs.legLength = dude->legs.thighLength + dude->legs.calfLength;
1804  break;
1805  case '%':
1806  sscanf(bu_optarg, "%lf", &x);
1807  x*=IN2MM;
1808  dude->legs.kneeWidth=x;
1809  break;
1810  case '$':
1811  sscanf(bu_optarg, "%lf", &x);
1812  x*=IN2MM;
1813  dude->legs.footLength=x;
1814  break;
1815  case '#':
1816  sscanf(bu_optarg, "%lf", &x);
1817  x*=IN2MM;
1818  dude->legs.ankleWidth=x;
1819  break;
1820  case '@':
1821  sscanf(bu_optarg, "%lf", &x);
1822  x*=IN2MM;
1823  dude->legs.toeWidth=x;
1824  break;
1825  case 'Z':
1826  sscanf(bu_optarg, "%lf", &x);
1827  x*=IN2MM;
1828  dude->torso.shoulderDepth=x;
1829  break;
1830  case 'Y':
1831  sscanf(bu_optarg, "%lf", &x);
1832  x*=IN2MM;
1833  dude->torso.abDepth=x;
1834  break;
1835  case 'W':
1836  sscanf(bu_optarg, "%lf", &x);
1837  x*=IN2MM;
1838  dude->torso.pelvisDepth=x;
1839  break;
1840 
1841  default:
1842  show_help(*argv, options);
1843  bu_exit(EXIT_SUCCESS, NULL);
1844  fflush(stdin);
1845  break;
1846  }
1847  }
1848  dude->height = (dude->legs.legLength + dude->torso.torsoLength + dude->head.headSize) / IN2MM;
1849 
1850  if ((argc - bu_optind) == 1) {
1851  /* Yes, there is a top-level name at the end of this argument chain, let's dump it into the file*/
1852  have_name = 1;
1853  memset(humanName, 0, MAXLENGTH);
1854  memset(topLevel, 0, MAXLENGTH);
1855  bu_strlcpy(topLevel, argv[bu_optind], MAXLENGTH);
1856  bu_strlcpy(humanName, topLevel, MAXLENGTH);
1857  bu_log("TopLevel=%s\n", topLevel);
1858  bu_log("TopLevel2=%s\n", humanName);
1859  }
1860  if (!have_name) {
1861  /*If there is no top level name at the end, go with a default */
1862  bu_log("Default top level object name\n");
1863  bu_log("Setting generic name, %s\n", DEFAULT_HUMANNAME);
1864  memset(humanName, 0, MAXLENGTH);
1865  memset(topLevel, 0, MAXLENGTH);
1868  }
1869  fflush(stdout);
1870  return bu_optind;
1871 }
1872 
1873 
1874 /**
1875  * The text function takes the dimensions of each region on the body,
1876  * and finds the measurements for each bounding box to be output to a
1877  * text file. All dimensions are in mm, because it seems everyone just
1878  * /loves/ millimeters for analytical purposes. Hard Coded to dump
1879  * out everything related to boundingboxes.
1880  */
1881 HIDDEN void
1882 text(struct human_data_t *dude)
1883 {
1884  fastf_t x=0, y=0, z=0;
1885  FILE *dump;
1886 
1887  bu_log("Outputting text file\n");
1888 
1889  dump = fopen("Stats.txt", "w+");
1890 
1891  fprintf(dump, "Name, X, Y, Z, all in millimeters\n");
1892 
1893  /*Head*/
1894  x = dude->head.headSize;
1895  y = x;
1896  z = x;
1897  fprintf(dump, "Head\t%f\t%f\t%f\n", x, y, z);
1898 
1899  /*Neck*/
1900  x = dude->head.neckWidth * 2;
1901  y = x;
1902  z = dude->head.neckLength;
1903  fprintf(dump, "Neck\t%f\t%f\t%f\n", x, y, z);
1904 
1905  /*Upper Torso*/
1906  if (dude->torso.shoulderDepth > dude->torso.abDepth)
1907  x = dude->torso.shoulderDepth;
1908  else
1909  x = dude->torso.abDepth;
1910  y = dude->torso.shoulderWidth;
1911  z = dude->torso.topTorsoLength;
1912  fprintf(dump, "UpperTorso\t%f\t%f\t%f\n", x, y, z);
1913 
1914  /*Lower Torso*/
1915  if (dude->torso.abDepth > dude->torso.pelvisDepth)
1916  x = dude->torso.abDepth;
1917  else
1918  x = dude->torso.pelvisDepth;
1919  y = dude->torso.pelvisWidth;
1920  z = dude->torso.lowTorsoLength;
1921  fprintf(dump, "LowerTorso\t%f\t%f\t%f\n", x, y, z);
1922 
1923  /*Shoulder*/
1924  x = dude->arms.upperArmWidth *2;
1925  y = x;
1926  z = y;
1927  fprintf(dump, "ShoulderJoint\t%f\t%f\t%f\n", x, y, z);
1928 
1929  /*Upper Arm*/
1930  x = dude->arms.upperArmWidth *2;
1931  y = x;
1932  z = dude->arms.upperArmLength;
1933  fprintf(dump, "UpperArm\t%f\t%f\t%f\n", x, y, z);
1934 
1935  /*Lower Arm*/
1936  x = dude->arms.elbowWidth * 2;
1937  y = x;
1938  z = dude->arms.lowerArmLength;
1939  fprintf(dump, "LowerArm\t%f\t%f\t%f\n", x, y, z);
1940 
1941  /*Elbow*/
1942  x = dude->arms.elbowWidth *2;
1943  y = x;
1944  z = y;
1945  fprintf(dump, "Elbow\t%f\t%f\t%f\n", x, y, z);
1946 
1947  /*Wrist*/
1948  x = dude->arms.wristWidth *2;
1949  y = x;
1950  z = y;
1951  fprintf(dump, "Wrist\t%f\t%f\t%f\n", x, y, z);
1952 
1953  /*Hand*/
1954  x = dude->arms.handWidth;
1955  y = dude->arms.handWidth;
1956  z = dude->arms.handLength;
1957  fprintf(dump, "Hand\t%f\t%f\t%f\n", x, y, z);
1958 
1959  /*Thigh Joint*/
1960  x = dude->legs.thighWidth*2;
1961  y = x;
1962  z = y;
1963  fprintf(dump, "ThighJoint\t%f\t%f\t%f\n", x, y, z);
1964 
1965  /*Thigh*/
1966  x = dude->legs.thighWidth*2;
1967  y = x;
1968  z = dude->legs.thighLength;
1969  fprintf(dump, "Thigh\t%f\t%f\t%f\n", x, y, z);
1970 
1971  /*Knee*/
1972  x = dude->legs.kneeWidth;
1973  y = x;
1974  z = y;
1975  fprintf(dump, "Knee\t%f\t%f\t%f\n", x, y, z);
1976 
1977  /*Calf*/
1978  x = dude->legs.kneeWidth*2;
1979  y = x;
1980  z = dude->legs.calfLength;
1981  fprintf(dump, "Calf\t%f\t%f\t%f\n", x, y, z);
1982 
1983  /*Ankle*/
1984  x = dude->legs.ankleWidth * 2;
1985  y = x;
1986  z = y;
1987  fprintf(dump, "Ankle\t%f\t%f\t%f\n", x, y, z);
1988 
1989  /*Foot*/
1990  x = dude->legs.footLength;
1991  y = dude->legs.toeWidth * 2;
1992  z = dude->legs.toeWidth * 2;
1993  fprintf(dump, "Foot\t%f\t%f\t%f\n", x, y, z);
1994 
1995  /*Total Height*/
1996  fprintf(dump, "Height\t%f\n", (dude->height * IN2MM));
1997 
1998  fclose(dump);
1999 }
2000 
2001 
2002 /**
2003  * Spit out every measurement of the model in a textfile called
2004  * Verbose.txt Includes all measurements: sans angles, joint
2005  * information
2006  */
2007 HIDDEN void
2008 verbose(struct human_data_t *dude)
2009 {
2010  FILE *dump;
2011 
2012  bu_log("Verbose Text Dump\n");
2013  dump = fopen("Verbose.txt", "w+");
2014  fprintf(dump, "#All Sizes are in mm\n");
2015 
2016  fprintf(dump, "headSize\t%f\n", dude->head.headSize);
2017  fprintf(dump, "neckLength\t%f\n", dude->head.neckLength);
2018  fprintf(dump, "neckWidth\t%f\n", dude->head.neckWidth);
2019 
2020  fprintf(dump, "topTorsoLength\t%f\n", dude->torso.topTorsoLength);
2021  fprintf(dump, "lowTorsoLength\t%f\n", dude->torso.lowTorsoLength);
2022  fprintf(dump, "shoulderWidth\t%f\n", dude->torso.shoulderWidth);
2023  fprintf(dump, "shoulderDepth\t%f\n", dude->torso.shoulderDepth);
2024  fprintf(dump, "abWidth\t%f\n", dude->torso.abWidth);
2025  fprintf(dump, "abDepth\t%f\n", dude->torso.abDepth);
2026  fprintf(dump, "pelvisWidth\t%f\n", dude->torso.pelvisWidth);
2027  fprintf(dump, "pelvisDepth\t%f\n", dude->torso.pelvisDepth);
2028 
2029  fprintf(dump, "upperArmWidth\t%f\n", dude->arms.upperArmWidth);
2030  fprintf(dump, "upperArmLength\t%f\n", dude->arms.upperArmLength);
2031  fprintf(dump, "lowerArmLength\t%f\n", dude->arms.lowerArmLength);
2032  fprintf(dump, "elbowWidth\t%f\n", dude->arms.elbowWidth);
2033  fprintf(dump, "wristWidth\t%f\n", dude->arms.wristWidth);
2034  fprintf(dump, "handLength\t%f\n", dude->arms.handLength);
2035  fprintf(dump, "handWidth\t%f\n", dude->arms.handWidth);
2036 
2037  fprintf(dump, "thighLength\t%f\n", dude->legs.thighLength);
2038  fprintf(dump, "thighWidth\t%f\n", dude->legs.thighWidth);
2039  fprintf(dump, "calfLength\t%f\n", dude->legs.calfLength);
2040  fprintf(dump, "kneeWidth\t%f\n", dude->legs.kneeWidth);
2041  fprintf(dump, "footLength\t%f\n", dude->legs.footLength);
2042  fprintf(dump, "ankleWidth\t%f\n", dude->legs.ankleWidth);
2043  fprintf(dump, "toeWidth\t%f\n", dude->legs.toeWidth);
2044 
2045  fclose(dump);
2046  bu_log("Verbose Output saved\n");
2047 }
2048 
2049 
2050 /**
2051  * This function reads in a file with bounding box information and
2052  * inputs into the program, instead of manual mode or auto mode.
2053  */
2054 HIDDEN void
2056 {
2057  char buffer[80];
2058  FILE *input;
2059 
2060  bu_log("Reading Textfile for Input\n");
2061 
2062  input = fopen("Stats.txt", "r");
2063 
2064  if (input == NULL) {
2065  bu_log("Non-existent input file.\n");
2066  } else {
2067  bu_log("File opened, reading data:\n");
2068 
2069  /* Inside this while loop, values which are input will be
2070  * placed into their respective holders in the human data
2071  * type, based upon name.
2072  */
2073  while (bu_fgets(buffer, 80, input)!=NULL) {
2074  bu_log("%s", buffer);
2075  }
2076  bu_log("Input file read.\n");
2077  fclose(input);
2078  }
2079 }
2080 
2081 
2082 HIDDEN void
2083 verbIn(struct human_data_t *dude)
2084 {
2085  char buffer[80];
2086  char s[80];
2087  double holder;
2088  FILE *input;
2089 
2090  bu_log("Reading textfile for all measurements\n");
2091 
2092  input = fopen("Verbose.txt", "r");
2093  if (input == NULL) {
2094  bu_log("Non-existent input file\n");
2095  } else {
2096  bu_log("File opened, setting measurements\n");
2097 
2098  /* Inside this while loop, values which are input will be
2099  * placed into their respective holders in the human data
2100  * type, based upon name.
2101  */
2102  while (bu_fgets(buffer, 80, input)!=NULL) {
2103  /*check string for comment symbols (#, ;, (whitespace)) and ignore them.*/
2104  sscanf(buffer, "%c", s);
2105  if (s[0] == '#'|| s[0] == ';')
2106  /*bu_log("COMMENT!!\n");*/
2107  /*Go to next line...*/
2108  ;
2109  else {
2110  /*Then check remaining strings against existing variables*/
2111  sscanf(buffer, "%s %lf", s, &holder);
2112  /*bu_log("%s, %f\n", s, holder);*/
2113  if (holder <= 0)
2114  bu_log("Bad inputs, zero and non-negative values for inputs!\n");
2115  /*Big statement of matching names with variables*/
2116  if (BU_STR_EQUAL(s, "headSize"))
2117  dude->head.headSize = holder;
2118  else if (BU_STR_EQUAL(s, "neckWidth"))
2119  dude->head.neckWidth = holder;
2120  else if (BU_STR_EQUAL(s, "neckLength"))
2121  dude->head.neckLength = holder;
2122  else if (BU_STR_EQUAL(s, "topTorsoLength"))
2123  dude->torso.topTorsoLength = holder;
2124  else if (BU_STR_EQUAL(s, "lowTorsoLength"))
2125  dude->torso.lowTorsoLength = holder;
2126  else if (BU_STR_EQUAL(s, "shoulderWidth"))
2127  dude->torso.shoulderWidth = holder;
2128  else if (BU_STR_EQUAL(s, "shoulderDepth"))
2129  dude->torso.shoulderDepth = holder;
2130  else if (BU_STR_EQUAL(s, "abWidth"))
2131  dude->torso.abWidth = holder;
2132  else if (BU_STR_EQUAL(s, "abDepth"))
2133  dude->torso.abDepth = holder;
2134  else if (BU_STR_EQUAL(s, "pelvisWidth"))
2135  dude->torso.pelvisWidth = holder;
2136  else if (BU_STR_EQUAL(s, "pelvisDepth"))
2137  dude->torso.pelvisDepth = holder;
2138  else if (BU_STR_EQUAL(s, "upperArmWidth"))
2139  dude->arms.upperArmWidth = holder;
2140  else if (BU_STR_EQUAL(s, "upperArmLength"))
2141  dude->arms.upperArmLength = holder;
2142  else if (BU_STR_EQUAL(s, "lowerArmLength"))
2143  dude->arms.lowerArmLength = holder;
2144  else if (BU_STR_EQUAL(s, "elbowWidth"))
2145  dude->arms.elbowWidth = holder;
2146  else if (BU_STR_EQUAL(s, "wristWidth"))
2147  dude->arms.wristWidth = holder;
2148  else if (BU_STR_EQUAL(s, "handLength"))
2149  dude->arms.handLength = holder;
2150  else if (BU_STR_EQUAL(s, "handWidth"))
2151  dude->arms.handWidth = holder;
2152  else if (BU_STR_EQUAL(s, "thighLength"))
2153  dude->legs.thighLength = holder;
2154  else if (BU_STR_EQUAL(s, "thighWidth"))
2155  dude->legs.thighWidth = holder;
2156  else if (BU_STR_EQUAL(s, "calfLength"))
2157  dude->legs.calfLength = holder;
2158  else if (BU_STR_EQUAL(s, "kneeWidth"))
2159  dude->legs.kneeWidth = holder;
2160  else if (BU_STR_EQUAL(s, "footLength"))
2161  dude->legs.footLength = holder;
2162  else if (BU_STR_EQUAL(s, "ankleWidth"))
2163  dude->legs.ankleWidth = holder;
2164  else if (BU_STR_EQUAL(s, "toeWidth"))
2165  dude->legs.toeWidth = holder;
2166  else
2167  bu_log("Bad spelling somewhere\n");
2168  }
2169  }
2170  bu_log("File read\n");
2171  dude->legs.legLength = dude->legs.thighLength + dude->legs.calfLength;
2172  dude->torso.torsoLength = dude->torso.topTorsoLength + dude->torso.lowTorsoLength;
2173  dude->height = (dude->legs.legLength + dude->torso.torsoLength + dude->head.headSize) / IN2MM;
2174  bu_log("In Height = %f\n", dude->height);
2175  fclose(input);
2176  }
2177 }
2178 
2179 
2180 /**
2181  * ged_human is the function which is called from an outside function
2182  * in the /shapes directory. It's essentially a main function without
2183  * main.
2184  */
2185 int
2186 ged_human(struct ged *gedp, int ac, const char *av[])
2187 {
2188  struct wmember human;
2189  struct wmember boxes;
2190  struct wmember hollow;
2191  struct wmember crowd;
2192  struct bu_vls name = BU_VLS_INIT_ZERO;
2193  struct bu_vls str = BU_VLS_INIT_ZERO;
2194  struct human_data_t human_data;
2195  int showBoxes = 0, troops = 0, stance = 0;
2196  fastf_t percentile = (fastf_t)50.0;
2197  char suffix[MAXLENGTH]="";
2198  point_t location;
2199  int is_region = 0;
2200  unsigned char rgb[3], rgb2[3], rgb3[3];
2201  char topLevel[MAXLENGTH]="";
2202 
2203  bu_log("Entering Human Builder\n");
2204  srand(time(NULL));
2205  human_data.height = DEFAULT_HEIGHT_INCHES;
2206  VSET(location, 0, 0, 0); /* Default standing location */
2207 
2210 
2211  /* Process command line arguments */
2212  read_args(ac, av, topLevel, &human_data, &percentile, location, &stance, &troops, &showBoxes);
2213 
2215 
2216  bu_log("Center Location: ");
2217  bu_log("%.2f %.2f %.2f\n", location[X], location[Y], location[Z]);
2218 
2219 /******MAGIC******/
2220 
2221  /* This applies the generic end-name to the high-level object */
2222  bu_log("%s\n", topLevel);
2223  memset(humanName, 0, MAXLENGTH);
2224  bu_strlcpy(humanName, topLevel, MAXLENGTH);
2225 
2226  setStance(stance, &human_data);
2227  if (human_data.textread == 1)
2228  getText(&human_data);
2229  if (human_data.verbread == 1)
2230  verbIn(&human_data);
2231  if (troops <= 1) {
2232  makeBody(gedp->ged_wdbp, suffix, &human_data, location, showBoxes);
2233  mk_id_units(gedp->ged_wdbp, "A single Human", "in");
2234 
2235  /*This function dumps out a text file of all dimensions of bounding boxes/anthro-data/whatever on human model.*/
2236  if (human_data.textwrite == 1)
2237  text(&human_data);
2238  if (human_data.verbwrite == 1)
2239  verbose(&human_data);
2240  }
2241  if (troops > 1) {
2242  makeArmy(gedp->ged_wdbp, &human_data, troops, showBoxes);
2243  mk_id_units(gedp->ged_wdbp, "An army of people", "in");
2244  }
2245 /****End Magic****/
2246 
2247 /** Make the Regions (.r's) of the body */
2248 /* Make the .r for the real body */
2249  bu_log("Building Regions\n");
2250  if (!troops) {
2251  BU_LIST_INIT(&human.l);
2252  (void)mk_addmember("Head.s", &human.l, NULL, WMOP_UNION);
2253  (void)mk_addmember("Neck.s", &human.l, NULL, WMOP_UNION);
2254  (void)mk_addmember("UpperTorso.s", &human.l, NULL, WMOP_UNION);
2255  (void)mk_addmember("LowerTorso.s", &human.l, NULL, WMOP_UNION);
2256  (void)mk_addmember("LeftUpperArm.s", &human.l, NULL, WMOP_UNION);
2257  (void)mk_addmember("RightUpperArm.s", &human.l, NULL, WMOP_UNION);
2258  (void)mk_addmember("LeftShoulderJoint.s", &human.l, NULL, WMOP_UNION);
2259  (void)mk_addmember("RightShoulderJoint.s", &human.l, NULL, WMOP_UNION);
2260  (void)mk_addmember("LeftElbowJoint.s", &human.l, NULL, WMOP_UNION);
2261  (void)mk_addmember("RightElbowJoint.s", &human.l, NULL, WMOP_UNION);
2262  (void)mk_addmember("LeftLowerArm.s", &human.l, NULL, WMOP_UNION);
2263  (void)mk_addmember("RightLowerArm.s", &human.l, NULL, WMOP_UNION);
2264  (void)mk_addmember("LeftWristJoint.s", &human.l, NULL, WMOP_UNION);
2265  (void)mk_addmember("RightWristJoint.s", &human.l, NULL, WMOP_UNION);
2266  (void)mk_addmember("LeftHand.s", &human.l, NULL, WMOP_UNION);
2267  (void)mk_addmember("RightHand.s", &human.l, NULL, WMOP_UNION);
2268  (void)mk_addmember("LeftThigh.s", &human.l, NULL, WMOP_UNION);
2269  (void)mk_addmember("RightThigh.s", &human.l, NULL, WMOP_UNION);
2270  (void)mk_addmember("LeftThighJoint.s", &human.l, NULL, WMOP_UNION);
2271  (void)mk_addmember("RightThighJoint.s", &human.l, NULL, WMOP_UNION);
2272  (void)mk_addmember("LeftKneeJoint.s", &human.l, NULL, WMOP_UNION);
2273  (void)mk_addmember("RightKneeJoint.s", &human.l, NULL, WMOP_UNION);
2274  (void)mk_addmember("LeftCalf.s", &human.l, NULL, WMOP_UNION);
2275  (void)mk_addmember("RightCalf.s", &human.l, NULL, WMOP_UNION);
2276  (void)mk_addmember("LeftAnkleJoint.s", &human.l, NULL, WMOP_UNION);
2277  (void)mk_addmember("RightAnkleJoint.s", &human.l, NULL, WMOP_UNION);
2278  (void)mk_addmember("LeftFoot.s", &human.l, NULL, WMOP_UNION);
2279  (void)mk_addmember("RightFoot.s", &human.l, NULL, WMOP_UNION);
2280 
2281  is_region = 1;
2282  VSET(rgb, 128, 255, 128); /* some wonky bright green color */
2283  mk_lcomb(gedp->ged_wdbp,
2284  humanName,
2285  &human,
2286  is_region,
2287  "plastic",
2288  "di=.99 sp=.01",
2289  rgb,
2290  0);
2291 
2292 /* make the .r for the bounding boxes */
2293  if (showBoxes) {
2294  /*
2295  * Create opaque bounding boxes for representations of where the person model
2296  * may lay up next to another model
2297  */
2298  BU_LIST_INIT(&boxes.l)
2299  (void)mk_addmember("Head.sBox", &boxes.l, NULL, WMOP_UNION);
2300  (void)mk_addmember("Neck.sBox", &boxes.l, NULL, WMOP_UNION);
2301  (void)mk_addmember("UpperTorso.sBox", &boxes.l, NULL, WMOP_UNION);
2302  (void)mk_addmember("LowerTorso.sBox", &boxes.l, NULL, WMOP_UNION);
2303  (void)mk_addmember("LeftUpperArm.sBox", &boxes.l, NULL, WMOP_UNION);
2304  (void)mk_addmember("RightUpperArm.sBox", &boxes.l, NULL, WMOP_UNION);
2305  (void)mk_addmember("LeftLowerArm.sBox", &boxes.l, NULL, WMOP_UNION);
2306  (void)mk_addmember("RightLowerArm.sBox", &boxes.l, NULL, WMOP_UNION);
2307  (void)mk_addmember("LeftHand.sBox", &boxes.l, NULL, WMOP_UNION);
2308  (void)mk_addmember("RightHand.sBox", &boxes.l, NULL, WMOP_UNION);
2309  (void)mk_addmember("LeftThigh.sBox", &boxes.l, NULL, WMOP_UNION);
2310  (void)mk_addmember("RightThigh.sBox", &boxes.l, NULL, WMOP_UNION);
2311  (void)mk_addmember("LeftCalf.sBox", &boxes.l, NULL, WMOP_UNION);
2312  (void)mk_addmember("RightCalf.sBox", &boxes.l, NULL, WMOP_UNION);
2313  (void)mk_addmember("LeftFoot.sBox", &boxes.l, NULL, WMOP_UNION);
2314  (void)mk_addmember("RightFoot.sBox", &boxes.l, NULL, WMOP_UNION);
2315  is_region = 1;
2316  VSET(rgb2, 255, 128, 128); /* redish color */
2317  mk_lcomb(gedp->ged_wdbp,
2318  "Boxes.r",
2319  &boxes,
2320  is_region,
2321  "plastic",
2322  "di=0.5 sp=0.5",
2323  rgb2,
2324  0);
2325  /*
2326  * Creating a hollow box that would allow for a person to see inside the
2327  * bounding boxes to the actual body representation inside.
2328  */
2329 
2330  BU_LIST_INIT(&hollow.l);
2331  (void)mk_addmember("Head.sBox", &hollow.l, NULL, WMOP_UNION);
2332  (void)mk_addmember("Head.s", &hollow.l, NULL, WMOP_SUBTRACT);
2333 
2334  (void)mk_addmember("Neck.sBox", &hollow.l, NULL, WMOP_UNION);
2335  (void)mk_addmember("Neck.s", &hollow.l, NULL, WMOP_SUBTRACT);
2336  (void)mk_addmember("Head.s", &hollow.l, NULL, WMOP_SUBTRACT);
2337 
2338  (void)mk_addmember("UpperTorso.sBox", &hollow.l, NULL, WMOP_UNION);
2339  (void)mk_addmember("UpperTorso.s", &hollow.l, NULL, WMOP_SUBTRACT);
2340 
2341  (void)mk_addmember("LowerTorso.sBox", &hollow.l, NULL, WMOP_UNION);
2342  (void)mk_addmember("LowerTorso.s", &hollow.l, NULL, WMOP_SUBTRACT);
2343 
2344  (void)mk_addmember("LeftShoulderJoint.sBox", &hollow.l, NULL, WMOP_UNION);
2345  (void)mk_addmember("LeftShoulderJoint.s", &hollow.l, NULL, WMOP_SUBTRACT);
2346 
2347  (void)mk_addmember("RightShoulderJoint.sBox", &hollow.l, NULL, WMOP_UNION);
2348  (void)mk_addmember("RightShoulderJoint.s", &hollow.l, NULL, WMOP_SUBTRACT);
2349 
2350  (void)mk_addmember("LeftUpperArm.sBox", &hollow.l, NULL, WMOP_UNION);
2351  (void)mk_addmember("LeftUpperArm.s", &hollow.l, NULL, WMOP_SUBTRACT);
2352 
2353  (void)mk_addmember("RightUpperArm.sBox", &hollow.l, NULL, WMOP_UNION);
2354  (void)mk_addmember("RightUpperArm.s", &hollow.l, NULL, WMOP_SUBTRACT);
2355 
2356  (void)mk_addmember("LeftLowerArm.sBox", &hollow.l, NULL, WMOP_UNION);
2357  (void)mk_addmember("LeftLowerArm.s", &hollow.l, NULL, WMOP_SUBTRACT);
2358 
2359  (void)mk_addmember("RightLowerArm.sBox", &hollow.l, NULL, WMOP_UNION);
2360  (void)mk_addmember("RightLowerArm.s", &hollow.l, NULL, WMOP_SUBTRACT);
2361 
2362  (void)mk_addmember("LeftHand.sBox", &hollow.l, NULL, WMOP_UNION);
2363  (void)mk_addmember("LeftHand.s", &hollow.l, NULL, WMOP_SUBTRACT);
2364 
2365  (void)mk_addmember("RightHand.sBox", &hollow.l, NULL, WMOP_UNION);
2366  (void)mk_addmember("RightHand.s", &hollow.l, NULL, WMOP_SUBTRACT);
2367 
2368  (void)mk_addmember("LeftThigh.sBox", &hollow.l, NULL, WMOP_UNION);
2369  (void)mk_addmember("LeftThigh.s", &hollow.l, NULL, WMOP_SUBTRACT);
2370 
2371  (void)mk_addmember("RightThigh.sBox", &hollow.l, NULL, WMOP_UNION);
2372  (void)mk_addmember("RightThigh.s", &hollow.l, NULL, WMOP_SUBTRACT);
2373 
2374  (void)mk_addmember("LeftCalf.sBox", &hollow.l, NULL, WMOP_UNION);
2375  (void)mk_addmember("LeftCalf.s", &hollow.l, NULL, WMOP_SUBTRACT);
2376 
2377  (void)mk_addmember("RightCalf.sBox", &hollow.l, NULL, WMOP_UNION);
2378  (void)mk_addmember("RightCalf.s", &hollow.l, NULL, WMOP_SUBTRACT);
2379 
2380  (void)mk_addmember("LeftFoot.sBox", &hollow.l, NULL, WMOP_UNION);
2381  (void)mk_addmember("LeftFoot.s", &hollow.l, NULL, WMOP_SUBTRACT);
2382 
2383  (void)mk_addmember("RightFoot.sBox", &hollow.l, NULL, WMOP_UNION);
2384  (void)mk_addmember("RightFoot.s", &hollow.l, NULL, WMOP_SUBTRACT);
2385 
2386  is_region = 1;
2387  VSET(rgb3, 128, 128, 255); /* blueish color */
2388  mk_lcomb(gedp->ged_wdbp,
2389  "Hollow.r",
2390  &hollow,
2391  is_region,
2392  "glass",
2393  "di=0.5 sp=0.5 tr=0.75 ri=1",
2394  rgb3,
2395  0);
2396  }
2397  }
2398  if (troops) {
2399  /*Build body regions for each troop*/
2400  /*append number to end of part name, (Head.s0, LeftElbowJoint.s99, etc.) */
2401  int num=0;
2402  int w=0;
2403  int x=0;
2404  char holder[10]={'0'};
2405  int z=0;
2406  char thing[10]="0";
2407  char thing2[10]="0";
2408  bu_log("Naming\n");
2409 
2410  for (w=0; w<(troops*troops); w++) {
2411  char names[MAXLENGTH][MAXLENGTH]={"Head.s", "Neck.s", "UpperTorso.s", "LowerTorso.s", "LeftShoulderJoint.s", "LeftUpperArm.s", "LeftElbowJoint.s",
2412  "LeftLowerArm.s", "LeftWristJoint.s", "LeftHand.s", "RightShoulderJoint.s", "RightUpperArm.s", "RightElbowJoint.s", "RightLowerArm.s",
2413  "RightWristJoint.s", "RightHand.s", "LeftThighJoint.s", "LeftThigh.s", "LeftKneeJoint.s", "LeftCalf.s", "LeftAnkleJoint.s", "LeftFoot.s",
2414  "RightThighJoint.s", "RightThigh.s", "RightKneeJoint.s", "RightCalf.s", "RightAnkleJoint.s", "RightFoot.s", "0"};
2415  char body[MAXLENGTH][MAXLENGTH];
2416  char box[MAXLENGTH][MAXLENGTH];
2417 
2418  bu_strlcpy(body[0], topLevel, MAXLENGTH);
2419  bu_strlcpy(box[0], "Box.r", MAXLENGTH);
2420 
2421  bu_log("%d\n", w);
2422 
2423  sprintf(holder, "%d", num);
2424  bu_strlcpy(suffix, holder, MAXLENGTH);
2425  bu_strlcat(body[0], suffix, MAXLENGTH);
2426  bu_strlcat(box[0], suffix, MAXLENGTH);
2427  bu_log("Adding Members\n");
2428  BU_LIST_INIT(&human.l);
2429  BU_LIST_INIT(&crowd.l);
2430  if (showBoxes)
2431  BU_LIST_INIT(&boxes.l);
2432 
2433  /*This value is the number of items in char names */
2434  while (x<28) {
2435  bu_log("%s : ", names[x]);
2436  bu_strlcat(names[x], suffix, MAXLENGTH);
2437  (void)mk_addmember(names[x], &human.l, NULL, WMOP_UNION);
2438  if (showBoxes) {
2439  bu_strlcat(names[x], "Box", MAXLENGTH);
2440  bu_log("%s : ", names[x]);
2441  (void)mk_addmember(names[x], &boxes.l, NULL, WMOP_UNION);
2442  }
2443  x++;
2444  }
2445  x=0;
2446  VSET(rgb, 128, 255, 128); /* some wonky bright green color */
2447  bu_log("Combining\n");
2448  is_region = 1;
2449  mk_lcomb(gedp->ged_wdbp,
2450  body[0],
2451  &human,
2452  is_region,
2453  "plastic",
2454  "di=.99 sp=.01",
2455  rgb,
2456  0);
2457 
2458  if (showBoxes) {
2459  VSET(rgb2, 255, 128, 128); /* redish color */
2460  mk_lcomb(gedp->ged_wdbp,
2461  box[0],
2462  &boxes,
2463  is_region,
2464  "plastic",
2465  "di=0.5 sp=0.5",
2466  rgb2,
2467  0);
2468  }
2469  bu_log("%s\n", body[0]);
2470  num++;
2471  }
2472  is_region = 0;
2473  for (z=0; z<(troops*troops); z++) {
2474  char comber[MAXLENGTH];
2475 
2476  bu_strlcpy(comber, topLevel, MAXLENGTH);
2477 
2478  sprintf(thing, "%d", z);
2479  bu_strlcpy(thing2, thing, MAXLENGTH);
2480  bu_strlcat(comber, thing2, MAXLENGTH);
2481  (void)mk_addmember(comber, &crowd.l, NULL, WMOP_UNION);
2482  }
2483  }
2484  if (troops)
2485  mk_lcomb(gedp->ged_wdbp, "Crowd.c", &crowd, 0, NULL, NULL, NULL, 0);
2486 
2487  /* Close database */
2488  bu_log("Regions Built\n");
2489  bu_vls_free(&name);
2490  bu_vls_free(&str);
2491 
2492  return GED_OK;
2493 }
2494 
2495 
2496 /*
2497  * Local Variables:
2498  * mode: C
2499  * tab-width: 8
2500  * indent-tabs-mode: t
2501  * c-file-style: "stroustrup"
2502  * End:
2503  * ex: shiftwidth=4 tabstop=8
2504  */
HIDDEN void RandAuto(struct human_data_t *dude)
Definition: human.c:1274
Definition: db_flip.c:35
#define GED_OK
Definition: ged.h:55
HIDDEN void getText(struct human_data_t *dude)
Definition: human.c:2055
char filename[MAXLENGTH]
Definition: human.c:105
int mk_rcc(struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, fastf_t radius)
int textread
Definition: human.c:215
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
struct legInfo legs
Definition: human.c:211
char * progname
Definition: human.c:104
struct headInfo head
Definition: human.c:208
void bu_vls_strncat(struct bu_vls *vp, const char *s, size_t n)
Definition: vls.c:390
struct jointInfo joints
Definition: human.c:212
HIDDEN void boundingBox(struct rt_wdb *file, char *name, fastf_t *startPoint, fastf_t *lengthVector, fastf_t partWidth, fastf_t *rotMatrix)
Definition: human.c:268
fastf_t lowerArmLength
Definition: human.c:161
HIDDEN fastf_t setDirection(fastf_t *inVect, fastf_t *resultVect, fastf_t *outMatrix, fastf_t x, fastf_t y, fastf_t z)
Definition: human.c:232
vect_t calfVector
Definition: human.c:185
point_t neckJoint
Definition: human.c:113
char humanName[MAXLENGTH]
Definition: human.c:106
Definition: ged.h:338
vect_t armVector
Definition: human.c:165
if lu s
Definition: nmg_mod.c:3860
Definition: clone.c:90
fastf_t abDepth
Definition: human.c:146
HIDDEN void boundingRectangle(struct rt_wdb *file, char *name, fastf_t *startPoint, fastf_t *lengthVector, fastf_t partWidth, fastf_t partDepth, fastf_t *rotMatrix)
Definition: human.c:339
int verbread
Definition: human.c:217
#define VSET(a, b, c, d)
Definition: color.c:53
HIDDEN void verbIn(struct human_data_t *dude)
Definition: human.c:2083
HIDDEN fastf_t makeElbow(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude)
Definition: human.c:559
vect_t lElbowDirection
Definition: human.c:168
point_t leftShoulderJoint
Definition: human.c:114
int mk_ell(struct rt_wdb *fp, const char *name, const point_t center, const vect_t a, const vect_t b, const vect_t c)
HIDDEN void show_help(const char *name, const char *optstr)
Definition: human.c:1514
int verbwrite
Definition: human.c:218
HIDDEN fastf_t makeLowerTorso(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:452
Definition: human.c:156
int ged_human(struct ged *gedp, int ac, const char *av[])
Definition: human.c:2186
HIDDEN void makeHand(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:621
ethnicities
Definition: human.c:197
fastf_t lowTorsoLength
Definition: human.c:142
point_t rightThighJoint
Definition: human.c:121
fastf_t toeWidth
Definition: human.c:182
HIDDEN fastf_t makeUpperArm(struct rt_wdb *file, int isLeft, char *partName, struct human_data_t *dude, int showBoxes)
Definition: human.c:522
struct rt_wdb * ged_wdbp
Definition: ged.h:340
Definition: wdb.h:64
char * bu_optarg
Definition: globals.c:91
HIDDEN fastf_t makeShoulder(struct rt_wdb *file, fastf_t isLeft, char *partName, struct human_data_t *dude, int showBoxes)
Definition: human.c:515
Header file for the BRL-CAD common definitions.
int mk_tgc(struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, const vect_t a, const vect_t b, const vect_t c, const vect_t d)
HIDDEN fastf_t makeThigh(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:653
int bu_optind
Definition: globals.c:89
#define WMOP_SUBTRACT
Definition: wdb.h:886
#define MAXLENGTH
Definition: human.c:100
long time(time_t *)
HIDDEN fastf_t makeHead(struct rt_wdb(*file), char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:380
vect_t lWristDirection
Definition: human.c:170
HIDDEN void Manual(struct human_data_t *dude)
Definition: human.c:1286
#define WMOP_UNION
Definition: wdb.h:887
point_t headJoint
Definition: human.c:112
fastf_t handLength
Definition: human.c:163
struct torsoInfo torso
Definition: human.c:209
int bu_getopt(int nargc, char *const nargv[], const char *ostr)
Definition: getopt.c:43
struct bu_list l
Definition: wdb.h:65
fastf_t abWidth
Definition: human.c:145
#define GED_ERROR
Definition: ged.h:61
#define HIDDEN
Definition: common.h:86
fastf_t thighWidth
Definition: human.c:179
vect_t headVector
Definition: human.c:133
#define isLeft(L0, L1, p)
Definition: chull.c:38
fastf_t footLength
Definition: human.c:181
#define mk_lcomb(_fp, _name, _headp, _rf, _shadername, _shaderargs, _rgb, _inh)
Definition: wdb.h:820
HIDDEN fastf_t makeAnkle(struct rt_wdb *file, int isLeftr, char *name, struct human_data_t *dude)
Definition: human.c:718
HIDDEN fastf_t makeFoot(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:726
void bu_vls_free(struct bu_vls *vp)
Definition: vls.c:248
#define DEFAULT_HEIGHT_INCHES
Definition: human.c:96
Definition: color.c:49
#define DEFAULT_HUMANNAME
Definition: human.c:98
HIDDEN fastf_t makeLowerArm(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:575
point_t wristJoint
Definition: human.c:117
void * memset(void *s, int c, size_t n)
Definition: human.c:197
HIDDEN void makeBody(struct rt_wdb(*file), char *suffix, struct human_data_t *dude, fastf_t *location, int showBoxes)
Definition: human.c:887
int mk_arb8(struct rt_wdb *fp, const char *name, const fastf_t *pts8)
Definition: wdb.c:233
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
vect_t lKneeDirection
Definition: human.c:189
void bu_exit(int status, const char *fmt,...) _BU_ATTR_NORETURN _BU_ATTR_PRINTF23
Definition: bomb.c:195
#define IN2MM
Definition: human.c:101
vect_t lFootDirection
Definition: human.c:191
point_t abdomenJoint
Definition: human.c:118
fastf_t torsoLength
Definition: human.c:141
fastf_t calfLength
Definition: human.c:180
vect_t thighVector
Definition: human.c:184
fastf_t armLength
Definition: human.c:158
HIDDEN void getLocation(fastf_t *location)
Definition: human.c:1556
int textwrite
Definition: human.c:216
#define LOOKUP_QUIET
Definition: raytrace.h:893
HIDDEN fastf_t makeCalf(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:687
#define bu_strlcpy(dst, src, size)
Definition: str.h:60
HIDDEN int read_args(int argc, const char **argv, char *topLevel, struct human_data_t *dude, fastf_t *percentile, fastf_t *location, int *stance, int *troops, int *showBoxes)
Definition: human.c:1583
Definition: human.c:176
sexes
Definition: human.c:196
char * options
Definition: gqa.c:56
HIDDEN void makeLeg(struct rt_wdb(*file), char *suffix, int isLeft, struct human_data_t *dude, int showBoxes)
Definition: human.c:841
vect_t lArmDirection
Definition: human.c:166
fastf_t elbowWidth
Definition: human.c:161
HIDDEN fastf_t makeThighJoint(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude)
Definition: human.c:641
Definition: human.c:197
fastf_t pelvisDepth
Definition: human.c:148
#define UNUSED(parameter)
Definition: common.h:239
struct wmember * mk_addmember(const char *name, struct bu_list *headp, mat_t mat, int op)
Definition: reg.c:181
fastf_t shoulderWidth
Definition: human.c:143
vect_t footVector
Definition: human.c:186
fastf_t kneeWidth
Definition: human.c:180
HIDDEN void setStance(fastf_t stance, struct human_data_t *dude)
Definition: human.c:1048
#define GED_CHECK_EXISTS(_gedp, _name, _noisy, _flags)
Definition: ged.h:171
HIDDEN void makeArm(struct rt_wdb(*file), char *suffix, int isLeft, struct human_data_t *dude, int showBoxes)
Definition: human.c:795
char * bu_vls_addr(const struct bu_vls *vp)
Definition: vls.c:111
HIDDEN fastf_t makeKnee(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude)
Definition: human.c:679
vect_t neckVector
Definition: human.c:134
void bn_mat_angles(mat_t mat, double alpha, double beta, double ggamma)
vect_t rWristDirection
Definition: human.c:171
fastf_t headSize
Definition: human.c:130
HIDDEN fastf_t makeShoulderJoint(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude, int showBoxes)
Definition: human.c:484
fastf_t height
Definition: human.c:202
fastf_t upperArmLength
Definition: human.c:160
point_t rightShoulderJoint
Definition: human.c:115
fastf_t thighLength
Definition: human.c:179
fastf_t pelvisWidth
Definition: human.c:147
fastf_t neckWidth
Definition: human.c:131
fastf_t legLength
Definition: human.c:178
fastf_t handWidth
Definition: human.c:163
HIDDEN void makeProfile(struct rt_wdb(*file), char *suffix, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:754
#define BU_LIST_INIT(_hp)
Definition: list.h:148
Definition: human.c:196
int age
Definition: human.c:203
HIDDEN fastf_t makeWrist(struct rt_wdb *file, int isLeft, char *name, struct human_data_t *dude)
Definition: human.c:613
vect_t topTorsoVector
Definition: human.c:150
Definition: human.c:197
point_t elbowJoint
Definition: human.c:116
vect_t rKneeDirection
Definition: human.c:190
fastf_t topTorsoLength
Definition: human.c:142
HIDDEN void Auto(struct human_data_t *dude)
Definition: human.c:1235
int bu_opterr
Definition: globals.c:88
int mk_id_units(struct rt_wdb *fp, const char *title, const char *units)
Definition: id.c:50
HIDDEN void manualPosition(struct human_data_t *dude)
Definition: human.c:993
HIDDEN void makeTorso(struct rt_wdb(*file), char *suffix, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:770
point_t pelvisJoint
Definition: human.c:119
fastf_t neckLength
Definition: human.c:131
HIDDEN void text(struct human_data_t *dude)
Definition: human.c:1882
struct armInfo arms
Definition: human.c:210
Definition: color.c:51
HIDDEN fastf_t makeNeck(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:401
vect_t rLegDirection
Definition: human.c:188
bn_poly_t input[3]
Definition: bn_poly_add.c:36
fastf_t wristWidth
Definition: human.c:162
fastf_t upperArmWidth
Definition: human.c:159
char * bu_fgets(char *s, int size, FILE *stream)
Definition: fgets.c:31
HIDDEN fastf_t makeUpperTorso(struct rt_wdb *file, char *name, struct human_data_t *dude, fastf_t *direction, int showBoxes)
Definition: human.c:417
HIDDEN void makeArmy(struct rt_wdb(*file), struct human_data_t *dude, int number, int showBoxes)
Definition: human.c:932
fastf_t shoulderDepth
Definition: human.c:144
vect_t lowTorsoVector
Definition: human.c:151
Definition: human.c:197
point_t kneeJoint
Definition: human.c:122
#define DEFAULT_FILENAME
Definition: human.c:97
#define BU_VLS_INIT_ZERO
Definition: vls.h:84
vect_t rArmDirection
Definition: human.c:167
HIDDEN void grabCoordinates(fastf_t *positions)
Definition: human.c:960
point_t leftThighJoint
Definition: human.c:120
HIDDEN void verbose(struct human_data_t *dude)
Definition: human.c:2008
int mk_trc_h(struct rt_wdb *fp, const char *name, const point_t base, const vect_t height, fastf_t radbase, fastf_t radtop)
#define GED_CHECK_READ_ONLY(_gedp, _flags)
Definition: ged.h:181
Definition: vls.h:56
double fastf_t
Definition: defines.h:300
vect_t rFootDirection
Definition: human.c:192
vect_t lLegDirection
Definition: human.c:187
int mk_sph(struct rt_wdb *fp, const char *name, const point_t center, fastf_t radius)
vect_t rElbowDirection
Definition: human.c:169
Definition: color.c:50
#define bu_strlcat(dst, src, size)
Definition: str.h:50
point_t ankleJoint
Definition: human.c:123
Definition: human.c:196
int mk_particle(struct rt_wdb *fp, const char *name, point_t vertex, vect_t height, double vradius, double hradius)
fastf_t ankleWidth
Definition: human.c:181
#define BU_STR_EQUAL(s1, s2)
Definition: str.h:126