Revision: 52832
http://brlcad.svn.sourceforge.net/brlcad/?rev=52832&view=rev
Author: brlcad
Date: 2012-10-05 05:01:18 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
scan into doubles, copy into fastf_t
Modified Paths:
--------------
brlcad/trunk/src/anim/anim_orient.c
brlcad/trunk/src/anim/anim_time.c
brlcad/trunk/src/anim/anim_track.c
brlcad/trunk/src/anim/anim_turn.c
Modified: brlcad/trunk/src/anim/anim_orient.c
===================================================================
--- brlcad/trunk/src/anim/anim_orient.c 2012-10-05 05:00:53 UTC (rev 52831)
+++ brlcad/trunk/src/anim/anim_orient.c 2012-10-05 05:01:18 UTC (rev 52832)
@@ -184,26 +184,34 @@
/* read data */
num_read = length;
while (1) {
+ double scan[4];
switch (input_mode) {
case YPR:
case XYZ:
case AET:
- num_read = scanf("%lf %lf %lf", angle, angle+1, angle+2);
+ num_read = scanf("%lf %lf %lf", &scan[0], &scan[1], &scan[2]);
/* convert to radians if in degrees */
if (input_units==DEGREES) {
- VSCALE(angle, angle, DEG2RAD);
+ VSCALE(angle, scan, DEG2RAD); /* double to fastf_t */
+ } else {
+ VMOVE(angle, scan); /* double to fastf_t */
}
break;
case QUAT:
- num_read = scanf("%lf %lf %lf %lf", quat, quat+1, quat+2,
quat+3);
+ num_read = scanf("%lf %lf %lf %lf", &scan[0], &scan[1],
&scan[2], &scan[3]);
+ HMOVE(quat, scan); /* double to fastf_t */
break;
case MAT:
num_read = 0;
- num_read += scanf("%lf %lf %lf %lf", matrix, matrix+1,
matrix+2, matrix+3);
- num_read += scanf("%lf %lf %lf %lf", matrix+4, matrix+5,
matrix+6, matrix+7);
- num_read += scanf("%lf %lf %lf %lf", matrix+8, matrix+9,
matrix+10, matrix+11);
- num_read += scanf("%lf %lf %lf %lf", matrix+12, matrix+13,
matrix+14, matrix+15);
+ num_read += scanf("%lf %lf %lf %lf", &scan[0], &scan[1],
&scan[2], &scan[3]);
+ HMOVE(matrix, scan); /* double to fastf_t */
+ num_read += scanf("%lf %lf %lf %lf", &scan[0], &scan[1],
&scan[2], &scan[3]);
+ HMOVE(matrix+4, scan); /* double to fastf_t */
+ num_read += scanf("%lf %lf %lf %lf", &scan[0], &scan[1],
&scan[2], &scan[3]);
+ HMOVE(matrix+8, scan); /* double to fastf_t */
+ num_read += scanf("%lf %lf %lf %lf", &scan[0], &scan[1],
&scan[2], &scan[3]);
+ HMOVE(matrix+12, scan); /* double to fastf_t */
break;
}
Modified: brlcad/trunk/src/anim/anim_time.c
===================================================================
--- brlcad/trunk/src/anim/anim_time.c 2012-10-05 05:00:53 UTC (rev 52831)
+++ brlcad/trunk/src/anim/anim_time.c 2012-10-05 05:01:18 UTC (rev 52832)
@@ -48,7 +48,6 @@
/* command line variables */
-fastf_t inv0, inv1;
int v0_set = TIME_NONE;
int v1_set = TIME_NONE;
int query = 0;
@@ -57,7 +56,10 @@
int domem = 0;
int debug = 0;
+/* intentionally double for scan */
+double inv0, inv1;
+
fastf_t
gettime(fastf_t dist, fastf_t a, fastf_t b, fastf_t c, fastf_t init)
{
@@ -96,6 +98,7 @@
int c;
while ((c=bu_getopt(argc, argv, OPT_STR)) != -1) {
+
switch (c) {
case 's':
sscanf(bu_optarg, "%lf", &inv0);
@@ -146,13 +149,14 @@
int
main(int argc, char **argv)
{
- fastf_t *l, *x, *y, *z;
- fastf_t temp0, temp1, temp2, start=0.0, end, v0, v1;
+ fastf_t *l;
+ fastf_t temp0, temp1, temp2, start=0.0, v0, v1;
int i, j, num, plen;
-
fastf_t time, dist, slope, a, b, c;
+ /* intentionally double for scan */
+ double end, *x, *y, *z;
plen = 0;
@@ -167,13 +171,13 @@
l = (fastf_t *) bu_malloc(maxlines*sizeof(fastf_t), "l[]");
if (verbose) {
- x = (fastf_t *) bu_malloc(maxlines*sizeof(fastf_t), "x[]");
- y = (fastf_t *) bu_malloc(maxlines*sizeof(fastf_t), "y[]");
- z = (fastf_t *) bu_malloc(maxlines*sizeof(fastf_t), "z[]");
+ x = (double *) bu_malloc(maxlines*sizeof(double), "x[]");
+ y = (double *) bu_malloc(maxlines*sizeof(double), "y[]");
+ z = (double *) bu_malloc(maxlines*sizeof(double), "z[]");
} else {
- x = (fastf_t *) bu_malloc(2*sizeof(fastf_t), "x[]");
- y = (fastf_t *) bu_malloc(2*sizeof(fastf_t), "y[]");
- z = (fastf_t *) bu_malloc(2*sizeof(fastf_t), "z[]");
+ x = (double *) bu_malloc(2*sizeof(double), "x[]");
+ y = (double *) bu_malloc(2*sizeof(double), "y[]");
+ z = (double *) bu_malloc(2*sizeof(double), "z[]");
}
l[0] = 0.0;
Modified: brlcad/trunk/src/anim/anim_track.c
===================================================================
--- brlcad/trunk/src/anim/anim_track.c 2012-10-05 05:00:53 UTC (rev 52831)
+++ brlcad/trunk/src/anim/anim_track.c 2012-10-05 05:01:18 UTC (rev 52832)
@@ -95,7 +95,7 @@
fastf_t curve_a, curve_b, curve_c, s_start;
int num_links, num_wheels;
-fastf_t track_y, tracklen, first_tracklen;
+fastf_t track_y, tracklen;
/* variables set by get_args */
int wheel_nindex; /* argv[wheel_nindex] = wheelname*/
@@ -119,7 +119,10 @@
vect_t centroid, rcentroid; /* alternate centroid and its reverse */
mat_t m_axes, m_rev_axes; /* matrices to and from alternate axes */
+/* intentionally double for scan */
+double first_tracklen;
+
int
get_args(int argc, char **argv)
{
@@ -140,6 +143,8 @@
anti_strobe = 0;
while ((c=bu_getopt(argc, argv, OPT_STR)) != -1) {
+ double scan[3];
+
i=0;
switch (c) {
case 's':
@@ -159,9 +164,14 @@
break;
case 'b':
bu_optind -= 1;
- sscanf(argv[bu_optind+(i++)], "%lf", &yaw);
- sscanf(argv[bu_optind+(i++)], "%lf", &pch);
- sscanf(argv[bu_optind+(i++)], "%lf", &rll);
+
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[0]);
+ yaw = scan[0];
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[0]);
+ pch = scan[0];
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[0]);
+ rll = scan[0];
+
bu_optind += 3;
anim_dx_y_z2mat(m_axes, rll, -pch, yaw);
anim_dz_y_x2mat(m_rev_axes, -rll, pch, -yaw);
@@ -169,9 +179,12 @@
break;
case 'd':
bu_optind -= 1;
- sscanf(argv[bu_optind+(i++)], "%lf", centroid);
- sscanf(argv[bu_optind+(i++)], "%lf", centroid+1);
- sscanf(argv[bu_optind+(i++)], "%lf", centroid+2);
+
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[0]);
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[1]);
+ sscanf(argv[bu_optind+(i++)], "%lf", &scan[2]);
+ VMOVE(centroid, scan); /* double to fastf_t */
+
bu_optind += 3;
VREVERSE(rcentroid, centroid);
cent = 1;
@@ -180,10 +193,12 @@
sscanf(bu_optarg, "%d", &first_frame);
break;
case 'i':
- sscanf(bu_optarg, "%lf", &init_dist);
+ sscanf(bu_optarg, "%lf", &scan[0]);
+ init_dist = scan[0]; /* double to fastf_t */
break;
case 'r':
- sscanf(bu_optarg, "%lf", &radius);
+ sscanf(bu_optarg, "%lf", &scan[0]);
+ radius = scan[0]; /* double to fastf_t */
one_radius = 1;
break;
case 'p':
@@ -429,7 +444,7 @@
int go;
fastf_t y_rot, distance, yaw, pch, roll;
vect_t cent_pos, wheel_now, wheel_prev;
- vect_t zero, position, vdelta, temp, to_track, to_front;
+ vect_t zero, position, vdelta, to_track, to_front;
mat_t wmat, mat_x;
FILE *stream;
struct wheel *wh;
@@ -437,6 +452,9 @@
int rndtabi=0;
fastf_t halfpadlen, delta, prev_dist;
+ /* intentionally double for scan */
+ double temp[3];
+
VSETALL(zero, 0.0);
VSETALL(to_track, 0.0);
VSETALL(centroid, 0.0);
@@ -493,14 +511,18 @@
/*read original wheel positions*/
for (i=0;i<NW;i++) {
+ double scan;
+
count = fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
if (count != 3)
break;
- if (one_radius)
+ if (one_radius) {
x[i].w.rad = radius;
- else
- count = fscanf(stream, "%lf", & x[i].w.rad);
+ } else {
+ count = fscanf(stream, "%lf", &scan);
+ x[i].w.rad = scan;
+ }
MAT4X3PNT(x[i].w.pos, m_rev_axes, temp);
if (i==0)
track_y = x[0].w.pos[1];
@@ -529,7 +551,8 @@
if (dist_mode==STEERED) {
/* prime the pumps */
val = scanf("%*f");/*time*/
- val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
+ val = scanf("%lf %lf %lf", temp, temp+1, temp+2);
+ VMOVE(cent_pos, temp);
if (val < 3)
return 0;
go = anim_steer_mat(mat_x, cent_pos, 0);
@@ -548,14 +571,21 @@
for (; ; frame++) {
if (dist_mode==GIVEN) {
val = scanf("%*f");/*time*/
- val = scanf("%lf", &distance);
+ val = scanf("%lf", &temp[0]);
+ distance = temp[0];
if (val < 1) {
break;
}
} else if (dist_mode==CALCULATED) {
val = scanf("%*f");/*time*/
- val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos+2);
- val = scanf("%lf %lf %lf", &yaw, &pch, &roll);
+ val = scanf("%lf %lf %lf", &temp[0], &temp[1], &temp[2]);
+ /* converting double to fastf_t */
+ VMOVE(cent_pos, temp);
+ val = scanf("%lf %lf %lf", &temp[0], &temp[1], &temp[2]);
+ /* converting double to fastf_t */
+ yaw = temp[0];
+ pch = temp[1];
+ roll = temp[2];
if (val < 3)
break;
anim_dy_p_r2mat(mat_x, yaw, pch, roll);
@@ -566,7 +596,9 @@
if (read_wheels) {
/* read in all wheel positions */
for (i=0;i<NW;i++) {
- val = scanf("%lf %lf", x[i].w.pos, x[i].w.pos + 2);
+ val = scanf("%lf %lf", &temp[0], &temp[1]);
+ x[i].w.pos[0] = temp[0];
+ x[i].w.pos[2] = temp[1]; /* ??? is [2] right? */
if (val < 2) {
break;
}
@@ -575,13 +607,16 @@
if (dist_mode==STEERED) {
val = scanf("%*f");/*time*/
- val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
+ val = scanf("%lf %lf %lf", &temp[0], &temp[1], &temp[2]);
if (val < 3) {
if (last_steer)
break;
else
last_steer = 1;
}
+ /* converting double to fastf_t */
+ VMOVE(cent_pos, temp);
+
go = anim_steer_mat(mat_x, cent_pos, last_steer);
anim_add_trans(mat_x, cent_pos, rcentroid);
}
@@ -647,9 +682,11 @@
}
if (print_wheel) {
for (count = 0;count<num_wheels;count++) {
+ vect_t xpos;
+
anim_y_p_r2mat(wmat, 0.0, -distance/wh[count].rad, 0.0);
- VREVERSE(temp, wh[count].pos);
- anim_add_trans(wmat, x[count].w.pos, temp);
+ VREVERSE(xpos, wh[count].pos);
+ anim_add_trans(wmat, x[count].w.pos, xpos);
if (axes || cent) {
bn_mat_mul(mat_x, wmat, m_rev_axes);
bn_mat_mul(wmat, m_axes, mat_x);
Modified: brlcad/trunk/src/anim/anim_turn.c
===================================================================
--- brlcad/trunk/src/anim/anim_turn.c 2012-10-05 05:00:53 UTC (rev 52831)
+++ brlcad/trunk/src/anim/anim_turn.c 2012-10-05 05:01:18 UTC (rev 52832)
@@ -46,10 +46,12 @@
int print_int = 1;
int angle_set = 0;
int turn_wheels = 0;
-fastf_t length, angle, radius;
-fastf_t factor = 1.0;
+/* intentionally double for scan */
+double length, angle, radius;
+double factor = 1.0;
+
int
get_args(int argc, char **argv)
{
@@ -88,10 +90,14 @@
main(int argc, char *argv[])
{
int count;
- fastf_t val, t /* time */, roll_ang, yaw, sign;
+ fastf_t val, roll_ang, yaw, sign;
vect_t v, point, front, back, zero, temp1, temp2;
mat_t m_from_world, m_to_world;
+ /* intentionally double for scan */
+ double scan[3];
+ double t /* time */;
+
/* initialize variables */
VSETALL(zero, 0.0);
VSETALL(v, 0.0);
@@ -110,14 +116,16 @@
if (!angle_set) {
/* set angle if not yet done */
count = scanf("%*f%*[^-0123456789]");
- count = VSCAN(temp1);
+ count = VSCAN(scan);
if (count != 3)
return 1;
+ VMOVE(temp1, scan); /* double to fastf_t */
count = scanf("%*f%*[^-0123456789]");
- count = VSCAN(temp2);
+ count = VSCAN(scan);
if (count != 3)
return 1;
+ VMOVE(temp2, scan); /* double to fastf_t */
angle = bn_atan2((temp2[1]-temp1[1]), (temp2[0]-temp1[0]));
rewind(stdin);
@@ -126,10 +134,11 @@
while (1) {
/* read one line of table */
val = scanf("%lf%*[^-0123456789]", &t); /*read time, ignore garbage*/
- val = scanf("%lf %lf %lf", point, point+1, point +2);
+ val = scanf("%lf %lf %lf", &scan[0], &scan[1], &scan[2]);
if (val < 3) {
break;
}
+ VMOVE(point, scan); /* double to fastf_t */
/*update to and from matrices */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits