-x# -y# -z# Rotation about axis in degrees\n\ -X# -Y# -Z# Translation along axis\n\ -s# Scale factor\n\ -a# -e# Azimuth/Elevation from front view\n\ (usually first, in this order, implies -M)\n\ -g MGED front view to display coordinates (usually last)\n\ -M Autoscale space command like RT model RPP\n\ -m# Takes a 4X4 matrix as an argument\n\ -v Verbose\n\ -S# Space: takes a quoted string of six floats\n"; /* * M O D E L _ R P P * * Process a space command. * Behavior depends on setting of several flags. * * Implicit Returns - * In all cases, sets space_min and space_max. */ int model_rpp(const fastf_t *min, const fastf_t *max) { if ( space_set ) { fprintf(stderr, "plrot: additional SPACE command ignored\n"); fprintf(stderr, "got: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(min), V3ARGS(max) ); fprintf(stderr, "still using: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(space_min), V3ARGS(space_max) ); return 0; } if ( rpp ) { point_t rot_center; /* center of rotation */ mat_t xlate; mat_t resize; mat_t t1, t2; VADD2SCALE( rot_center, min, max, 0.5 ); /* Create the matrix which encodes this */ MAT_IDN( xlate ); MAT_DELTAS_VEC_NEG( xlate, rot_center); MAT_IDN( resize ); resize[15] = 1/scale; bn_mat_mul( t1, resize, xlate ); bn_mat_mul( t2, rmat, t1 ); MAT_COPY( rmat, t2 ); if ( verbose ) { bn_mat_print("rmat", rmat); } if ( Mflag ) { /* Don't rebound, just expand size of space * around center point. * Has advantage of the output space() not being * affected by changes in rotation, * which may be significant for animation scripts. */ vect_t diag; double v; VSUB2( diag, max, min ); v = MAGNITUDE(diag)*0.5 + 0.5; VSET( space_min, -v, -v, -v ); VSET( space_max, v, v, v ); } else { /* re-bound the space() rpp with a tighter one * after rotating & scaling it. */ bn_rotate_bbox( space_min, space_max, rmat, min, max ); } space_set = 1; } else { VMOVE( space_min, min ); VMOVE( space_max, max ); space_set = 1; } if ( forced_space ) { /* Put forced space back */ VMOVE( space_min, forced_space_min ); VMOVE( space_max, forced_space_max ); space_set = 1; } if ( verbose ) { fprintf(stderr, "got: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(min), V3ARGS(max) ); fprintf(stderr, "put: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(space_min), V3ARGS(space_max) ); } return( 1 ); }
/* * Process a space command. * Behavior depends on setting of several flags. * * Implicit Returns - * In all cases, sets space_min and space_max. */ int model_rpp(const fastf_t *min, const fastf_t *max) { if (space_set) { bu_log("plot3rot: additional SPACE command ignored\n"); bu_log("got: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(min), V3ARGS(max)); bu_log("still using: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(space_min), V3ARGS(space_max)); return 0; } if (rpp) { point_t rot_center; /* center of rotation */ mat_t xlate; mat_t resize; mat_t t1, t2; VADD2SCALE(rot_center, min, max, 0.5); /* Create the matrix which encodes this */ MAT_IDN(xlate); MAT_DELTAS_VEC_NEG(xlate, rot_center); MAT_IDN(resize); resize[15] = 1/scale; bn_mat_mul(t1, resize, xlate); bn_mat_mul(t2, rmat, t1); MAT_COPY(rmat, t2); if (verbose) { bn_mat_print("rmat", rmat); } if (Mflag) { /* Don't rebound, just expand size of space * around center point. * Has advantage of the output space() not being * affected by changes in rotation, * which may be significant for animation scripts. */ vect_t diag; double v; VSUB2(diag, max, min); v = MAGNITUDE(diag)*0.5 + 0.5; VSET(space_min, -v, -v, -v); VSET(space_max, v, v, v); } else { /* re-bound the space() rpp with a tighter one * after rotating & scaling it. */ bn_rotate_bbox(space_min, space_max, rmat, min, max); } space_set = 1; } else { VMOVE(space_min, min); VMOVE(space_max, max); space_set = 1; } if (forced_space) { /* Put forced space back */ VMOVE(space_min, forced_space_min); VMOVE(space_max, forced_space_max); space_set = 1; } if (verbose) { bu_log("got: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(min), V3ARGS(max)); bu_log("put: space (%g, %g, %g) (%g, %g, %g)\n", V3ARGS(space_min), V3ARGS(space_max)); } return 1; }