Compare commits
2
Commits
annotrt
...
stable-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bcae53344 | ||
|
|
a9d022b10a |
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* C O N S T . C
|
||||
*
|
||||
* Constants used by the ray tracing library.
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1989 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSmat[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
|
||||
CONST double rt_pi = 3.14159265358979323846; /* pi */
|
||||
CONST double rt_twopi = 6.28318530717958647692; /* pi*2 */
|
||||
CONST double rt_halfpi = 1.57079632679489661923; /* pi/2 */
|
||||
CONST double rt_quarterpi=0.78539816339744830961; /* pi/4 */
|
||||
CONST double rt_invpi = 0.318309886183790671538; /* 1/pi */
|
||||
CONST double rt_inv2pi = 0.159154943091895335769; /* 1/(pi*2) */
|
||||
CONST double rt_inv4pi = 0.07957747154594766788; /* 1/(pi*4) */
|
||||
|
||||
CONST double rt_inv255 = 1.0/255.0;
|
||||
|
||||
CONST double rt_degtorad = 0.0174532925199433; /* (pi*2)/360 */
|
||||
CONST double rt_radtodeg = 57.29577951308230698802; /* 360/(pi*2) */
|
||||
|
||||
CONST mat_t rt_identity = {
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
|
||||
#ifdef ipsc860
|
||||
/* Hack to work around the broken iPSC/860 loader. It doesn't
|
||||
* see the definition in global.c, probably because there is no
|
||||
* .text or .data there that it needs.
|
||||
*/
|
||||
struct rt_g rt_g;
|
||||
#endif
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* H I S T . C
|
||||
*
|
||||
* General purpose histogram handling routines
|
||||
*
|
||||
* The macro RT_HISTOGRAM_TALLY is used to record items that
|
||||
* live in a single "bin", while the subroutine rt_hist_range()
|
||||
* is used to record items that may extend across multiple "bin"s.
|
||||
*
|
||||
* Author -
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1990 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCShist[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
#include "./debug.h"
|
||||
|
||||
/*
|
||||
* R T _ H I S T _ F R E E
|
||||
*/
|
||||
void
|
||||
rt_hist_free( histp )
|
||||
struct histogram *histp;
|
||||
{
|
||||
/* The 'clean' command can be called before the first rt_prep(),
|
||||
* resulting in zero magic numbers in rtip->rti_hist_cellsize.
|
||||
*/
|
||||
if( histp && histp->magic == 0 ) return;
|
||||
RT_CK_HISTOGRAM(histp);
|
||||
if( histp->hg_bins )
|
||||
rt_free( (char *)histp->hg_bins, "old histogram bins");
|
||||
histp->hg_bins = (long *)0;
|
||||
histp->hg_nbins = 0;
|
||||
histp->magic = -1; /* sanity */
|
||||
}
|
||||
|
||||
/*
|
||||
* R T _ H I S T _ I N I T
|
||||
*
|
||||
* Initialize a histogram structure.
|
||||
* It is expected that the structure is junk upon entry.
|
||||
*/
|
||||
void
|
||||
rt_hist_init( histp, min, max, nbins )
|
||||
struct histogram *histp;
|
||||
fastf_t min, max;
|
||||
int nbins;
|
||||
{
|
||||
|
||||
if( max <= min ) max = min+1;
|
||||
if( nbins < 2 ) {
|
||||
nbins = 2;
|
||||
} else if( nbins > 10000 ) {
|
||||
nbins = 10000;
|
||||
}
|
||||
|
||||
histp->hg_min = floor(min);
|
||||
histp->hg_max = ceil(max);
|
||||
histp->hg_nbins = nbins;
|
||||
|
||||
/* When max-min <= nbins, clumpsize should be 1 */
|
||||
histp->hg_clumpsize = ((max-min)/nbins)+1;
|
||||
if( histp->hg_clumpsize <= 0 ) histp->hg_clumpsize = 1;
|
||||
|
||||
histp->hg_nsamples = 0L;
|
||||
histp->hg_bins = (long *)rt_calloc( nbins+1, sizeof(long), "histogram bins");
|
||||
histp->magic = RT_HISTOGRAM_MAGIC;
|
||||
}
|
||||
|
||||
/*
|
||||
* R T _ H I S T _ R A N G E
|
||||
*/
|
||||
void
|
||||
rt_hist_range( hp, low, high )
|
||||
register struct histogram *hp;
|
||||
fastf_t low;
|
||||
fastf_t high;
|
||||
{
|
||||
long a;
|
||||
long b;
|
||||
register int i;
|
||||
|
||||
RT_CK_HISTOGRAM(hp);
|
||||
if( low <= hp->hg_min )
|
||||
a = 0;
|
||||
else
|
||||
a = (low - hp->hg_min) / hp->hg_clumpsize;
|
||||
if( high >= hp->hg_max )
|
||||
b = hp->hg_nbins-1;
|
||||
else
|
||||
b = (high - hp->hg_min) / hp->hg_clumpsize;
|
||||
if( a < 0 || b >= hp->hg_nbins ) rt_bomb("rt_hist_range() out of range\n");
|
||||
for( i=a; i <= b; i++ ) {
|
||||
hp->hg_bins[i]++;
|
||||
}
|
||||
hp->hg_nsamples++;
|
||||
}
|
||||
|
||||
/*
|
||||
* R T _ H I S T _ P R
|
||||
*/
|
||||
void
|
||||
rt_hist_pr( histp, title )
|
||||
register struct histogram *histp;
|
||||
CONST char *title;
|
||||
{
|
||||
register int i;
|
||||
long maxcount;
|
||||
static CONST char marks[] = "################################################################";
|
||||
#define NMARKS 50
|
||||
char buf[256];
|
||||
int percent;
|
||||
int mark_count;
|
||||
int val;
|
||||
int nbins;
|
||||
|
||||
RT_CK_HISTOGRAM(histp);
|
||||
|
||||
/* Find entry with highest count */
|
||||
maxcount = 0L;
|
||||
for( i=0; i<histp->hg_nbins; i++ ) {
|
||||
if( histp->hg_bins[i] > maxcount )
|
||||
maxcount = histp->hg_bins[i];
|
||||
}
|
||||
if( maxcount <= 0 ) maxcount = 1;
|
||||
|
||||
/* Supress trailing bins with zero counts. nbins s/b >= 1 */
|
||||
for( nbins = histp->hg_nbins-1; nbins >= 1; nbins-- )
|
||||
if(histp->hg_bins[nbins] > 0) break;
|
||||
|
||||
/* 12345678 12345678 123 .... */
|
||||
rt_log("\nHistogram of %s\nmin=%g, max=%g, nbins=%d, clumpsize=%g\n%d samples collected, highest count was %d\n\n Value Count Rel%%| Bar Graph\n",
|
||||
title,
|
||||
histp->hg_min, histp->hg_max,
|
||||
histp->hg_nbins, histp->hg_clumpsize,
|
||||
histp->hg_nsamples, maxcount );
|
||||
|
||||
/* Print each bin. Final bins with zero counts are supressed. */
|
||||
for( i=0; i <= nbins; i++ ) {
|
||||
percent = (int)(((double)histp->hg_bins[i])*100.0/maxcount);
|
||||
mark_count = percent*NMARKS/100;
|
||||
if( mark_count <= 0 ) {
|
||||
buf[0] = '\0';
|
||||
} else {
|
||||
bcopy( marks, buf, mark_count );
|
||||
buf[mark_count] = '\0';
|
||||
}
|
||||
val = histp->hg_min + i*histp->hg_clumpsize;
|
||||
rt_log("%8d %8d %3d |%s\n",
|
||||
val,
|
||||
histp->hg_bins[i], percent, buf );
|
||||
}
|
||||
}
|
||||
-2379
File diff suppressed because it is too large
Load Diff
-551
@@ -1,551 +0,0 @@
|
||||
/*
|
||||
* P O L Y L I B . C
|
||||
*
|
||||
* Library for dealing with polynomials.
|
||||
*
|
||||
* Functions -
|
||||
* rt_poly_mul Multiply two polynomials
|
||||
* rt_poly_scale Scale a polynomial
|
||||
* rt_poly_add Add two polynomials
|
||||
* rt_poly_sub Subtract two polynomials
|
||||
* rt_poly_synthetic_division Divide 1 poly into another using Synthetic Division
|
||||
* quadratic Solve quadratic formula
|
||||
* cubic Solve cubic forumla
|
||||
* rt_pr_poly Print a polynomial
|
||||
*
|
||||
* Author -
|
||||
* Jeff Hanes
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char RCSpolylib[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
#include "machine.h"
|
||||
#include "externs.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
#include "rtstring.h"
|
||||
#include "./polyno.h"
|
||||
#include "./complex.h"
|
||||
|
||||
extern void rt_pr_poly();
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
#define PI_DIV_3 (M_PI/3.0)
|
||||
static poly Zpoly = { 0, 0.0 };
|
||||
|
||||
/*
|
||||
* rt_poly_mul -- multiply two polynomials
|
||||
*/
|
||||
poly *
|
||||
rt_poly_mul(m1,m2,product)
|
||||
register poly *m1, *m2, *product;
|
||||
{
|
||||
if( m1->dgr == 1 && m2->dgr == 1 ) {
|
||||
product->dgr = 2;
|
||||
product->cf[0] = m1->cf[0] * m2->cf[0];
|
||||
product->cf[1] = m1->cf[0] * m2->cf[1] +
|
||||
m1->cf[1] * m2->cf[0];
|
||||
product->cf[2] = m1->cf[1] * m2->cf[1];
|
||||
return(product);
|
||||
}
|
||||
if( m1->dgr == 2 && m2->dgr == 2 ) {
|
||||
product->dgr = 4;
|
||||
product->cf[0] = m1->cf[0] * m2->cf[0];
|
||||
product->cf[1] = m1->cf[0] * m2->cf[1] +
|
||||
m1->cf[1] * m2->cf[0];
|
||||
product->cf[2] = m1->cf[0] * m2->cf[2] +
|
||||
m1->cf[1] * m2->cf[1] +
|
||||
m1->cf[2] * m2->cf[0];
|
||||
product->cf[3] = m1->cf[1] * m2->cf[2] +
|
||||
m1->cf[2] * m2->cf[1];
|
||||
product->cf[4] = m1->cf[2] * m2->cf[2];
|
||||
return(product);
|
||||
}
|
||||
|
||||
/* Not one of the common (or easy) cases. */
|
||||
{
|
||||
register int ct1, ct2;
|
||||
|
||||
*product = Zpoly;
|
||||
|
||||
/* If the degree of the product will be larger than the
|
||||
* maximum size allowed in "polyno.h", then return a null
|
||||
* pointer to indicate failure.
|
||||
*/
|
||||
if ( (product->dgr = m1->dgr + m2->dgr) > MAXP )
|
||||
return PM_NULL;
|
||||
|
||||
for ( ct1=0; ct1 <= m1->dgr; ++ct1 ){
|
||||
for ( ct2=0; ct2 <= m2->dgr; ++ct2 ){
|
||||
product->cf[ct1+ct2] +=
|
||||
m1->cf[ct1] * m2->cf[ct2];
|
||||
}
|
||||
}
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rt_poly_scale -- scale a polynomial
|
||||
*/
|
||||
poly *
|
||||
rt_poly_scale(eqn,factor)
|
||||
register poly *eqn;
|
||||
double factor;
|
||||
{
|
||||
register int cnt;
|
||||
|
||||
for ( cnt=0; cnt <= eqn->dgr; ++cnt ){
|
||||
eqn->cf[cnt] *= factor;
|
||||
}
|
||||
return eqn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rt_poly_add -- add two polynomials
|
||||
*/
|
||||
poly *
|
||||
rt_poly_add(poly1,poly2,sum)
|
||||
register poly *poly1, *poly2, *sum;
|
||||
{
|
||||
LOCAL poly tmp;
|
||||
register int i, offset;
|
||||
|
||||
offset = Abs(poly1->dgr - poly2->dgr);
|
||||
|
||||
tmp = Zpoly;
|
||||
|
||||
if ( poly1->dgr >= poly2->dgr ){
|
||||
*sum = *poly1;
|
||||
for ( i=0; i <= poly2->dgr; ++i ){
|
||||
tmp.cf[i+offset] = poly2->cf[i];
|
||||
}
|
||||
} else {
|
||||
*sum = *poly2;
|
||||
for ( i=0; i <= poly1->dgr; ++i ){
|
||||
tmp.cf[i+offset] = poly1->cf[i];
|
||||
}
|
||||
}
|
||||
|
||||
for ( i=0; i <= sum->dgr; ++i ){
|
||||
sum->cf[i] += tmp.cf[i];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rt_poly_sub -- subtract two polynomials
|
||||
*/
|
||||
poly *
|
||||
rt_poly_sub(poly1,poly2,diff)
|
||||
register poly *poly1, *poly2, *diff;
|
||||
{
|
||||
LOCAL poly tmp;
|
||||
register int i, offset;
|
||||
|
||||
offset = Abs(poly1->dgr - poly2->dgr);
|
||||
|
||||
*diff = Zpoly;
|
||||
tmp = Zpoly;
|
||||
|
||||
if ( poly1->dgr >= poly2->dgr ){
|
||||
*diff = *poly1;
|
||||
for ( i=0; i <= poly2->dgr; ++i ){
|
||||
tmp.cf[i+offset] = poly2->cf[i];
|
||||
}
|
||||
} else {
|
||||
diff->dgr = poly2->dgr;
|
||||
for ( i=0; i <= poly1->dgr; ++i ){
|
||||
diff->cf[i+offset] = poly1->cf[i];
|
||||
}
|
||||
tmp = *poly2;
|
||||
}
|
||||
|
||||
for ( i=0; i <= diff->dgr; ++i ){
|
||||
diff->cf[i] -= tmp.cf[i];
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
/* >>> s y n D i v ( ) <<<
|
||||
* Divides any polynomial into any other polynomial using synthetic
|
||||
* division. Both polynomials must have real coefficients.
|
||||
*/
|
||||
void
|
||||
rt_poly_synthetic_division(dvdend,dvsor,quo,rem)
|
||||
register poly *dvdend, *dvsor, *quo, *rem;
|
||||
{
|
||||
register int div;
|
||||
register int n;
|
||||
|
||||
*quo = *dvdend;
|
||||
*rem = Zpoly;
|
||||
|
||||
if ((quo->dgr = dvdend->dgr - dvsor->dgr) < 0)
|
||||
quo->dgr = -1;
|
||||
if ((rem->dgr = dvsor->dgr - 1) > dvdend->dgr)
|
||||
rem->dgr = dvdend->dgr;
|
||||
|
||||
for ( n=0; n <= quo->dgr; ++n){
|
||||
quo->cf[n] /= dvsor->cf[0];
|
||||
for ( div=1; div <= dvsor->dgr; ++div){
|
||||
quo->cf[n+div] -= quo->cf[n] * dvsor->cf[div];
|
||||
}
|
||||
}
|
||||
for ( n=1; n<=(rem->dgr+1); ++n){
|
||||
rem->cf[n-1] = quo->cf[quo->dgr+n];
|
||||
quo->cf[quo->dgr+n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* >>> q u a d r a t i c ( ) <<<
|
||||
*
|
||||
* Uses the quadratic formula to find the roots (in `complex' form)
|
||||
* of any quadratic equation with real coefficients.
|
||||
*/
|
||||
void
|
||||
rt_poly_quadratic_roots( quadrat, root )
|
||||
register poly *quadrat;
|
||||
register complex root[];
|
||||
{
|
||||
LOCAL fastf_t discrim, denom, rad;
|
||||
|
||||
if( NEAR_ZERO( quadrat->cf[0], SMALL ) ) {
|
||||
/* root = -cf[2] / cf[1] */
|
||||
if( NEAR_ZERO( quadrat->cf[1], SMALL ) ) {
|
||||
/* No solution. Now what? */
|
||||
rt_log("rt_poly_quadratic_roots(): ERROR, no solution\n");
|
||||
return;
|
||||
}
|
||||
/* Fake it as a repeated root. */
|
||||
root[0].re = root[1].re = -quadrat->cf[2]/quadrat->cf[1];
|
||||
root[0].im = root[1].im = 0.0;
|
||||
return;
|
||||
}
|
||||
/* What to do if cf[1] > SQRT_MAX_FASTF ? */
|
||||
|
||||
discrim = quadrat->cf[1]*quadrat->cf[1] - 4.0* quadrat->cf[0]*quadrat->cf[2];
|
||||
denom = 0.5 / quadrat->cf[0];
|
||||
if ( discrim >= 0.0 ){
|
||||
rad = sqrt( discrim );
|
||||
root[0].re = ( -quadrat->cf[1] + rad ) * denom;
|
||||
root[1].re = ( -quadrat->cf[1] - rad ) * denom;
|
||||
root[1].im = root[0].im = 0.0;
|
||||
} else {
|
||||
root[1].re = root[0].re = -quadrat->cf[1] * denom;
|
||||
root[1].im = -(root[0].im = sqrt( -discrim ) * denom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define SQRT3 1.732050808
|
||||
#define THIRD 0.333333333333333333333333333
|
||||
#define INV_TWENTYSEVEN 0.037037037037037037037037037
|
||||
#define CUBEROOT( a ) (( (a) >= 0.0 ) ? pow( a, THIRD ) : -pow( -(a), THIRD ))
|
||||
|
||||
/* >>> c u b i c ( ) <<<
|
||||
*
|
||||
* Uses the cubic formula to find the roots ( in `complex' form )
|
||||
* of any cubic equation with real coefficients.
|
||||
*
|
||||
* to solve a polynomial of the form:
|
||||
*
|
||||
* X**3 + c1*X**2 + c2*X + c3 = 0,
|
||||
*
|
||||
* first reduce it to the form:
|
||||
*
|
||||
* Y**3 + a*Y + b = 0,
|
||||
*
|
||||
* where
|
||||
* Y = X + c1/3,
|
||||
* and
|
||||
* a = c2 - c1**2/3,
|
||||
* b = ( 2*c1**3 - 9*c1*c2 + 27*c3 )/27.
|
||||
*
|
||||
* Then we define the value delta, D = b**2/4 + a**3/27.
|
||||
*
|
||||
* If D > 0, there will be one real root and two conjugate
|
||||
* complex roots.
|
||||
* If D = 0, there will be three real roots at least two of
|
||||
* which are equal.
|
||||
* If D < 0, there will be three unequal real roots.
|
||||
*
|
||||
* Returns 1 for success, 0 for fail.
|
||||
*/
|
||||
static int expecting_fpe = 0;
|
||||
static jmp_buf abort_buf;
|
||||
HIDDEN void rt_catch_FPE(sig)
|
||||
int sig;
|
||||
{
|
||||
if( !expecting_fpe )
|
||||
rt_bomb("unexpected SIGFPE!");
|
||||
if( !rt_g.rtg_parallel )
|
||||
(void)signal(SIGFPE, rt_catch_FPE); /* Renew handler */
|
||||
longjmp(abort_buf, 1); /* return error code */
|
||||
}
|
||||
|
||||
int
|
||||
rt_poly_cubic_roots( eqn, root )
|
||||
register poly *eqn;
|
||||
register complex root[];
|
||||
{
|
||||
LOCAL fastf_t a, b, c1, c1_3rd, delta;
|
||||
register int i;
|
||||
static int first_time = 1;
|
||||
|
||||
if( !rt_g.rtg_parallel ) {
|
||||
/* abort_buf is NOT parallel! */
|
||||
if( first_time ) {
|
||||
first_time = 0;
|
||||
(void)signal(SIGFPE, rt_catch_FPE);
|
||||
}
|
||||
expecting_fpe = 1;
|
||||
if( setjmp( abort_buf ) ) {
|
||||
(void)signal(SIGFPE, rt_catch_FPE);
|
||||
rt_log("rt: rt_poly_cubic_roots() Floating Point Error\n");
|
||||
return(0); /* FAIL */
|
||||
}
|
||||
}
|
||||
|
||||
c1 = eqn->cf[1];
|
||||
if( Abs(c1) > SQRT_MAX_FASTF ) return(0); /* FAIL */
|
||||
c1_3rd = c1 * THIRD;
|
||||
a = eqn->cf[2] - c1*c1_3rd;
|
||||
if( Abs(a) > SQRT_MAX_FASTF ) return(0); /* FAIL */
|
||||
b = (2.0*c1*c1*c1 - 9.0*c1*eqn->cf[2] + 27.0*eqn->cf[3])*INV_TWENTYSEVEN;
|
||||
if( Abs(b) > SQRT_MAX_FASTF ) return(0); /* FAIL */
|
||||
|
||||
if( (delta = a*a) > SQRT_MAX_FASTF ) return(0); /* FAIL */
|
||||
delta = b*b*0.25 + delta*a*INV_TWENTYSEVEN;
|
||||
|
||||
if ( delta > 0.0 ){
|
||||
LOCAL fastf_t r_delta, A, B;
|
||||
|
||||
r_delta = sqrt( delta );
|
||||
A = B = -0.5 * b;
|
||||
A += r_delta;
|
||||
B -= r_delta;
|
||||
|
||||
A = CUBEROOT( A );
|
||||
B = CUBEROOT( B );
|
||||
|
||||
root[2].re = root[1].re = -0.5 * ( root[0].re = A + B );
|
||||
|
||||
root[0].im = 0.0;
|
||||
root[2].im = -( root[1].im = (A - B)*SQRT3*0.5 );
|
||||
} else if ( delta == 0.0 ){
|
||||
LOCAL fastf_t b_2;
|
||||
b_2 = -0.5 * b;
|
||||
|
||||
root[0].re = 2.0* CUBEROOT( b_2 );
|
||||
root[2].re = root[1].re = -0.5 * root[0].re;
|
||||
root[2].im = root[1].im = root[0].im = 0.0;
|
||||
} else {
|
||||
LOCAL fastf_t phi, fact;
|
||||
LOCAL fastf_t cs_phi, sn_phi_s3;
|
||||
|
||||
if( a >= 0.0 ) {
|
||||
fact = 0.0;
|
||||
phi = 0.0;
|
||||
cs_phi = 1.0; /* cos( phi ); */
|
||||
sn_phi_s3 = 0.0; /* sin( phi ) * SQRT3; */
|
||||
} else {
|
||||
FAST fastf_t f;
|
||||
a *= -THIRD;
|
||||
fact = sqrt( a );
|
||||
if( (f = b * (-0.5) / (a*fact)) >= 1.0 ) {
|
||||
phi = 0.0;
|
||||
cs_phi = 1.0; /* cos( phi ); */
|
||||
sn_phi_s3 = 0.0; /* sin( phi ) * SQRT3; */
|
||||
} else if( f <= -1.0 ) {
|
||||
phi = PI_DIV_3;
|
||||
cs_phi = cos( phi );
|
||||
sn_phi_s3 = sin( phi ) * SQRT3;
|
||||
} else {
|
||||
phi = acos( f ) * THIRD;
|
||||
cs_phi = cos( phi );
|
||||
sn_phi_s3 = sin( phi ) * SQRT3;
|
||||
}
|
||||
}
|
||||
|
||||
root[0].re = 2.0*fact*cs_phi;
|
||||
root[1].re = fact*( sn_phi_s3 - cs_phi);
|
||||
root[2].re = fact*( -sn_phi_s3 - cs_phi);
|
||||
root[2].im = root[1].im = root[0].im = 0.0;
|
||||
}
|
||||
for ( i=0; i < 3; ++i )
|
||||
root[i].re -= c1_3rd;
|
||||
expecting_fpe = 0;
|
||||
return(1); /* OK */
|
||||
}
|
||||
|
||||
|
||||
/* >>> q u a r t i c ( ) <<<
|
||||
*
|
||||
* Uses the quartic formula to find the roots ( in `complex' form )
|
||||
* of any quartic equation with real coefficients.
|
||||
*
|
||||
* Returns 1 for success, 0 for fail.
|
||||
*/
|
||||
int
|
||||
rt_poly_quartic_roots( eqn, root )
|
||||
register poly *eqn;
|
||||
register complex root[];
|
||||
{
|
||||
LOCAL poly cube, quad1, quad2;
|
||||
LOCAL complex u[3];
|
||||
LOCAL fastf_t U, p, q, q1, q2;
|
||||
#define Max3(a,b,c) ((c)>((a)>(b)?(a):(b)) ? (c) : ((a)>(b)?(a):(b)))
|
||||
|
||||
cube.dgr = 3;
|
||||
cube.cf[0] = 1.0;
|
||||
cube.cf[1] = -eqn->cf[2];
|
||||
cube.cf[2] = eqn->cf[3]*eqn->cf[1]
|
||||
- 4*eqn->cf[4];
|
||||
cube.cf[3] = -eqn->cf[3]*eqn->cf[3]
|
||||
- eqn->cf[4]*eqn->cf[1]*eqn->cf[1]
|
||||
+ 4*eqn->cf[4]*eqn->cf[2];
|
||||
|
||||
if( !rt_poly_cubic_roots( &cube, u ) ) {
|
||||
return( 0 ); /* FAIL */
|
||||
}
|
||||
if ( u[1].im != 0.0 ){
|
||||
U = u[0].re;
|
||||
} else {
|
||||
U = Max3( u[0].re, u[1].re, u[2].re );
|
||||
}
|
||||
|
||||
p = eqn->cf[1]*eqn->cf[1]*0.25 + U - eqn->cf[2];
|
||||
U *= 0.5;
|
||||
q = U*U - eqn->cf[4];
|
||||
if( p < 0 ) {
|
||||
if( p < -1.0e-8 ) {
|
||||
return(0); /* FAIL */
|
||||
}
|
||||
p = 0;
|
||||
} else {
|
||||
p = sqrt( p );
|
||||
}
|
||||
if( q < 0 ) {
|
||||
if( q < -1.0e-8 ) {
|
||||
return(0); /* FAIL */
|
||||
}
|
||||
q = 0;
|
||||
} else {
|
||||
q = sqrt( q );
|
||||
}
|
||||
|
||||
quad1.dgr = quad2.dgr = 2;
|
||||
quad1.cf[0] = quad2.cf[0] = 1.0;
|
||||
quad1.cf[1] = eqn->cf[1]*0.5;
|
||||
quad2.cf[1] = quad1.cf[1] + p;
|
||||
quad1.cf[1] -= p;
|
||||
|
||||
q1 = U - q;
|
||||
q2 = U + q;
|
||||
|
||||
p = quad1.cf[1]*q2 + quad2.cf[1]*q1 - eqn->cf[3];
|
||||
if( Abs( p ) < 1.0e-8){
|
||||
quad1.cf[2] = q1;
|
||||
quad2.cf[2] = q2;
|
||||
} else {
|
||||
q = quad1.cf[1]*q1 + quad2.cf[1]*q2 - eqn->cf[3];
|
||||
if( Abs( q ) < 1.0e-8 ){
|
||||
quad1.cf[2] = q2;
|
||||
quad2.cf[2] = q1;
|
||||
} else {
|
||||
return(0); /* FAIL */
|
||||
}
|
||||
}
|
||||
|
||||
rt_poly_quadratic_roots( &quad1, root );
|
||||
rt_poly_quadratic_roots( &quad2, &root[2] );
|
||||
return(1); /* SUCCESS */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* R T _ P R _ P O L Y
|
||||
*/
|
||||
void
|
||||
rt_pr_poly(title, eqn)
|
||||
char *title;
|
||||
register poly *eqn;
|
||||
{
|
||||
register int n;
|
||||
register int exp;
|
||||
struct rt_vls str;
|
||||
char buf[48];
|
||||
|
||||
rt_vls_init( &str );
|
||||
rt_vls_extend( &str, 196 );
|
||||
rt_vls_strcat( &str, title );
|
||||
sprintf(buf, " polynomial, degree = %d\n", eqn->dgr);
|
||||
rt_vls_strcat( &str, buf );
|
||||
|
||||
exp = eqn->dgr;
|
||||
for ( n=0; n<=eqn->dgr; n++,exp-- ) {
|
||||
register double coeff = eqn->cf[n];
|
||||
if( n > 0 ) {
|
||||
if( coeff < 0 ) {
|
||||
rt_vls_strcat( &str, " - " );
|
||||
coeff = -coeff;
|
||||
} else {
|
||||
rt_vls_strcat( &str, " + " );
|
||||
}
|
||||
}
|
||||
sprintf( buf, "%g", coeff );
|
||||
rt_vls_strcat( &str, buf );
|
||||
if( exp > 1 ) {
|
||||
sprintf( buf, " *X^%d", exp );
|
||||
rt_vls_strcat( &str, buf );
|
||||
} else if( exp == 1 ) {
|
||||
|
||||
rt_vls_strcat( &str, " *X" );
|
||||
} else {
|
||||
/* For constant term, add nothing */
|
||||
}
|
||||
}
|
||||
rt_vls_strcat( &str, "\n" );
|
||||
rt_log( "%s", rt_vls_addr(&str) );
|
||||
rt_vls_free( &str );
|
||||
}
|
||||
|
||||
/*
|
||||
* R T _ P R _ R O O T S
|
||||
*/
|
||||
void
|
||||
rt_pr_roots( title, roots, n )
|
||||
char *title;
|
||||
complex roots[];
|
||||
int n;
|
||||
{
|
||||
register int i;
|
||||
|
||||
rt_log("%s: %d roots:\n", title, n );
|
||||
for( i=0; i<n; i++ ) {
|
||||
rt_log("%4d %e + i * %e\n", i, roots[i].re, roots[i].im );
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* P O L Y N O . H
|
||||
*
|
||||
* Definitions for handling polynomial equations
|
||||
*
|
||||
* Author -
|
||||
* Jeff Hanes
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*
|
||||
* Copyright Notice -
|
||||
* This software is Copyright (C) 1985 by the United States Army.
|
||||
* All rights reserved.
|
||||
*
|
||||
* $Header$
|
||||
*/
|
||||
#ifndef POLYNO_H
|
||||
#define POLYNO_H seen
|
||||
|
||||
#define MAXP 4 /* Maximum Poly Order */
|
||||
|
||||
#define Abs( a ) ((a) >= 0 ? (a) : -(a))
|
||||
#define Max( a, b ) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/* error return value for 'polyMul' */
|
||||
#define PM_NULL ((poly *)0)
|
||||
|
||||
/* polynomial data type */
|
||||
typedef struct {
|
||||
int dgr;
|
||||
double cf[MAXP+1];
|
||||
} poly;
|
||||
|
||||
|
||||
/* library functions in polylib.c */
|
||||
extern poly *polyAdd(), *polySub(), *polyMul(), *polyScal();
|
||||
extern void quadratic(), synDiv(), prntpoly(), pr_poly();
|
||||
extern int quartic(), cubic();
|
||||
|
||||
#endif /* POLYNO_H */
|
||||
-1797
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
SUBDIRS = \
|
||||
PictureTypeA \
|
||||
PictureTypeB \
|
||||
PictureTypeC \
|
||||
PictureTypeD \
|
||||
PictureTypeE \
|
||||
PictureTypeF
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeA
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,6 +0,0 @@
|
||||
This image type consists of a simple, full-color rendering. This is the most common image type.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render, and the view information (e.g. azimuth and elevation).
|
||||
|
||||
To change the colors of the objects, you must use 'mged' to change the shader parameters for the objects.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Create a new full-color image.
|
||||
@@ -1,11 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a simple full-color image. In order to produce this image you will need to specify the items that you wish to render. You will also need to specify the view parameters, that is, the view orientation and size.
|
||||
|
||||
To change the azimuth, use the View:Azimuth control. The default is 35 degrees. To change the elevation, use the View:Elevation control. The default is 25 degrees. To change the size, use the View:Size control.
|
||||
|
||||
You may also use MGED shift-grips to change the view parameters.
|
||||
|
||||
You may change the backaground color using the Options:Background Color tool. The default background color is white.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 73 KiB |
@@ -1 +0,0 @@
|
||||
Simple Full-Color Image
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeB
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,3 +0,0 @@
|
||||
This image type produces a simple line drawing.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render, and the view information (e.g. azimuth and elevation). You may select arbitrary line and background colors.
|
||||
@@ -1 +0,0 @@
|
||||
Create a new line drawing.
|
||||
@@ -1,11 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a simple line drawing. In order to produce this image you will need to specify the items that you wish to render. You will also need to specify the view parameters, that is, the view orientation and size.
|
||||
|
||||
To change the azimuth, use the View:Azimuth control. The default is 35 degrees. To change the elevation, use the View:Elevation control. The default is 25 degrees. To change the size, use the View:Size control.
|
||||
|
||||
You may also use MGED shift-grips to change the view parameters.
|
||||
|
||||
You may change the line color by using the Options:Line Color tool. The default line color is black. To change the background color, use the Options:Non-line Color control. The default background color is white. Although the Options:Occlusion Mode control is active, it has not affect for this image type.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
@@ -1 +0,0 @@
|
||||
Simple Line Drawing
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeC
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,4 +0,0 @@
|
||||
This image type produces an full-color image that is overlaid with a line drawing. The line drawing highlights the edges of the full-color objects.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render, and the view information (e.g. azimuth and elevation). You may also specify the color of the lines. To change the colors of the objects, you must use 'mged' to change the shader parameters for the objects.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Create a new full-color image with edges highlighted.
|
||||
@@ -1,11 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a highlighted full-color image. A highlighted image is a full-color image with a line drawing overlaid to emphasize features. In order to produce this image you will need to specify the items that you wish to render. You will also need to specify the view parameters, that is, the view orientation and size.
|
||||
|
||||
To change the azimuth, use the View:Azimuth control. The default is 35 degrees. To change the elevation, use the View:Elevation control. The default is 25 degrees. To change the size, use the View:Size control.
|
||||
|
||||
You may also use MGED shift-grips to change the view parameters.
|
||||
|
||||
You may change the backaground color using the Options:Background Color tool. The default background color is white. You may also change the highlight line color by using the Options:Line Color tool. The default line color is black.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 73 KiB |
@@ -1 +0,0 @@
|
||||
Highlighted Image
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeD
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,4 +0,0 @@
|
||||
This image type allows you to mix full-color images and line drawings. You may render some objects in full color, and other objects as line drawings.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render in full color, the objects you want to render as line drawings, and the view information.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Create a mixed full-color and line drawing.
|
||||
@@ -1,22 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a combined full-color image and line drawing. This is a slightly complicated image type. In order to produce this image you will need to do the following:
|
||||
1. Specify the items that you wish to render in full color.
|
||||
2. Specify the items to be rendered as line drawings.
|
||||
3. Specify the rule for combining the full-color and line elements.
|
||||
4. Specify the view parameters.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
|
||||
To specify the full-color elements, use the "Configure Full-Color Elements" page. Select the objects you wish to render in full color. You may also select a background color.
|
||||
|
||||
To specify the line-drawing elements, use the "Configure Line-Drawing Elements" page. Select the objects you wish to render as line drawings. You may also select the line color, or elect to use default region colors for the lines.
|
||||
|
||||
Use the Options:Occlusion Mode control to specify how the full-color and line-drawing elements are combined. There are three options. The first, the default, draws lines only if they are in the foreground relative to the full-color elements. The second option draws foreground lines, it also draws foreground non-lines (hits) in the non-line color. The third option is like the second, except that the non-line pixels are dithered to make them appear semi-transparent. The best way to understand the occlusion mode behavior is to render the same image under each mode.
|
||||
|
||||
To configure the view parameters, use the MGED shift-grips, of the controls under the view menu. Note that because there are two MGED pages, it is necessary for you to select the one from which the view parameters will be retrieved. The default is the "Configure Full-Color Elements" page.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB |
@@ -1 +0,0 @@
|
||||
Mixed Full-Color and Edges
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeE
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,7 +0,0 @@
|
||||
This image type consists of full-color elements superimposed over a
|
||||
light black-and-white (ghost) image.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render in full color, the objects you want to render in the ghost image, and the view information.
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Create a ghost image with an insert.
|
||||
@@ -1,19 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a ghost image with a full-color insert. This is a slightly complicated image type. In order to produce this image you will need to do the following:
|
||||
1. Specify the items that you wish to render in the ghost image.
|
||||
2. Specify the items to be rendered in full-color
|
||||
3. Specify the view parameters.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
|
||||
To specify the ghost-view elements, use the "Configure Ghost Elements" page.
|
||||
|
||||
To specify the full-color elements, use the "Configure Full-Color Elements" page. Select the objects you wish to render in full color. Background color selections are ignored, a ghost-view image may only be produced on a white background.
|
||||
|
||||
To configure the view parameters, use the MGED shift-grips, of the controls under the view menu. Note that because there are two MGED pages, it is necessary for you to select the one from which the view parameters will be retrieved. The default is the "Configure Ghost Elements" page.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB |
@@ -1 +0,0 @@
|
||||
Ghost Image with Insert
|
||||
@@ -1,14 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
tcldir = $(prefix)/tclscripts/rtwizard/examples/PictureTypeF
|
||||
|
||||
dist_tcl_DATA = \
|
||||
desc.txt \
|
||||
helpstr.txt \
|
||||
intro.txt \
|
||||
title.txt \
|
||||
preview.small.gif
|
||||
|
||||
EXTRA_DIST = $(dist_tcl_DATA)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,3 +0,0 @@
|
||||
This image type consists of a line drawing superimposed on full-color elements that are superimposed over a ghost image. This is the most complicated image type.
|
||||
|
||||
To produce this image, you will need to specify the objects you want to render in the ghost image, the objects you want to render in full color, the objects you want to render in the line drawing, and the view information.
|
||||
@@ -1 +0,0 @@
|
||||
Create a new ghost image with color insert and lines.
|
||||
@@ -1,25 +0,0 @@
|
||||
Hi!
|
||||
|
||||
You have elected to produce a ghost image with a full-color insert. This is a slightly complicated image type. In order to produce this image you will need to do the following:
|
||||
1. Specify the items that you wish to render in the ghost image.
|
||||
2. Specify the items to be rendered in full-color
|
||||
3. Specify the items to be rendered as line drawings.
|
||||
4. Specify the rule for combining the various elements.
|
||||
5. Specify the view parameters.
|
||||
|
||||
Use the Steps menu to move between steps. They may be done in any order.
|
||||
|
||||
To specify the ghost-view elements, use the "Configure Ghost Elements" page.
|
||||
|
||||
To specify the full-color elements, use the "Configure Full-Color Elements" page. Select the objects you wish to render in full color. You may also select a background color.
|
||||
|
||||
To specify the line-drawing elements, use the "Configure Line-Drawing Elements" page. Select the objects you wish to render as line drawings. You may also select the line color, or elect to use default region colors for the lines.
|
||||
|
||||
Use the Options:Occlusion Mode control to specify how the full-color and line-drawing elements are combined. There are three options. The first, the default, draws lines only if they are in the foreground relative to the full-color elements. The second option draws foreground lines, it also draws foreground non-lines (hits) in the non-line color. The third option is like the second, except that the non-line pixels are dithered to make them appear semi-transparent. The best way to understand the occlusion mode behavior is to render the same image under each mode.
|
||||
|
||||
To configure the view parameters, use the MGED shift-grips, of the controls under the view menu. Note that because there are two MGED pages, it is necessary for you to select the one from which the view parameters will be retrieved. The default is the "Configure Full-Color Elements" page.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB |
@@ -1 +0,0 @@
|
||||
Ghost Image with Insert and Lines
|
||||
@@ -1,2 +0,0 @@
|
||||
pkgIndex.tcl
|
||||
tclIndex
|
||||
@@ -1,319 +0,0 @@
|
||||
# D B P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# DbPage.itk
|
||||
#
|
||||
# This file provides a page for specifying the database to be loaded.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide DbPage 1.0
|
||||
|
||||
#
|
||||
# dbpage - Provides a lowercased access method for the
|
||||
# DbPage class.
|
||||
#
|
||||
proc dbpage {pathName args} {
|
||||
uplevel DbPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *DbPage.borderWidth 2 widgetDefault
|
||||
option add *DbPage.labelPos wn widgetDefault
|
||||
option add *DbPage.listHeight 150 widgetDefault
|
||||
option add *DbPage.hscrollMode dynamic widgetDefault
|
||||
option add *DbPage.vscrollMode dynamic widgetDefault
|
||||
option add *DbPage.textBackground seashell
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual DbPage {
|
||||
keep -activebackground \
|
||||
-activerelief \
|
||||
-background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-troughcolor
|
||||
}
|
||||
|
||||
#
|
||||
# DbPage -
|
||||
#
|
||||
# The DbPage megawidget is very simple. It is a fileselector and
|
||||
# some help text.
|
||||
#
|
||||
# The DbPage is a support page, not a "step."
|
||||
#
|
||||
itcl::class DbPage {
|
||||
inherit ::iwidgets::Labeledframe
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {};
|
||||
|
||||
method onSelect {}
|
||||
method onDeselect {}
|
||||
method getStepInfo {}
|
||||
|
||||
method getDbFile {}
|
||||
}
|
||||
|
||||
private {
|
||||
method onOK {}
|
||||
method onCancel {}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the Database Page
|
||||
#
|
||||
::itcl::body DbPage::constructor {args} {
|
||||
|
||||
#
|
||||
# Set up the childsite
|
||||
#
|
||||
set cs [ $this childsite ]
|
||||
$cs configure -relief groove -bd 2
|
||||
|
||||
#
|
||||
# Create the help panel
|
||||
#
|
||||
itk_component add helpPanel {
|
||||
::iwidgets::scrolledtext $cs.#auto \
|
||||
-hscrollmode none \
|
||||
-vscrollmode none \
|
||||
-visibleitems 80x3 \
|
||||
-wrap word \
|
||||
-relief flat \
|
||||
-textfont $::RtWizard::helpFont
|
||||
} {
|
||||
usual
|
||||
ignore -textbackground
|
||||
ignore -textfont
|
||||
}
|
||||
|
||||
#
|
||||
# Add the help text.
|
||||
#
|
||||
$itk_component(helpPanel) insert end \
|
||||
"Please select the BRL-CAD database that contains the "
|
||||
$itk_component(helpPanel) insert end \
|
||||
"objects that you wish to render."
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
|
||||
#
|
||||
# Create the fileselector for the database name.
|
||||
#
|
||||
itk_component add fileSelect {
|
||||
::iwidgets::fileselectionbox $cs.#auto \
|
||||
-height 340
|
||||
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Look only for BRL-CAD databases
|
||||
#
|
||||
$itk_component(fileSelect) configure -mask "*.g"
|
||||
|
||||
|
||||
#
|
||||
# Create a button box for the OK button
|
||||
#
|
||||
itk_component add bbox {
|
||||
::iwidgets::buttonbox $cs.#auto
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
$itk_component(bbox) add OK \
|
||||
-text "OK" \
|
||||
-command "[::itcl::code $this onOK]"
|
||||
|
||||
$itk_component(bbox) add cancel \
|
||||
-text "Cancel" \
|
||||
-command "[::itcl::code $this onCancel]"
|
||||
|
||||
$itk_component(bbox) default cancel
|
||||
|
||||
#
|
||||
# Pack the items
|
||||
#
|
||||
pack $itk_component(helpPanel) \
|
||||
-side top \
|
||||
-fill x \
|
||||
-expand 1
|
||||
pack $itk_component(fileSelect) \
|
||||
-fill both \
|
||||
-expand yes \
|
||||
-padx 4 \
|
||||
-pady 4
|
||||
pack $itk_component(bbox) \
|
||||
-side right \
|
||||
-expand 0 \
|
||||
-pady 2
|
||||
|
||||
#
|
||||
# Configure the labeled widget
|
||||
#
|
||||
$this configure -labeltext "Select a Database"
|
||||
$this configure -labelpos nw
|
||||
|
||||
#
|
||||
# Evaluate any user supplied args.
|
||||
#
|
||||
eval itk_initialize $args
|
||||
}
|
||||
|
||||
#
|
||||
# onSelect
|
||||
#
|
||||
# Makes any necessary changes to the Wizard configuration
|
||||
# when this page is selected.
|
||||
#
|
||||
itcl::body DbPage::onSelect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect
|
||||
#
|
||||
# Cleans up when the page is deselected
|
||||
#
|
||||
itcl::body DbPage::onDeselect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# getStepInfo
|
||||
#
|
||||
# In principal, returns a name for the step, and a variable that
|
||||
# can be queried for state. The database page is not a 'step', so
|
||||
# it returns "No Step"
|
||||
#
|
||||
itcl::body DbPage::getStepInfo {} {
|
||||
set a "No Step"
|
||||
set b "banana"
|
||||
return [list $a $b]
|
||||
}
|
||||
|
||||
#
|
||||
# getDbFile - returns the currently selected file.
|
||||
#
|
||||
::itcl::body DbPage::getDbFile { } {
|
||||
return [ $itk_component(fileSelect) get ]
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onOK - called when the OK button is called
|
||||
#
|
||||
itcl::body DbPage::onOK {} {
|
||||
set ::RtWizard::dbFile [getDbFile]
|
||||
$::wizardInstance select exp
|
||||
}
|
||||
|
||||
#
|
||||
# onCancel - called when the OK button is called
|
||||
#
|
||||
itcl::body DbPage::onCancel {} {
|
||||
exit
|
||||
# $::wizardInstance selectPrev
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,531 +0,0 @@
|
||||
# E X A M P L E P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# ExamplePage.itk
|
||||
#
|
||||
# This page provides the user with a set of examples from which they
|
||||
# can choose the type of picture they would like to make.
|
||||
#
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide ExamplePage 1.0
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *ExamplePage.borderWidth 2 widgetDefault
|
||||
option add *ExamplePage.labelPos wn widgetDefault
|
||||
option add *ExamplePage.listHeight 150 widgetDefault
|
||||
option add *ExamplePage.hscrollMode dynamic widgetDefault
|
||||
option add *ExamplePage.vscrollMode dynamic widgetDefault
|
||||
option add *ExamplePage.textBackground seashell
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual ExamplePage {
|
||||
keep -activebackground \
|
||||
-activerelief \
|
||||
-background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor
|
||||
}
|
||||
|
||||
#
|
||||
# ExamplePage
|
||||
#
|
||||
# The example page class provides a series of pictures that
|
||||
# show examples of the type of pictures that can be made with
|
||||
# the wizard.
|
||||
#
|
||||
::itcl::class ExamplePage {
|
||||
inherit ::iwidgets::Labeledwidget
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# Public interface
|
||||
#
|
||||
public {
|
||||
constructor {args} {}
|
||||
|
||||
method onSelect {}
|
||||
method onDeselect {}
|
||||
method getStepInfo {}
|
||||
|
||||
method addType {type token args}
|
||||
method setType {}
|
||||
method changePicType {}
|
||||
method getImageType {} {return $imageType}
|
||||
|
||||
# XXX something to get script info
|
||||
method getCurrentTypeObj {} {return $currentTypeObj}
|
||||
method getViewPage {} {return $viewPage}
|
||||
method setViewPage {page} {
|
||||
set viewPage $page
|
||||
}
|
||||
}
|
||||
|
||||
private {
|
||||
method updatePreview {}
|
||||
method onOK {}
|
||||
method onCancel {}
|
||||
method insertHelpText {}
|
||||
|
||||
variable typeObjects
|
||||
|
||||
variable imageType
|
||||
variable currentTypeObj ""
|
||||
|
||||
variable previewImages
|
||||
variable descText
|
||||
variable keyMap
|
||||
|
||||
common viewPage
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the Example Page
|
||||
#
|
||||
itcl::body ExamplePage::constructor {args} {
|
||||
|
||||
set cs [ $this childsite ]
|
||||
$cs configure -relief groove -bd 2
|
||||
|
||||
#
|
||||
# Create the help panel
|
||||
#
|
||||
itk_component add helpPanel {
|
||||
::iwidgets::scrolledtext $cs.helpPanel \
|
||||
-hscrollmode none \
|
||||
-vscrollmode none \
|
||||
-visibleitems 80x8 \
|
||||
-wrap word \
|
||||
-relief flat \
|
||||
-textfont $::RtWizard::helpFont
|
||||
} {
|
||||
usual
|
||||
ignore -textbackground
|
||||
}
|
||||
|
||||
#
|
||||
# Create a frame for the center of the panel. On the left
|
||||
# will be the hierachy window, on the right will be the
|
||||
# mged window over its controls
|
||||
#
|
||||
itk_component add midFrame {
|
||||
frame $cs.midFrame \
|
||||
-relief flat
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Build the middle, the left side contains an option menu over
|
||||
# descriptive text, the right is an a sample image
|
||||
#
|
||||
itk_component add leftFrame {
|
||||
frame $itk_component(midFrame).lf \
|
||||
-relief flat
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
itk_component add picTypes {
|
||||
iwidgets::optionmenu $itk_component(leftFrame).pt \
|
||||
-labeltext "Select an Image Type" \
|
||||
-labelpos nw \
|
||||
-command "[::itcl::code $this updatePreview]"
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Add text description
|
||||
#
|
||||
itk_component add descBox {
|
||||
iwidgets::scrolledtext $itk_component(leftFrame).descBox \
|
||||
-visibleitems 40x12 \
|
||||
-hscrollmode dynamic \
|
||||
-vscrollmode dynamic \
|
||||
-wrap word \
|
||||
-textbackground seashell
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Pack the optionmenu and the descriptive text within
|
||||
# the left frame
|
||||
#
|
||||
pack $itk_component(picTypes) \
|
||||
-side top \
|
||||
-anchor w \
|
||||
-pady 5 \
|
||||
-fill x \
|
||||
-expand y
|
||||
pack $itk_component(descBox) \
|
||||
-fill both \
|
||||
-expand y \
|
||||
-pady 5
|
||||
|
||||
#
|
||||
# On the right side, put the preview image
|
||||
#
|
||||
itk_component add previewImg {
|
||||
label $itk_component(midFrame).pimg \
|
||||
-relief sunken
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Create a button box for the OK button
|
||||
#
|
||||
itk_component add bbox {
|
||||
::iwidgets::buttonbox $cs.#auto
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
$itk_component(bbox) add OK \
|
||||
-text "OK" \
|
||||
-command "[::itcl::code $this onOK]"
|
||||
|
||||
$itk_component(bbox) add cancel \
|
||||
-text "Cancel" \
|
||||
-command "[::itcl::code $this onCancel]"
|
||||
|
||||
$itk_component(bbox) default cancel
|
||||
|
||||
#
|
||||
# Now pack the left frame and the preview image.
|
||||
#
|
||||
pack $itk_component(leftFrame) \
|
||||
-side left \
|
||||
-anchor n \
|
||||
-padx 5 \
|
||||
-fill y \
|
||||
-expand y
|
||||
|
||||
pack $itk_component(previewImg) \
|
||||
-anchor center \
|
||||
-padx 5 \
|
||||
-pady 5
|
||||
|
||||
#
|
||||
# Pack the top
|
||||
#
|
||||
pack $itk_component(helpPanel)
|
||||
pack $itk_component(midFrame)
|
||||
pack $itk_component(bbox) -side right
|
||||
|
||||
#
|
||||
# Configure the labeled widget
|
||||
#
|
||||
$this configure -labeltext "Select Image Type"
|
||||
$this configure -labelpos nw
|
||||
|
||||
#
|
||||
# Insert help text
|
||||
#
|
||||
insertHelpText
|
||||
|
||||
#
|
||||
# Evaluate any user supplied args.
|
||||
#
|
||||
eval configure $args
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# onSelect
|
||||
#
|
||||
# Makes any necessary changes to the Wizard configuration
|
||||
# when this page is selected.
|
||||
#
|
||||
itcl::body ExamplePage::onSelect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect
|
||||
#
|
||||
# Cleans up when the page is deselected
|
||||
#
|
||||
itcl::body ExamplePage::onDeselect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# getStepInfo
|
||||
#
|
||||
# In principal, returns a name for the step, and a variable that
|
||||
# can be queried for state. The database page is not a 'step', so
|
||||
# it returns "No Step"
|
||||
#
|
||||
itcl::body ExamplePage::getStepInfo {} {
|
||||
set a "No Step"
|
||||
set b "banana"
|
||||
return [list $a $b]
|
||||
}
|
||||
|
||||
#
|
||||
# addType
|
||||
#
|
||||
# Adds a picture type to the set of supported pictures.
|
||||
#
|
||||
itcl::body ExamplePage::addType { type token args } {
|
||||
|
||||
#
|
||||
# Create the picture type object. Note that it defines
|
||||
# steps and the "preview" and "fullSize" methods. It
|
||||
# provides the sample image and the help text.
|
||||
#
|
||||
set typeObj [ $type #auto $args ]
|
||||
set typeObjects($token) $typeObj
|
||||
|
||||
#
|
||||
# Set up the arrays that map the option menu.
|
||||
# entries to the sample image and the descriptive
|
||||
# text.
|
||||
#
|
||||
# The option menu outputs the "title" string. We
|
||||
# get the token via the keyMap. That then lets us
|
||||
# access the text and image.
|
||||
#
|
||||
set title [$typeObj getTitle]
|
||||
set keyMap($title) $token
|
||||
set previewImages($token) [$typeObj getSampleImage]
|
||||
set descText($token) [$typeObj getDescText]
|
||||
|
||||
#
|
||||
# Add this type to the radiobox in the Image
|
||||
# menu. If changed, it calls the setType method.
|
||||
#
|
||||
$::wizardInstance menubar add radiobutton .image.$token \
|
||||
-label $title \
|
||||
-variable [itcl::scope imageType] \
|
||||
-value $title \
|
||||
-helpstr [$typeObj getHelpStr] \
|
||||
-command "[itcl::code $this changePicType]"
|
||||
|
||||
#
|
||||
# Finally, add the new type (title) to the option
|
||||
# menu
|
||||
#
|
||||
$itk_component(picTypes) insert end [$typeObj getTitle]
|
||||
$itk_component(picTypes) select 0
|
||||
updatePreview
|
||||
}
|
||||
|
||||
#
|
||||
# changePicType
|
||||
#
|
||||
# This method is activated when the radiobuttons are changed.
|
||||
#
|
||||
itcl::body ExamplePage::changePicType {} {
|
||||
#
|
||||
# update the optionmenu
|
||||
#
|
||||
$itk_component(picTypes) select $imageType
|
||||
|
||||
#
|
||||
# call setType
|
||||
#
|
||||
setType
|
||||
}
|
||||
|
||||
#
|
||||
# setType
|
||||
#
|
||||
# Sets the current picture type to whatever is specified in the
|
||||
# option menu.
|
||||
#
|
||||
itcl::body ExamplePage::setType {} {
|
||||
|
||||
#
|
||||
# deactivate the current type object
|
||||
#
|
||||
if {[string length $currentTypeObj] != 0} {
|
||||
$currentTypeObj deactivate
|
||||
}
|
||||
#
|
||||
# Get the new type selection
|
||||
#
|
||||
set title [ $itk_component(picTypes) get ]
|
||||
set token $keyMap($title)
|
||||
set typeObj $typeObjects($token)
|
||||
set imageType $title
|
||||
|
||||
#
|
||||
# activate the new type
|
||||
#
|
||||
$typeObj activate
|
||||
set currentTypeObj $typeObj
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# updatePreview -
|
||||
#
|
||||
# Called whenever the optionmenu is changed, this method updates the
|
||||
# sample image and the help text.
|
||||
#
|
||||
::itcl::body ExamplePage::updatePreview {} {
|
||||
set selection [ $itk_component(picTypes) get ]
|
||||
|
||||
if {[string length $selection] == 0} {
|
||||
return
|
||||
}
|
||||
|
||||
#
|
||||
# Convert the long string to the key
|
||||
#
|
||||
set key $keyMap($selection)
|
||||
|
||||
$itk_component(previewImg) configure \
|
||||
-image $previewImages($key)
|
||||
$itk_component(descBox) configure -state normal
|
||||
$itk_component(descBox) delete 1.0 end
|
||||
$itk_component(descBox) insert end $descText($key)
|
||||
$itk_component(descBox) configure -state disabled
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# onOK - called when the OK button is called
|
||||
#
|
||||
::itcl::body ExamplePage::onOK {} {
|
||||
|
||||
#
|
||||
# Select the new picture type
|
||||
#
|
||||
$this setType
|
||||
|
||||
#
|
||||
# Activate the introductory page
|
||||
#
|
||||
$::wizardInstance select intro
|
||||
}
|
||||
|
||||
#
|
||||
# onCancel - called when the OK button is called
|
||||
#
|
||||
::itcl::body ExamplePage::onCancel {} {
|
||||
$::wizardInstance selectPrev
|
||||
}
|
||||
|
||||
#
|
||||
# insertHelpText - puts in the helpful text at the top of the
|
||||
# page
|
||||
#
|
||||
::itcl::body ExamplePage::insertHelpText {} {
|
||||
|
||||
#
|
||||
# Short alias
|
||||
#
|
||||
set hw $itk_component(helpPanel)
|
||||
|
||||
$hw configure -state normal
|
||||
|
||||
$hw insert end \
|
||||
"Please select the type of image that you would like to "
|
||||
$hw insert end \
|
||||
"make. There are currently six types from which to choose. "
|
||||
$hw insert end \
|
||||
"Each image type requires slightly different information "
|
||||
$hw insert end \
|
||||
"to configure. "
|
||||
$hw insert end \
|
||||
"Use the menu button below to view an example of each type "
|
||||
$hw insert end \
|
||||
"of picture. \n\nWhen you have decided on a type, select it "
|
||||
$hw insert end \
|
||||
"and hit \"OK\"."
|
||||
|
||||
$hw configure -state disabled
|
||||
}
|
||||
}
|
||||
#end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,628 +0,0 @@
|
||||
# F B P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# FbPage.itk
|
||||
#
|
||||
# This file provides a page for specifying framebuffer parameters
|
||||
# such as device, width, depth, and background color.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require FrameBufferDialog 1.0
|
||||
package provide FbPage 1.0
|
||||
|
||||
#
|
||||
# fbpage - Provides a lowercased access method for the
|
||||
# FbPage class
|
||||
#
|
||||
proc fbpage {pathName args} {
|
||||
uplevel FbPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *FbPage.borderWidth 2 widgetDefault
|
||||
option add *FbPage.labelPos wn widgetDefault
|
||||
option add *FbPage.listHeight 150 widgetDefault
|
||||
option add *FbPage.hscrollMode dynamic widgetDefault
|
||||
option add *FbPage.vscrollMode dynamic widgetDefault
|
||||
option add *FbPage.textBackground seashell
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual FbPage {
|
||||
keep -activebackground \
|
||||
-activerelief \
|
||||
-background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor
|
||||
}
|
||||
|
||||
#
|
||||
# FbPage
|
||||
#
|
||||
# The FbPage contains some entryfields.
|
||||
#
|
||||
::itcl::class FbPage {
|
||||
inherit ::iwidgets::Labeledwidget
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {};
|
||||
|
||||
method onSelect {}
|
||||
method onDeselect {}
|
||||
method getStepInfo {}
|
||||
method getWidth {}
|
||||
method getHeight {}
|
||||
method getFrameBuffer {width height {screenOnly false}}
|
||||
}
|
||||
|
||||
private {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
method loadHelpText {widget}
|
||||
method onOK {}
|
||||
method selectFbFile {}
|
||||
|
||||
method onToScreen {}
|
||||
method onToFile {}
|
||||
|
||||
method updateWidth {}
|
||||
method incrWidth {}
|
||||
method decrWidth {}
|
||||
|
||||
method updateHeight {}
|
||||
method incrHeight {}
|
||||
method decrHeight {}
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
common sizes { 256 480 512 640 768 1024 1200 1600 2048 }
|
||||
common topSpot 8
|
||||
variable rbvar
|
||||
variable fbFile
|
||||
|
||||
variable width
|
||||
variable heigh
|
||||
|
||||
variable widthIndex
|
||||
variable heightIndex
|
||||
|
||||
variable lastPort 0
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the Framebuffer Page
|
||||
#
|
||||
::itcl::body FbPage::constructor {args} {
|
||||
|
||||
#
|
||||
# Set up the childsite
|
||||
#
|
||||
set cs [ $this childsite ]
|
||||
$cs configure -relief groove -bd 2
|
||||
|
||||
#
|
||||
# Create the help panel
|
||||
#
|
||||
itk_component add helpPanel {
|
||||
::iwidgets::scrolledtext $cs.#auto \
|
||||
-hscrollmode none \
|
||||
-vscrollmode none \
|
||||
-visibleitems 80x3 \
|
||||
-wrap word \
|
||||
-relief flat \
|
||||
-textfont {avantgarde 12 italic}
|
||||
} {
|
||||
usual
|
||||
ignore -textbackground
|
||||
}
|
||||
loadHelpText $itk_component(helpPanel);
|
||||
|
||||
pack $itk_component(helpPanel) \
|
||||
-side top
|
||||
|
||||
#
|
||||
# Add a frame to facilitate packing the remainder of the
|
||||
# contents.
|
||||
#
|
||||
itk_component add sfm {
|
||||
frame $cs.fm \
|
||||
-relief flat
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Create two frames, the left frame will hold the size and
|
||||
# color stuff, the right will hold the device stuff.
|
||||
#
|
||||
itk_component add ltFrame {
|
||||
frame $itk_component(sfm).ltFrame
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
itk_component add rtFrame {
|
||||
frame $itk_component(sfm).rtFrame
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Build the contents of the left-hand-side
|
||||
#
|
||||
itk_component add szFrame {
|
||||
iwidgets::labeledframe $itk_component(ltFrame).szFrame \
|
||||
-labeltext "Size" \
|
||||
-labelpos nw \
|
||||
-relief groove
|
||||
}
|
||||
|
||||
set szCs [$itk_component(szFrame) childsite]
|
||||
|
||||
itk_component add width {
|
||||
iwidgets::spinner $szCs.width \
|
||||
-labeltext "Width:" \
|
||||
-width 6 \
|
||||
-labelmargin 2 \
|
||||
-increment "[::itcl::code $this incrWidth]" \
|
||||
-decrement "[::itcl::code $this decrWidth]"
|
||||
} {
|
||||
ignore -textfont
|
||||
keep -textbackground
|
||||
}
|
||||
|
||||
set widthIndex 5
|
||||
updateWidth
|
||||
|
||||
itk_component add height {
|
||||
iwidgets::spinint $szCs.height \
|
||||
-labeltext "Height:" \
|
||||
-width 6 \
|
||||
-increment "[::itcl::code $this incrHeight]" \
|
||||
-decrement "[::itcl::code $this decrHeight]"
|
||||
} {
|
||||
ignore -textfont
|
||||
keep -textbackground
|
||||
}
|
||||
|
||||
set heightIndex 5
|
||||
updateHeight
|
||||
|
||||
#
|
||||
# Build the contents of the right-hand-size
|
||||
#
|
||||
itk_component add devFrame {
|
||||
iwidgets::labeledframe $itk_component(rtFrame).devFrame \
|
||||
-labeltext "Device" \
|
||||
-labelpos nw \
|
||||
-relief groove
|
||||
|
||||
} {
|
||||
usual
|
||||
}
|
||||
set devCs [$itk_component(devFrame) childsite]
|
||||
|
||||
itk_component add radBox {
|
||||
iwidgets::radiobox $devCs.radBox \
|
||||
-relief flat
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
$itk_component(radBox) add toScreen \
|
||||
-text "Display on Screen" \
|
||||
-selectcolor green \
|
||||
-command "[::itcl::code $this onToScreen]"
|
||||
|
||||
$itk_component(radBox) add toFile \
|
||||
-text "Write to File" \
|
||||
-selectcolor green \
|
||||
-command "[::itcl::code $this onToFile]"
|
||||
|
||||
itk_component add fileName {
|
||||
iwidgets::entryfield $devCs.fileName \
|
||||
-labeltext "File:" -width 48 \
|
||||
-textvariable [::itcl::scope fbFile]
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
itk_component add fsd {
|
||||
iwidgets::fileselectiondialog .fsd \
|
||||
-modality application
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
itk_component add browse {
|
||||
button $devCs.browse \
|
||||
-text "Browse" \
|
||||
-command "[::itcl::code $this selectFbFile]"
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Add a buttonbox
|
||||
#
|
||||
itk_component add bbox {
|
||||
iwidgets::buttonbox $cs.bbox
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
$itk_component(bbox) add OK \
|
||||
-text "OK" \
|
||||
-command "[::itcl::code $::wizardInstance] selectPrev"
|
||||
|
||||
#
|
||||
# Pack the items
|
||||
#
|
||||
|
||||
#
|
||||
# Pack the contents of the szFrame
|
||||
#
|
||||
pack $itk_component(width)
|
||||
pack $itk_component(height)
|
||||
|
||||
eval iwidgets::Labeledwidget::alignlabels \
|
||||
$itk_component(height) \
|
||||
$itk_component(width)
|
||||
|
||||
#
|
||||
# Pack the contents of the devFrame
|
||||
#
|
||||
pack $itk_component(radBox) -anchor w
|
||||
pack $itk_component(fileName) -anchor w
|
||||
pack $itk_component(browse) -anchor e
|
||||
|
||||
#
|
||||
# Pack the size frame and dev frame
|
||||
#
|
||||
pack $itk_component(szFrame) -fill y -expand 1
|
||||
pack $itk_component(devFrame) -fill y -expand 1
|
||||
|
||||
#
|
||||
# Pack the lhs and rhs frame into the middle
|
||||
#
|
||||
pack $itk_component(ltFrame) -side left
|
||||
pack $itk_component(rtFrame) -side right
|
||||
|
||||
#
|
||||
# Now pack the top-level widgets.
|
||||
#
|
||||
pack $itk_component(helpPanel) -side top
|
||||
pack $itk_component(sfm)
|
||||
pack $itk_component(bbox) -side right
|
||||
|
||||
|
||||
#
|
||||
# Configure the labeledframe
|
||||
#
|
||||
configure -labelpos nw
|
||||
configure -labeltext "Configure the Framebuffer"
|
||||
|
||||
#
|
||||
# Select to screen
|
||||
#
|
||||
$itk_component(radBox) select 0
|
||||
|
||||
#
|
||||
# Evaluate any other args
|
||||
#
|
||||
eval itk_initialize $args
|
||||
}
|
||||
|
||||
#
|
||||
# onSelect
|
||||
#
|
||||
# Makes any necessary changes to the Wizard configuration
|
||||
# when this page is selected.
|
||||
#
|
||||
::itcl::body FbPage::onSelect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect
|
||||
#
|
||||
# Cleans up when the page is deselected
|
||||
#
|
||||
::itcl::body FbPage::onDeselect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# getStepInfo
|
||||
#
|
||||
# In principal, returns a name for the step, and a variable that
|
||||
# can be queried for state. The framebuffer page is not a 'step',
|
||||
# so it returns "No Step"
|
||||
#
|
||||
::itcl::body FbPage::getStepInfo {} {
|
||||
set a "No Step"
|
||||
set b "banana"
|
||||
return [list $a $b]
|
||||
}
|
||||
|
||||
#
|
||||
# getWidth - returns the current width
|
||||
#
|
||||
::itcl::body FbPage::getWidth {} {
|
||||
return [$itk_component(width) get]
|
||||
}
|
||||
|
||||
#
|
||||
# getHeight - returns the current height
|
||||
#
|
||||
::itcl::body FbPage::getHeight {} {
|
||||
return [$itk_component(height) get]
|
||||
}
|
||||
|
||||
#
|
||||
# getFrameBuffer - opens frame buffer and returns the port.
|
||||
#
|
||||
::itcl::body FbPage::getFrameBuffer { width height {screenOnly false} } {
|
||||
#
|
||||
# If the user specified a framebuffer file and it is
|
||||
# not null, return the name. Otherwise, open an on-screen
|
||||
# buffer.
|
||||
#
|
||||
set mode [$itk_component(radBox) get]
|
||||
if { [string match $mode "toFile"] && \
|
||||
[string length $fbFile] > 0 && \
|
||||
[string match $screenOnly "false"] } {
|
||||
return $fbFile
|
||||
}
|
||||
set binpath [bu_brlcad_path bin]
|
||||
#
|
||||
# Create an on-screen buffer
|
||||
#
|
||||
set port [incr lastPort]
|
||||
set ok false
|
||||
while {[catch \
|
||||
"exec $binpath/fbserv -w $width -n $height -F /dev/X -p $port &" \
|
||||
catchResult]} {
|
||||
puts $catchResult
|
||||
incr port
|
||||
}
|
||||
#
|
||||
# Damn important, give the fbserv a bit o' time to fire up
|
||||
#
|
||||
after 1000
|
||||
exec $binpath/fbclear -F $port 0 0 0
|
||||
set lastPort $port
|
||||
|
||||
return $port
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onOK - called when the OK button is called
|
||||
#
|
||||
::itcl::body FbPage::onOK {} {
|
||||
$::wizardInstance select intro
|
||||
}
|
||||
|
||||
#
|
||||
# loadHelpText - loads a bit of helpful information into a
|
||||
# text widget
|
||||
#
|
||||
::itcl::body FbPage::loadHelpText { widget } {
|
||||
set help "Copious help on frame buffer stuff"
|
||||
$widget insert end $help
|
||||
}
|
||||
|
||||
#
|
||||
# selectFbFile - called when the "browse" fb file is specified
|
||||
#
|
||||
::itcl::body FbPage::selectFbFile { } {
|
||||
$itk_component(fsd) activate
|
||||
set fbFile [$itk_component(fsd) get]
|
||||
}
|
||||
|
||||
#
|
||||
# onToScreen - called when the toScreen radiobutton is
|
||||
# selected. Deactivates the "fileName" and
|
||||
# "browse" components.
|
||||
#
|
||||
::itcl::body FbPage::onToScreen { } {
|
||||
$itk_component(fileName) configure -state disabled
|
||||
$itk_component(browse) configure -state disabled
|
||||
}
|
||||
|
||||
#
|
||||
# onToFile - called when the toFile radiobutton is
|
||||
# selected. Activates the "fileName" and
|
||||
# "browse" components.
|
||||
#
|
||||
::itcl::body FbPage::onToFile { } {
|
||||
$itk_component(fileName) configure -state normal
|
||||
$itk_component(browse) configure -state normal
|
||||
}
|
||||
|
||||
#
|
||||
# updateWidth - clears the width widget and inserts the
|
||||
# current value.
|
||||
#
|
||||
::itcl::body FbPage::updateWidth { } {
|
||||
$itk_component(width) clear
|
||||
$itk_component(width) insert 0 [ lindex $sizes $widthIndex ]
|
||||
}
|
||||
|
||||
#
|
||||
# incrWidth - called when the width spinner's up button
|
||||
# is pressed.
|
||||
#
|
||||
::itcl::body FbPage::incrWidth { } {
|
||||
if { $widthIndex < $topSpot } {
|
||||
incr widthIndex
|
||||
}
|
||||
updateWidth
|
||||
}
|
||||
|
||||
#
|
||||
# decrWidth - called when the width spinner's down button
|
||||
# is pressed.
|
||||
#
|
||||
::itcl::body FbPage::decrWidth { } {
|
||||
if { $widthIndex > 0 } {
|
||||
incr widthIndex -1
|
||||
}
|
||||
updateWidth
|
||||
}
|
||||
|
||||
#
|
||||
# updateHeight - clears the height widget and inserts the
|
||||
# current value.
|
||||
#
|
||||
::itcl::body FbPage::updateHeight { } {
|
||||
$itk_component(height) clear
|
||||
$itk_component(height) insert 0 [ lindex $sizes $heightIndex ]
|
||||
}
|
||||
|
||||
#
|
||||
# incrHeight - called when the height spinner's up button
|
||||
# is pressed.
|
||||
#
|
||||
::itcl::body FbPage::incrHeight { } {
|
||||
if { $heightIndex < $topSpot } {
|
||||
incr heightIndex
|
||||
}
|
||||
updateHeight
|
||||
}
|
||||
|
||||
#
|
||||
# decrHeight - called when the height spinner's down button
|
||||
# is pressed.
|
||||
#
|
||||
::itcl::body FbPage::decrHeight { } {
|
||||
if { $heightIndex > 0 } {
|
||||
incr heightIndex -1
|
||||
}
|
||||
updateHeight
|
||||
}
|
||||
|
||||
}
|
||||
#end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,79 +0,0 @@
|
||||
# F E E D B A C K D I A L O G . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# FeedbackDialog.itk
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide FeedbackDialog 1.0
|
||||
|
||||
::itcl::class FeedbackDialog {
|
||||
inherit ::iwidgets::Shell
|
||||
|
||||
public {
|
||||
constructor {args} {}
|
||||
method inform {comment steps}
|
||||
}
|
||||
}
|
||||
|
||||
itcl::body FeedbackDialog::constructor {args} {
|
||||
set cs [$this childsite]
|
||||
|
||||
itk_component add fb {
|
||||
iwidgets::feedback $cs.fb \
|
||||
-barcolor "#9999cc" \
|
||||
-steps 100 \
|
||||
-labelpos n
|
||||
}
|
||||
|
||||
pack $itk_component(fb) -fill x -expand 1
|
||||
eval itk_initialize $args
|
||||
$this center
|
||||
}
|
||||
|
||||
itcl::body FeedbackDialog::inform { comment steps } {
|
||||
$itk_component(fb) configure \
|
||||
-labeltext $comment
|
||||
$itk_component(fb) step $steps
|
||||
update idletasks
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,155 +0,0 @@
|
||||
# F R A M E B U F F E R D I A L O G . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# FrameBufferDialog.itk
|
||||
#
|
||||
# A frame buffer dialog is a top-level window that contains a frame
|
||||
# buffer.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide FrameBufferDialog 1.0
|
||||
|
||||
#
|
||||
# framebufferdialog - Provides a lowercased access method for the
|
||||
# FrameBufferDialog class
|
||||
#
|
||||
proc framebufferdialog {pathName args} {
|
||||
uplevel FrameBufferDialog $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual FrameBufferDialog {
|
||||
keep -activebackground \
|
||||
-activerelief \
|
||||
-background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor
|
||||
}
|
||||
|
||||
::itcl::class FrameBufferDialog {
|
||||
inherit ::itk::Toplevel
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {}
|
||||
destructor {}
|
||||
method fb {args}
|
||||
}
|
||||
|
||||
private {
|
||||
variable servePort 0
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the FrameBuffer widget
|
||||
#
|
||||
::itcl::body FrameBufferDialog::constructor {args} {
|
||||
|
||||
# set cs [$this childsite]
|
||||
|
||||
#
|
||||
# Add the Dm widget
|
||||
#
|
||||
itk_component add fb {
|
||||
Display $itk_interior.fb
|
||||
} {
|
||||
keep -dmsize
|
||||
}
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
fb listen 0
|
||||
fb fb_active 2
|
||||
pack $itk_component(fb)
|
||||
wm iconify [namespace tail $this]
|
||||
}
|
||||
|
||||
#
|
||||
# fb - passes commands to the frame buffer (Dm widget)
|
||||
#
|
||||
::itcl::body FrameBufferDialog::fb {args} {
|
||||
return [eval $itk_component(fb) $args]
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,155 +0,0 @@
|
||||
# F U L L C O L O R P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# FullColorPage.itk
|
||||
#
|
||||
# This page supports selecting options for full-color images
|
||||
#
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require MGEDpage 1.0
|
||||
package provide FullColorPage 1.0
|
||||
|
||||
#
|
||||
# fullcolorpage - Provides a lowercased access method for the
|
||||
# full-color image class
|
||||
#
|
||||
proc fullcolorpage {pathName args} {
|
||||
uplevel FullColorPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# Class definition
|
||||
#
|
||||
::itcl::class FullColorPage {
|
||||
inherit ::RtWizard::MGEDpage
|
||||
|
||||
public {
|
||||
constructor {filename args} {
|
||||
MGEDpage::constructor $filename
|
||||
} {
|
||||
#
|
||||
# Build the help text
|
||||
#
|
||||
$itk_component(helpPanel) insert insert \
|
||||
"\nUse this page to select the items that you wish to render in a full-color image." \
|
||||
HelpTag
|
||||
|
||||
$itk_component(helpPanel) tag configure HelpTag \
|
||||
-font {helvetica 10 bold}
|
||||
|
||||
configure -onSelectCallback [itcl::code $this onSelect2]
|
||||
configure -onDeselectCallback [itcl::code $this onDeselect2]
|
||||
configure -statusCallback [itcl::code $this statusCallback]
|
||||
configure -labeltext "Configure the Full-Color Elements"
|
||||
configure -labelpos nw
|
||||
configure -stepName "Configure Full-Color Elements"
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
private {
|
||||
method onSelect2 {optionsMenu}
|
||||
method onDeselect2 {}
|
||||
method statusCallback {}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onSelect2
|
||||
#
|
||||
# Derived class extension for the base class onSelect method.
|
||||
#
|
||||
itcl::body FullColorPage::onSelect2 {optionsMenu} {
|
||||
#
|
||||
# Add to the the options menu
|
||||
#
|
||||
$::wizardInstance menubar add command .$optionsMenu.bg \
|
||||
-label "Background Color..." \
|
||||
-helpstr "Set the background color" \
|
||||
-command "[itcl::code $this backgroundColorChooser]"
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect2
|
||||
#
|
||||
# Cleans up when a page is deselected
|
||||
#
|
||||
itcl::body FullColorPage::onDeselect2 {} {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# statusCallback
|
||||
#
|
||||
# Page-specific status method
|
||||
#
|
||||
itcl::body FullColorPage::statusCallback {} {
|
||||
return 1
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,150 +0,0 @@
|
||||
# G H O S T P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# GhostPage.itk
|
||||
#
|
||||
# This page supports selecting options for full-color images
|
||||
#
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require MGEDpage 1.0
|
||||
package provide GhostPage 1.0
|
||||
|
||||
#
|
||||
# ghostpage - Provides a lowercased access method for the
|
||||
# ghost image class
|
||||
#
|
||||
proc ghostpage {pathName args} {
|
||||
uplevel GhostPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# Class Definition
|
||||
#
|
||||
::itcl::class GhostPage {
|
||||
inherit ::RtWizard::MGEDpage
|
||||
|
||||
public {
|
||||
constructor {filename args} {
|
||||
MGEDpage::constructor $filename
|
||||
} {
|
||||
|
||||
$itk_component(helpPanel) insert insert \
|
||||
"Use this page to select the items that you wish to render as a ghost image." \
|
||||
HelpTag
|
||||
|
||||
$itk_component(helpPanel) tag configure HelpTag \
|
||||
-font {helvetica 10 bold}
|
||||
|
||||
configure -onSelectCallback [itcl::code $this onSelect2]
|
||||
configure -onDeselectCallback [itcl::code $this onDeselect2]
|
||||
configure -statusCallback [itcl::code $this statusCallback]
|
||||
configure -labeltext "Configure the Ghost Elements"
|
||||
configure -labelpos nw
|
||||
configure -stepName "Configure Ghost Elements"
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
private {
|
||||
method onSelect2 {optionsMenu}
|
||||
method onDeselect2 {}
|
||||
method statusCallback {}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onSelect2
|
||||
#
|
||||
# Derived class extension for the base class onSelect method.
|
||||
#
|
||||
itcl::body GhostPage::onSelect2 {optionsMenu} {
|
||||
#
|
||||
# Do the options menu
|
||||
#
|
||||
$::wizardInstance menubar add command .$optionsMenu.intense \
|
||||
-label "Ghost Intensity..." \
|
||||
-helpstr "Set the intensity of the ghost image." \
|
||||
-command "[itcl::code $this intensityDialogReveal]"
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect2
|
||||
#
|
||||
# Cleans up when a page is deselected
|
||||
#
|
||||
itcl::body GhostPage::onDeselect2 {} {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# statusCallback
|
||||
#
|
||||
# Page-specific status method
|
||||
#
|
||||
itcl::body GhostPage::statusCallback {} {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,342 +0,0 @@
|
||||
# H E L P P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# HelpPage.itk
|
||||
#
|
||||
# This file provides a page that can be used for providing a general
|
||||
# overview of the picture making process.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide HelpPage 1.0
|
||||
|
||||
#
|
||||
# helppage - Provides a lowercased access method for the
|
||||
# HelpPage class
|
||||
#
|
||||
proc helppage {pathName args} {
|
||||
uplevel HelpPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *HelpPage.borderWidth 2 widgetDefault
|
||||
option add *HelpPage.labelPos wn widgetDefault
|
||||
option add *HelpPage.listHeight 150 widgetDefault
|
||||
option add *HelpPage.hscrollMode dynamic widgetDefault
|
||||
option add *HelpPage.vscrollMode dynamic widgetDefault
|
||||
option add *HelpPage.textBackground #ccccff
|
||||
option add *HelpPage.helpText "Bananas are tasty." widgetDefault
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual HelpPage {
|
||||
keep -background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor \
|
||||
-stepName
|
||||
}
|
||||
|
||||
#
|
||||
# HelpPage
|
||||
#
|
||||
# The helppage holds helpful text
|
||||
#
|
||||
::itcl::class HelpPage {
|
||||
inherit ::iwidgets::Labeledframe
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
itk_option define -helpText helptext HelpText ""
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {};
|
||||
|
||||
method onSelect {}
|
||||
method onDeselect {}
|
||||
method getStepInfo {}
|
||||
}
|
||||
|
||||
|
||||
private {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
method doHelpText {}
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the Help Page
|
||||
#
|
||||
::itcl::body HelpPage::constructor {args} {
|
||||
|
||||
#
|
||||
# Set up the childsite
|
||||
#
|
||||
set cs [ $this childsite ]
|
||||
$cs configure -relief groove -bd 2
|
||||
|
||||
#
|
||||
# Splat instructive text.
|
||||
#
|
||||
itk_component add helpPanel {
|
||||
::iwidgets::scrolledtext $cs.gp \
|
||||
-vscrollmode dynamic \
|
||||
-hscrollmode dynamic \
|
||||
-wrap word \
|
||||
-visibleitems 80x30 \
|
||||
-textfont {helvetica 10} \
|
||||
-relief flat
|
||||
|
||||
} {
|
||||
usual
|
||||
ignore -textfont
|
||||
}
|
||||
|
||||
#
|
||||
# Pack it!
|
||||
#
|
||||
pack $itk_component(helpPanel) -fill both -expand 1
|
||||
|
||||
#
|
||||
# Evaluate any additional args.
|
||||
#
|
||||
eval itk_initialize $args
|
||||
|
||||
doHelpText
|
||||
}
|
||||
|
||||
#
|
||||
# helpText
|
||||
#
|
||||
::itcl::configbody HelpPage::helpText {
|
||||
$itk_component(helpPanel) configure -state normal
|
||||
$itk_component(helpPanel) insert end [cget -helpText]
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
}
|
||||
|
||||
#
|
||||
# onSelect
|
||||
#
|
||||
# Makes any necessary changes to the Wizard configuration
|
||||
# when this page is selected.
|
||||
#
|
||||
::itcl::body HelpPage::onSelect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect
|
||||
#
|
||||
# Cleans up when the page is deselected
|
||||
#
|
||||
::itcl::body HelpPage::onDeselect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# getStepInfo
|
||||
#
|
||||
# In principal, returns a name for the step, and a variable that
|
||||
# can be queried for state. The Help page is not a 'step',
|
||||
# so it returns "No Step"
|
||||
#
|
||||
::itcl::body HelpPage::getStepInfo {} {
|
||||
set a "No Step"
|
||||
set b "banana"
|
||||
return [list $a $b]
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
itcl::body HelpPage::doHelpText {} {
|
||||
|
||||
#
|
||||
# A short alias for convenience,
|
||||
#
|
||||
set t $itk_component(helpPanel)
|
||||
|
||||
$t configure -state normal
|
||||
|
||||
$t insert insert \
|
||||
"Overview\n\n" \
|
||||
Level1Tag
|
||||
|
||||
$t insert insert \
|
||||
"Welcome to the RtWizard. The RtWizard is a tool for creating images from BRL-CAD databases. The design philosophy behind the RtWizard is to provide you, the user, with a choice of several image types. Once the selection is made, you need only configure a minimum of options before a picture can be made. The user is then free to tweak options and generate new images.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The Database Selection Page\n\n" \
|
||||
Level1Tag
|
||||
|
||||
$t insert insert \
|
||||
"If RtWizard is started without specifying a BRL-CAD database on the command line, you are first presented with the database selection page. Use the file browser on the page to find the desired BRL-CAD database. Once you have selected the desired file, press the okay button.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Note that it is current not possible to change the BRL-CAD database once one has been opened. This is due to a bug in the MGED objects that the RtWizard uses to interact with the databases.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The Sample Image Page\n\n" \
|
||||
Level1Tag
|
||||
|
||||
$t insert insert \
|
||||
"Once the database has been selected, you will be presented with the sample images page. This page allows you to select the type of image you would like to produce. On the left is a widget that allows you to select the type of image. Below that widget is some text that describes the image and what information will be required. To the right is the sample image. To proceed, simply select the image you would like to make and hit \"OK\" \n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The image type can be changed at any time by selecting the \"New Image\" control from the Image menu. You may also select an image type directly from the Image menu. Note that if you change image types during production, any data that is common between the two image types will be conserved.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The Steps\n\n" \
|
||||
Level1Tag
|
||||
|
||||
$t insert insert \
|
||||
"Use the Steps menu to move between steps. They may be done in any order.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"When you select an image type, RtWizard will present you with a series of steps. These steps are listed under the \"Steps\" menu. The first step is the greeting. The greeting explains how what you will need to do to make the picture. The greeting is followed by one or more MGED-based pages. These pages allow you to select geometry, view parameters, and options such as background color. Note that each of the MGED page entries has a box next to it. This box will turn green when that page has been configured. A picture can not be produced until all boxes are green. The final entry is the framebuffer configuration page. The framebuffer page is used to specify the framebuffer device, either screen or file, and the framebuffer size.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The RtWizard uses imbedded MGED objects to allow the user to interact with the BRL-CAD database. These objects are placed are placed on a series of pages. These pages are the Full Color, Line Drawing, Highlighted Image and Ghost Image pages. The purpose of these pages is to select the objects that a rendered in the various modes. For example, the objects selected on the line-drawing page will be rendered as line drawings.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The MGED pages that you see depends on the type of picture that the user wishes to create. For example, if you wish to generate a simple line drawing, only the Line Drawing page is activated. However, if you wish to create a ghost image with full-color insert and lines, the ghost, full-color, and line drawing pages will be active.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"The MGED pages are also used to specify the view parameters, that is, the orientation and size that is used for the image. If multiple MGED pages are active, only one can be used to specify the view parameters. To select a page to define the view parameters, click the \"Use this view for image\" button.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Common behaviors for the MGED pages:\n" \
|
||||
Level2Tag
|
||||
|
||||
$t insert insert \
|
||||
"Use the hierachy widget on the left to navigate the .g file. Click on an item to select it. Selected items will be shown in the small MGED window to the right. Click on an item again to deselect it. Pressing the \"Clear\" button will clear (zap) the screen. Pressing the \"Refresh\" but will redraw everything currently selected and perform autosizing.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Use MGED shift-grips, or the View menu, to change the view orientation and size. The View menu contains controls for the azimuth, elevation, and view size. It also includes a control for the perspective angle. Using perspective can be confusing, please be patient.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Full-Color page specific behaviors:\n" \
|
||||
Level2Tag
|
||||
|
||||
$t insert insert \
|
||||
"The background color may be changed using the Options:Background Color menu.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Line Drawing page specific behaviors:\n" \
|
||||
Level2Tag
|
||||
|
||||
$t insert insert \
|
||||
"The line color may be selected using the Options:Line Color control. You may also elect to use the individual region colors by selecting the Options:Use Region Colors option. The non-line color background color may be changed using the Options:Non-Line Color control. For renderings that include full-color objects, the occlusion mode may be selected using the Options:Occlusion Mode control.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Highlighted Image Page\n" \
|
||||
Level2Tag
|
||||
|
||||
$t insert insert \
|
||||
"A highlighted image is simply a full-color image with a line drawing overlaid. The objects rendered in the line drawing are the same as those rendered in full color. The user may set the background color, using the Options:Background Color control. The may also set the line color, or elect to use region colors.\n\n" \
|
||||
NormalTag
|
||||
|
||||
$t insert insert \
|
||||
"Rendering\n\n" \
|
||||
Level1Tag
|
||||
|
||||
$t insert insert \
|
||||
"When all of the MGED pages have been configured, the Render menu becomes active. The Render menu contains two entries, preview and full-size. Selecting full-size will generate an image of the size specified on the framebuffer page to the specified framebuffer device. Selecting preview will generate a one-quarter size image to the screen. For example, a 1024x1024 image will preview at 512x512.\n\nNote that line drawings are always one pixel wide, thus the smaller the image, the more dominant the lines appear.\n\n" \
|
||||
NormalTag
|
||||
|
||||
|
||||
$t tag configure Level1Tag -font {helvetica 12 bold}
|
||||
$t tag configure Level2Tag -font {helvetica 10 bold}
|
||||
$t tag configure NormalTag -font {helvetica 10}
|
||||
|
||||
$t configure -state disabled
|
||||
}
|
||||
}
|
||||
#end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,167 +0,0 @@
|
||||
# H I G H L I G H T E D P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# HighlightedPage.itk
|
||||
#
|
||||
# This page supports selecting options for a full-color image
|
||||
# with lines highlighting the edges.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require MGEDpage 1.0
|
||||
package provide HighlightedPage 1.0
|
||||
|
||||
#
|
||||
# highlightedpage - Provides a lowercased access method for the
|
||||
# full-color and lines image class
|
||||
#
|
||||
proc highlightedpage { pathName args } {
|
||||
uplevel HighlightedPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
::itcl::class HighlightedPage {
|
||||
inherit ::RtWizard::MGEDpage
|
||||
|
||||
public {
|
||||
constructor {filename args} {
|
||||
MGEDpage::constructor $filename
|
||||
} {
|
||||
|
||||
$itk_component(helpPanel) insert insert \
|
||||
"Use this page to select the items that you wish to render as a full-color image with highlight lines." \
|
||||
HelpTag
|
||||
|
||||
$itk_component(helpPanel) tag configure HelpTag \
|
||||
-font {helvetica 10 bold}
|
||||
|
||||
configure -onSelectCallback [itcl::code $this onSelect2]
|
||||
configure -onDeselectCallback [itcl::code $this onDeselect2]
|
||||
configure -statusCallback [itcl::code $this statusCallback]
|
||||
configure -labeltext "Configure the Highlighted Elements"
|
||||
configure -labelpos nw
|
||||
configure -stepName "Configure Highlighted Elements"
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
private {
|
||||
method onSelect2 {optionMenu}
|
||||
method onDeselect2 {}
|
||||
method statusCallback {}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onSelect2
|
||||
#
|
||||
# Derived class extension for the base class onSelect method.
|
||||
#
|
||||
itcl::body HighlightedPage::onSelect2 {optionsMenu} {
|
||||
#
|
||||
# Do the options menu
|
||||
#
|
||||
$::wizardInstance menubar add command .$optionsMenu.bg \
|
||||
-label "Background Color..." \
|
||||
-helpstr "Set the background color" \
|
||||
-command "[itcl::code $this backgroundColorChooser]"
|
||||
|
||||
$::wizardInstance menubar add cascade .$optionsMenu.fgCasc \
|
||||
-label "Line Color"
|
||||
|
||||
$::wizardInstance menubar add command .$optionsMenu.fgCasc.fgChoose \
|
||||
-label "Choose..." \
|
||||
-helpstr "Set the color of rendered lines" \
|
||||
-command "[itcl::code $this lineColorChooser]"
|
||||
|
||||
$::wizardInstance menubar add checkbutton \
|
||||
.$optionsMenu.fgCasc.useRegCol \
|
||||
-label "Use Region Colors" \
|
||||
-helpstr "Use the colors assigned to individual regions" \
|
||||
-variable "[itcl::scope useRegionColors]" \
|
||||
-offvalue "false" \
|
||||
-onvalue "true"
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect2
|
||||
#
|
||||
# Cleans up when a page is deselected
|
||||
#
|
||||
itcl::body HighlightedPage::onDeselect2 {} {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# statusCallback
|
||||
#
|
||||
# Page-specific status method
|
||||
#
|
||||
itcl::body HighlightedPage::statusCallback {} {
|
||||
return 1
|
||||
}
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,250 +0,0 @@
|
||||
# I N T R O P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# IntroPage.itk
|
||||
#
|
||||
# This file provides a page that can be used for providing a general
|
||||
# overview of the picture making process.
|
||||
#
|
||||
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide IntroPage 1.0
|
||||
|
||||
#
|
||||
# intropage - Provides a lowercased access method for the
|
||||
# IntroPage class
|
||||
#
|
||||
proc intropage {pathName args} {
|
||||
uplevel IntroPage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *IntroPage.borderWidth 2 widgetDefault
|
||||
option add *IntroPage.labelPos wn widgetDefault
|
||||
option add *IntroPage.listHeight 150 widgetDefault
|
||||
option add *IntroPage.hscrollMode dynamic widgetDefault
|
||||
option add *IntroPage.vscrollMode dynamic widgetDefault
|
||||
option add *IntroPage.textBackground #ccccff
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
::itk::usual IntroPage {
|
||||
keep -background \
|
||||
-borderwidth \
|
||||
-cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor \
|
||||
-stepName
|
||||
}
|
||||
|
||||
#
|
||||
# IntroPage
|
||||
#
|
||||
# The intropage holds helpful text
|
||||
#
|
||||
|
||||
#
|
||||
# Use the singleton pattern to allow the picture types to
|
||||
# easily change the greeting text.
|
||||
#
|
||||
set ::introInstance ""
|
||||
|
||||
::itcl::class IntroPage {
|
||||
inherit ::iwidgets::Labeledwidget
|
||||
|
||||
#
|
||||
# Configuration variables
|
||||
#
|
||||
|
||||
itk_option define -greeting greeting Greeting \
|
||||
"Welcome to the RtWizard."
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {};
|
||||
|
||||
method onSelect {}
|
||||
method onDeselect {}
|
||||
method getStepInfo {}
|
||||
}
|
||||
|
||||
|
||||
private {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - builds the Intro Page
|
||||
#
|
||||
::itcl::body IntroPage::constructor {args} {
|
||||
|
||||
global introInstance
|
||||
|
||||
if { [string length $introInstance] > 0 } {
|
||||
error "Can not instantiate a second IntroPage object."
|
||||
}
|
||||
|
||||
#
|
||||
# Set up the childsite
|
||||
#
|
||||
set cs [ $this childsite ]
|
||||
$cs configure -relief groove -bd 2
|
||||
|
||||
#
|
||||
# Splat instructive text.
|
||||
#
|
||||
itk_component add greetPanel {
|
||||
::iwidgets::scrolledtext $cs.gp \
|
||||
-vscrollmode dynamic \
|
||||
-hscrollmode dynamic \
|
||||
-wrap word \
|
||||
-visibleitems 75x30 \
|
||||
-textfont {helvetica 10 bold} \
|
||||
-relief sunken
|
||||
|
||||
} {
|
||||
usual
|
||||
ignore -textfont
|
||||
}
|
||||
|
||||
# Next
|
||||
itk_component add next {
|
||||
button $cs.next \
|
||||
-text Next \
|
||||
-width 8 \
|
||||
-command "[itcl::code $this goNext]"
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Pack it!
|
||||
#
|
||||
pack $itk_component(greetPanel) -anchor w -fill both -expand 1
|
||||
|
||||
#
|
||||
# Evaluate any additional args.
|
||||
#
|
||||
eval itk_initialize $args
|
||||
|
||||
set introInstance $this
|
||||
}
|
||||
|
||||
#
|
||||
# greeting
|
||||
#
|
||||
::itcl::configbody IntroPage::greeting {
|
||||
$itk_component(greetPanel) configure -state normal
|
||||
$itk_component(greetPanel) clear
|
||||
$itk_component(greetPanel) insert end [cget -greeting]
|
||||
$itk_component(greetPanel) configure -state disabled
|
||||
}
|
||||
|
||||
#
|
||||
# onSelect
|
||||
#
|
||||
# Makes any necessary changes to the Wizard configuration
|
||||
# when this page is selected.
|
||||
#
|
||||
::itcl::body IntroPage::onSelect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect
|
||||
#
|
||||
# Cleans up when the page is deselected
|
||||
#
|
||||
::itcl::body IntroPage::onDeselect {} {
|
||||
#
|
||||
# Nothing yet!
|
||||
#
|
||||
}
|
||||
|
||||
#
|
||||
# getStepInfo
|
||||
#
|
||||
# In principal, returns a name for the step, and a variable that
|
||||
# can be queried for state. The Intro page is not a 'step',
|
||||
# so it returns "No Step"
|
||||
#
|
||||
::itcl::body IntroPage::getStepInfo {} {
|
||||
set a "No Step"
|
||||
set b "banana"
|
||||
return [list $a $b]
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
|
||||
}
|
||||
#end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,172 +0,0 @@
|
||||
# L I N E P A G E . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# LinePage.itk
|
||||
#
|
||||
# This page supports selecting options for line renderings images
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require MGEDpage 1.0
|
||||
package provide LinePage 1.0
|
||||
|
||||
#
|
||||
# linepage - Provides a lowercased access method for the
|
||||
# full-color image class
|
||||
#
|
||||
proc linepage {pathName args} {
|
||||
uplevel LinePage $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
::itcl::class LinePage {
|
||||
inherit ::RtWizard::MGEDpage
|
||||
|
||||
public {
|
||||
constructor {filename args} {
|
||||
MGEDpage::constructor $filename
|
||||
} {
|
||||
|
||||
$itk_component(helpPanel) insert insert \
|
||||
"\nUse this page to select the items that you wish to render as a line drawing." \
|
||||
HelpTag
|
||||
|
||||
$itk_component(helpPanel) tag configure HelpTag \
|
||||
-font {helvetica 10 bold}
|
||||
|
||||
configure -onSelectCallback [itcl::code $this onSelect2]
|
||||
configure -onDeselectCallback [itcl::code $this onDeselect2]
|
||||
configure -statusCallback [itcl::code $this statusCallback]
|
||||
configure -labeltext "Configure the Line-Drawing Elements"
|
||||
configure -labelpos nw
|
||||
configure -stepName "Configure Line-Drawing Elements"
|
||||
|
||||
eval itk_initialize $args
|
||||
|
||||
$itk_component(helpPanel) configure -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
private {
|
||||
method onSelect2 {optionsMenu}
|
||||
method onDeselect2 {}
|
||||
method statusCallback {}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
|
||||
#--------------------#
|
||||
# Private Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# onSelect2
|
||||
#
|
||||
# Derived class extension for the base class onSelect method.
|
||||
#
|
||||
itcl::body LinePage::onSelect2 {optionsMenu} {
|
||||
#
|
||||
# Do the options menu
|
||||
#
|
||||
$::wizardInstance menubar add cascade .$optionsMenu.fgCasc \
|
||||
-label "Line Color"
|
||||
|
||||
$::wizardInstance menubar add command .$optionsMenu.fgCasc.fgChoose \
|
||||
-label "Choose..." \
|
||||
-helpstr "Set the color of rendered lines" \
|
||||
-command "[itcl::code $this lineColorChooser]"
|
||||
|
||||
$::wizardInstance menubar add checkbutton \
|
||||
.$optionsMenu.fgCasc.useRegCol \
|
||||
-label "Use Region Colors" \
|
||||
-helpstr "Use the colors assigned to individual regions" \
|
||||
-variable "[itcl::scope useRegionColors]" \
|
||||
-offvalue "false" \
|
||||
-onvalue "true"
|
||||
|
||||
$::wizardInstance menubar add command .$optionsMenu.bg \
|
||||
-label "Non-Line Color..." \
|
||||
-helpstr "Set the Non-line color" \
|
||||
-command "[itcl::code $this nonLineColorChooser]"
|
||||
|
||||
$::wizardInstance menubar add command .$optionsMenu.occMode \
|
||||
-label "Occlusion Mode..." \
|
||||
-helpstr \
|
||||
"Select how full-color objects and lines are mixed" \
|
||||
-command "[itcl::code $this occModeDialogReveal]"
|
||||
}
|
||||
|
||||
#
|
||||
# onDeselect2
|
||||
#
|
||||
# Cleans up when a page is deselected
|
||||
#
|
||||
itcl::body LinePage::onDeselect2 {} {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# statusCallback
|
||||
#
|
||||
# Page-specific status method
|
||||
#
|
||||
itcl::body LinePage::statusCallback {} {
|
||||
return 1
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,46 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
this_dir = tclscripts/rtwizard/lib
|
||||
tcldir = $(prefix)/$(this_dir)
|
||||
|
||||
scripties = \
|
||||
DbPage.itk \
|
||||
ExamplePage.itk \
|
||||
FbPage.itk \
|
||||
FeedbackDialog.itk \
|
||||
FrameBufferDialog.itk \
|
||||
FullColorPage.itk \
|
||||
GhostPage.itk \
|
||||
HelpPage.itk \
|
||||
HighlightedPage.itk \
|
||||
IntroPage.itk \
|
||||
LinePage.itk \
|
||||
MGEDpage.itk \
|
||||
PictureTypeA.itcl \
|
||||
PictureTypeB.itcl \
|
||||
PictureTypeBase.itcl \
|
||||
PictureTypeC.itcl \
|
||||
PictureTypeD.itcl \
|
||||
PictureTypeE.itcl \
|
||||
PictureTypeF.itcl \
|
||||
Wizard.itk
|
||||
|
||||
tcl_SCRIPTS = \
|
||||
$(BUILT_SOURCES) \
|
||||
$(scripties)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
pkgIndex.tcl \
|
||||
tclIndex
|
||||
|
||||
pkgIndex.tcl:
|
||||
$(top_builddir)/src/bwish/btclsh $(top_srcdir)/src/tclscripts/ampi.tcl $(top_srcdir)/src/$(this_dir)
|
||||
|
||||
tclIndex:
|
||||
$(top_builddir)/src/bwish/btclsh $(top_srcdir)/src/tclscripts/ami.tcl $(top_srcdir)/src/$(this_dir)
|
||||
|
||||
EXTRA_DIST = $(scripties)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,185 +0,0 @@
|
||||
# P I C T U R E T Y P E A . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeA.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "A". This is a simple full-color rendering, e.g.
|
||||
# rt with the Phong shader.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require PictureTypeBase 1.0
|
||||
package provide PictureTypeA 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeA class supports a simple Phong-shaded image.
|
||||
# Note that all public methods are specified in the abstract
|
||||
# base class.
|
||||
#
|
||||
::itcl::class PictureTypeA {
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
variable fcp
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeA::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set fcp [$::wizardInstance enable fullColor]
|
||||
[$fcp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeA::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable fullColor
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeA::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $fcp $fb $w2 $h2
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeA::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $fcp $fb $w $h
|
||||
}
|
||||
|
||||
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,180 +0,0 @@
|
||||
# P I C T U R E T Y P E B . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeB.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "F". This is a simple line drawing done using
|
||||
# rtedge.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require PictureTypeBase 1.0
|
||||
package provide PictureTypeB 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeB class supports a line drawing.
|
||||
#
|
||||
::itcl::class PictureTypeB {
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
variable lp
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeB::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set lp [$::wizardInstance enable lines]
|
||||
[$lp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeB::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable lines
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeB::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtedgeCmd $lp $fb $w2 $h2
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeB::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtedgeCmd $lp $fb $w $h
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,482 +0,0 @@
|
||||
# P I C T U R E T Y P E B A S E . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeBase.itcl
|
||||
#
|
||||
# This is the base class for the various picture types (duh!).
|
||||
# It provides the shared methods.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide PictureTypeBase 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeBase class should not be instantiated!
|
||||
#
|
||||
::itcl::class PictureTypeBase {
|
||||
|
||||
public {
|
||||
constructor {args} {}
|
||||
|
||||
#
|
||||
# These methods handle when a picture type is chosen
|
||||
# or replaced.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
|
||||
#
|
||||
# Accessor methods
|
||||
#
|
||||
method getTitle {} {
|
||||
return $title
|
||||
}
|
||||
|
||||
method getSampleImage {} {
|
||||
return $sampleImage
|
||||
}
|
||||
|
||||
method getDescText {} {
|
||||
return $descText
|
||||
}
|
||||
|
||||
method getHelpStr {} {
|
||||
return $helpStr
|
||||
}
|
||||
|
||||
#
|
||||
# These methods generate pictures. They query the
|
||||
# individual pages for the information they need.
|
||||
#
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
protected {
|
||||
method rtCmd {objPage width height fb} {}
|
||||
method rtedgeCmd \
|
||||
{objPage fb width height \
|
||||
{overlay 0} \
|
||||
{occMode 0} \
|
||||
{occObjsPage {}}} {}
|
||||
method hexToRGB {hexRGB} {}
|
||||
|
||||
variable title
|
||||
variable sampleImage
|
||||
variable descText
|
||||
variable helpStr
|
||||
variable introText
|
||||
variable startPage
|
||||
}
|
||||
|
||||
private {
|
||||
method runRtCmd {cmd {viewInfo {}}}
|
||||
method testRead {pipe}
|
||||
|
||||
variable waiting ""
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# constructor - Loads all of the information necessary
|
||||
# to support this image type. This includes
|
||||
# the sample image, the descriptive text,
|
||||
#
|
||||
itcl::body PictureTypeBase::constructor { args } {
|
||||
#
|
||||
# Protect against instantiation. This is an _abstract_
|
||||
# class.
|
||||
#
|
||||
set type [namespace tail [$this info class]]
|
||||
if { $type == "PictureTypeBase" } {
|
||||
error "Can't instantiate the abstract PictureTypeBase class."
|
||||
}
|
||||
|
||||
#
|
||||
# The support directory name is the same as the
|
||||
# class type.
|
||||
#
|
||||
|
||||
#
|
||||
# Load the title string
|
||||
#
|
||||
set title ""
|
||||
|
||||
set success 0
|
||||
|
||||
foreach i $::auto_path {
|
||||
set dir [file join $i {..} tclscripts rtwizard examples $type ]
|
||||
if {[file exists [file join $dir title.txt ]]} {
|
||||
set fd [open [file join $dir title.txt] r]
|
||||
set title [read -nonewline $fd]
|
||||
close $fd
|
||||
set success 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if { $success == 0 } {
|
||||
puts "Could not find tclscripts/rtwizard/examples/$type/title.txt\ninautopath:\n $::auto_path"
|
||||
exit
|
||||
}
|
||||
|
||||
#
|
||||
# Create an image object to hold the sample image.
|
||||
#
|
||||
set tmpFile [ file join $dir preview.small.gif ]
|
||||
set sampleImage [ image create photo -file $tmpFile ]
|
||||
|
||||
#
|
||||
# Load the text that describes the sample.
|
||||
#
|
||||
set tmpFile [file join $dir desc.txt]
|
||||
set fd [open $tmpFile r]
|
||||
set descText [read -nonewline $fd]
|
||||
close $fd
|
||||
|
||||
#
|
||||
# Load the help string.
|
||||
#
|
||||
set tmpFile [file join $dir helpstr.txt]
|
||||
set fd [open $tmpFile r]
|
||||
set helpStr [read -nonewline $fd]
|
||||
close $fd
|
||||
|
||||
#
|
||||
# Load the introtext.
|
||||
#
|
||||
set tmpFile [file join $dir intro.txt]
|
||||
set fd [open $tmpFile r]
|
||||
set introText [read -nonewline $fd]
|
||||
close $fd
|
||||
}
|
||||
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeBase::activate { } {
|
||||
append msg "PictureTypeBase::activate called" \
|
||||
" - should be overloaded by derived class."
|
||||
error $msg
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeBase::deactivate { } {
|
||||
append msg "PictureTypeBase::deactivate called" \
|
||||
" - should be overloaded by derived class."
|
||||
error $msg
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image
|
||||
#
|
||||
itcl::body PictureTypeBase::preview { } {
|
||||
append msg "PictureTypeBase::preview called" \
|
||||
" - should be overloaded by derived class."
|
||||
error $msg
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates the full size image
|
||||
#
|
||||
itcl::body PictureTypeBase::fullSize { } {
|
||||
append msg "PictureTypeBase::fullSize called" \
|
||||
" - should be overloaded by derived class."
|
||||
error $msg
|
||||
}
|
||||
|
||||
#-------------------#
|
||||
# Protected Methods #
|
||||
#-------------------#
|
||||
#
|
||||
# rtCmd - formats an rt command to generate a picture.
|
||||
# Width, height, and framebuffer are passed in
|
||||
# because they differ for fullSize and preview
|
||||
#
|
||||
itcl::body PictureTypeBase::rtCmd \
|
||||
{objPage fb width height } {
|
||||
#
|
||||
# Get the page that contains the view information.
|
||||
#
|
||||
set viewPage [$::exp getViewPage]
|
||||
|
||||
#
|
||||
# Get the view info
|
||||
#
|
||||
set viewInfo [$viewPage getEyeModel]
|
||||
|
||||
#
|
||||
# Get the background color
|
||||
#
|
||||
set bgHex [$objPage getBackgroundColor]
|
||||
set bg [hexToRGB $bgHex]
|
||||
|
||||
#
|
||||
# Get the object list, the file is global
|
||||
#
|
||||
set objects [$objPage getObjects]
|
||||
|
||||
#
|
||||
# compute the aspect ratio. Note how floating point
|
||||
# math is forced.
|
||||
#
|
||||
set ar [ expr $width.0 / $height.0 ]
|
||||
|
||||
#
|
||||
# Assemble the rt command - note that it is a
|
||||
# full-blown script.
|
||||
#
|
||||
set cmd [list rt -M -R -F $fb -w $width \
|
||||
-n $height -V $ar -A 0.9 \
|
||||
-C [lindex $bg 0]/[lindex $bg 1]/[lindex $bg 2] \
|
||||
$::RtWizard::dbFile]
|
||||
|
||||
foreach obj $objects {
|
||||
lappend cmd $obj
|
||||
}
|
||||
|
||||
runRtCmd $cmd $viewInfo
|
||||
}
|
||||
|
||||
#
|
||||
# rtedgeCmd - formats an rtedge command to generate a picture.
|
||||
#
|
||||
itcl::body PictureTypeBase::rtedgeCmd \
|
||||
{objPage fb width height \
|
||||
{overlay 0} \
|
||||
{occMode 0} \
|
||||
{occObjsPage {}}} {
|
||||
#
|
||||
# Get the page that contains the view information.
|
||||
#
|
||||
set viewPage [$::exp getViewPage]
|
||||
|
||||
#
|
||||
# Get the view info
|
||||
#
|
||||
set viewInfo [$viewPage getEyeModel]
|
||||
|
||||
#
|
||||
# Get the edge color color
|
||||
#
|
||||
set lineHex [$objPage getLineColor]
|
||||
set l [hexToRGB $lineHex]
|
||||
|
||||
#
|
||||
# Get the non-line color
|
||||
#
|
||||
set nonLineHex [$objPage getNonLineColor]
|
||||
set nl [hexToRGB $nonLineHex]
|
||||
|
||||
#
|
||||
# Get the object list, the file is global
|
||||
#
|
||||
set objects [$objPage getObjects]
|
||||
|
||||
#
|
||||
# compute the aspect ratio. Note how floating point
|
||||
# math is forced.
|
||||
#
|
||||
set ar [ expr $width.0 / $height.0 ]
|
||||
|
||||
#
|
||||
# Determine if region colors were requested, if so, use them.
|
||||
# Otherwise, use the specified foreground colors.
|
||||
#
|
||||
if {[$objPage getRegionColorFlag] == "true"} {
|
||||
set fgMode [list set rc=1]
|
||||
} else {
|
||||
set fgMode [list set fg=[lindex $l 0],[lindex $l 1],[lindex $l 2]]
|
||||
}
|
||||
|
||||
#
|
||||
# Assemble the rtedge command - note that it is a
|
||||
# full-blown script.
|
||||
#
|
||||
if {$occMode != 0} {
|
||||
#
|
||||
# If required, get occlusion objects
|
||||
#
|
||||
set occObjects [$occObjsPage getObjects]
|
||||
|
||||
set cmd [list rtedge -M -R -F $fb -w $width \
|
||||
-n $height -V $ar -A 0.9 \
|
||||
-c "$fgMode" \
|
||||
-c "set bg=[lindex $nl 0],[lindex $nl 1],[lindex $nl 2]" \
|
||||
-c "set om=$occMode" \
|
||||
-c "set oo=\"$occObjects\"" \
|
||||
$::RtWizard::dbFile]
|
||||
} else {
|
||||
|
||||
set cmd [list rtedge -M -R -F $fb -w $width \
|
||||
-n $height -V $ar -A 0.9 \
|
||||
-c "$fgMode" \
|
||||
-c "set bg=[lindex $nl 0],[lindex $nl 1],[lindex $nl 2]" \
|
||||
-c "set ov=$overlay" \
|
||||
$::RtWizard::dbFile]
|
||||
}
|
||||
|
||||
#
|
||||
# Add the objects
|
||||
#
|
||||
foreach obj $objects {
|
||||
lappend cmd $obj
|
||||
}
|
||||
|
||||
runRtCmd $cmd $viewInfo
|
||||
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# hexToRGB - converts an RGB color in hex #rrggbb format to
|
||||
# decimal {rrr ggg bbb} format
|
||||
#
|
||||
itcl::body PictureTypeBase::hexToRGB {hexRGB} {
|
||||
|
||||
scan [string range $hexRGB 1 2] "%x" redDec
|
||||
scan [string range $hexRGB 3 4] "%x" greenDec
|
||||
scan [string range $hexRGB 5 6] "%x" blueDec
|
||||
|
||||
return [list $redDec $greenDec $blueDec]
|
||||
}
|
||||
|
||||
#
|
||||
# runRtCmd - common method for event-handling the rt commands
|
||||
#
|
||||
itcl::body PictureTypeBase::runRtCmd {cmd {viewInfo {}}} {
|
||||
set ::waiting ""
|
||||
#
|
||||
# open the pipe
|
||||
#
|
||||
set pipe [open "| $cmd" r+]
|
||||
|
||||
#
|
||||
# puts the matrix info to the pipe
|
||||
#
|
||||
if {[string length $viewInfo] != 0} {
|
||||
puts $pipe "$viewInfo"
|
||||
puts $pipe "start 0; clean; end;\n\n"
|
||||
flush $pipe
|
||||
}
|
||||
|
||||
#
|
||||
# Set up a callback for readable events, and wait!
|
||||
#
|
||||
# fileevent $pipe readable [ list testRead $pipe ]
|
||||
# fileevent $pipe writable [ list testWrite $pipe ]
|
||||
# vwait ::waiting
|
||||
fconfigure $pipe -blocking true
|
||||
|
||||
catch "close $pipe" catchResult
|
||||
puts $catchResult
|
||||
}
|
||||
|
||||
#
|
||||
# TestRead - pipe fileevent callback
|
||||
#
|
||||
itcl::body PictureTypeBase::testRead {pipe} {
|
||||
|
||||
set waiting "Done"
|
||||
}
|
||||
}; # end namespace
|
||||
|
||||
#
|
||||
# TestRead - pipe fileevent callback
|
||||
#
|
||||
proc testRead {pipe} {
|
||||
set ::waiting "Done"
|
||||
}
|
||||
|
||||
#
|
||||
# TestWrite - pipe fileevent callback
|
||||
#
|
||||
proc testWrite {pipe} {
|
||||
if [eof $pipe] {
|
||||
set ::waiting "Done"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,195 +0,0 @@
|
||||
# P I C T U R E T Y P E C . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeC.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "C". This is a full-color image with a line
|
||||
# drawing overlay that highlights the edges of the image.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require PictureTypeBase 1.0
|
||||
package provide PictureTypeC 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeC class supports a full-color image with line highlights.
|
||||
#
|
||||
::itcl::class PictureTypeC {
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
variable hp
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeC::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set hp [$::wizardInstance enable highlighted]
|
||||
[$hp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeC::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable highlighted
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeC::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $hp $fb $w2 $h2
|
||||
|
||||
#
|
||||
# Run RtEdge
|
||||
#
|
||||
rtedgeCmd $hp $fb $w2 $h2 1 1 $hp
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeC::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $hp $fb $w $h
|
||||
|
||||
#
|
||||
# Run RtEdge
|
||||
#
|
||||
rtedgeCmd $hp $fb $w $h 1 1 $hp
|
||||
}
|
||||
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,212 +0,0 @@
|
||||
# P I C T U R E T Y P E D . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeD.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "D". This is a full-color image mixed with a
|
||||
# line drawing. This image type differs from Type C in that the
|
||||
# objects rendered in the line drawing may differ from those
|
||||
# rendered in the full-color image.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require PictureTypeBase 1.0
|
||||
package provide PictureTypeD 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeD class supports making a mixed full-color and line
|
||||
# image.
|
||||
#
|
||||
::itcl::class PictureTypeD {
|
||||
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
method makeImage {fb w h}
|
||||
|
||||
variable fp
|
||||
variable lp
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeD::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set fp [$::wizardInstance enable fullColor]
|
||||
set lp [$::wizardInstance enable lines]
|
||||
[$fp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeD::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable fullColor
|
||||
$::wizardInstance disable lines
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeD::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# get occlusion mode
|
||||
#
|
||||
set occMode [$lp getOcclusionMode]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $fp $fb $w2 $h2
|
||||
|
||||
#
|
||||
# Run RtEdge
|
||||
#
|
||||
rtedgeCmd $lp $fb $w2 $h2 1 $occMode $fp
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeD::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h]
|
||||
|
||||
#
|
||||
# get occlusion mode
|
||||
#
|
||||
set occMode [$lp getOcclusionMode]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
rtCmd $fp $fb $w $h
|
||||
|
||||
#
|
||||
# Run RtEdge
|
||||
#
|
||||
rtedgeCmd $lp $fb $w $h 1 $occMode $fp
|
||||
}
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,228 +0,0 @@
|
||||
# P I C T U R E T Y P E E . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeE.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "E". This is a ghost image with a full-color
|
||||
# insert.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide PictureTypeE 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeE class supports making a ghost view image overlayed
|
||||
# with a full-color insert.
|
||||
#
|
||||
::itcl::class PictureTypeE {
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
method makeImage {fb w h}
|
||||
|
||||
variable gp
|
||||
variable fp
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeE::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set gp [$::wizardInstance enable ghost]
|
||||
set fp [$::wizardInstance enable fullColor]
|
||||
[$gp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeE::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable ghost
|
||||
$::wizardInstance disable fullColor
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeE::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# Run rt to generate the ghost image objects
|
||||
#
|
||||
makeImage $fb $w2 $h2
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeE::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h false]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
makeImage $fb $w $h
|
||||
}
|
||||
|
||||
#
|
||||
# makeImage
|
||||
#
|
||||
itcl::body PictureTypeE::makeImage {fb w h} {
|
||||
|
||||
set tgi [file join / tmp [pid]_ghost.pix]
|
||||
set tfci [file join / tmp [pid]_fc.pix]
|
||||
set tmi [file join / tmp [pid]_merge.pix]
|
||||
set tbw [ file join / tmp [pid]_bw.bw ]
|
||||
set tmod [ file join / tmp [pid]_bwmod.bw ]
|
||||
set tbwpix [ file join / tmp [pid]_bwpix.pix]
|
||||
|
||||
#
|
||||
# Get the background color
|
||||
#
|
||||
set bgHex [$fp getBackgroundColor]
|
||||
set bg [hexToRGB $bgHex]
|
||||
set bgl "=[lindex $bg 0]/[lindex $bg 1]/[lindex $bg 2]"
|
||||
|
||||
#
|
||||
# Get the gamma
|
||||
#
|
||||
set gamma 12 ; #[$gp getIntensity]
|
||||
|
||||
set binpath [bu_brlcad_path bin]
|
||||
#
|
||||
# Run rt to generate the full-color version of the ghost image
|
||||
#
|
||||
rtCmd $gp $fb $w $h
|
||||
|
||||
catch "exec $binpath/fb-pix -F $fb -w $w -n $h > $tgi" junk
|
||||
|
||||
#
|
||||
# Run rt to generate the insert
|
||||
#
|
||||
rtCmd $fp $fb $w $h
|
||||
catch "exec $binpath/fb-pix -F $fb -w $w -n $h > $tfci" junk
|
||||
|
||||
#
|
||||
# Convert to ghost image
|
||||
#
|
||||
catch "exec $binpath/pix-bw $tgi > $tbw" junk
|
||||
|
||||
catch "exec $binpath/bwmod -a 4 -d259 -r$gamma -m255 < $tbw > $tmod" junk
|
||||
|
||||
catch "exec $binpath/bw-pix < $tmod > $tbwpix" junk
|
||||
|
||||
catch "exec pixmatte -e $tfci $bgl $tbwpix $tfci > $tmi" junk
|
||||
|
||||
#
|
||||
# Finally, put the image to the framebuffer
|
||||
#
|
||||
catch "exec $binpath/pix-fb -F $fb -w $w -n $h $tmi" junk
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,254 +0,0 @@
|
||||
# P I C T U R E T Y P E F . I T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# PictureTypeF.itcl
|
||||
#
|
||||
# This class defines the process necessary to build a BRL-CAD
|
||||
# picture of Type "F". This is a Ghost Image with a full-color
|
||||
# insert and lines.
|
||||
#
|
||||
# This is the most complicated picture type.
|
||||
#
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package require PictureTypeBase 1.0
|
||||
package provide PictureTypeF 1.0
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
# None!
|
||||
|
||||
#
|
||||
# The PictureTypeF class supports makeing a Ghost view image overlayed
|
||||
# with a full-color insert and lines.
|
||||
#
|
||||
::itcl::class PictureTypeF {
|
||||
inherit ::RtWizard::PictureTypeBase
|
||||
|
||||
public {
|
||||
constructor {args} {
|
||||
PictureTypeBase::constructor $args
|
||||
} {}
|
||||
|
||||
#
|
||||
# Methods that impliment abstract base class methods.
|
||||
# Unfortunately, I have to redeclare them here.
|
||||
#
|
||||
method activate {}
|
||||
method deactivate {}
|
||||
method preview {}
|
||||
method fullSize {}
|
||||
}
|
||||
|
||||
private {
|
||||
method makeImage {fb w h}
|
||||
|
||||
variable gp
|
||||
variable fp
|
||||
variable lp
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------#
|
||||
# Public Methods #
|
||||
#--------------------#
|
||||
#
|
||||
# activate - called when this picture type is selected.
|
||||
#
|
||||
itcl::body PictureTypeF::activate { } {
|
||||
#
|
||||
# Open a new steps menu
|
||||
#
|
||||
$::wizardInstance openSteps
|
||||
|
||||
#
|
||||
# Update the introductory text
|
||||
#
|
||||
$::introInstance configure -greeting "$introText"
|
||||
|
||||
#
|
||||
# Activate the pages that are necessary for this picture
|
||||
# type.
|
||||
#
|
||||
set gp [$::wizardInstance enable ghost]
|
||||
set fp [$::wizardInstance enable fullColor]
|
||||
set lp [$::wizardInstance enable lines]
|
||||
[$gp component useMe] select
|
||||
}
|
||||
|
||||
#
|
||||
# deactivate - called when this picture type is deselected.
|
||||
#
|
||||
itcl::body PictureTypeF::deactivate { } {
|
||||
#
|
||||
# Deactivate the pages.
|
||||
#
|
||||
$::wizardInstance disable ghost
|
||||
$::wizardInstance disable fullColor
|
||||
$::wizardInstance disable lines
|
||||
|
||||
#
|
||||
# Close the current steps menu
|
||||
#
|
||||
$::wizardInstance closeSteps
|
||||
}
|
||||
|
||||
#
|
||||
# preview - generates a 1/4 size preview image, limited to on-screen
|
||||
#
|
||||
itcl::body PictureTypeF::preview { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set w2 [ expr $w / 2 ]
|
||||
|
||||
set h [$::fbp getHeight]
|
||||
set h2 [ expr $h / 2 ]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w2 $h2 true]
|
||||
|
||||
#
|
||||
# Run rt to generate the ghost image objects
|
||||
#
|
||||
makeImage $fb $w2 $h2
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - generates a fullSize picture.
|
||||
#
|
||||
itcl::body PictureTypeF::fullSize { } {
|
||||
#
|
||||
# get height and width
|
||||
#
|
||||
set w [$::fbp getWidth]
|
||||
set h [$::fbp getHeight]
|
||||
|
||||
#
|
||||
# get a framebuffer
|
||||
#
|
||||
set fb [$::fbp getFrameBuffer $w $h false]
|
||||
|
||||
#
|
||||
# Run rt
|
||||
#
|
||||
makeImage $fb $w $h
|
||||
}
|
||||
|
||||
#
|
||||
# makeImage
|
||||
#
|
||||
itcl::body PictureTypeF::makeImage {fb w h} {
|
||||
|
||||
set tgi [file join / tmp [pid]_ghost.pix]
|
||||
set tfci [file join / tmp [pid]_fc.pix]
|
||||
set tmi [file join / tmp [pid]_merge.pix]
|
||||
set tbw [ file join / tmp [pid]_bw.bw ]
|
||||
set tmod [ file join / tmp [pid]_bwmod.bw ]
|
||||
set tbwpix [ file join / tmp [pid]_bwpix.pix]
|
||||
|
||||
#
|
||||
# Get the background color
|
||||
#
|
||||
set bgHex [$fp getBackgroundColor]
|
||||
set bg [hexToRGB $bgHex]
|
||||
set bgl "=[lindex $bg 0]/[lindex $bg 1]/[lindex $bg 2]"
|
||||
|
||||
#
|
||||
# Get the gamma
|
||||
#
|
||||
set gamma 12 ; #[$gp getIntensity]
|
||||
|
||||
#
|
||||
# Run rt to generate the full-color version of the ghost image
|
||||
#
|
||||
rtCmd $gp $fb $w $h
|
||||
|
||||
catch "exec fb-pix -F $fb -w $w -n $h > $tgi" junk
|
||||
|
||||
#
|
||||
# Run rt to generate the insert
|
||||
#
|
||||
rtCmd $fp $fb $w $h
|
||||
catch "exec fb-pix -F $fb -w $w -n $h > $tfci" junk
|
||||
|
||||
#
|
||||
# Convert to ghost image
|
||||
#
|
||||
catch "exec pix-bw $tgi > $tbw" junk
|
||||
|
||||
catch "exec bwmod -a 4 -d259 -r$gamma -m255 < $tbw > $tmod" junk
|
||||
|
||||
catch "exec bw-pix < $tmod > $tbwpix" junk
|
||||
|
||||
catch "exec pixmatte -e $tfci $bgl $tbwpix $tfci > $tmi" junk
|
||||
|
||||
#
|
||||
# Put the image to the framebuffer
|
||||
#
|
||||
catch "exec pix-fb -F $fb -w $w -n $h $tmi" junk
|
||||
|
||||
#
|
||||
# Finally! Run rtedge
|
||||
#
|
||||
# XXX - may need to fix the logic for which objects are
|
||||
# edged
|
||||
#
|
||||
rtedgeCmd $lp $fb $w $h 1 1 $gp
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,628 +0,0 @@
|
||||
# W I Z A R D . I T K
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# Wizard.itk
|
||||
#
|
||||
# This is the 'revised' Wizard class. It uses a notebook like the
|
||||
# original version, but it ditches the Prev/Next/Cancel buttons.
|
||||
# Rather it incoporates a menubar and help frame. Switching between
|
||||
# steps is accomplished using a menu with checkboxes. The check-
|
||||
# boxes indicate whether a particular step has been accomplished.
|
||||
#
|
||||
# Individual pages can take addvantage of the fact that the menubar
|
||||
# is dynamic.
|
||||
#
|
||||
|
||||
package require Itcl
|
||||
package require Itk
|
||||
package require Iwidgets
|
||||
|
||||
namespace eval RtWizard {
|
||||
|
||||
package provide Wizard 1.0
|
||||
|
||||
#
|
||||
# wizard - Provides a lowercased access method for the
|
||||
# Wizard class.
|
||||
#
|
||||
proc wizard {pathName args} {
|
||||
uplevel Wizard $pathName $args
|
||||
}
|
||||
|
||||
#
|
||||
# Add options
|
||||
#
|
||||
option add *Wizard.borderWidth 2 widgetDefault
|
||||
option add *Wizard.labelPos wn widgetDefault
|
||||
option add *Wizard.listHeight 150 widgetDefault
|
||||
option add *Wizard.hscrollMode dynamic widgetDefault
|
||||
option add *Wizard.vscrollMode dynamic widgetDefault
|
||||
option add *Wizard.textBackground seashell
|
||||
|
||||
#
|
||||
# Define the usual options
|
||||
#
|
||||
itk::usual Wizard {
|
||||
keep -activebackground \
|
||||
-activerelief \
|
||||
-background \
|
||||
-borderwidth -cursor \
|
||||
-elementborderwidth \
|
||||
-foreground \
|
||||
-highlightcolor \
|
||||
-highlightthickness \
|
||||
-insertbackground \
|
||||
-insertborderwidth \
|
||||
-insertofftime \
|
||||
-insertontime \
|
||||
-insertwidth \
|
||||
-jump \
|
||||
-labelfont \
|
||||
-selectbackground \
|
||||
-selectborderwidth \
|
||||
-textbackground \
|
||||
-textfont \
|
||||
-troughcolor
|
||||
}
|
||||
|
||||
#
|
||||
# Wizard
|
||||
#
|
||||
# The wizard class provides the framework in which the RtWizard
|
||||
# operates. The wizard holds a series of pages (e.g. Color-
|
||||
# ObjSelector). Individual picture types (e.g. TypeF) use a subset
|
||||
# of the available pages to gather the information the need to
|
||||
# create an image.
|
||||
#
|
||||
# Use the singleton pattern to allow the pages to invoke wizard methods
|
||||
#
|
||||
set ::wizardInstance ""
|
||||
|
||||
::itcl::class Wizard {
|
||||
inherit ::itk::Widget
|
||||
|
||||
public {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
constructor {args} {}
|
||||
method add {type token args}
|
||||
method delete {token}
|
||||
method enable {token}
|
||||
method disable {toke}
|
||||
|
||||
method select {token}
|
||||
method selectPrev {}
|
||||
|
||||
method menubar {args}
|
||||
|
||||
method setType {token}
|
||||
method addType {type token}
|
||||
method getTypeInfo {token}
|
||||
|
||||
method getIntroPage {}
|
||||
|
||||
method openSteps {}
|
||||
method closeSteps {}
|
||||
|
||||
method fullSize {}
|
||||
method preview {}
|
||||
|
||||
method updateRenderMenu {}
|
||||
}
|
||||
|
||||
private {
|
||||
#
|
||||
# methods
|
||||
#
|
||||
method setupDefaultMenus {}
|
||||
|
||||
#
|
||||
# variables
|
||||
#
|
||||
variable DEF_WIDTH 600
|
||||
|
||||
variable currentPageToken
|
||||
variable prevPageToken
|
||||
|
||||
variable pagePaths ""
|
||||
variable helpVar
|
||||
|
||||
variable statusVariables ""
|
||||
|
||||
variable pages
|
||||
variable enabledPages
|
||||
|
||||
variable imageType
|
||||
|
||||
variable stepCount 0
|
||||
variable currentStepMenu ""
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# The Wizard class follows the singleton design pattern. If
|
||||
# a Wizard has already been created, the constructor throws.
|
||||
#
|
||||
itcl::body Wizard::constructor {args} {
|
||||
|
||||
global wizardInstance
|
||||
|
||||
if { [string length $wizardInstance] > 0 } {
|
||||
error "Can not instantiate a second wizard object."
|
||||
}
|
||||
|
||||
#
|
||||
# Create the menubar
|
||||
#
|
||||
itk_component add menubar {
|
||||
iwidgets::menubar $itk_interior.menubar \
|
||||
-helpvariable [ itcl::scope helpVar ]
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Configure the File, Image, and Help menus.
|
||||
#
|
||||
setupDefaultMenus
|
||||
|
||||
#
|
||||
# Create the notebook
|
||||
#
|
||||
itk_component add notebook {
|
||||
iwidgets::notebook $itk_interior.notebook \
|
||||
-width $DEF_WIDTH \
|
||||
-height 500
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Create the help label at the bottom of the screen
|
||||
#
|
||||
itk_component add helpThing {
|
||||
label $itk_interior.helpThing \
|
||||
-anchor w \
|
||||
-textvariable [itcl::scope helpVar] \
|
||||
-width 40 \
|
||||
-relief sunken
|
||||
} {
|
||||
usual
|
||||
}
|
||||
|
||||
#
|
||||
# Pack em!
|
||||
#
|
||||
pack $itk_component(menubar) -fill x
|
||||
pack $itk_component(notebook) -fill both -expand 1
|
||||
pack $itk_component(helpThing) -fill x
|
||||
|
||||
set wizardInstance $this
|
||||
}
|
||||
|
||||
#
|
||||
# setupDefaultMenus
|
||||
#
|
||||
# Adds the initial set of menus to the menubar. These menus should
|
||||
# not be changed by the content objects.
|
||||
#
|
||||
itcl::body Wizard::setupDefaultMenus { } {
|
||||
|
||||
#
|
||||
# File menu
|
||||
#
|
||||
$itk_component(menubar) add menubutton file \
|
||||
-text File \
|
||||
-menu {
|
||||
options -tearoff false -selectcolor blue
|
||||
}
|
||||
|
||||
$itk_component(menubar) add command .file.goNew \
|
||||
-label "New" \
|
||||
-helpstr "Create a new images." \
|
||||
-command {puts "New Selected"}
|
||||
|
||||
$itk_component(menubar) menuconfigure .file.goNew \
|
||||
-state disabled
|
||||
|
||||
$itk_component(menubar) add command .file.goOpen \
|
||||
-label "Open BRL-CAD Database" \
|
||||
-helpstr "Open a BRL-CAD database." \
|
||||
-command {puts "Open Selected"}
|
||||
|
||||
$itk_component(menubar) menuconfigure .file.goOpen \
|
||||
-state disabled
|
||||
|
||||
$itk_component(menubar) add separator .file.sep
|
||||
|
||||
$itk_component(menubar) add command .file.Quit \
|
||||
-label "Quit" -underline 0 \
|
||||
-helpstr "Quit the RtWizard." \
|
||||
-command {exit}
|
||||
|
||||
#
|
||||
# Image Menu
|
||||
#
|
||||
$itk_component(menubar) add menubutton image \
|
||||
-text "Image" \
|
||||
-menu {
|
||||
options -tearoff false -selectcolor blue
|
||||
}
|
||||
|
||||
$itk_component(menubar) add command .image.SelectType \
|
||||
-label "New Image..." \
|
||||
-helpstr "View examples of different image types." \
|
||||
-command "[itcl::code $this select exp]"
|
||||
|
||||
$itk_component(menubar) add separator .image.sep1
|
||||
|
||||
#
|
||||
# Steps menu
|
||||
#
|
||||
|
||||
#
|
||||
# Render Menu
|
||||
#
|
||||
$itk_component(menubar) add menubutton render \
|
||||
-text "Render" \
|
||||
-state disabled \
|
||||
-menu {
|
||||
options -tearoff false -selectcolor blue
|
||||
}
|
||||
|
||||
$itk_component(menubar) add command .render.preview \
|
||||
-label "Preview" \
|
||||
-helpstr "Generate a quarter-size preview image" \
|
||||
-command "[itcl::code $this preview]"
|
||||
|
||||
$itk_component(menubar) add command .render.render \
|
||||
-label "Full-Size" \
|
||||
-helpstr "Generate a full-size picture with the current." \
|
||||
-command "[itcl::code $this fullSize]"
|
||||
|
||||
#
|
||||
# Help menu
|
||||
#
|
||||
$itk_component(menubar) add menubutton help \
|
||||
-text Help \
|
||||
-menu {
|
||||
options -tearoff true -selectcolor green
|
||||
}
|
||||
|
||||
$itk_component(menubar) add command .help.goHelp \
|
||||
-label "Help..." \
|
||||
-helpstr "Detailed help" \
|
||||
-command "[::itcl::code $this select] help"
|
||||
|
||||
$itk_component(menubar) add command .help.goAbout \
|
||||
-label "About..." \
|
||||
-helpstr "About the RtWizard" \
|
||||
-command {puts "selected: About..."}
|
||||
}
|
||||
|
||||
#
|
||||
# add
|
||||
#
|
||||
# Adds a content page to the Wizard. The page should be implemented
|
||||
# as an iwidget that inherits from labeledframe. This is primarily
|
||||
# for consistancy.
|
||||
#
|
||||
# The content page must support these puplic methods.
|
||||
#
|
||||
# 1. onSelect - called when the page is exposed.
|
||||
# 2. onDeselect - callback for hide events
|
||||
# 3. getStepInfo - gets the name of the step provided, and the
|
||||
# status variable.
|
||||
#
|
||||
itcl::body Wizard::add { type token args } {
|
||||
|
||||
#
|
||||
# Create the page. First, we need to get the parent from the
|
||||
# notebook
|
||||
#
|
||||
set path [ $itk_component(notebook) add -label $token ]
|
||||
|
||||
#
|
||||
# Instantiate the page, pass the arguments.
|
||||
#
|
||||
set pageName [ eval $type ${path}.#auto $args ]
|
||||
|
||||
#
|
||||
# Add to the pages array
|
||||
#
|
||||
set pages($token) $pageName
|
||||
|
||||
#
|
||||
# Pack it!
|
||||
#
|
||||
pack $pageName \
|
||||
-fill both -expand 1
|
||||
pack propagate $pageName
|
||||
|
||||
set currentPageToken $token
|
||||
|
||||
return $pageName
|
||||
}
|
||||
|
||||
#
|
||||
# select
|
||||
#
|
||||
# Calls the onDeselect method for the current page.
|
||||
# Changes the notebook to the requested page.
|
||||
# Calls the onShow method for the new page.
|
||||
#
|
||||
itcl::body Wizard::select { token } {
|
||||
|
||||
# onHide
|
||||
eval $pages($currentPageToken) onDeselect
|
||||
set prevPageToken $currentPageToken
|
||||
|
||||
# switch pages
|
||||
set index [ $itk_component(notebook) index $token ]
|
||||
$itk_component(notebook) select $index
|
||||
|
||||
set currentPageToken $token
|
||||
|
||||
# onShow
|
||||
eval $pages($currentPageToken) onSelect
|
||||
}
|
||||
|
||||
#
|
||||
# selectPrev
|
||||
#
|
||||
# Selects the previous viewed page. All pop-ups should
|
||||
# call this from their onOK and onCancel methods
|
||||
#
|
||||
itcl::body Wizard::selectPrev { } {
|
||||
select $prevPageToken
|
||||
}
|
||||
|
||||
#
|
||||
# menubar
|
||||
#
|
||||
# Routes menubar configuration commands to the menubar.
|
||||
#
|
||||
itcl::body Wizard::menubar {args} {
|
||||
eval $itk_component(menubar) $args
|
||||
}
|
||||
|
||||
#
|
||||
# enable
|
||||
#
|
||||
# Enables a page, loads its step into the steps menu, and
|
||||
# adds the page to the list of enabled pages.
|
||||
#
|
||||
itcl::body Wizard::enable {token} {
|
||||
|
||||
#
|
||||
# Get the pageName, this is the object path.
|
||||
#
|
||||
set pageName $pages($token)
|
||||
|
||||
#
|
||||
# Get the Step name and status variable
|
||||
#
|
||||
set si [ $pageName getStepInfo ]
|
||||
set stepName [ lindex $si 0 ]
|
||||
set stepVar [ lindex $si 1 ]
|
||||
|
||||
#
|
||||
# Add the step to the step menu. If the page does not correspond
|
||||
# to a required step, skip.
|
||||
#
|
||||
if { $stepName != "No Step" } {
|
||||
$itk_component(menubar) insert .$currentStepMenu.sep2 \
|
||||
checkbutton $token \
|
||||
-label $stepName \
|
||||
-variable $stepVar \
|
||||
-command "[itcl::code $this select] $token" \
|
||||
-selectcolor green \
|
||||
-helpstr [concat "Go to the \" " $stepName "\" page"]
|
||||
|
||||
#
|
||||
# Add status variable to the list
|
||||
#
|
||||
lappend statusVariables $stepVar
|
||||
|
||||
} else {
|
||||
# puts "Page does not require user interaction"
|
||||
}
|
||||
|
||||
lappend enabledPages $token
|
||||
|
||||
return $pageName
|
||||
}
|
||||
|
||||
#
|
||||
# disable
|
||||
#
|
||||
# Disables a page. The step is removed from the steps menu and
|
||||
# the token is removed from the list of enabled pages.
|
||||
#
|
||||
itcl::body Wizard::disable {token} {
|
||||
|
||||
#
|
||||
# Change to the intro page. It won't go away
|
||||
#
|
||||
select intro
|
||||
|
||||
if { $token == "intro" } {
|
||||
return
|
||||
}
|
||||
|
||||
set index [lsearch $enabledPages $token]
|
||||
|
||||
if { $index >= 0 } {
|
||||
#
|
||||
# delete menu entry
|
||||
#
|
||||
$itk_component(menubar) delete .$currentStepMenu.$token
|
||||
|
||||
#
|
||||
# delete from list of enabled pages.
|
||||
#
|
||||
set enabledPages [ lreplace $enabledPages $index $index ]
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# openSteps - opens the step menu.
|
||||
#
|
||||
itcl::body Wizard::openSteps {} {
|
||||
#
|
||||
# Generate a unique name for the steps menu. They cannot
|
||||
# be reused even if they are deleted. It seems odd, but its
|
||||
# is true.
|
||||
#
|
||||
set stepMenu ""
|
||||
append stepMenu "step" $stepCount
|
||||
|
||||
incr stepCount
|
||||
|
||||
set currentStepMenu $stepMenu
|
||||
set statusVariables ""
|
||||
|
||||
$itk_component(menubar) add menubutton $stepMenu \
|
||||
-text Steps \
|
||||
-menu {
|
||||
options -tearoff true -selectcolor blue
|
||||
}
|
||||
|
||||
$itk_component(menubar) add command .$stepMenu.goGreet \
|
||||
-label "Greeting" \
|
||||
-helpstr "Return to the greeting page." \
|
||||
-command "[itcl::code $this select intro]"
|
||||
|
||||
$itk_component(menubar) add separator .$stepMenu.sep1
|
||||
|
||||
$itk_component(menubar) add separator .$stepMenu.sep2
|
||||
|
||||
$itk_component(menubar) add command .$stepMenu.fb \
|
||||
-label "Configure Framebuffer" \
|
||||
-helpstr "Configure the framebuffer" \
|
||||
-command "[itcl::code $this select fbp]"
|
||||
}
|
||||
|
||||
#
|
||||
# closeSteps - closes the step menu. The step menu should be
|
||||
# active only when there is an active picture
|
||||
# process.
|
||||
#
|
||||
itcl::body Wizard::closeSteps { } {
|
||||
if { [string length $currentStepMenu] > 0 } {
|
||||
$itk_component(menubar) delete $currentStepMenu
|
||||
set currentStepMenu ""
|
||||
}
|
||||
set statusVariables ""
|
||||
}
|
||||
|
||||
#
|
||||
# getIntroPage - returns the text widget in the intro page
|
||||
# so that the text may be modified.
|
||||
#
|
||||
itcl::body Wizard::getIntroPage { } {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# fullSize - front-end to the type specific method
|
||||
#
|
||||
itcl::body Wizard::fullSize { } {
|
||||
set obj [$::exp getCurrentTypeObj]
|
||||
namespace inscope ::RtWizard::ExamplePage $obj fullSize
|
||||
}
|
||||
|
||||
#
|
||||
# preview - front-end to the type specific method
|
||||
#
|
||||
itcl::body Wizard::preview { } {
|
||||
set obj [$::exp getCurrentTypeObj]
|
||||
namespace inscope ::RtWizard::ExamplePage $obj preview
|
||||
}
|
||||
|
||||
#
|
||||
# updateRenderMenu - activates or deactivates render menu
|
||||
# based on the status variables
|
||||
#
|
||||
itcl::body Wizard::updateRenderMenu {} {
|
||||
|
||||
if {[llength $statusVariables] == 0} {
|
||||
return
|
||||
}
|
||||
|
||||
set state 1
|
||||
foreach var $statusVariables {
|
||||
|
||||
#
|
||||
# Retrieve the value of the variable whose name is
|
||||
# stored in $var.
|
||||
#
|
||||
upvar #0 $var val
|
||||
|
||||
if { $state == 1 && $val == 1} {
|
||||
set state 1
|
||||
} else {
|
||||
set state 0
|
||||
}
|
||||
}
|
||||
|
||||
if {$state == 1} {
|
||||
$itk_component(menubar) menuconfigure render \
|
||||
-state normal
|
||||
} else {
|
||||
$itk_component(menubar) menuconfigure render \
|
||||
-state disabled
|
||||
}
|
||||
}
|
||||
|
||||
}; # end namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,2 +0,0 @@
|
||||
pkgIndex.tcl
|
||||
tclIndex
|
||||
@@ -1,28 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
this_dir = tclscripts/util
|
||||
tcldir = $(prefix)/$(this_dir)
|
||||
|
||||
scripties = \
|
||||
expand_int_ranges.tcl \
|
||||
luniq.tcl
|
||||
|
||||
tcl_SCRIPTS = \
|
||||
$(BUILT_SOURCES) \
|
||||
$(scripties)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
pkgIndex.tcl \
|
||||
tclIndex
|
||||
|
||||
pkgIndex.tcl:
|
||||
$(top_builddir)/src/bwish/btclsh $(top_srcdir)/src/tclscripts/ampi.tcl $(top_srcdir)/src/$(this_dir)
|
||||
|
||||
tclIndex:
|
||||
$(top_builddir)/src/bwish/btclsh $(top_srcdir)/src/tclscripts/ami.tcl $(top_srcdir)/src/$(this_dir)
|
||||
|
||||
EXTRA_DIST = $(scripties)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,77 +0,0 @@
|
||||
# E X P A N D _ I N T _ R A N G E S . T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# E X P A N D _ I N T _ R A N G E S
|
||||
#
|
||||
# Accepts a string specifying zero or more ranges of integers
|
||||
# and returns a list of all the integers so specified
|
||||
#
|
||||
# Example:
|
||||
# expand_int_ranges 2,10-12,6
|
||||
# returns
|
||||
# 2 10 11 12 6
|
||||
#
|
||||
proc expand_int_ranges {spec} {
|
||||
set previ 0
|
||||
set result ""
|
||||
while {[string length $spec]} {
|
||||
#
|
||||
# Pull off the next block,
|
||||
# i.e., comma-separated chunk of the specification string
|
||||
#
|
||||
if {[set i [string first "," $spec]] == -1} {
|
||||
set block [string range $spec 0 end]
|
||||
set spec ""
|
||||
} else {
|
||||
set block [string range $spec 0 [expr $i - 1]]
|
||||
set spec [string range $spec [expr $i + 1] end]
|
||||
}
|
||||
set previ $i
|
||||
#
|
||||
# Process the current block.
|
||||
# A valid block is either a nonnegative integer
|
||||
# or a dash-separated pair of nonnegative integers.
|
||||
#
|
||||
if {[regexp {^([0-9]+)-([0-9]+)$} $block match from to]} {
|
||||
if {$from > $to} {
|
||||
error "Illegal block: $block: $from > $to"
|
||||
}
|
||||
for {set n $from} {$n <= $to} {incr n} {
|
||||
lappend result $n
|
||||
}
|
||||
} elseif {[regexp {^([0-9]+)$} $block match n]} {
|
||||
lappend result $n
|
||||
} else {
|
||||
error "Invalid intger range: $block"
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,49 +0,0 @@
|
||||
# L U N I Q . T C L
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (C) 2004-2005 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this file; see the file named COPYING for more
|
||||
# information.
|
||||
#
|
||||
###
|
||||
#
|
||||
# L U N I Q
|
||||
#
|
||||
# Accepts a list and replaces multiple consecutive occurences
|
||||
# of a value with a single copy
|
||||
#
|
||||
proc luniq {list_in} {
|
||||
set length_in [llength $list_in]
|
||||
set result {}
|
||||
for {set i 0} {$i < $length_in} {set i $j} {
|
||||
lappend result [lindex $list_in $i]
|
||||
for {set j [expr $i + 1]} {$j < $length_in} {incr j} {
|
||||
if {[string compare [lindex $list_in $i] [lindex $list_in $j]]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: Tcl
|
||||
# tab-width: 8
|
||||
# c-basic-offset: 4
|
||||
# tcl-indent-level: 4
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=4 tabstop=8
|
||||
@@ -1,16 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
# XXX need to build unigraphics conditionally if the dev libs are available
|
||||
# XXX perhaps make it a special unbuilt-until-requested target
|
||||
# bin_PROGRAMS = ug-g
|
||||
# ug_g_SOURCES = ug-g.c ug_misc.c
|
||||
# ug_g_LDADD = ${LIBRT} ${WDB} ${UGOPEN} ${TCL}
|
||||
|
||||
dist_man_MANS = ug-g.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
conv.h \
|
||||
log.h \
|
||||
ug-g.c \
|
||||
ug_misc.c \
|
||||
ug_misc.h
|
||||
@@ -1,56 +0,0 @@
|
||||
/* C O N V . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file conv.h
|
||||
*
|
||||
*/
|
||||
|
||||
/* default indentation for a single level in the DAG */
|
||||
#define LEVEL_INDENT 6
|
||||
#define FLAG_SUPPRESS 0
|
||||
#define FLAG_RESET_SUP 1
|
||||
#define FLAG_FACETIZE 2
|
||||
#define MAX_FLAGS 14 /* UG limitation */
|
||||
extern int flags[MAX_FLAGS];
|
||||
|
||||
extern int feature_is_suppressible(tag_t feat,
|
||||
int level,
|
||||
double units_conv,
|
||||
uf_list_p_t sup_l);
|
||||
|
||||
typedef struct ug_tol {
|
||||
double dist;
|
||||
double radius;
|
||||
} ug_tol;
|
||||
|
||||
extern ug_tol ugtol;
|
||||
|
||||
extern int debug;
|
||||
#define dprintf if (debug) printf
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,38 +0,0 @@
|
||||
/* L O G . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file log.h
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
extern void log(const char *fmt, ...);
|
||||
extern void dialog(const char *fmt, ...);
|
||||
extern void log_init(void);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,75 +0,0 @@
|
||||
.TH UG-G 1 BRL-CAD
|
||||
.SH NAME
|
||||
ug-g \- Unigraphics Translator (Unigraphics to BRL-CAD)
|
||||
.SH SYNOPSIS
|
||||
.B ug-g
|
||||
[-d level] [-i starting_ident_number] [-n part_no_to_part_name_mapping_file] [-t surface_tolerance] [-a surface_normal_tolerance] [-R use_refset_name] [-c min_chamfer] [-r min_round] [-f] [-s] [-u] -o database.g part_filename [subpart1 subpart2 ...]
|
||||
.SH DESCRIPTION
|
||||
.I ug-g\^
|
||||
converts the specified
|
||||
.I part_filename
|
||||
model to a BRL-CAD
|
||||
.I database.g
|
||||
file. The
|
||||
.I part_filename
|
||||
is expected to be a Unigraphics part file.
|
||||
The
|
||||
.I -d
|
||||
specifies a debug
|
||||
.I level.
|
||||
Currently this is either on or off for levels 0 or 1.
|
||||
The
|
||||
.I -i
|
||||
option specifies a starting ident number for the conversion. Each part converted will be assigned an ident
|
||||
number, starting with the one specified. The
|
||||
.I -n
|
||||
option provides a part number to name mapping file. This can be provided if the Unigraphics model
|
||||
uses part numbers instead of part names. If provided, the mapping file will be consulted for
|
||||
part names during the conversion, and the BRL-CAD model will use the names rather than the part numbers.
|
||||
The
|
||||
.I -t
|
||||
option specifies the surface error tolerance for tesellation (in mm). The
|
||||
.I -a
|
||||
option specifies an surface normal tolerance for tesellation (in degrees). The
|
||||
.I -R
|
||||
option specifies a Unigraphics reference set name. If supplied, only the specified reference set will be converted. The
|
||||
.I -c
|
||||
option specifies a minimum chamfer dimension. Any chamfers with dimensions of this minimum or less will be ignored. The
|
||||
.I -r
|
||||
option specifies a minimum round radius. Any rounds or blends with radii of curvature of this minimum or
|
||||
less will be ignored. The
|
||||
.I -f
|
||||
option requests that no CSG conversion be attempted, so that all BRL-CAD geometry will be Bot primitives. The
|
||||
.I -s
|
||||
option requests that all features get listed rather than only those successfully converted to CSG. This option has no effect if the
|
||||
.I -f
|
||||
option is specified. The
|
||||
.I -u
|
||||
option requests surface normals to be extracted from the Unigraphics model and assigned to Bot primitives.
|
||||
The
|
||||
.I -o
|
||||
option specifies a BRL-CAD output file for the conversion. If a list of optional
|
||||
.I subparts
|
||||
is specified on the command line, only those subparts of the Unigraphics
|
||||
.I part_filename
|
||||
are converted.
|
||||
.PP
|
||||
Note that this converter requires the Unigraphics
|
||||
.I ugopen
|
||||
module. This may be obtained from Unigraphics.
|
||||
.SH EXAMPLE
|
||||
.RS
|
||||
$ \|\fuug-g \|-o sample.g \|sample.prt\fP
|
||||
.RE
|
||||
.SH AUTHORS
|
||||
John Anderson
|
||||
.br
|
||||
Lee Butler
|
||||
.SH SOURCE
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, MD 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <bugs@brlcad.org>.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,48 +0,0 @@
|
||||
/* U G _ M I S C . H
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file ug_misc.h
|
||||
*
|
||||
*/
|
||||
|
||||
#include <setjmp.h>
|
||||
extern jmp_buf my_env;
|
||||
|
||||
/* This macro and function support a compact error-checking interface to the
|
||||
* UG library routines
|
||||
*/
|
||||
#define UF_func(X) report(#X, __FILE__, __LINE__, (X))
|
||||
extern int report(char *call, char *file, int line, int code);
|
||||
extern void Add_lists(uf_list_p_t dest, uf_list_p_t src);
|
||||
extern const char *feature_sign(tag_t feat);
|
||||
extern tag_t Lee_open_part(char *p_name, const int level);
|
||||
extern tag_t ask_cset_of_unloaded_children(tag_t part, tag_t part_occ);
|
||||
extern void unload_sub_parts(tag_t loaded_child_cset);
|
||||
extern tag_t load_sub_parts(tag_t displayed_part);
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,124 +0,0 @@
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
alias-pix
|
||||
ap-pix
|
||||
asc-pl
|
||||
azel
|
||||
bary
|
||||
binfo
|
||||
buffer
|
||||
bw-a
|
||||
bw-imp
|
||||
bw-pix
|
||||
bw-png
|
||||
bw-ps
|
||||
bw-rle
|
||||
bw3-pix
|
||||
bwcrop
|
||||
bwdiff
|
||||
bwfilter
|
||||
bwhist
|
||||
bwhisteq
|
||||
bwmod
|
||||
bwrect
|
||||
bwrot
|
||||
bwscale
|
||||
bwshrink
|
||||
bwstat
|
||||
bwthresh
|
||||
cv
|
||||
dbcp
|
||||
decimate
|
||||
double-asc
|
||||
dpix-pix
|
||||
dsp_add
|
||||
dunncolor
|
||||
dunnsnap
|
||||
files-tape
|
||||
gencolor
|
||||
hd
|
||||
imgdims
|
||||
loop
|
||||
mac-pix
|
||||
msrandom
|
||||
mst
|
||||
op-bw
|
||||
orle-pix
|
||||
pcd-pix
|
||||
pix-alias
|
||||
pix-bw
|
||||
pix-bw3
|
||||
pix-orle
|
||||
pix-png
|
||||
pix-ppm
|
||||
pix-ps
|
||||
pix-rle
|
||||
pix-spm
|
||||
pix-sun
|
||||
pix-yuv
|
||||
pix3filter
|
||||
pixbackgnd
|
||||
pixbgstrip
|
||||
pixblend
|
||||
pixborder
|
||||
pixbustup
|
||||
pixclump
|
||||
pixcolors
|
||||
pixcount
|
||||
pixcut
|
||||
pixdiff
|
||||
pixdsplit
|
||||
pixelswap
|
||||
pixembed
|
||||
pixfade
|
||||
pixfields
|
||||
pixfieldsep
|
||||
pixfilter
|
||||
pixhalve
|
||||
pixhist
|
||||
pixhist3d
|
||||
pixhist3d-pl
|
||||
pixinterp2x
|
||||
pixmatte
|
||||
pixmerge
|
||||
pixmorph
|
||||
pixpaste
|
||||
pixrect
|
||||
pixrot
|
||||
pixsaturate
|
||||
pixscale
|
||||
pixshrink
|
||||
pixstat
|
||||
pixsubst
|
||||
pixtile
|
||||
pixuntile
|
||||
pl-X
|
||||
pl-X10.1
|
||||
pl-asc
|
||||
pl-hpgl
|
||||
pl-pl
|
||||
pl-ps
|
||||
pl-sgi
|
||||
pl-tek
|
||||
plcolor
|
||||
pldebug
|
||||
plgetframe
|
||||
plline2
|
||||
plrot
|
||||
plstat
|
||||
png-bw
|
||||
png-pix
|
||||
png_info
|
||||
query
|
||||
remapid
|
||||
rle-pix
|
||||
sgi-pix
|
||||
sun-pix
|
||||
terrain
|
||||
texturescale
|
||||
ttcp
|
||||
wavelet
|
||||
xyz-pl
|
||||
yuv-pix
|
||||
@@ -1,566 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
bin_PROGRAMS = \
|
||||
alias-pix \
|
||||
ap-pix \
|
||||
asc-pl \
|
||||
azel \
|
||||
bary \
|
||||
binfo \
|
||||
buffer \
|
||||
bw-a \
|
||||
bw-imp \
|
||||
bw-pix \
|
||||
bw-png \
|
||||
bw-ps \
|
||||
bw-rle \
|
||||
bw3-pix \
|
||||
bwcrop \
|
||||
bwdiff \
|
||||
bwfilter \
|
||||
bwhist \
|
||||
bwhisteq \
|
||||
bwmod \
|
||||
bwrect \
|
||||
bwrot \
|
||||
bwscale \
|
||||
bwshrink \
|
||||
bwstat \
|
||||
bwthresh \
|
||||
cv \
|
||||
dbcp \
|
||||
decimate \
|
||||
double-asc \
|
||||
dpix-pix \
|
||||
dsp_add \
|
||||
dunncolor \
|
||||
dunnsnap \
|
||||
files-tape \
|
||||
gencolor \
|
||||
hd \
|
||||
imgdims \
|
||||
loop \
|
||||
mac-pix \
|
||||
msrandom \
|
||||
mst \
|
||||
op-bw \
|
||||
orle-pix \
|
||||
pcd-pix \
|
||||
pix-alias \
|
||||
pix-bw \
|
||||
pix-bw3 \
|
||||
pix-orle \
|
||||
pix-png \
|
||||
pix-ppm \
|
||||
pix-ps \
|
||||
pix-rle \
|
||||
pix-spm \
|
||||
pix-sun \
|
||||
pix-yuv \
|
||||
pix3filter \
|
||||
pixbackgnd \
|
||||
pixbgstrip \
|
||||
pixblend \
|
||||
pixborder \
|
||||
pixbustup \
|
||||
pixclump \
|
||||
pixcolors \
|
||||
pixcount \
|
||||
pixcut \
|
||||
pixdiff \
|
||||
pixdsplit \
|
||||
pixelswap \
|
||||
pixembed \
|
||||
pixfade \
|
||||
pixfields \
|
||||
pixfieldsep \
|
||||
pixfilter \
|
||||
pixhalve \
|
||||
pixhist \
|
||||
pixhist3d \
|
||||
pixhist3d-pl \
|
||||
pixinterp2x \
|
||||
pixmatte \
|
||||
pixmerge \
|
||||
pixmorph \
|
||||
pixpaste \
|
||||
pixrect \
|
||||
pixrot \
|
||||
pixsaturate \
|
||||
pixscale \
|
||||
pixshrink \
|
||||
pixstat \
|
||||
pixsubst \
|
||||
pixtile \
|
||||
pixuntile \
|
||||
pl-X \
|
||||
pl-asc \
|
||||
pl-hpgl \
|
||||
pl-pl \
|
||||
pl-ps \
|
||||
pl-sgi \
|
||||
pl-tek \
|
||||
plcolor \
|
||||
pldebug \
|
||||
plgetframe \
|
||||
plline2 \
|
||||
plrot \
|
||||
plstat \
|
||||
png-bw \
|
||||
png-pix \
|
||||
png_info \
|
||||
query \
|
||||
remapid \
|
||||
rle-pix \
|
||||
sgi-pix \
|
||||
sun-pix \
|
||||
terrain \
|
||||
texturescale \
|
||||
ttcp \
|
||||
wavelet \
|
||||
xyz-pl \
|
||||
yuv-pix
|
||||
|
||||
# XXX - doesn't work, needs to be updated to newer dm interface
|
||||
# noinst_PROGRAMS = pl-dm
|
||||
|
||||
dist_bin_SCRIPTS = rtwizard morphedit.tcl
|
||||
|
||||
pixsubst_SOURCES = pixsubst.c
|
||||
|
||||
wavelet_SOURCES = wavelet.c
|
||||
wavelet_LDADD = ${BN} ${FB}
|
||||
|
||||
png_info_SOURCES = png_info.c
|
||||
png_info_LDADD = ${BN} ${LIBPNG}
|
||||
|
||||
pix_png_SOURCES = pix-png.c
|
||||
pix_png_LDADD = ${BN} ${LIBPNG}
|
||||
|
||||
png_pix_SOURCES = png-pix.c
|
||||
png_pix_LDADD = ${BN} ${LIBPNG}
|
||||
|
||||
bw_png_SOURCES = bw-png.c
|
||||
bw_png_LDADD = ${BN} ${LIBPNG}
|
||||
|
||||
png_bw_SOURCES = png-bw.c
|
||||
png_bw_LDADD = ${BN} ${LIBPNG}
|
||||
|
||||
dunncolor_SOURCES = dunncolor.c dunncomm.c
|
||||
|
||||
dunnsnap_SOURCES = dunnsnap.c dunncomm.c
|
||||
dunnsnap_LDADD = ${FB}
|
||||
|
||||
loop_SOURCES = loop.c
|
||||
|
||||
mac_pix_SOURCES = mac-pix.c
|
||||
|
||||
sun_pix_SOURCES = sun-pix.c
|
||||
|
||||
ttcp_SOURCES = ttcp.c
|
||||
|
||||
pixmerge_SOURCES = pixmerge.c
|
||||
|
||||
pixmatte_SOURCES = pixmatte.c
|
||||
|
||||
pixbustup_SOURCES = pixbustup.c
|
||||
|
||||
pixfade_SOURCES = pixfade.c
|
||||
pixfade_LDADD = ${BN}
|
||||
|
||||
pixfields_SOURCES = pixfields.c
|
||||
|
||||
pixfieldsep_SOURCES = pixfieldsep.c
|
||||
|
||||
pixdiff_SOURCES = pixdiff.c
|
||||
|
||||
pixinterp2x_SOURCES = pixinterp2x.c
|
||||
|
||||
pixtile_SOURCES = pixtile.c
|
||||
|
||||
pixuntile_SOURCES = pixuntile.c
|
||||
|
||||
orle_pix_SOURCES = orle-pix.c
|
||||
orle_pix_LDADD = ${FB} ${ORLE}
|
||||
|
||||
pix_orle_SOURCES = pix-orle.c
|
||||
pix_orle_LDADD = ${FB} ${ORLE}
|
||||
|
||||
rle_pix_SOURCES = rle-pix.c strdup.c
|
||||
rle_pix_LDADD = ${RLE} ${BU}
|
||||
|
||||
pix_rle_SOURCES = pix-rle.c strdup.c
|
||||
pix_rle_LDADD = ${RLE} ${BU}
|
||||
|
||||
bw_rle_SOURCES = bw-rle.c strdup.c
|
||||
bw_rle_LDADD = ${RLE} ${BU}
|
||||
|
||||
ap_pix_SOURCES = ap-pix.c
|
||||
|
||||
pixbackgnd_SOURCES = pixbackgnd.c
|
||||
|
||||
pixbgstrip_SOURCES = pixbgstrip.c
|
||||
pixbgstrip_LDADD = ${BN}
|
||||
|
||||
bw_a_SOURCES = bw-a.c
|
||||
bw_a_LDADD = ${BN}
|
||||
|
||||
bw_imp_SOURCES = bw-imp.c
|
||||
|
||||
bw_ps_SOURCES = bw-ps.c
|
||||
|
||||
bw_pix_SOURCES = bw-pix.c
|
||||
|
||||
bw3_pix_SOURCES = bw3-pix.c
|
||||
|
||||
bwcrop_SOURCES = bwcrop.c
|
||||
|
||||
bwdiff_SOURCES = bwdiff.c
|
||||
|
||||
bwfilter_SOURCES = bwfilter.c
|
||||
|
||||
bwhist_SOURCES = bwhist.c
|
||||
bwhist_LDADD = ${FB}
|
||||
|
||||
bwhisteq_SOURCES = bwhisteq.c
|
||||
|
||||
bwmod_SOURCES = bwmod.c
|
||||
bwmod_LDADD = ${LIBM}
|
||||
|
||||
bwrect_SOURCES = bwrect.c
|
||||
|
||||
bwrot_SOURCES = bwrot.c
|
||||
bwrot_LDADD = ${LIBM}
|
||||
|
||||
bwscale_SOURCES = bwscale.c
|
||||
|
||||
bwstat_SOURCES = bwstat.c
|
||||
bwstat_LDADD = ${LIBM}
|
||||
|
||||
gencolor_SOURCES = gencolor.c
|
||||
|
||||
pix_bw_SOURCES = pix-bw.c
|
||||
|
||||
pix_bw3_SOURCES = pix-bw3.c
|
||||
|
||||
pixfilter_SOURCES = pixfilter.c
|
||||
|
||||
pixhist_SOURCES = pixhist.c
|
||||
pixhist_LDADD = ${FB}
|
||||
|
||||
pixhist3d_SOURCES = pixhist3d.c
|
||||
pixhist3d_LDADD = ${FB}
|
||||
|
||||
pixrect_SOURCES = pixrect.c
|
||||
|
||||
pixrot_SOURCES = pixrot.c
|
||||
|
||||
pixscale_SOURCES = pixscale.c
|
||||
|
||||
pixembed_SOURCES = pixembed.c
|
||||
|
||||
pixcut_SOURCES = pixcut.c
|
||||
pixcut_LDADD = ${BN}
|
||||
|
||||
pixpaste_SOURCES = pixpaste.c
|
||||
pixpaste_LDADD = ${BN}
|
||||
|
||||
pixstat_SOURCES = pixstat.c
|
||||
pixstat_LDADD = ${LIBM}
|
||||
|
||||
pixhist3d_pl_SOURCES = pixhist3d-pl.c
|
||||
pixhist3d_pl_LDADD = ${BN}
|
||||
|
||||
# XXX - example code doesn't work so disable for now
|
||||
# pl_dm_SOURCES = pl-dm.c
|
||||
# pl_dm_LDADD = ${BU} ${DM}
|
||||
|
||||
pl_sgi_SOURCES = pl-sgi.c
|
||||
pl_sgi_LDADD = ${LIBSGIGL} ${BU}
|
||||
|
||||
pl_ps_SOURCES = pl-ps.c
|
||||
pl_ps_LDADD = ${BU}
|
||||
|
||||
pldebug_SOURCES = pldebug.c
|
||||
pldebug_LDADD = ${BU}
|
||||
|
||||
plgetframe_SOURCES = plgetframe.c
|
||||
|
||||
plrot_SOURCES = plrot.c
|
||||
plrot_LDADD = ${BN}
|
||||
|
||||
cv_SOURCES = cv.c
|
||||
cv_LDADD = ${BU}
|
||||
|
||||
op_bw_SOURCES = op-bw.c
|
||||
|
||||
plcolor_SOURCES = plcolor.c
|
||||
plcolor_LDADD = ${BN}
|
||||
|
||||
plline2_SOURCES = plline2.c
|
||||
plline2_LDADD = ${BN}
|
||||
|
||||
pl_pl_SOURCES = pl-pl.c
|
||||
pl_pl_LDADD = ${BU}
|
||||
|
||||
pl_tek_SOURCES = pl-tek.c
|
||||
pl_tek_LDADD = ${BU}
|
||||
|
||||
buffer_SOURCES = buffer.c
|
||||
|
||||
dbcp_SOURCES = dbcp.c
|
||||
|
||||
files_tape_SOURCES = files-tape.c
|
||||
|
||||
pix3filter_SOURCES = pix3filter.c
|
||||
|
||||
pix_spm_SOURCES = pix-spm.c
|
||||
pix_spm_LDADD = ${BN}
|
||||
|
||||
pix_sun_SOURCES = pix-sun.c
|
||||
|
||||
pix_alias_SOURCES = pix-alias.c
|
||||
|
||||
alias_pix_SOURCES = alias-pix.c
|
||||
|
||||
pixcolors_SOURCES = pixcolors.c
|
||||
|
||||
hd_SOURCES = hd.c
|
||||
|
||||
sgi_pix_SOURCES = sgi-pix.c
|
||||
sgi_pix_LDADD = ${LIBSGIGL}
|
||||
|
||||
pixsaturate_SOURCES = pixsaturate.c
|
||||
|
||||
query_SOURCES = query.c
|
||||
|
||||
pixshrink_SOURCES = pixshrink.c
|
||||
|
||||
bwshrink_SOURCES = bwshrink.c
|
||||
|
||||
pixhalve_SOURCES = pixhalve.c
|
||||
pixhalve_LDADD = ${BN}
|
||||
|
||||
pix_ps_SOURCES = pix-ps.c
|
||||
|
||||
pix_ppm_SOURCES = pix-ppm.c
|
||||
pix_ppm_LDADD = ${BN}
|
||||
|
||||
pcd_pix_SOURCES = pcd-pix.c
|
||||
|
||||
pix_yuv_SOURCES = pix-yuv.c
|
||||
pix_yuv_LDADD = ${BN}
|
||||
|
||||
yuv_pix_SOURCES = yuv-pix.c
|
||||
yuv_pix_LDADD = ${BN}
|
||||
|
||||
plstat_SOURCES = plstat.c
|
||||
plstat_LDADD = ${BU}
|
||||
|
||||
pl_asc_SOURCES = pl-asc.c
|
||||
pl_asc_LDADD = ${BU}
|
||||
|
||||
asc_pl_SOURCES = asc-pl.c
|
||||
asc_pl_LDADD = ${BN} ${LIBM}
|
||||
|
||||
pl_hpgl_SOURCES = pl-hpgl.c
|
||||
|
||||
xyz_pl_SOURCES = xyz-pl.c
|
||||
xyz_pl_LDADD = ${BN}
|
||||
|
||||
azel_SOURCES = azel.c
|
||||
azel_LDADD = ${LIBM}
|
||||
|
||||
bary_SOURCES = bary.c
|
||||
bary_LDADD = ${BU}
|
||||
|
||||
pixdsplit_SOURCES = pixdsplit.c
|
||||
pixdsplit_LDADD = ${BU}
|
||||
|
||||
mst_SOURCES = mst.c
|
||||
mst_LDADD = ${BU}
|
||||
|
||||
remapid_SOURCES = remapid.c
|
||||
remapid_LDADD = ${LIBRT}
|
||||
|
||||
texturescale_SOURCES = texturescale.c
|
||||
texturescale_LDADD = ${BN}
|
||||
|
||||
double_asc_SOURCES = double-asc.c
|
||||
double_asc_LDADD = ${BN}
|
||||
|
||||
bwthresh_SOURCES = bwthresh.c
|
||||
|
||||
dpix_pix_SOURCES = dpix-pix.c
|
||||
|
||||
#pix_ci_SOURCES = pix-ci.c
|
||||
#pix_ci_LDADD = ${X_LIBS}
|
||||
|
||||
pl_X_SOURCES = pl-X.c
|
||||
pl_X_CFLAGS = ${X_CFLAGS}
|
||||
pl_X_LDADD = ${X_LIBS} ${BU}
|
||||
|
||||
#pl_X10_SOURCES = pl-X10.c
|
||||
|
||||
#pl_starbase_SOURCES = pl-starbase.c
|
||||
|
||||
pixelswap_SOURCES = pixelswap.c
|
||||
|
||||
decimate_SOURCES = decimate.c
|
||||
|
||||
msrandom_SOURCES = msrandom.c
|
||||
msrandom_LDADD = ${BN}
|
||||
|
||||
pixblend_SOURCES = pixblend.c
|
||||
|
||||
pixmorph_SOURCES = pixmorph.c
|
||||
pixmorph_LDADD = ${BN}
|
||||
|
||||
pixborder_SOURCES = pixborder.c
|
||||
pixborder_LDADD = ${BN}
|
||||
|
||||
pixclump_SOURCES = pixclump.c
|
||||
pixclump_LDADD = ${BU}
|
||||
|
||||
pixcount_SOURCES = pixcount.c
|
||||
pixcount_LDADD = ${BU}
|
||||
|
||||
imgdims_SOURCES = imgdims.c
|
||||
imgdims_LDADD = ${BN}
|
||||
|
||||
terrain_SOURCES = terrain.c
|
||||
terrain_LDADD = ${BN}
|
||||
|
||||
dsp_add_SOURCES = dsp_add.c
|
||||
dsp_add_LDADD = ${BU}
|
||||
|
||||
binfo_SOURCES = binfo.c
|
||||
binfo_LDADD = ${BN} ${FB}
|
||||
|
||||
.PHONY : vers.c
|
||||
vers.c:
|
||||
sh $(top_srcdir)/sh/vers.sh version "BRL-CAD info" > $@
|
||||
|
||||
man_MANS = \
|
||||
alias-pix.1 \
|
||||
ap-pix.1 \
|
||||
asc-pl.1 \
|
||||
azel.1 \
|
||||
bary.1 \
|
||||
brlcad.1 \
|
||||
buffer.1 \
|
||||
bw-imp.1 \
|
||||
bw-pix.1 \
|
||||
bw-png.1 \
|
||||
bw-ps.1 \
|
||||
bw-rle.1 \
|
||||
bw3-pix.1 \
|
||||
bwcrop.1 \
|
||||
bwdiff.1 \
|
||||
bwfilter.1 \
|
||||
bwhist.1 \
|
||||
bwhisteq.1 \
|
||||
bwmod.1 \
|
||||
bwrect.1 \
|
||||
bwrot.1 \
|
||||
bwscale.1 \
|
||||
bwshrink.1 \
|
||||
bwstat.1 \
|
||||
bwthresh.1 \
|
||||
cv.1 \
|
||||
dbcp.1 \
|
||||
decimate.1 \
|
||||
dpix-pix.1 \
|
||||
dunncolor.1 \
|
||||
dunnsnap.1 \
|
||||
gencolor.1 \
|
||||
hd.1 \
|
||||
imgdims.1 \
|
||||
loop.1 \
|
||||
mac-pix.1 \
|
||||
morphedit.1 \
|
||||
op-bw.1 \
|
||||
orle-pix.1 \
|
||||
pcd-pix.1 \
|
||||
pix-alias.1 \
|
||||
pix-bw.1 \
|
||||
pix-bw3.1 \
|
||||
pix-orle.1 \
|
||||
pix-png.1 \
|
||||
pix-ps.1 \
|
||||
pix-rle.1 \
|
||||
pix-sun.1 \
|
||||
pixbackgnd.1 \
|
||||
pixbgstrip.1 \
|
||||
pixblend.1 \
|
||||
pixborder.1 \
|
||||
pixbustup.1 \
|
||||
pixclump.1 \
|
||||
pixcolors.1 \
|
||||
pixcut.1 \
|
||||
pixdiff.1 \
|
||||
pixdsplit.1 \
|
||||
pixfade.1 \
|
||||
pixfilter.1 \
|
||||
pixhalve.1 \
|
||||
pixhist.1 \
|
||||
pixhist3d-pl.1 \
|
||||
pixhist3d.1 \
|
||||
pixinterp2x.1 \
|
||||
pixmatte.1 \
|
||||
pixmerge.1 \
|
||||
pixmorph.1 \
|
||||
pixrect.1 \
|
||||
pixrot.1 \
|
||||
pixsaturate.1 \
|
||||
pixscale.1 \
|
||||
pixshrink.1 \
|
||||
pixstat.1 \
|
||||
pixsubst.1 \
|
||||
pixtile.1 \
|
||||
pixuntile.1 \
|
||||
pl-X.1 \
|
||||
pl-X10.1 \
|
||||
pl-asc.1 \
|
||||
pl-hpgl.1 \
|
||||
pl-pl.1 \
|
||||
pl-ps.1 \
|
||||
pl-sgi.1 \
|
||||
pl-starbase.1 \
|
||||
pl-tek.1 \
|
||||
plcolor.1 \
|
||||
pldebug.1 \
|
||||
plgetframe.1 \
|
||||
plline2.1 \
|
||||
plrot.1 \
|
||||
png-bw.1 \
|
||||
png-pix.1 \
|
||||
png_info.1 \
|
||||
query.1 \
|
||||
rle-pix.1 \
|
||||
sun-pix.1 \
|
||||
terrain.1 \
|
||||
wavelet.1
|
||||
|
||||
sample_applicationsdir = $(SAMPLE_APPLICATIONS_DIR)
|
||||
|
||||
sample_applications_DATA = pl-dm.c
|
||||
|
||||
# XXX need to investigate why these .c are not being built
|
||||
EXTRA_DIST = \
|
||||
$(man_MANS) \
|
||||
$(sample_applications_DATA) \
|
||||
fix_polysolids.c \
|
||||
lowp.c \
|
||||
pix-both-ik.c \
|
||||
pix-ci.c \
|
||||
pix-filt-ik.c \
|
||||
pix-ik.c \
|
||||
pix-ikr.c \
|
||||
pix-lowp-ik.c \
|
||||
pixt-ik.c \
|
||||
pl-X10.c \
|
||||
pl-starbase.c \
|
||||
strchr.c
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,365 +0,0 @@
|
||||
#
|
||||
# util/Makefile.loc
|
||||
# Makefile for a variety of framebuffer utilities
|
||||
#
|
||||
# Source -
|
||||
# SECAD/VLD Computing Consortium, Bldg 394
|
||||
# The U. S. Army Ballistic Research Laboratory
|
||||
# Aberdeen Proving Ground, Maryland 21005
|
||||
|
||||
# Make null for default, or specify -p or -pg for profiling
|
||||
PROFILE =
|
||||
|
||||
PRODUCTS = fbanim loop pix-fb fb-pix \
|
||||
pixbustup pixdiff pixinterp2x pixtile pixuntile \
|
||||
pp-fb fbclear fbgrid \
|
||||
rle-fb fb-rle rle-pix pix-rle \
|
||||
fbcmap fb-cmap cmap-fb fbgamma \
|
||||
fbscanplot fbzoom fbpoint fblabel fbline\
|
||||
pl-fb fbcolor fbcmrot pixbackgnd fbframe ap-pix \
|
||||
bw-fb bw-pix bw3-pix bwcrop bwdiff bwfilter bw-impress \
|
||||
bwhist bwhisteq bwmod bwrect bwrot bwscale bwstat fb-bw \
|
||||
gencolor pix-bw pix-bw3 pixfilter pixhist \
|
||||
pixhist3d pixhist3d-pl \
|
||||
pixrect pixrot pixscale pixstat fbcbars \
|
||||
sun-pix mac-pix pixmerge op-bw \
|
||||
pl-sgi pldebug plgetframe plrot \
|
||||
dunncolor dunnsnap
|
||||
|
||||
SRCDIR = util
|
||||
VPATH = ../util
|
||||
MANSECTION = 1
|
||||
|
||||
CFILES = dunncolor.c dunnsnap.c fbanim.c loop.c pix-fb.c fb-pix.c \
|
||||
pixbustup.c pixdiff.c pixinterp2x.c pixtile.c pixuntile.c \
|
||||
pp-fb.c fbclear.c fbgrid.c \
|
||||
rle-fb.c fb-rle.c rle-pix.c pix-rle.c \
|
||||
fbcmap.c fb-cmap.c cmap-fb.c fbgamma.c \
|
||||
fbscanplot.c fbzoom.c fbpoint.c fblabel.c fbline.c pl-fb.c \
|
||||
fbcolor.c fbcmrot.c pixbackgnd.c fbframe.c ap-pix.c \
|
||||
bw-fb.c bw-pix.c bw3-pix.c bwcrop.c bwdiff.c bwfilter.c \
|
||||
bw-impress.c bwhist.c bwhisteq.c \
|
||||
bwmod.c bwrect.c bwrot.c bwscale.c bwstat.c fb-bw.c \
|
||||
gencolor.c pix-bw.c pix-bw3.c pixfilter.c pixhist.c \
|
||||
pixhist3d.c pixhist3d-pl.c \
|
||||
sun-pix.c mac-pix.c pixmerge.c fbcbars.c \
|
||||
pixrect.c pixrot.c pixscale.c pixstat.c op-bw.c \
|
||||
pl-sgi.c pldebug.c plgetframe.c plrot.c
|
||||
|
||||
all: ${PRODUCTS}
|
||||
|
||||
# This is how to make the product. ${LIBES} should be listed last.
|
||||
#${PRODUCTS}: $$@.o
|
||||
# $(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
dunncolor: dunncolor.o dunncomm.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o dunncomm.o ${LIBES}
|
||||
|
||||
dunnsnap: dunnsnap.o dunncomm.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o dunncomm.o ${LIBES}
|
||||
|
||||
fbanim: fbanim.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
pl-fb: pl-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBPLOT} ${LIBES}
|
||||
|
||||
loop: loop.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
mac-pix: mac-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
sun-pix: sun-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
pixmerge: pixmerge.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
fbcbars: fbcbars.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
pix-fb: pix-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fb-pix: fb-pix.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
pixbustup: pixbustup.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixdiff: pixdiff.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixinterp2x: pixinterp2x.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
pixtile: pixtile.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
pixuntile: pixuntile.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
pp-fb: pp-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBTERMIO} ${LIBES}
|
||||
|
||||
fbclear: fbclear.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
fbgrid: fbgrid.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
rle-fb: rle-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBRLE} ${LIBES}
|
||||
|
||||
fb-rle: fb-rle.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBRLE} ${LIBES}
|
||||
|
||||
rle-pix: rle-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBRLE} ${LIBES}
|
||||
|
||||
pix-rle: pix-rle.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBRLE} ${LIBES}
|
||||
|
||||
fbcmap: fbcmap.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fb-cmap: fb-cmap.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
cmap-fb: cmap-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fbgamma: fbgamma.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fbscanplot: fbscanplot.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fbzoom: fbzoom.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBTERMIO} ${LIBES}
|
||||
|
||||
fbpoint: fbpoint.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBTERMIO} ${LIBES}
|
||||
|
||||
fblabel: fblabel.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fbline: fbline.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
fbcolor: fbcolor.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBTERMIO} ${LIBES}
|
||||
|
||||
ap-pix: ap-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
fbcmrot: fbcmrot.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
pixbackgnd: pixbackgnd.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
fbframe: fbframe.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
bw-fb: bw-fb.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
bw-impress: bw-impress.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
bw-pix: bw-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bw3-pix: bw3-pix.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwcrop: bwcrop.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwdiff: bwdiff.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwfilter: bwfilter.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
bwhist: bwhist.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
bwhisteq: bwhisteq.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwmod: bwmod.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
bwrect: bwrect.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwrot: bwrot.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwscale: bwscale.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
bwstat: bwstat.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
fb-bw: fb-bw.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBFB} ${LIBES}
|
||||
|
||||
gencolor: gencolor.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pix-bw: pix-bw.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pix-bw3: pix-bw3.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixfilter: pixfilter.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBSYSV} ${LIBES}
|
||||
|
||||
pixhist: pixhist.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
pixhist3d: pixhist3d.o ${LIBFB}
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBFB} ${LIBES}
|
||||
|
||||
pixrect: pixrect.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixrot: pixrot.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixscale: pixscale.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixstat: pixstat.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
pixhist3d-pl: pixhist3d-pl.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBPLOT} ${LIBES}
|
||||
|
||||
pl-sgi: pl-sgi.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBPLOT} ${LIBFB} ${LIBES}
|
||||
|
||||
pldebug: pldebug.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBPLOT} ${LIBES}
|
||||
|
||||
plgetframe: plgetframe.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBPLOT} ${LIBES}
|
||||
|
||||
plrot: plrot.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBPLOT} ${LIBES}
|
||||
|
||||
op-bw: op-bw.o
|
||||
$(CC) ${LDFLAGS} -o $@ $@.o ${LIBES}
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
dunncolor.o: dunncolor.c
|
||||
dunnsnap.o: dunnsnap.c
|
||||
fbanim.o: fbanim.c
|
||||
fbanim.o: ../h/fb.h
|
||||
loop.o: loop.c
|
||||
pix-fb.o: pix-fb.c
|
||||
pix-fb.o: ../h/fb.h
|
||||
fb-pix.o: fb-pix.c
|
||||
fb-pix.o: ../h/fb.h
|
||||
pixbustup.o: pixbustup.c
|
||||
pixdiff.o: pixdiff.c
|
||||
pixinterp2x.o: pixinterp2x.c
|
||||
pixtile.o: pixtile.c
|
||||
pixuntile.o: pixuntile.c
|
||||
pp-fb.o: pp-fb.c
|
||||
pp-fb.o: ../h/fb.h
|
||||
fbclear.o: fbclear.c
|
||||
fbclear.o: ../h/fb.h
|
||||
fbgrid.o: fbgrid.c
|
||||
fbgrid.o: ../h/fb.h
|
||||
rle-fb.o: rle-fb.c
|
||||
rle-fb.o: ../h/fb.h
|
||||
rle-fb.o: ../h/rle.h
|
||||
fb-rle.o: fb-rle.c
|
||||
fb-rle.o: ../h/fb.h
|
||||
fb-rle.o: ../h/rle.h
|
||||
rle-pix.o: rle-pix.c
|
||||
rle-pix.o: ../h/fb.h
|
||||
rle-pix.o: ../h/rle.h
|
||||
pix-rle.o: pix-rle.c
|
||||
pix-rle.o: ../h/fb.h
|
||||
pix-rle.o: ../h/rle.h
|
||||
fbcmap.o: fbcmap.c
|
||||
fbcmap.o: ../h/fb.h
|
||||
fb-cmap.o: fb-cmap.c
|
||||
fb-cmap.o: ../h/fb.h
|
||||
cmap-fb.o: cmap-fb.c
|
||||
cmap-fb.o: ../h/fb.h
|
||||
fbgamma.o: fbgamma.c
|
||||
fbgamma.o: ../h/fb.h
|
||||
fbscanplot.o: fbscanplot.c
|
||||
fbscanplot.o: ../h/fb.h
|
||||
fbzoom.o: fbzoom.c
|
||||
fbzoom.o: ../h/fb.h
|
||||
fbpoint.o: fbpoint.c
|
||||
fbpoint.o: ../h/../h/fb.h
|
||||
fblabel.o: fblabel.c
|
||||
fblabel.o: ../h/fb.h
|
||||
fbline.o: fbline.c
|
||||
fbline.o: ../h/fb.h
|
||||
pl-fb.o: pl-fb.c
|
||||
pl-fb.o: ../h/fb.h
|
||||
fbcolor.o: fbcolor.c
|
||||
fbcolor.o: ../h/fb.h
|
||||
fbcmrot.o: fbcmrot.c
|
||||
fbcmrot.o: ../h/fb.h
|
||||
pixbackgnd.o: pixbackgnd.c
|
||||
fbframe.o: fbframe.c
|
||||
fbframe.o: ../h/fb.h
|
||||
ap-pix.o: ap-pix.c
|
||||
bw-fb.o: bw-fb.c
|
||||
bw-fb.o: ../h/fb.h
|
||||
bw-pix.o: bw-pix.c
|
||||
bw3-pix.o: bw3-pix.c
|
||||
bwcrop.o: bwcrop.c
|
||||
bwdiff.o: bwdiff.c
|
||||
bwfilter.o: bwfilter.c
|
||||
bw-impress.o: bw-impress.c
|
||||
bwhist.o: bwhist.c
|
||||
bwhist.o: ../h/fb.h
|
||||
bwhisteq.o: bwhisteq.c
|
||||
bwmod.o: bwmod.c
|
||||
bwrect.o: bwrect.c
|
||||
bwrot.o: bwrot.c
|
||||
bwscale.o: bwscale.c
|
||||
bwstat.o: bwstat.c
|
||||
fb-bw.o: fb-bw.c
|
||||
fb-bw.o: ../h/fb.h
|
||||
gencolor.o: gencolor.c
|
||||
pix-bw.o: pix-bw.c
|
||||
pix-bw3.o: pix-bw3.c
|
||||
pixfilter.o: pixfilter.c
|
||||
pixhist.o: pixhist.c
|
||||
pixhist.o: ../h/fb.h
|
||||
pixhist3d.o: pixhist3d.c
|
||||
pixhist3d.o: ../h/fb.h
|
||||
pixhist3d-pl.o: pixhist3d-pl.c
|
||||
sun-pix.o: sun-pix.c
|
||||
mac-pix.o: mac-pix.c
|
||||
pixmerge.o: pixmerge.c
|
||||
fbcbars.o: fbcbars.c
|
||||
fbcbars.o: ../h/fb.h
|
||||
pixrect.o: pixrect.c
|
||||
pixrot.o: pixrot.c
|
||||
pixscale.o: pixscale.c
|
||||
pixstat.o: pixstat.c
|
||||
op-bw.o: op-bw.c
|
||||
pl-sgi.o: pl-sgi.c
|
||||
pldebug.o: pldebug.c
|
||||
plgetframe.o: plgetframe.c
|
||||
plrot.o: plrot.c
|
||||
plrot.o: ../h/machine.h
|
||||
plrot.o: ../h/vmath.h
|
||||
# DEPENDENCIES MUST END AT END OF FILE
|
||||
# IF YOU PUT STUFF HERE IT WILL GO AWAY
|
||||
# see make depend above
|
||||
@@ -1,20 +0,0 @@
|
||||
.TH ALIAS-PIX 1 BRL/CAD
|
||||
.SH NAME
|
||||
alias\(hypix \- convert an image from Alias(tm) pix format to BRL PIX(5) format
|
||||
.SH SYNOPSIS
|
||||
.B alias-pix
|
||||
[
|
||||
.I \-v
|
||||
]
|
||||
< ALIASpixfile > BRLpixfile
|
||||
.SH DESCRIPTION
|
||||
.Ialias\(hypix
|
||||
converts the
|
||||
.I Alias pix
|
||||
format file on the standard input to an
|
||||
.I BRL PIX(5)
|
||||
format file on the standard output.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
print a text summary of the Alias pix file header on standard error output.
|
||||
@@ -1,145 +0,0 @@
|
||||
/* A L I A S - P I X . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file alias-pix.c
|
||||
* Convert ALIAS(tm) PIX format image files to BRL PIX fomat files.
|
||||
*
|
||||
* Author:
|
||||
* Lee A. Butler
|
||||
*
|
||||
*/
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
char *progname = "(noname)";
|
||||
void usage(void)
|
||||
{
|
||||
(void) fprintf(stderr, "Usage: %s [ -v ] < ALIASpixfile >BRLpixfile\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct aliashead {
|
||||
short x, y; /* dimensions of this image in X and Y */
|
||||
short xoff, yoff; /* offsets of pixels */
|
||||
short bitplanes; /* the number of bits per pixel */
|
||||
} hdr;
|
||||
|
||||
#define BUFCNT 256
|
||||
struct pixel {
|
||||
unsigned char len, b, g, r;
|
||||
} buf[BUFCNT];
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
char *image;
|
||||
|
||||
int
|
||||
main(int ac, char **av)
|
||||
{
|
||||
int pixcnt, i;
|
||||
char *p;
|
||||
|
||||
progname = *av;
|
||||
|
||||
if (ac > 2 || isatty(fileno(stdin))) usage();
|
||||
|
||||
if (ac > 1) {
|
||||
p = av[1];
|
||||
if (*p == '-' && *(p+1) == 'v') verbose = 1;
|
||||
else usage();
|
||||
}
|
||||
|
||||
|
||||
/* read header in architecture-independent fashion */
|
||||
hdr.x = (getchar() & 0x0ff) << 8;
|
||||
hdr.x += (getchar() & 0x0ff);
|
||||
|
||||
hdr.y = (getchar() & 0x0ff) << 8;
|
||||
hdr.y += (getchar() & 0x0ff);
|
||||
|
||||
hdr.xoff = (getchar() & 0x0ff) << 8;
|
||||
hdr.xoff += (getchar() & 0x0ff);
|
||||
|
||||
hdr.yoff = (getchar() & 0x0ff) << 8;
|
||||
hdr.yoff += (getchar() & 0x0ff);
|
||||
|
||||
hdr.bitplanes = (getchar() & 0x0ff) << 8;
|
||||
hdr.bitplanes += (getchar() & 0x0ff);
|
||||
|
||||
if (hdr.bitplanes != 24) {
|
||||
(void) fprintf(stderr, "Weird image file:\n");
|
||||
(void) fprintf(stderr,
|
||||
"X: %d Y: %d xoff: %d yoff: %d bits/pixel: %d\n",
|
||||
hdr.x, hdr.y, hdr.xoff, hdr.yoff, hdr.bitplanes);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
(void) fprintf(stderr,
|
||||
"X: %d Y: %d xoff: %d yoff: %d bits/pixel: %d\n",
|
||||
hdr.x, hdr.y, hdr.xoff, hdr.yoff, hdr.bitplanes);
|
||||
}
|
||||
|
||||
|
||||
if ( (image=(char *)malloc(hdr.x*hdr.y*3)) == (char *)NULL) {
|
||||
(void) fprintf(stderr, "%s: insufficient memory for %d * %d image\n",
|
||||
progname, hdr.x, hdr.y);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* read and "unpack" the image */
|
||||
p = image;
|
||||
while ((pixcnt=fread(buf, sizeof(struct pixel), BUFCNT, stdin)) > 0) {
|
||||
for (i=0 ; i < pixcnt ; ++i)
|
||||
do {
|
||||
*p++ = buf[i].r;
|
||||
*p++ = buf[i].g;
|
||||
*p++ = buf[i].b;
|
||||
} while (--buf[i].len > 0);
|
||||
}
|
||||
|
||||
/* write out the image scanlines, correcting for different origin */
|
||||
|
||||
for(i=hdr.y-1 ; i >= 0 ; --i)
|
||||
if (fwrite(&image[i*hdr.x*3], hdr.x*3, 1, stdout) != 1) {
|
||||
(void) fprintf(stderr, "%s: Error writing image\n", *av);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
free(image);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,35 +0,0 @@
|
||||
.TH AP-PIX 1 BRL-CAD
|
||||
.SH NAME
|
||||
ap\(hypix \- convert Applicon files to pix files
|
||||
.SH SYNOPSIS
|
||||
.B ap-pix
|
||||
.RB [ \-v ]
|
||||
file.ap
|
||||
\>\ file.pix
|
||||
.SH DESCRIPTION
|
||||
.I Ap-pix
|
||||
converts an
|
||||
.I Applicon
|
||||
drum plotter image file into a
|
||||
.IR pix (5)
|
||||
file.
|
||||
.PP
|
||||
The
|
||||
.I Applicon
|
||||
file is assumed to consist of a number lines each 3456 bits long, the
|
||||
resulting
|
||||
.I pix
|
||||
file thus has scanlines of 3456 pixels.
|
||||
.SH "SEE ALSO"
|
||||
brlcad(1), pix(5).
|
||||
.SH AUTHOR
|
||||
Phillip Dykstra
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,119 +0,0 @@
|
||||
/* A P - P I X . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1986-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file ap-pix.c
|
||||
*
|
||||
* Applicon color ink jet printer to .pix file converter.
|
||||
*
|
||||
* Author -
|
||||
* Phillip Dykstra
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
/* Dots are least most signifigant bit first in increasing index */
|
||||
struct app_record {
|
||||
unsigned char ml[432];
|
||||
unsigned char yl[432];
|
||||
unsigned char cl[432];
|
||||
} magline, yelline, cyaline;
|
||||
|
||||
struct {
|
||||
char red, green, blue;
|
||||
} out;
|
||||
|
||||
FILE *magfp, *yelfp, *cyafp;
|
||||
int verbose = 0;
|
||||
|
||||
static char *Usage = "usage: ap-pix [-v] file.ap > file.pix (3456 x ?)\n";
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i, bit;
|
||||
int line;
|
||||
|
||||
if( argc > 1 && strcmp(argv[1],"-v") == 0 ) {
|
||||
verbose++;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if( argc != 2 ) {
|
||||
fputs( Usage, stderr );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
magfp = fopen( argv[1], "r" );
|
||||
if( magfp == NULL ) {
|
||||
fprintf( stderr, "ap-pix: can't open \"%s\"\n", argv[1] );
|
||||
exit( 2 );
|
||||
}
|
||||
yelfp = fopen( argv[1], "r" );
|
||||
fseek( yelfp, (long)(50*sizeof(yelline)), 0 );
|
||||
cyafp = fopen( argv[1], "r" );
|
||||
fseek( cyafp, (long)(100*sizeof(cyaline)), 0 );
|
||||
|
||||
line = 0;
|
||||
while( (int)fread( &cyaline, sizeof( cyaline ), 1, cyafp ) > 0 ) {
|
||||
fread( &magline, sizeof( magline ), 1, magfp );
|
||||
fread( &yelline, sizeof( yelline ), 1, yelfp );
|
||||
line++;
|
||||
|
||||
for( i = 0; i < 432; i++ ) {
|
||||
for( bit = 7; bit >= 0; bit-- ) {
|
||||
out.red = ((cyaline.cl[i]>>bit)&1) ? 0 : 255;
|
||||
out.green = ((magline.ml[i]>>bit)&1) ? 0 : 255;
|
||||
out.blue = ((yelline.yl[i]>>bit)&1) ? 0 : 255;
|
||||
fwrite( &out, sizeof( out ), 1, stdout );
|
||||
}
|
||||
}
|
||||
if( verbose )
|
||||
fprintf( stderr, "wrote line %d\n", line );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,40 +0,0 @@
|
||||
.TH ASC-PL 1 BRL-CAD
|
||||
.SH NAME
|
||||
asc-pl \- produce Plot3 instructions from ASCII representation
|
||||
.SH SYNOPSIS
|
||||
.B asc-pl
|
||||
[file.asc [unix_plot]]
|
||||
.SH DESCRIPTION
|
||||
Reads a stream of ASCII data representing Plot3 instructions
|
||||
and converts it to
|
||||
.IR plot3 (5)
|
||||
format.
|
||||
.I Asc-pl
|
||||
reads from standard input and writes to standard output
|
||||
if file names are not supplied.
|
||||
.PP
|
||||
The input should consist of lines of the form
|
||||
.sp
|
||||
.ti +5
|
||||
.I c arg arg ...
|
||||
.sp
|
||||
where
|
||||
.I c
|
||||
is one of the single-character Plot3 command names,
|
||||
and it is followed by white-space-separated arguments
|
||||
of appropriate number and types for that command.
|
||||
Optional white space and lines beginning with the comment character
|
||||
`#' are ignored.
|
||||
.SH "SEE ALSO"
|
||||
pl-asc(1), pl-pl(1), plrot(1), pl-fb(1), libplot3(3), plot3(5)
|
||||
.SH AUTHOR
|
||||
Paul Tanenbaum
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,275 +0,0 @@
|
||||
/* A S C - P L . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1990-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file asc-pl.c
|
||||
*
|
||||
* Produce UNIX plot commands in PLOT3(5) format
|
||||
* from ASCII representation.
|
||||
*
|
||||
* Author -
|
||||
* Paul Tanenbaum
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include "machine.h"
|
||||
#include "plot3.h"
|
||||
|
||||
#define BUF_LEN 512
|
||||
#define FP_IN 0
|
||||
#define FP_OUT 1
|
||||
|
||||
static char *usage = "asc-pl [file.in [file.pl]]\n";
|
||||
|
||||
static void printusage(void);
|
||||
static int check_syntax(char cmd, int needed, int got, int line);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *bp;
|
||||
char buf[BUF_LEN];
|
||||
char sarg[BUF_LEN];
|
||||
static char *fm[] = { "r", "w" };
|
||||
double darg[6];
|
||||
static FILE *fp[2];
|
||||
int i;
|
||||
int iarg[6];
|
||||
int line_nm;
|
||||
int nm_args = 0;
|
||||
|
||||
/* Handle command-line syntax */
|
||||
if (argc > 3)
|
||||
{
|
||||
printusage();
|
||||
exit (1);
|
||||
}
|
||||
fp[0] = stdin;
|
||||
fp[1] = stdout;
|
||||
for (i = 0; (i < 2) && (--argc > 0); ++i)
|
||||
{
|
||||
if ((**++argv == '-') && (*(*argv + 1) == '\0'))
|
||||
continue;
|
||||
if ((fp[i] = fopen(*argv, fm[i])) == NULL)
|
||||
{
|
||||
(void) fprintf(stderr, "Cannot open file '%s'\n", *argv);
|
||||
printusage();
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
if (isatty(fileno(fp[FP_OUT])))
|
||||
{
|
||||
(void) fputs("asc-pl: Will not write to a TTY\n", stderr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
for (line_nm = 1; fgets(buf, BUF_LEN - 1, fp[FP_IN]) != NULL; ++line_nm)
|
||||
{
|
||||
for (bp = buf; *bp != '\0'; ++bp)
|
||||
;
|
||||
*bp = '\n';
|
||||
*(bp + 1) = '\0';
|
||||
for (bp = buf; (*bp == ' ') || (*bp == '\t'); ++bp)
|
||||
;
|
||||
if (*bp == '\n')
|
||||
continue;
|
||||
if (strchr("aclmnpsCLMNPS", *bp))
|
||||
nm_args = sscanf(bp + 1, "%d%d%d%d%d%d",
|
||||
&iarg[0], &iarg[1], &iarg[2],
|
||||
&iarg[3], &iarg[4], &iarg[5]);
|
||||
else if (strchr("ioqrvwxOQVWX", *bp))
|
||||
nm_args = sscanf(bp + 1, "%lf%lf%lf%lf%lf%lf",
|
||||
&darg[0], &darg[1], &darg[2],
|
||||
&darg[3], &darg[4], &darg[5]);
|
||||
else if (strchr("ft", *bp))
|
||||
nm_args = sscanf(bp, "%*[^\"]\"%[^\"]\"", sarg);
|
||||
|
||||
switch (*bp)
|
||||
{
|
||||
case '#':
|
||||
break;
|
||||
case 'a':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pl_arc(fp[FP_OUT], iarg[0], iarg[1], iarg[2], iarg[3],
|
||||
iarg[4], iarg[5]);
|
||||
break;
|
||||
case 'c':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pl_circle(fp[FP_OUT], iarg[0], iarg[1], iarg[2]);
|
||||
break;
|
||||
case 'l':
|
||||
if (check_syntax(*bp, 4, nm_args, line_nm))
|
||||
pl_line(fp[FP_OUT], iarg[0], iarg[1], iarg[2], iarg[3]);
|
||||
break;
|
||||
case 'm':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pl_move(fp[FP_OUT], iarg[0], iarg[1]);
|
||||
break;
|
||||
case 'n':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pl_cont(fp[FP_OUT], iarg[0], iarg[1]);
|
||||
break;
|
||||
case 'p':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pl_point(fp[FP_OUT], iarg[0], iarg[1]);
|
||||
break;
|
||||
case 's':
|
||||
if (check_syntax(*bp, 4, nm_args, line_nm))
|
||||
pl_space(fp[FP_OUT], iarg[0], iarg[1], iarg[2], iarg[3]);
|
||||
break;
|
||||
case 'C':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pl_color(fp[FP_OUT], iarg[0], iarg[1], iarg[2]);
|
||||
break;
|
||||
case 'L':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pl_3line(fp[FP_OUT], iarg[0], iarg[1], iarg[2], iarg[3],
|
||||
iarg[4], iarg[5]);
|
||||
break;
|
||||
case 'M':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pl_3move(fp[FP_OUT], iarg[0], iarg[1], iarg[2]);
|
||||
break;
|
||||
case 'N':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pl_3cont(fp[FP_OUT], iarg[0], iarg[1], iarg[2]);
|
||||
break;
|
||||
case 'P':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pl_3point(fp[FP_OUT], iarg[0], iarg[1], iarg[2]);
|
||||
break;
|
||||
case 'S':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pl_3space(fp[FP_OUT], iarg[0], iarg[1], iarg[2], iarg[3],
|
||||
iarg[4], iarg[5]);
|
||||
case 'i':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pd_circle(fp[FP_OUT], darg[0], darg[1], darg[2]);
|
||||
break;
|
||||
case 'o':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pd_move(fp[FP_OUT], darg[0], darg[1]);
|
||||
break;
|
||||
case 'q':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pd_cont(fp[FP_OUT], darg[0], darg[1]);
|
||||
break;
|
||||
case 'r':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pd_arc(fp[FP_OUT], darg[0], darg[1], darg[2], darg[3],
|
||||
darg[4], darg[5]);
|
||||
break;
|
||||
case 'v':
|
||||
if (check_syntax(*bp, 4, nm_args, line_nm))
|
||||
pd_line(fp[FP_OUT], darg[0], darg[1], darg[2], darg[3]);
|
||||
break;
|
||||
case 'w':
|
||||
if (check_syntax(*bp, 4, nm_args, line_nm))
|
||||
pd_space(fp[FP_OUT], darg[0], darg[1], darg[2], darg[3]);
|
||||
break;
|
||||
case 'x':
|
||||
if (check_syntax(*bp, 2, nm_args, line_nm))
|
||||
pd_point(fp[FP_OUT], darg[0], darg[1]);
|
||||
break;
|
||||
case 'O':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pd_3move(fp[FP_OUT], darg[0], darg[1], darg[2]);
|
||||
break;
|
||||
case 'Q':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pd_3cont(fp[FP_OUT], darg[0], darg[1], darg[2]);
|
||||
break;
|
||||
case 'V':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pd_3line(fp[FP_OUT], darg[0], darg[1], darg[2], darg[3],
|
||||
darg[4], darg[5]);
|
||||
break;
|
||||
case 'W':
|
||||
if (check_syntax(*bp, 6, nm_args, line_nm))
|
||||
pd_3space(fp[FP_OUT], darg[0], darg[1], darg[2], darg[3],
|
||||
darg[4], darg[5]);
|
||||
case 'X':
|
||||
if (check_syntax(*bp, 3, nm_args, line_nm))
|
||||
pd_3point(fp[FP_OUT], darg[0], darg[1], darg[2]);
|
||||
break;
|
||||
case 'F':
|
||||
pl_flush(fp[FP_OUT]);
|
||||
break;
|
||||
case 'e':
|
||||
pl_erase(fp[FP_OUT]);
|
||||
break;
|
||||
case 'f':
|
||||
if (check_syntax(*bp, 1, nm_args, line_nm))
|
||||
pl_linmod(fp[FP_OUT], sarg);
|
||||
break;
|
||||
case 't':
|
||||
if (check_syntax(*bp, 1, nm_args, line_nm))
|
||||
pl_label(fp[FP_OUT], sarg);
|
||||
break;
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
"Unknown PLOT3 command: '%c' (o%o) on line %d\n",
|
||||
*bp, *bp, line_nm);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void printusage (void)
|
||||
{
|
||||
(void) fputs(usage, stderr);
|
||||
}
|
||||
|
||||
static int check_syntax (char cmd, int needed, int got, int line)
|
||||
{
|
||||
if (got < needed)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
"Too few arguments for '%c' command on line %d\n", cmd, line);
|
||||
exit (1);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
.\" define new carat and tilde symbols
|
||||
.ds ^ \v'+.15v'\s+2^\s-2\v'-.15v'
|
||||
.ds ~ \v'-.1v'\s-4\(ap\s+4\v'+.1v'
|
||||
.\" \*^ and \*~ insert them into text
|
||||
.\" Define [nt]roff strings for Greek letters
|
||||
.if t .ds be \(*b
|
||||
.if n .ds be beta
|
||||
.if t .ds pi \(*p
|
||||
.if n .ds pi pi
|
||||
.if t .ds rh \(*r
|
||||
.if n .ds rh rho
|
||||
.if t .ds th \(*h
|
||||
.if n .ds th theta
|
||||
.\" Define upstart and upend macros for superscripts
|
||||
.\" to insert them, use \*(us and \*(ue, respectively
|
||||
.if t .ds us \v'-.4m'\s-3
|
||||
.if n .ds us \u
|
||||
.if t .ds ue \s0\v'.4m'
|
||||
.if n .ds ue \d
|
||||
.\" Set the interparagraph spacing to 1 (default is 0.4)
|
||||
.PD 1v
|
||||
.\"
|
||||
.\" The man page begins...
|
||||
.\"
|
||||
.TH AZEL 1 BRL-CAD
|
||||
.SH NAME
|
||||
azel \- rotate 3-D Cartesian data in azimuth and elevation
|
||||
.SH SYNOPSIS
|
||||
.BR "azel [ " options " ] [ infile [ outfile ] ]"
|
||||
.SH DESCRIPTION
|
||||
.I Azel
|
||||
converts between right-handed Cartesian coordinate systems,
|
||||
an application-geometry system
|
||||
\fIx\fR, \fIy\fR, \fIz\fR
|
||||
and a viewer-embedded system
|
||||
\fId\fR, \fIh\fR, \fIv\fR.
|
||||
These systems differ by rotation in azimuth and elevation
|
||||
about their common origin.
|
||||
Input comes from
|
||||
.I infile
|
||||
and output goes to
|
||||
.I outfile
|
||||
if they are specified, otherwise
|
||||
.I azel
|
||||
uses stdin and stdout, respectively.
|
||||
Each line of input must contain three numbers separated by
|
||||
white space.
|
||||
Unless the
|
||||
.B -i
|
||||
option (q.v.) is specified,
|
||||
.I azel
|
||||
interprets each triple as the
|
||||
\fIx\fR, \fIy\fR, \fIz\fR
|
||||
coordinates of a vector, and prints out its
|
||||
\fId\fR, \fIh\fR, \fIv\fR
|
||||
coordinates.
|
||||
Any other text on the input line beyond the triple is copied verbatim.
|
||||
.SS Options
|
||||
The command-line options and their meanings are given below.
|
||||
.TP 12
|
||||
.BI -a " azim"
|
||||
Specifies azimuthal rotation of
|
||||
.I azim
|
||||
degrees.
|
||||
Default is 0.
|
||||
.TP 12
|
||||
.BI -e " elev"
|
||||
Specifies elevation rotation of
|
||||
.I elev
|
||||
degrees.
|
||||
Default is 0.
|
||||
.TP 12
|
||||
.BI -c " celsiz"
|
||||
Specifies a cell size of
|
||||
.I celsiz.
|
||||
Output vectors are scalar multiplied by
|
||||
.RI 1/ celsiz.
|
||||
Default is 1.
|
||||
Useful with the
|
||||
.B -r
|
||||
option to bin output data into cells.
|
||||
.TP 12
|
||||
.B -i
|
||||
Causes
|
||||
.I azel
|
||||
to perform the inverse rotation.
|
||||
The input is transformed from viewer to application-geometry coordinates
|
||||
(i.e., from
|
||||
\fId\fR, \fIh\fR, \fIv\fR
|
||||
to
|
||||
\fIx\fR, \fIy\fR, \fIz\fR).
|
||||
Incompatible with the
|
||||
.B -p
|
||||
option.
|
||||
.TP 12
|
||||
.B -p
|
||||
Causes
|
||||
.I azel
|
||||
to project the output vectors onto the \fIhv\fR plane.
|
||||
This gives grid-plane coordinates.
|
||||
Incompatible with the
|
||||
.B -i
|
||||
option.
|
||||
.TP 12
|
||||
.B -r
|
||||
Causes
|
||||
.I azel
|
||||
to round each coordinate of the output vectors to the nearest integer.
|
||||
Useful with the
|
||||
.B -c
|
||||
option to bin output data into cells.
|
||||
.SH DEFINITIONS
|
||||
The viewer coordinates are defined so that
|
||||
positive \fId\fR points toward the viewer,
|
||||
positive \fIh\fR (horizontal) points to the viewer's right, and
|
||||
positive \fIv\fR (vertical) points up.
|
||||
When \fIazim\fR\ =\ \fIelev\fR\ =\ 0,
|
||||
the two coordinate systems coincide, in which case
|
||||
.I azel
|
||||
performs the identity transformation.
|
||||
Azimuth is the angle in the \fIdh\fR plane
|
||||
from positive \fIh\fR to positive \fIy\fR,
|
||||
measured toward positive \fId\fR.
|
||||
Elevation is the angle in the \fIdv\fR plane
|
||||
from positive \fIv\fR to positive \fIz\fR,
|
||||
measured toward positive \fId\fR.
|
||||
In the forward direction
|
||||
the azimuthal rotation is performed before the elevation,
|
||||
while in the inverse direction, the elevation is undone before the azimuth.
|
||||
Thus, the \fIz\fR axis is always normal to the \fIh\fR axis.
|
||||
When \fIazim\fR\ =\ 90 and \fIelev\fR\ =\ 0,
|
||||
\fIx\fR\ =\ -\fIh\fR,
|
||||
\fIy\fR\ =\ \fId\fR, and
|
||||
\fIz\fR\ =\ \fIv\fR.
|
||||
When \fIazim\fR\ =\ 0 and \fIelev\fR\ =\ 90,
|
||||
\fIx\fR\ =\ -\fIv\fR,
|
||||
\fIy\fR\ =\ \fIh\fR, and
|
||||
\fIz\fR\ =\ \fId\fR.
|
||||
.SH DIAGNOSTICS
|
||||
The exit status is 0 if all input was successfully transformed,
|
||||
1 otherwise.
|
||||
.SH AUTHOR
|
||||
Paul Tanenbaum
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
-316
@@ -1,316 +0,0 @@
|
||||
/* A Z E L . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file azel.c
|
||||
*
|
||||
* This program reads data for points in Euclidean 3-space
|
||||
* and prints out the same data, having transformed the coordinates
|
||||
* of the points according to an azimuth-elevation rotation.
|
||||
*
|
||||
* Each point in the input must be of the form:
|
||||
*
|
||||
* a b c field_1 field_2 ... field_n.
|
||||
*
|
||||
* The default behavior of the program is to interpret (a, b, c) as
|
||||
* the point (x, y, z) in unrotated coordinates and to output
|
||||
*
|
||||
* d h v field_1 field_2 ... field_n.
|
||||
*
|
||||
* where (d, h, v) are the "viewer's coordinates."
|
||||
*
|
||||
* The -p option causes the program to output the projection
|
||||
* of the point onto a plane normal to the line of sight:
|
||||
*
|
||||
* h v field_1 field_2 ... field_n.
|
||||
*
|
||||
* The -i option causes the program to invert the rotation.
|
||||
* (a, b, c) is interpreted as the point (d, h, v) in the viewer's
|
||||
* coordinates, and the point is output in derotated form:
|
||||
*
|
||||
* x y z field_1 field_2 ... field_n.
|
||||
* Author -
|
||||
* Paul J. Tanenbaum
|
||||
*
|
||||
* Source -
|
||||
* The U. S. Army Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066 USA
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "machine.h"
|
||||
|
||||
#define DEG2RAD 0.01745329 /* Convert degrees to radians */
|
||||
#define OPT_STRING "a:c:e:ipr?" /* For getopt(3) */
|
||||
#define fpeek(f) ungetc(fgetc(f), f)
|
||||
|
||||
void PrintUsage(void);
|
||||
void GetCoord(FILE *Whence, double *Coord, char Label, int LineNm, char *FileName);
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *inFname = "stdin"; /* Name of input source */
|
||||
char *outFname = "stdout"; /* Name of output destination */
|
||||
char *Label; /* Names of input coordinates */
|
||||
char Tail[1024]; /* Rest of input line beyond coords */
|
||||
extern char *optarg; /* argument from getopt(3C) */
|
||||
FILE *inPtr = stdin; /* Pointer to input */
|
||||
FILE *outPtr = stdout; /* Pointer to output */
|
||||
double Azim = 0.0; /* Azimuth angle (in degrees) */
|
||||
double Elev = 0.0; /* Elevation angle (in degrees) */
|
||||
double CelSiz = 1.0; /* Size of cells (dimensionless) */
|
||||
double Cazim; /* Cosine of the azimuth angle */
|
||||
double Celev; /* Cosine of the elevation angle */
|
||||
double Sazim; /* Sine of the azimuth angle */
|
||||
double Selev; /* Sine of the elevation angle */
|
||||
double U1; /* Input coords of current point */
|
||||
double V1; /* " " " " " */
|
||||
double W1; /* " " " " " */
|
||||
double U2; /* Output coords of current point */
|
||||
double V2; /* " " " " " */
|
||||
double W2; /* " " " " " */
|
||||
double UU; /* Weight of U1 in computing U2 */
|
||||
double UV; /* " " U1 " " V2 */
|
||||
double UW; /* " " U1 " " W2 */
|
||||
double VU; /* Weight of V1 in computing U2 */
|
||||
double VV; /* " " V1 " " V2 */
|
||||
double VW; /* " " V1 " " W2 */
|
||||
double WU; /* Weight of W1 in computing U2 */
|
||||
double WV; /* " " W1 " " V2 */
|
||||
double WW; /* " " W1 " " W2 */
|
||||
int Invert = 0; /* Undo az-el rotation? */
|
||||
int PlanarProj = 0; /* Project points onto plane? */
|
||||
int Round = 0; /* Round the output coords? */
|
||||
int LineNm = 0; /* How far through input? */
|
||||
int Ch; /* Input character */
|
||||
int i; /* Dummy variable for loop indexing */
|
||||
extern int optind; /* index from getopt(3C) */
|
||||
|
||||
/* Handle command-line options */
|
||||
while ((Ch = getopt(argc, argv, OPT_STRING)) != EOF)
|
||||
switch (Ch)
|
||||
{
|
||||
case 'a':
|
||||
if (sscanf(optarg, "%lf", &Azim) != 1)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
"Bad azimuth specification: '%s'\n", optarg);
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
if (sscanf(optarg, "%lf", &CelSiz) != 1)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
"Bad cell-size specification: '%s'\n", optarg);
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'e':
|
||||
if (sscanf(optarg, "%lf", &Elev) != 1)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
"Bad elevation specification: '%s'\n", optarg);
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
Invert = 1;
|
||||
break;
|
||||
case 'p':
|
||||
PlanarProj = 1;
|
||||
break;
|
||||
case 'r':
|
||||
Round = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Bad option '-%c'\n", Ch);
|
||||
case '?':
|
||||
PrintUsage();
|
||||
exit (Ch != '?');
|
||||
}
|
||||
|
||||
if (PlanarProj && Invert)
|
||||
{
|
||||
fputs("Incompatible options: -i and -p\n", stderr);
|
||||
PrintUsage();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Determine source and destination */
|
||||
if (argc - optind > 0)
|
||||
{
|
||||
inFname = argv[optind];
|
||||
if ((inPtr = fopen(inFname, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "azel: Cannot open file '%s'\n", inFname);
|
||||
exit(1);
|
||||
}
|
||||
if (argc - optind > 1)
|
||||
{
|
||||
outFname = argv[optind + 1];
|
||||
if ((outPtr = fopen(outFname, "w")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "azel: Cannot create file '%s'\n", outFname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (argc - optind > 2)
|
||||
{
|
||||
PrintUsage();
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute transformation coefficients */
|
||||
Cazim = cos(Azim * DEG2RAD);
|
||||
Celev = cos(Elev * DEG2RAD);
|
||||
Sazim = sin(Azim * DEG2RAD);
|
||||
Selev = sin(Elev * DEG2RAD);
|
||||
if (Invert)
|
||||
{
|
||||
UU = Celev * Cazim;
|
||||
VU = -Sazim;
|
||||
WU = -(Selev * Cazim);
|
||||
UV = Celev * Sazim;
|
||||
VV = Cazim;
|
||||
WV = -(Selev * Sazim);
|
||||
UW = Selev;
|
||||
VW = 0.0;
|
||||
WW = Celev;
|
||||
}
|
||||
else
|
||||
{
|
||||
UU = Celev * Cazim;
|
||||
VU = Celev * Sazim;
|
||||
WU = Selev;
|
||||
UV = -Sazim;
|
||||
VV = Cazim;
|
||||
WV = 0.0;
|
||||
UW = -(Selev * Cazim);
|
||||
VW = -(Selev * Sazim);
|
||||
WW = Celev;
|
||||
}
|
||||
|
||||
/* * * * * Filter Data * * * * */
|
||||
Label = Invert ? "DHV" : "XYZ";
|
||||
|
||||
while ((Ch = fpeek(inPtr)) != EOF)
|
||||
{
|
||||
/* Read U1, V1, and W1 of next point in input frame of reference */
|
||||
GetCoord(inPtr, &U1, *Label, LineNm + 1, inFname);
|
||||
GetCoord(inPtr, &V1, *(Label + 1), LineNm + 1, inFname);
|
||||
GetCoord(inPtr, &W1, *(Label + 2), LineNm + 1, inFname);
|
||||
|
||||
/* Compute U2, V2, and W2 for this point */
|
||||
U2 = (U1 * UU + V1 * VU + W1 * WU) / CelSiz;
|
||||
V2 = (U1 * UV + V1 * VV + W1 * WV) / CelSiz;
|
||||
W2 = (U1 * UW + V1 * VW + W1 * WW) / CelSiz;
|
||||
|
||||
if (Round)
|
||||
{
|
||||
U2 = floor(U2 + .5);
|
||||
V2 = floor(V2 + .5);
|
||||
W2 = floor(W2 + .5);
|
||||
}
|
||||
|
||||
/* Read in the rest of the line for subsequent dumping out */
|
||||
for (i = 0; (Ch = fgetc(inPtr)) != '\n'; i++)
|
||||
if (Ch == EOF)
|
||||
{
|
||||
Tail[i] = '\n';
|
||||
break;
|
||||
}
|
||||
else
|
||||
Tail[i] = Ch;
|
||||
Tail[i] = '\0';
|
||||
|
||||
/* Write out the filtered version of this line */
|
||||
if (! PlanarProj)
|
||||
fprintf(outPtr, "%g\t", U2);
|
||||
fprintf(outPtr, "%g\t%g\t%s\n", V2, W2, Tail);
|
||||
LineNm++;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
/* ======================================================================== */
|
||||
void
|
||||
PrintUsage (void)
|
||||
{
|
||||
fputs("Usage: 'azel [-a azim] [-e elev] [-c celsiz] [-{ip}r] [infile [outfile]]'\n", stderr);
|
||||
}
|
||||
/* ======================================================================== */
|
||||
void
|
||||
GetCoord (FILE *Whence, double *Coord, char Label, int LineNm, char *FileName)
|
||||
|
||||
/* File from which to read */
|
||||
/* Where to store coordinate */
|
||||
/* Name of coordinate */
|
||||
/* How far in input? */
|
||||
/* What input stream? */
|
||||
|
||||
{
|
||||
int Ch;
|
||||
|
||||
/* Skip leading white space */
|
||||
while (((Ch = fgetc(Whence)) == ' ') || (Ch == '\t'))
|
||||
;
|
||||
|
||||
if (ungetc(Ch, Whence) == EOF)
|
||||
{
|
||||
fprintf(stderr, "azel: Premature end-of-file, file %s\n",
|
||||
FileName);
|
||||
exit(1);
|
||||
}
|
||||
if (Ch == '\n')
|
||||
{
|
||||
fprintf(stderr, "azel: Premature end-of-line on line %d, file %s\n",
|
||||
LineNm, FileName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (fscanf(Whence, "%lf", Coord) != 1)
|
||||
{
|
||||
fprintf(stderr, "azel: Bad %c-coordinate at line %d, file %s\n",
|
||||
Label, LineNm, FileName);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,86 +0,0 @@
|
||||
.\" Set the interparagraph spacing to 1 (default is 0.4)
|
||||
.PD 1v
|
||||
.\"
|
||||
.\" The man page begins...
|
||||
.\"
|
||||
.TH BARY 1
|
||||
.SH NAME
|
||||
bary \- compute weighted sums of points
|
||||
.SH SYNOPSIS
|
||||
.BR "bary [ -nt ] [ -s " "'x y z'" " ] [ " "file" " ] "
|
||||
.SH DESCRIPTION
|
||||
.I Bary
|
||||
computes weighted sums of a set of sites in Euclidean 3-space,
|
||||
writing them on the standard output.
|
||||
The site weights are read from
|
||||
.I file
|
||||
if it is specified;
|
||||
otherwise,
|
||||
.I bary
|
||||
reads from the standard input.
|
||||
A line of input must be either
|
||||
(1) entirely white space,
|
||||
(2) white space followed by a comment (begun with the '#' character),
|
||||
or (3) white-space-separated weights, one per site.
|
||||
|
||||
By default,
|
||||
.I bary
|
||||
uses the three sites (1, 0, 0), (0, 1, 0), and (0, 0, 1).
|
||||
One or more occurences of the
|
||||
.B -s
|
||||
option cause
|
||||
.I bary
|
||||
to replace
|
||||
the default sites with all the sites
|
||||
(\fIx\fR, \fIy\fR, \fIz\fR)
|
||||
.\".RI "(" "x" ", " "y" ", " "z" ")" " " "huh?"
|
||||
so specified.
|
||||
|
||||
The
|
||||
.B -n
|
||||
option causes
|
||||
.I bary
|
||||
to normalize each tuple of weights to sum to one.
|
||||
This has the effect of computing
|
||||
barycentric combinations of the sites.
|
||||
|
||||
If any line of weights in the input stream
|
||||
contains more fields than the number of sites,
|
||||
.I bary
|
||||
will, by default,
|
||||
ignore the excess fields.
|
||||
The
|
||||
.B -t
|
||||
option causes
|
||||
.I bary
|
||||
to copy all such trailing fields verbatim onto the tail of
|
||||
the corresponding line of output.
|
||||
|
||||
.SH EXAMPLE
|
||||
The command
|
||||
|
||||
.nf
|
||||
.in +4
|
||||
bary -tn -s '0 0 0' -s '1 0 0' -s '0.5 0.866 0' <<EOF
|
||||
#------------------------------
|
||||
# x y z aux. data
|
||||
#------------------------------
|
||||
1.0 2.5 3.6 58 alpha
|
||||
0.0 1.0 2.0 37 bravo
|
||||
13.0 9.2 6.3 69 charlie delta
|
||||
EOF
|
||||
.in -4
|
||||
.fi
|
||||
|
||||
maps the triples to points in an equilateral triangle in the \fIxy\fR-plane,
|
||||
producing the following output:
|
||||
|
||||
.nf
|
||||
.in +4
|
||||
0.605634 0.439099 0 58 alpha
|
||||
0.666667 0.577333 0 37 bravo
|
||||
0.433333 0.191432 0 69 charlie delta
|
||||
.in -4
|
||||
.fi
|
||||
.SH AUTHOR
|
||||
Paul Tanenbaum
|
||||
-253
@@ -1,253 +0,0 @@
|
||||
/* B A R Y . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1995-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file bary.c
|
||||
*
|
||||
* Author -
|
||||
* Paul J. Tanenbaum
|
||||
*
|
||||
* Source -
|
||||
* The U. S. Army Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5068 USA
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (ARL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "machine.h"
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "raytrace.h"
|
||||
#include "rtlist.h"
|
||||
|
||||
struct site
|
||||
{
|
||||
struct bu_list l;
|
||||
fastf_t s_x;
|
||||
fastf_t s_y;
|
||||
fastf_t s_z;
|
||||
};
|
||||
#define SITE_NULL ((struct site *) 0)
|
||||
#define SITE_MAGIC 0x73697465
|
||||
#define s_magic l.magic
|
||||
|
||||
void print_usage (void)
|
||||
{
|
||||
#define OPT_STRING "ns:t?"
|
||||
|
||||
bu_log("Usage: 'bary [-nt] [-s \"x y z\"] [file]'\n");
|
||||
}
|
||||
|
||||
void enqueue_site (struct bu_list *sl, fastf_t x, fastf_t y, fastf_t z)
|
||||
{
|
||||
struct site *sp;
|
||||
|
||||
BU_CK_LIST_HEAD(sl);
|
||||
|
||||
sp = (struct site *) bu_malloc(sizeof(struct site), "site structure");
|
||||
sp -> s_magic = SITE_MAGIC;
|
||||
sp -> s_x = x;
|
||||
sp -> s_y = y;
|
||||
sp -> s_z = z;
|
||||
|
||||
BU_LIST_INSERT(sl, &(sp -> l));
|
||||
}
|
||||
|
||||
void show_sites (struct bu_list *sl)
|
||||
{
|
||||
struct site *sp;
|
||||
|
||||
BU_CK_LIST_HEAD(sl);
|
||||
|
||||
for (BU_LIST_FOR(sp, site, sl))
|
||||
{
|
||||
bu_log("I got a site (%g, %g, %g)\n",
|
||||
sp -> s_x, sp -> s_y, sp -> s_z);
|
||||
}
|
||||
}
|
||||
|
||||
int read_point (FILE *fp, fastf_t *c_p, int c_len, int normalize, struct bu_vls *tail)
|
||||
{
|
||||
char *cp = NULL;
|
||||
fastf_t sum;
|
||||
int i;
|
||||
int return_code = 1;
|
||||
static int line_nm = 0;
|
||||
struct bu_vls *bp;
|
||||
|
||||
for (bp = bu_vls_vlsinit(); ; bu_vls_trunc(bp, 0))
|
||||
{
|
||||
if (bu_vls_gets(bp, fp) == -1)
|
||||
{
|
||||
return_code = EOF;
|
||||
goto wrap_up;
|
||||
}
|
||||
|
||||
++line_nm;
|
||||
cp = bu_vls_addr(bp);
|
||||
|
||||
while ((*cp == ' ') || (*cp == '\t'))
|
||||
++cp;
|
||||
|
||||
if ((*cp == '#') || (*cp == '\0'))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < c_len; ++i)
|
||||
{
|
||||
char *endp;
|
||||
|
||||
c_p[i] = strtod(cp, &endp);
|
||||
if (endp == cp)
|
||||
{
|
||||
bu_log("Illegal input at line %d: '%s'\n",
|
||||
line_nm, bu_vls_addr(bp));
|
||||
exit (1);
|
||||
}
|
||||
cp = endp;
|
||||
}
|
||||
|
||||
if (normalize)
|
||||
{
|
||||
sum = 0.0;
|
||||
for (i = 0; i < c_len; ++i)
|
||||
sum += c_p[i];
|
||||
for (i = 0; i < c_len; ++i)
|
||||
c_p[i] /= sum;
|
||||
}
|
||||
goto wrap_up;
|
||||
}
|
||||
|
||||
wrap_up:
|
||||
if ((return_code == 1) && (tail != 0))
|
||||
{
|
||||
bu_vls_trunc(tail, 0);
|
||||
bu_vls_strcat(tail, cp);
|
||||
}
|
||||
bu_vls_vlsfree(bp);
|
||||
return (return_code);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *inf_name;
|
||||
int ch;
|
||||
int i;
|
||||
int nm_sites;
|
||||
int normalize = 0; /* Make all weights sum to one? */
|
||||
fastf_t *coeff;
|
||||
fastf_t x, y, z;
|
||||
FILE *infp;
|
||||
struct bu_list site_list;
|
||||
struct bu_vls *tail_buf = 0;
|
||||
struct site *sp;
|
||||
|
||||
BU_LIST_INIT(&site_list);
|
||||
while ((ch = bu_getopt(argc, argv, OPT_STRING)) != EOF)
|
||||
switch (ch)
|
||||
{
|
||||
case 'n':
|
||||
normalize = 1;
|
||||
break;
|
||||
case 's':
|
||||
if (sscanf(bu_optarg, "%lf %lf %lf", &x, &y, &z) != 3)
|
||||
{
|
||||
bu_log("Illegal site: '%s'\n", bu_optarg);
|
||||
print_usage();
|
||||
exit (1);
|
||||
}
|
||||
enqueue_site(&site_list, x, y, z);
|
||||
break;
|
||||
case 't':
|
||||
if (tail_buf == 0) /* Only initialize it once */
|
||||
tail_buf = bu_vls_vlsinit();
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
print_usage();
|
||||
exit (ch != '?');
|
||||
}
|
||||
|
||||
switch (argc - bu_optind)
|
||||
{
|
||||
case 0:
|
||||
inf_name = "stdin";
|
||||
infp = stdin;
|
||||
break;
|
||||
case 1:
|
||||
inf_name = argv[bu_optind++];
|
||||
if ((infp = fopen(inf_name, "r")) == NULL)
|
||||
{
|
||||
bu_log ("Cannot open file '%s'\n", inf_name);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print_usage();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (BU_LIST_IS_EMPTY(&site_list))
|
||||
{
|
||||
enqueue_site(&site_list, (fastf_t) 1.0, (fastf_t) 0.0, (fastf_t) 0.0);
|
||||
enqueue_site(&site_list, (fastf_t) 0.0, (fastf_t) 1.0, (fastf_t) 0.0);
|
||||
enqueue_site(&site_list, (fastf_t) 0.0, (fastf_t) 0.0, (fastf_t) 1.0);
|
||||
}
|
||||
|
||||
nm_sites = 0;
|
||||
for (BU_LIST_FOR(sp, site, &site_list))
|
||||
++nm_sites;
|
||||
|
||||
coeff = (fastf_t *)
|
||||
bu_malloc(nm_sites * sizeof(fastf_t), "coefficient array");
|
||||
|
||||
while (read_point(infp, coeff, nm_sites, normalize, tail_buf) != EOF)
|
||||
{
|
||||
x = y = z = 0.0;
|
||||
i = 0;
|
||||
for (BU_LIST_FOR(sp, site, &site_list))
|
||||
{
|
||||
x += sp -> s_x * coeff[i];
|
||||
y += sp -> s_y * coeff[i];
|
||||
z += sp -> s_z * coeff[i];
|
||||
++i;
|
||||
}
|
||||
bu_flog(stdout, "%g %g %g", x, y, z);
|
||||
if (tail_buf)
|
||||
bu_flog(stdout, "%s", bu_vls_addr(tail_buf));
|
||||
bu_flog(stdout, "\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,92 +0,0 @@
|
||||
/* B I N F O . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2002-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file binfo.c
|
||||
* G 2 A S C . C
|
||||
*
|
||||
*
|
||||
* Usage: binfo
|
||||
*
|
||||
* Author -
|
||||
* Charles M Kennedy
|
||||
* Christopher Sean Morrison
|
||||
*
|
||||
* Source -
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "machine.h"
|
||||
#include "vmath.h"
|
||||
#include "db.h"
|
||||
#include "raytrace.h"
|
||||
#include "wdb.h"
|
||||
#include "rtgeom.h"
|
||||
#include "tcl.h"
|
||||
|
||||
extern const char bu_version[];
|
||||
extern const char bn_version[];
|
||||
extern const char rt_version[];
|
||||
extern const char fb_version[];
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: binfo \
|
||||
returns information about the BRL-CAD runtime environment characteristics\n\
|
||||
";
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 0) {
|
||||
printf("%s", usage);
|
||||
}
|
||||
|
||||
printf("binfo: bu_version=[%s]\n", bu_version);
|
||||
printf("binfo: bn_version=[%s]\n", bn_version);
|
||||
#if 0
|
||||
printf("binfo: rt_version=[%s]\n", rt_version);
|
||||
#endif
|
||||
printf("binfo: fb_version=[%s]\n", fb_version);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,364 +0,0 @@
|
||||
.TH BRLCAD 1 BRL-CAD
|
||||
.SH NAME
|
||||
brlcad \- BRL CAD programs for solid modeling, raytracing,
|
||||
graphics, and image processing
|
||||
.SH DESCRIPTION
|
||||
The BRL CAD Distribution contains many directories of materials.
|
||||
The major categories of programs are:
|
||||
.TP
|
||||
.B mged
|
||||
A multi-device interactive editor for constructing and updating
|
||||
combinatorial solid geometry (CSG)
|
||||
models.
|
||||
See
|
||||
.IR mged (1),
|
||||
and
|
||||
\fIUnderstanding the Preparation and Analysis of Solid Models\fR
|
||||
by Michael John Muuss (enclosed, in the ``paper'') directory.
|
||||
.TP
|
||||
.B librt
|
||||
A library of functions suitable for interogation of a
|
||||
CSG solid model, utilizing ray-tracing techniques.
|
||||
See
|
||||
.IR librt (3).
|
||||
.TP
|
||||
.B rt
|
||||
A ray-tracing lighting model, for rendering pictures of
|
||||
.IR mged (1)
|
||||
CSG models.
|
||||
See
|
||||
.IR rt (1),
|
||||
.IR rtray (1),
|
||||
.IR rtpp (1).
|
||||
.TP
|
||||
.B conv
|
||||
Programs to convert
|
||||
.IR mged (1)
|
||||
and
|
||||
.IR pix (3)
|
||||
format binary files to a portable ASCII form, and back again.
|
||||
See
|
||||
.IR asc2g (1),
|
||||
.IR asc2pix (1),
|
||||
.IR conv-vg2g (1),
|
||||
.IR g2asc (1),
|
||||
.IR pix2asc (1).
|
||||
.TP
|
||||
.B libpkg
|
||||
A ``message-passing'' interface layered on top of TCP network links,
|
||||
to ease construction of network-distributed applications.
|
||||
.TP
|
||||
.B libfb
|
||||
A generic frame-buffer library which includes
|
||||
support for a number of display devices,
|
||||
as well as file, network, and debugging interfaces.
|
||||
Most programs which use this library have the letters ``fb''
|
||||
in their names. To override your system default frame-buffer,
|
||||
the environment variable
|
||||
.B
|
||||
.SM FB_FILE
|
||||
can be set. In addition, some commands also support a
|
||||
.B \-F
|
||||
.I framebuffer
|
||||
option.
|
||||
Note that the disk file format of
|
||||
.I libfb
|
||||
is that of
|
||||
.IR pix (5),
|
||||
allowing ``framebuffer'' files to be later processed by
|
||||
any of the ``pix'' family of programs.
|
||||
See
|
||||
.IR libfb (3),
|
||||
.IR pix-fb (3),
|
||||
.IR pix (5),
|
||||
etc.
|
||||
.TP
|
||||
.B rfbd
|
||||
TCP-based network server which implements remote frame-buffer services.
|
||||
.TP
|
||||
.B libsysv
|
||||
Some System-V compatability routines
|
||||
.TP
|
||||
.B libtermio
|
||||
A library to handle terminal mode setting
|
||||
on both Berkeley or SystemV machines.
|
||||
.TP
|
||||
.B libplot3
|
||||
A public-domain version of the UNIX-Plot library
|
||||
which differs from that of the standard
|
||||
.IR libplot (3),
|
||||
by the addition of 3-D primatives, color, floating point
|
||||
coordinate routines, and the use of a file pointer parameter.
|
||||
See
|
||||
.IR libplot3 (3),
|
||||
.IR plot3 (5).
|
||||
.TP
|
||||
.B librle
|
||||
A Run-Length-Encoding (RLE) library,
|
||||
providing functions
|
||||
originally from the University of Utah in a library package.
|
||||
Note that the current version of this library reads
|
||||
Edition-3 RLE files.
|
||||
[Edition-1 and Edition-2 RLE files can be read and written
|
||||
with the
|
||||
.B liborle
|
||||
and
|
||||
.B orle
|
||||
programs.]
|
||||
See
|
||||
.IR rle-fb (1),
|
||||
.IR fb-rle (1),
|
||||
.IR rle-pix (1),
|
||||
.IR pix-rle (1),
|
||||
.IR librle (3).
|
||||
.TP
|
||||
.B util
|
||||
A collection of image-handling utilities,
|
||||
each constructed as individual tools intended to be used in combination.
|
||||
See
|
||||
.IR ap-pix (1),
|
||||
.IR bw-fb (1),
|
||||
.IR bw-imp (1),
|
||||
.IR bw-pix (1),
|
||||
.IR bw3-pix (1),
|
||||
.IR bwcrop (1),
|
||||
.IR bwdiff (1),
|
||||
.IR bwfilter (1),
|
||||
.IR bwhist (1),
|
||||
.IR bwmod (1),
|
||||
.IR bwrect (1),
|
||||
.IR bwrot (1),
|
||||
.IR bwscale (1),
|
||||
.IR bwstat (1),
|
||||
.IR dunncolor (1),
|
||||
.IR dunnsnap (1),
|
||||
.IR fb-bw (1),
|
||||
.IR fb-pix (1),
|
||||
.IR fb-rle (1),
|
||||
.IR fbanim (1),
|
||||
.IR fbclear (1),
|
||||
.IR fbcmap (1),
|
||||
.IR fbcmrot (1),
|
||||
.IR fbcolor (1),
|
||||
.IR fbframe (1),
|
||||
.IR fbgrid (1),
|
||||
.IR fbpoint (1),
|
||||
.IR fbzoom (1),
|
||||
.IR gencolor (1),
|
||||
.IR loop (1),
|
||||
.IR pix-bw (1),
|
||||
.IR pix-bw3 (1),
|
||||
.IR pix-fb (1),
|
||||
.IR pixbackgnd (1),
|
||||
.IR pixbustup (1),
|
||||
.IR pixdiff (1),
|
||||
.IR pixfilter (1),
|
||||
.IR pixhist (1),
|
||||
.IR pixhist3d-pl (1),
|
||||
.IR pixhist3d (1),
|
||||
.IR pixinterp2x (1),
|
||||
.IR pixrect (1),
|
||||
.IR pixrot (1),
|
||||
.IR pixscale (1),
|
||||
.IR pixstat (1),
|
||||
.IR pixtile (1),
|
||||
.IR pl-fb (1),
|
||||
.IR pp-fb (1),
|
||||
.IR rle-fb (1),
|
||||
.IR rle-pix (1),
|
||||
.IR wavelet (1),
|
||||
.IR bw (5),
|
||||
.IR pix (5),
|
||||
.IR plot3 (5).
|
||||
.TP
|
||||
.B fbed
|
||||
An interactive, termcap-based frame-buffer image editor.
|
||||
See
|
||||
.IR fbed (1).
|
||||
.TP
|
||||
.B vdeck
|
||||
A program to convert
|
||||
.I mged(1)
|
||||
models to
|
||||
.I gift(1)
|
||||
format card deck files.
|
||||
See
|
||||
.IR vdeck (1).
|
||||
.PD
|
||||
.SH FB_FILE
|
||||
Whenever a framebuffer is needed, and the
|
||||
.B \-F
|
||||
option has not been specified, the environment variable
|
||||
.B
|
||||
.SM FB_FILE
|
||||
is checked for the device to use. The format of this
|
||||
variable is either
|
||||
.IB [hostname:] /dev/ device_name[num]
|
||||
or
|
||||
.I UNIX_path ,
|
||||
the pathname of a disk file to be used as a ``virtual framebuffer.''
|
||||
.I Hostname
|
||||
is the name of a remote machine if the remote framebuffer interface
|
||||
is being used.
|
||||
When a local display device is being specified, the
|
||||
.I hostname
|
||||
should not be specified, for performance reasons; just the
|
||||
special string
|
||||
.I Device_name
|
||||
is used to select a particular type of framebuffer.
|
||||
.I Num
|
||||
is type dependent and can either mean a display number or select
|
||||
some options for that type.
|
||||
Note that for security reasons, it is not permitted to access a
|
||||
disk file via the remote interface.
|
||||
.PP
|
||||
If
|
||||
.B
|
||||
.SM FB_FILE
|
||||
is not set, the default for you system will be used.
|
||||
.PP
|
||||
The use of
|
||||
.B /dev/
|
||||
before the
|
||||
.I device_name
|
||||
is simply to distinguish them from filenames. See the end of the
|
||||
.IR libfb (3)
|
||||
manual page for a list of the device names and the meanings of
|
||||
any
|
||||
.I num
|
||||
parameters they may take, and for a more detailed discussion.
|
||||
.SH OPTIONS
|
||||
A convention exists for the options used on
|
||||
most of the utilities provided.
|
||||
Random options are usually lower case.
|
||||
Options which could specify either a screen or file size
|
||||
are, by convention, lower case for file information,
|
||||
and upper case for screen information.
|
||||
Here's a list of some of the common options you may encounter:
|
||||
.TP
|
||||
.B \-h
|
||||
The ``high resolution'' flag, increasing the default screen and file
|
||||
size of 512x512
|
||||
to 1024x1024. Has same effect as
|
||||
.B \-s 1024 \-S 1024
|
||||
but exists as a convienient shorthand held over from the simple days
|
||||
when framebuffers where square, and only came in two resolutions.
|
||||
This historical usage unfortunately prempts this letter from use
|
||||
as a height specifier, forcing that function to relocate under
|
||||
protest to
|
||||
.BR \-n ,
|
||||
which can be thought of as ``number of scanlines'', which isn't
|
||||
too bad a mnemonic.
|
||||
.TP
|
||||
.B \-i
|
||||
Inverse flag. Pretend origin is in upper left corner of screen,
|
||||
for that good old-fashioned fourth-quadrant behavior.
|
||||
.TP
|
||||
.B \-c
|
||||
Various. Typically means clear the screen first.
|
||||
.TP
|
||||
.B \-z
|
||||
Various. Typically means zoom-in on current area of display.
|
||||
.TP
|
||||
.BI \-s\ square_file_size
|
||||
.B WARNING:
|
||||
Behavior is undefined when the
|
||||
.B \-s
|
||||
flag is used in conjunction with the
|
||||
.BR \-w\ or\ \-n
|
||||
flags.
|
||||
.TP
|
||||
.BI \-w\ file_width
|
||||
.TP
|
||||
.BI \-n\ file_height
|
||||
.TP
|
||||
.BI \-S\ square_screen_size
|
||||
.B WARNING:
|
||||
Behavior is undefined when the
|
||||
.B \-S
|
||||
flag is used in conjunction with the
|
||||
.BR \-W\ or\ \-N
|
||||
flags.
|
||||
.TP
|
||||
.BI \-W\ screen_width
|
||||
.TP
|
||||
.BI \-N\ screen_height
|
||||
.TP
|
||||
.BI \-x\ file_x_offset
|
||||
.TP
|
||||
.BI \-y\ file_y_offset
|
||||
.TP
|
||||
.BI \-X\ screen_x_offset
|
||||
.TP
|
||||
.BI \-Y\ screen_y_offset
|
||||
.TP
|
||||
.BI \-#\ bytes_per_sample
|
||||
specifies the number of bytes per sample, where the
|
||||
flag, where the
|
||||
.B #
|
||||
character is a literal ``pound'' or ``sharp'' sign character,
|
||||
typically found over the numeral ``3'' on ANSI keyboards.
|
||||
Several programs (like pixrect)
|
||||
can operate on data samples of arbitrary width.
|
||||
For example, a
|
||||
.BR pix (5)
|
||||
format file can often be treated like a
|
||||
.BR bw (5)
|
||||
format file with a width of three bytes per sample.
|
||||
.SH "TAPE FORMAT"
|
||||
When dealing with large collections of images, as might be
|
||||
needed for making a movie,
|
||||
it frequently becomes desirable to deal with magnetic tapes.
|
||||
Some of the early
|
||||
.BR pix (5)
|
||||
tools contained built-in knowledge of the tape format.
|
||||
While this aberrant early design has been corrected
|
||||
in favor of using tape-oriented programs such as
|
||||
.BR dd (1)
|
||||
in pipelines with the image tools, our ``standard''
|
||||
image format remains.
|
||||
.PP
|
||||
Regardless of image resolution, all tape records are 24k bytes long.
|
||||
If an image does not occupy an integral number of tape records,
|
||||
the last record is padded out.
|
||||
For example, NTSC images in 640x480 format use
|
||||
37.5 records per image.
|
||||
The
|
||||
.IR files-tape (1)
|
||||
utility is helpful in performing this function.
|
||||
.PP
|
||||
The capacity of an averate 2400 foot reel of tape at 6250 is 6144 records
|
||||
of 24k bytes each.
|
||||
For the various combinations of density and image resolution,
|
||||
a convention for the number of frames/reel exists:
|
||||
.br
|
||||
Density\ \ Resolution\ \ Frames/reel
|
||||
.br
|
||||
\ 6250\ \ \ \ \ \ \ \ 1k\ \ \ \ \ \ \ \ \ \ 48
|
||||
.br
|
||||
\ 6250\ \ \ \ \ \ 640x480\ \ \ \ \ \ 160
|
||||
.br
|
||||
\ 6250\ \ \ \ \ \ \ 512\ \ \ \ \ \ \ \ \ 192
|
||||
.br
|
||||
\ 1600\ \ \ \ \ \ \ \ 1k\ \ \ \ \ \ \ \ \ \ 12
|
||||
.br
|
||||
\ 1600\ \ \ \ \ \ \ 512\ \ \ \ \ \ \ \ \ 48
|
||||
.SH "FILES"
|
||||
At BRL, the software is installed in the directories:
|
||||
.br
|
||||
/usr/brlcad/bin
|
||||
/usr/brlcad/lib
|
||||
/usr/brlcad/etc
|
||||
.br
|
||||
The master source tree resides on the machine SPARK.ARL.ARMY.MIL:
|
||||
/m/cad
|
||||
.B
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005-5066
|
||||
.SH BUG REPORTS
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,37 +0,0 @@
|
||||
.TH BUFFER 1 BRL-CAD
|
||||
.SH NAME
|
||||
buffer \- buffer data from stdin until EOF, then write to stdout
|
||||
.SH SYNOPSIS
|
||||
.B buffer
|
||||
.SH DESCRIPTION
|
||||
.I Buffer\^
|
||||
is intended to be use as part of a complex pipeline.
|
||||
It serves somewhat the same purpose as the Prolog "cut" operator.
|
||||
Data from stdin is read and buffered until EOF is detected, and then
|
||||
all the buffered data is written to stdout. An arbitrary amount of
|
||||
data may need to be buffered, so a combination of a 1 Mbyte memory buffer
|
||||
and a temporary file is used.
|
||||
This can be useful when context switching may need to be reduced,
|
||||
because of too many processes competing at the same time.
|
||||
This can also be useful when processing data from and to the
|
||||
same framebuffer with a pipeline, without interfering.
|
||||
.SH EXAMPLES
|
||||
\fI
|
||||
.nf
|
||||
munch | crunch | buffer | grind | package
|
||||
fb-pix | pixfilter -flo | buffer | pix-fb
|
||||
.fi
|
||||
\fP
|
||||
.SH FILES
|
||||
/usr/tmp/bufferXXXXXX
|
||||
.SH AUTHOR
|
||||
Michael John Muuss
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,167 +0,0 @@
|
||||
/* B U F F E R . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 2004-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file buffer.c
|
||||
*
|
||||
* This program is intended to be use as part of a complex pipeline.
|
||||
* It serves somewhat the same purpose as the Prolog "cut" operator.
|
||||
* Data from stdin is read and buffered until EOF is detected, and then
|
||||
* all the buffered data is written to stdout. An arbitrary amount of
|
||||
* data may need to be buffered, so a combination of a 1 Mbyte memory buffer
|
||||
* and a temporary file is used.
|
||||
*
|
||||
* The use of read() and write() is prefered over fread() and fwrite()
|
||||
* for reasons of efficiency, given the large buffer size in use.
|
||||
*
|
||||
* Author -
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int mread(int fd, char *bufp, int n );
|
||||
|
||||
char template[] = "/usr/tmp/bufferXXXXXX";
|
||||
|
||||
#define SIZE (1024*1024)
|
||||
|
||||
char buf[SIZE];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
register int count;
|
||||
register int tfd;
|
||||
|
||||
if( (count = mread(0, buf, sizeof(buf))) < sizeof(buf) ) {
|
||||
if( count < 0 ) {
|
||||
perror("buffer: mem read");
|
||||
exit(1);
|
||||
}
|
||||
/* Entire input sequence fit into buf */
|
||||
if( write(1, buf, count) != count ) {
|
||||
perror("buffer: stdout write 1");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Create temporary file to hold data, get r/w file descriptor */
|
||||
(void)mkstemp( template );
|
||||
if( (tfd = creat( template, 0600 )) < 0 ) {
|
||||
perror(template);
|
||||
exit(1);
|
||||
}
|
||||
(void)close(tfd);
|
||||
if( (tfd = open( template, 2 )) < 0 ) {
|
||||
perror(template);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Stash away first buffer full */
|
||||
if( write(tfd, buf, count) != count ) {
|
||||
perror("buffer: tmp write1");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Continue reading and writing additional buffer loads to temp file */
|
||||
while( (count = mread(0, buf, sizeof(buf))) > 0 ) {
|
||||
if( write(tfd, buf, count) != count ) {
|
||||
perror("buffer: tmp write2");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if( count < 0 ) {
|
||||
perror("buffer: read");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* All input read, regurgitate it all on stdout */
|
||||
if( lseek( tfd, 0L, 0 ) < 0 ) {
|
||||
perror("buffer: lseek");
|
||||
goto err;
|
||||
}
|
||||
while( (count = mread(tfd, buf, sizeof(buf))) > 0 ) {
|
||||
if( write(1, buf, count) != count ) {
|
||||
perror("buffer: stdout write 2");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if( count < 0 ) {
|
||||
perror("buffer: tmp read");
|
||||
goto err;
|
||||
}
|
||||
(void)unlink(template);
|
||||
exit(0);
|
||||
|
||||
err:
|
||||
(void)unlink(template);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* M R E A D
|
||||
*
|
||||
* This function performs the function of a read(II) but will
|
||||
* call read(II) multiple times in order to get the requested
|
||||
* number of characters. This can be necessary because pipes
|
||||
* and network connections don't deliver data with the same
|
||||
* grouping as it is written with. Written by Robert S. Miles, BRL.
|
||||
*/
|
||||
int
|
||||
mread(int fd, register char *bufp, int n)
|
||||
{
|
||||
register int count = 0;
|
||||
register int nread;
|
||||
|
||||
do {
|
||||
nread = read(fd, bufp, (unsigned)n-count);
|
||||
if(nread < 0) {
|
||||
perror("buffer: mread");
|
||||
return(-1);
|
||||
}
|
||||
if(nread == 0)
|
||||
return((int)count);
|
||||
count += (unsigned)nread;
|
||||
bufp += nread;
|
||||
} while(count < n);
|
||||
|
||||
return((int)count);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
-163
@@ -1,163 +0,0 @@
|
||||
/* B W - A . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1986-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file bw-a.c
|
||||
*
|
||||
*
|
||||
* Convert a bw file into an ASCII bitmap.
|
||||
*
|
||||
* The output of bw-a can be feed to the X11 program atobm to generated
|
||||
* a bitmap that X11 programs can use.
|
||||
*
|
||||
* It is assumed that the file is in inverse order.
|
||||
*
|
||||
* A translation sequence might be:
|
||||
* pix-fb -w1280 -n960 -i -Fimage.pixi image.pix # flip image.
|
||||
* pix-bw image.pixi | halftone -R -S -w1280 -n960 | \
|
||||
* bw-a -w1280 -n960 | atobm -name image.bm >image.bm
|
||||
*
|
||||
* Author -
|
||||
* Christopher T. Johnson - January 28, 1991
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "$Header$";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
|
||||
static int file_width = 512;
|
||||
static int autosize = 0;
|
||||
static char *file_name;
|
||||
static FILE *infp;
|
||||
static int fileinput = 0;
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: bw-a [a] [-s squarefilesize] [-w file_width] [-n file_height]\n\
|
||||
[file.bw]\n";
|
||||
|
||||
int
|
||||
get_args(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c=getopt(argc, argv, "as:w:n:")) != EOF ) {
|
||||
switch(c) {
|
||||
case 'a':
|
||||
autosize = 1;
|
||||
break;
|
||||
case 's':
|
||||
file_width = atoi(optarg);
|
||||
autosize = 0;
|
||||
break;
|
||||
case 'n':
|
||||
autosize = 0;
|
||||
break;
|
||||
case 'w':
|
||||
file_width = atoi(optarg);
|
||||
autosize = 0;
|
||||
break;
|
||||
default: /* '?' */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind >= argc ) {
|
||||
if (isatty(fileno(stdin)) ) return(0);
|
||||
file_name = "-";
|
||||
infp = stdin;
|
||||
} else {
|
||||
file_name = argv[optind];
|
||||
if ((infp = fopen(file_name, "r")) == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
"bw-a: cannot open \"%s\" for reading\n",
|
||||
file_name);
|
||||
return(0);
|
||||
}
|
||||
fileinput++;
|
||||
}
|
||||
|
||||
if (argc > ++optind) {
|
||||
(void) fprintf(stderr, "bw-a: excess argument(s) ignored\n");
|
||||
}
|
||||
return(1); /* OK */
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int cur_width = 0;
|
||||
int cur_height = 0;
|
||||
|
||||
if ( !get_args(argc, argv)) {
|
||||
(void) fputs(usage, stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* autosize the input? */
|
||||
if (fileinput && autosize) {
|
||||
int w, h;
|
||||
if ( bn_common_file_size(&w, &h, file_name, 1) ) {
|
||||
file_width = w;
|
||||
} else {
|
||||
fprintf(stderr, "bw-a: unable to autosize\n");
|
||||
}
|
||||
}
|
||||
|
||||
while ((c=getc(infp)) != EOF) {
|
||||
if (c < 127) {
|
||||
putchar('#');
|
||||
} else {
|
||||
putchar('-');
|
||||
}
|
||||
if (++cur_width >= file_width) {
|
||||
putchar('\n');
|
||||
cur_width=0;
|
||||
cur_height++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,112 +0,0 @@
|
||||
.TH BW-IMP 1 BRL-CAD
|
||||
.SH NAME
|
||||
bw\(hyimp \- convert a black and white bw image file to imPRESS bitmap
|
||||
.SH SYNOPSIS
|
||||
.B bw-imp
|
||||
.RB [ \-Dh ]
|
||||
.RB [ \-s\ squaresize]
|
||||
.RB [ \-w\ width]
|
||||
.RB [ \-n\ height]
|
||||
.RB [ \-t\ thresh]
|
||||
.RB [ \-X\ page_xoff]
|
||||
.RB [ \-Y\ page_yoff]
|
||||
[file]
|
||||
.SH DESCRIPTION
|
||||
.I Bw-imp
|
||||
converts an 8-bit monochrome
|
||||
.IR bw (5)
|
||||
format
|
||||
.I file
|
||||
(read from the standard input if not specified)
|
||||
to
|
||||
.I Imagen imPRESS
|
||||
language codes
|
||||
for plotting a gray-scale image on a 300dpi
|
||||
.I Imagen
|
||||
laser printer.
|
||||
.PP
|
||||
The gray level is plotted on the
|
||||
.I Imagen
|
||||
as a small pattern of dots,
|
||||
by default using ``ordered dither'',
|
||||
magnifying each input pixel into multiple output pixels.
|
||||
The
|
||||
.B \-D
|
||||
option causes the gray levels to instead be plotted using halftones,
|
||||
as in newspaper/magazine reproductions of photographs.
|
||||
The
|
||||
.B \-t
|
||||
option turns off the dithering, and uses the supplied integer value
|
||||
as a threshold value.
|
||||
Input pixels with magnitude >= thresh are output as white,
|
||||
otherwise they are output as black.
|
||||
Each input pixel produces exactly one output pixel.
|
||||
If the input file is already bi-level, such as might be produced by the
|
||||
.IR haltfone (1)
|
||||
program, then this is the option to be used.
|
||||
.P
|
||||
The
|
||||
.B \-h
|
||||
option specifies a 1024x1024 image rather than the default of 512x512.
|
||||
Printing is done in portrait mode.
|
||||
The largest image which can generally be printed on an 8.5 by 11 inch
|
||||
piece of paper is 2240 by 3200 pixels,
|
||||
and the default page offsets are calculated for this size.
|
||||
For smaller images, such as 512 squared,
|
||||
.BR \-X 750
|
||||
and
|
||||
.BR \-Y 1200
|
||||
produce the image roughly centered on the page.
|
||||
.SH CAVEATS
|
||||
.I Bw-imp
|
||||
will take several CPU-minutes (on a VAX 780) to convert a single
|
||||
.IR file .
|
||||
.SH EXAMPLES
|
||||
The following invocations are fairly typical:
|
||||
.RS
|
||||
\fIpix-bw\| -ntsc\| image.pix\| | \|bw-imp\| | \| qpr \|\-qi300\fP \|&
|
||||
.RE
|
||||
.sp
|
||||
.RS
|
||||
\fIrle-pix\| image.rle\| | \|pix-bw\| -ntsc\| | \|bw-imp\| | \|qpr \|\-qi300\fP \|&
|
||||
.RE
|
||||
.sp
|
||||
The X and Y options in the bw-imp command below are to approximately
|
||||
center a 1024x1024 or 512x512
|
||||
figure on a 8.5 by 11 inch sheet of paper.
|
||||
As of release 4.0 the default margins on an output page resulting from
|
||||
a bw-imp usage are smaller. This allows a larger image to be printed
|
||||
on one page.
|
||||
.RS
|
||||
\fIrle-pix\| image.rle\| | \|pix-bw\| -ntsc\| | \|bw-imp -X 200 -Y 800\| | \|ipr -L impress -q i300 \fP
|
||||
.RE
|
||||
.sp
|
||||
To threshold and invert the black/white sense of a pix file, use:
|
||||
.RS
|
||||
\fIbwmod\| -m\| -8\| -a\| 255\| image.pix\| | \|pix-bw\| | \|bw-imp\| -t1\| |
|
||||
ttcp\| -t\| -p35 printhost \fP
|
||||
.RE
|
||||
.sp
|
||||
To use the halftone package:
|
||||
.RS
|
||||
\fIpix-bw\| -ntsc\| image.pix\| | \|haftone\| | \|bw-imp\| | \| qpr \|\-qi300\fP \|&
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
rle-pix(1), pix-bw(1), bw(5), pix(5)
|
||||
.SH DIAGNOSTICS
|
||||
Error messages are intended to be self-explanatory.
|
||||
.SH AUTHORS
|
||||
Geoffrey Cooper, Imagen Corporation
|
||||
.br
|
||||
Douglas A. Gwyn, BRL
|
||||
.br
|
||||
Michael John Muuss, BRL
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,342 +0,0 @@
|
||||
/* B W - I M P . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1986-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file bw-imp.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* B W - I M P . C
|
||||
*
|
||||
* Authors -
|
||||
* Douglas A. Gwyn
|
||||
* Michael John Muuss
|
||||
*
|
||||
* Borrows heavily from Steve Hawley's & Geoffrey Cooper's
|
||||
* "traceconv" program.
|
||||
*
|
||||
* Notes -
|
||||
* The image is printed upside down to simplify the arithmetic,
|
||||
* due to the organization of the input file.
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "machine.h"
|
||||
|
||||
typedef int bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
static int halftone[8][8] = /* halftone pattern */
|
||||
{
|
||||
{6, 7, 8, 9, 10, 11, 12, 13},
|
||||
{40, 42, 44, 46, 49, 51, 54, 14},
|
||||
{37, 112, 118, 124, 130, 137, 57, 15},
|
||||
{36, 106, 208, 219, 230, 145, 60, 16},
|
||||
{34, 101, 197, 254, 243, 152, 63, 17},
|
||||
{32, 96, 187, 178, 169, 160, 66, 18},
|
||||
{30, 91, 86, 82, 78, 74, 70, 19},
|
||||
{29, 27, 26, 25, 23, 22, 21, 20}
|
||||
};
|
||||
|
||||
static int dither[8][8] = /* dither pattern */
|
||||
{
|
||||
{6, 51, 14, 78, 8, 57, 16, 86},
|
||||
{118, 22, 178, 34, 130, 25, 197, 37},
|
||||
{18, 96, 10, 63, 20, 106, 12, 70},
|
||||
{219, 42, 145, 27, 243, 46, 160, 30},
|
||||
{9, 60, 17, 91, 7, 54, 15, 82},
|
||||
{137, 26, 208, 40, 124, 23, 187, 36},
|
||||
{21, 112, 13, 74, 19, 101, 11, 66},
|
||||
{254, 49, 169, 32, 230, 44, 152, 29}
|
||||
};
|
||||
|
||||
static int (*pattern)[8] = dither; /* -> dither or halftone */
|
||||
|
||||
static FILE *infp; /* input file handle */
|
||||
static char *file_name = "-"; /* name of input file, for banner */
|
||||
|
||||
static int height; /* input height */
|
||||
static int width; /* input width */
|
||||
|
||||
static int thresh = -1; /* Threshold */
|
||||
|
||||
static int page_xoff = 150; /* 150=0.5", 192=0.75" */
|
||||
static int page_yoff = 80; /* 80=0.25", 544=1.75" */
|
||||
|
||||
#define MAXWIDTH 2600
|
||||
long swath[32][MAXWIDTH/32]; /* assumes long has 32 bits */
|
||||
unsigned char line[MAXWIDTH]; /* grey-scale input buffer */
|
||||
|
||||
static int im_mag; /* magnification (1, 2 or 4) */
|
||||
static int im_width; /* image size (in Imagen dots) */
|
||||
static int im_wpatches; /* # 32-bit patches width */
|
||||
static int im_hpatches; /* # 32-bit patches height */
|
||||
|
||||
bool get_args(int argc, register char **argv);
|
||||
bool im_close(void);
|
||||
bool im_header(void);
|
||||
void im_write(int y);
|
||||
|
||||
char usage[] = "\
|
||||
Usage: bw-imp [-h -D] [-s squaresize] [-w width] [-n height]\n\
|
||||
[-X page_xoff] [-Y page_yoff] [-t thresh] [file.bw] > impress\n";
|
||||
|
||||
bool
|
||||
get_args(int argc, register char **argv)
|
||||
{
|
||||
register int c;
|
||||
|
||||
while ( (c = getopt( argc, argv, "hDs:n:w:t:X:Y:" )) != EOF ) {
|
||||
switch( c ) {
|
||||
case 'h':
|
||||
/* high-res */
|
||||
height = width = 1024;
|
||||
break;
|
||||
case 'D':
|
||||
/* halftone instead of dither */
|
||||
pattern = halftone;
|
||||
break;
|
||||
case 's':
|
||||
/* square size */
|
||||
height = width = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
height = atoi(optarg);
|
||||
break;
|
||||
case 'w':
|
||||
width = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
thresh = atoi(optarg);
|
||||
break;
|
||||
case 'X':
|
||||
page_xoff = atoi(optarg);
|
||||
break;
|
||||
case 'Y':
|
||||
page_yoff = atoi(optarg);
|
||||
break;
|
||||
|
||||
default: /* '?' */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( optind >= argc ) {
|
||||
if( isatty(fileno(stdin)) )
|
||||
return(false);
|
||||
file_name = "-";
|
||||
infp = stdin;
|
||||
} else {
|
||||
file_name = argv[optind];
|
||||
if( (infp = fopen(file_name, "r")) == NULL ) {
|
||||
(void)fprintf( stderr,
|
||||
"bw-imp: cannot open \"%s\" for reading\n",
|
||||
file_name );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( argc > ++optind )
|
||||
(void)fprintf( stderr, "bw-imp: excess argument(s) ignored\n" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
register int y;
|
||||
|
||||
height = width = 512; /* Defaults */
|
||||
|
||||
if ( !get_args( argc, argv ) || isatty(fileno(stdout)) ) {
|
||||
(void)fputs(usage, stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( thresh >= 0 ) {
|
||||
/* Each pixel in gives one bit out, depending on thresh */
|
||||
im_mag = 1;
|
||||
} else {
|
||||
if( width > 512 ) im_mag = 2;
|
||||
else if( width > 256 ) im_mag = 4;
|
||||
else if( width > 128 ) im_mag = 8;
|
||||
else im_mag = 16;
|
||||
}
|
||||
im_width = (width * im_mag) & (~31);
|
||||
im_wpatches = (im_width+31) / 32;
|
||||
im_hpatches = ((height * im_mag)+31) / 32;
|
||||
if( im_wpatches*32 > 2560 ) {
|
||||
fprintf(stderr,"bw-imp: output %d too wide, limit is 2560\n",
|
||||
im_wpatches*32);
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ( !im_header() )
|
||||
return 1;
|
||||
|
||||
for( y = 0; y < height; y += 32/im_mag ) {
|
||||
if( feof(infp) )
|
||||
return 1;
|
||||
im_write(y);
|
||||
}
|
||||
|
||||
if ( !im_close() )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
im_header(void)
|
||||
{
|
||||
|
||||
(void)printf( "@document(language impress, prerasterization on, Name \"%s\")",
|
||||
file_name
|
||||
);
|
||||
|
||||
/* The margins need to be multiples of 16 (printer word align) */
|
||||
(void)putchar(205); /* SET_HV_SYSTEM (whole page) */
|
||||
(void)putchar(0x54);
|
||||
(void)putchar(135); /* SET_ABS_H (left margin) */
|
||||
(void)putchar((page_xoff>>8)&0xFF);
|
||||
(void)putchar(page_xoff&0xFF);
|
||||
(void)putchar(137); /* SET_ABS_V (top margin) */
|
||||
(void)putchar((page_yoff>>8)&0xFF);
|
||||
(void)putchar(page_yoff&0xFF);
|
||||
(void)putchar(205); /* SET_HV_SYSTEM (set origin) */
|
||||
(void)putchar(0x74);
|
||||
(void)putchar(206); /* SET_ADV_DIRS (normal raster scan) */
|
||||
(void)putchar(0);
|
||||
(void)putchar(236); /* SET_MAGNIFICATION */
|
||||
(void)putchar(0); /* x 1 */
|
||||
(void)putchar(235); /* BITMAP */
|
||||
(void)putchar(3); /* opaque (store) */
|
||||
(void)putchar(im_wpatches); /* hsize (# patches across) */
|
||||
(void)putchar(im_hpatches); /* vsize (# patches down) */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
im_write(int y)
|
||||
{
|
||||
int y1;
|
||||
|
||||
/* Process one 32-bit high output swath */
|
||||
for ( y1 = 0; y1 < 32; y1 += im_mag ) {
|
||||
int x;
|
||||
|
||||
/* Obtain a single line of 8-bit pixels */
|
||||
if( fread( line, 1, width, infp ) != width ) {
|
||||
bzero( (void *)line, width );
|
||||
}
|
||||
|
||||
/* construct im_mag scans of Imagen swath */
|
||||
for ( x = 0; x < im_width; x += 32 ) {
|
||||
int my;
|
||||
|
||||
for ( my = 0; my < im_mag; ++my ) {
|
||||
register long b = 0L; /* image bits */
|
||||
int x1;
|
||||
|
||||
for ( x1 = 0; x1 < 32; x1 += im_mag ) {
|
||||
register int level =
|
||||
line[width-1-((x + x1) / im_mag)];
|
||||
register int mx;
|
||||
|
||||
if( im_mag <= 1 ) {
|
||||
b <<= 1;
|
||||
if( level < thresh )
|
||||
b |= 1L;
|
||||
continue;
|
||||
}
|
||||
for ( mx = 0; mx < im_mag; ++mx ) {
|
||||
register int pgx, pgy; /* page position */
|
||||
b <<= 1;
|
||||
|
||||
/* Compute Dither */
|
||||
pgx = x + x1 + mx;
|
||||
pgy = y + y1 + my;
|
||||
/* ameliorate grid regularity */
|
||||
if( pattern == halftone &&
|
||||
(pgy % 16) >= 8 )
|
||||
pgx += 4;
|
||||
|
||||
if( level < pattern[pgx % 8][pgy % 8] )
|
||||
b |= 1L;
|
||||
}
|
||||
}
|
||||
swath[y1 + my][x / 32] = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* output the swath */
|
||||
{
|
||||
register int xx, yy;
|
||||
for ( xx = 0; xx < im_wpatches; ++xx ) {
|
||||
for ( yy = 0; yy < 32; ++yy ) {
|
||||
register long b = swath[yy][xx];
|
||||
register int c;
|
||||
|
||||
c = (int)(b >> 24) & 0xFF; (void)putchar( c );
|
||||
c = (int)(b >> 16) & 0xFF; (void)putchar( c );
|
||||
c = (int)(b >> 8) & 0xFF; (void)putchar( c );
|
||||
c = (int)(b ) & 0xFF; (void)putchar( c );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
im_close(void)
|
||||
{
|
||||
/* (void)putchar( 219 ); ENDPAGE */
|
||||
|
||||
(void)fflush( stdout );
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,34 +0,0 @@
|
||||
.TH BW-PIX 1 BRL-CAD
|
||||
.SH NAME
|
||||
bw\(hypix \- convert a black and white image to color format
|
||||
.SH SYNOPSIS
|
||||
.B bw-pix
|
||||
[in.bw]
|
||||
[out.pix]
|
||||
.SH DESCRIPTION
|
||||
.I Bw-pix
|
||||
converts a black and white
|
||||
.IR bw (5)
|
||||
format
|
||||
file
|
||||
to a color
|
||||
.IR pix (5)
|
||||
format file.
|
||||
Each input value is replicated three times, thus the resulting
|
||||
output file has the same value in all three color planes.
|
||||
An input file name can be given, else input comes from stdin.
|
||||
Output will go to stdout unless an optional output file name
|
||||
is given.
|
||||
.SH "SEE ALSO"
|
||||
brlcad(1), pix-bw(1), pix-bw3(1), pix(5), bw(5).
|
||||
.SH AUTHOR
|
||||
Phillip Dykstra
|
||||
.SH SOURCE
|
||||
SECAD/VLD Computing Consortium, Bldg 394
|
||||
.br
|
||||
The U. S. Army Ballistic Research Laboratory
|
||||
.br
|
||||
Aberdeen Proving Ground, Maryland 21005
|
||||
.SH "BUG REPORTS"
|
||||
Reports of bugs or problems should be submitted via electronic
|
||||
mail to <CAD@ARL.ARMY.MIL>.
|
||||
@@ -1,104 +0,0 @@
|
||||
/* B W - P I X . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1986-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file bw-pix.c
|
||||
*
|
||||
* Convert an 8-bit black and white file to a 24-bit
|
||||
* color one by replicating each value three times.
|
||||
*
|
||||
* Author -
|
||||
* Phillip Dykstra
|
||||
*
|
||||
* Source -
|
||||
* SECAD/VLD Computing Consortium, Bldg 394
|
||||
* The U. S. Army Ballistic Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5066
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
unsigned char ibuf[1024], obuf[3*1024];
|
||||
|
||||
static char usage[] = "Usage: bw-pix [in.bw] [out.pix]\n";
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int in, out, num;
|
||||
FILE *finp, *foutp;
|
||||
|
||||
/* check for input file */
|
||||
if( argc > 1 ) {
|
||||
if( (finp = fopen( argv[1], "r" )) == NULL ) {
|
||||
fprintf( stderr, "bw-pix: can't open \"%s\"\n", argv[1] );
|
||||
exit( 1 );
|
||||
}
|
||||
} else
|
||||
finp = stdin;
|
||||
|
||||
/* check for output file */
|
||||
if( argc > 2 ) {
|
||||
if( (foutp = fopen( argv[2], "w" )) == NULL ) {
|
||||
fprintf( stderr, "bw-pix: can't open \"%s\"\n", argv[2] );
|
||||
exit( 2 );
|
||||
}
|
||||
} else
|
||||
foutp = stdout;
|
||||
|
||||
if( argc > 3 || isatty(fileno(finp)) || isatty(fileno(foutp)) ) {
|
||||
fputs( usage, stderr );
|
||||
exit( 3 );
|
||||
}
|
||||
|
||||
while( (num = fread( ibuf, sizeof( char ), 1024, finp )) > 0 ) {
|
||||
for( in = out = 0; in < num; in++, out += 3 ) {
|
||||
obuf[out] = ibuf[in];
|
||||
obuf[out+1] = ibuf[in];
|
||||
obuf[out+2] = ibuf[in];
|
||||
}
|
||||
fwrite( obuf, sizeof( char ), 3*num, foutp );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
@@ -1,41 +0,0 @@
|
||||
.TH BW-PNG 1 BRL/CAD
|
||||
.SH NAME
|
||||
bw-png \- convert a BRL BW(5) format image to a PNG (Portable Network Graphics) format
|
||||
.SH SYNOPSIS
|
||||
.B bw-png
|
||||
.RB [ \-a ]
|
||||
.RB [ \-s squaresize]
|
||||
.RB [ \-w file_width]
|
||||
.RB [ \-n file_height]
|
||||
[BRLbwfile] > PNG_file
|
||||
.SH DESCRIPTION
|
||||
.I bw-png
|
||||
converts a
|
||||
.I BRL BW(5)
|
||||
format file to a
|
||||
.I PNG
|
||||
format file on the standard output. The PNG file created will be an Gray scale file with a bit-depth of 8 and a file gamma of 1.0.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a
|
||||
autosize the input file to determine file image height and width
|
||||
.TP
|
||||
.B \-n file_height
|
||||
tells
|
||||
.I bw-png
|
||||
that the input is
|
||||
.I file_height
|
||||
scanlines tall
|
||||
.TP
|
||||
.B \-s squaresize
|
||||
sets both the width and the height for the input to be
|
||||
.I squaresize
|
||||
.TP
|
||||
.B \-w file_width
|
||||
tells
|
||||
.I bw-png
|
||||
that the input is
|
||||
.I file_width
|
||||
pixels wide
|
||||
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
/* B W - P N G . C
|
||||
* BRL-CAD
|
||||
*
|
||||
* Copyright (C) 1998-2005 United States Government as represented by
|
||||
* the U.S. Army Research Laboratory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; see the file named COPYING for more
|
||||
* information.
|
||||
*/
|
||||
/** @file bw-png.c
|
||||
* Convert bw file to PNG (Portable Network Graphics) format
|
||||
*
|
||||
* Author -
|
||||
* John R. Anderson
|
||||
*
|
||||
* Source -
|
||||
* The U. S. Army Research Laboratory
|
||||
* Aberdeen Proving Ground, Maryland 21005-5068 USA
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char RCSid[] = "@(#)$Header$ (BRL)";
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "png.h"
|
||||
#include "machine.h"
|
||||
#include "bu.h"
|
||||
#include "vmath.h"
|
||||
#include "bn.h"
|
||||
#include "zlib.h"
|
||||
|
||||
static int file_width = 512; /* default input width */
|
||||
static int file_height = 512; /* default input height */
|
||||
static int autosize = 0; /* !0 to autosize input */
|
||||
static int fileinput = 0; /* file of pipe on input? */
|
||||
static char *file_name;
|
||||
static FILE *infp;
|
||||
|
||||
#define BYTESPERPIXEL 1
|
||||
|
||||
#define ROWSIZE (file_width * BYTESPERPIXEL)
|
||||
#define SIZE (file_height * ROWSIZE)
|
||||
|
||||
static char usage[] = "\
|
||||
Usage: bw-png [-a] [-w file_width] [-n file_height]\n\
|
||||
[-s square_file_size] [file.bw]\n";
|
||||
|
||||
int
|
||||
get_args(int argc, register char **argv)
|
||||
{
|
||||
register int c;
|
||||
|
||||
while ( (c = getopt( argc, argv, "as:w:n:" )) != EOF ) {
|
||||
switch( c ) {
|
||||
case 'a':
|
||||
autosize = 1;
|
||||
break;
|
||||
case 's':
|
||||
/* square file size */
|
||||
file_height = file_width = atoi(optarg);
|
||||
autosize = 0;
|
||||
break;
|
||||
case 'w':
|
||||
file_width = atoi(optarg);
|
||||
autosize = 0;
|
||||
break;
|
||||
case 'n':
|
||||
file_height = atoi(optarg);
|
||||
autosize = 0;
|
||||
break;
|
||||
|
||||
default: /* '?' */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
if( optind >= argc ) {
|
||||
if( isatty(fileno(stdin)) )
|
||||
return(0);
|
||||
file_name = "-";
|
||||
infp = stdin;
|
||||
} else {
|
||||
file_name = argv[optind];
|
||||
if( (infp = fopen(file_name, "r")) == NULL ) {
|
||||
perror(file_name);
|
||||
(void)fprintf( stderr,
|
||||
"bw-png: cannot open \"%s\" for reading\n",
|
||||
file_name );
|
||||
exit(1);
|
||||
}
|
||||
fileinput++;
|
||||
}
|
||||
|
||||
if ( argc > ++optind )
|
||||
(void)fprintf( stderr, "bw-png: excess argument(s) ignored\n" );
|
||||
|
||||
return(1); /* OK */
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
unsigned char *scanbuf;
|
||||
unsigned char **rows;
|
||||
png_structp png_p;
|
||||
png_infop info_p;
|
||||
|
||||
if ( !get_args( argc, argv ) ) {
|
||||
(void)fputs(usage, stderr);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/* autosize input? */
|
||||
if( fileinput && autosize ) {
|
||||
int w, h;
|
||||
if( bn_common_file_size(&w, &h, file_name, 1) ) {
|
||||
file_width = w;
|
||||
file_height = h;
|
||||
} else {
|
||||
fprintf(stderr,"bw-png: unable to autosize\n");
|
||||
}
|
||||
}
|
||||
|
||||
png_p = png_create_write_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL );
|
||||
if( !png_p )
|
||||
bu_bomb( "Could not create PNG write structure\n" );
|
||||
|
||||
info_p = png_create_info_struct( png_p );
|
||||
if( !info_p )
|
||||
bu_bomb( "Could not create PNG info structure\n" );
|
||||
|
||||
/* allocate space for the image */
|
||||
scanbuf = (unsigned char *)bu_calloc( SIZE, sizeof( unsigned char ), "scanbuf" );
|
||||
|
||||
/* create array of pointers to rows for libpng */
|
||||
rows = (unsigned char **)bu_calloc( file_height, sizeof( unsigned char *), "rows" );
|
||||
for( i=0 ; i<file_height ; i++ )
|
||||
rows[i] = scanbuf + ((file_height-i-1)*ROWSIZE);
|
||||
|
||||
/* read the bw file */
|
||||
if( fread( scanbuf, SIZE, 1, infp ) != 1 )
|
||||
bu_bomb( "bw-png: Short read\n");
|
||||
|
||||
png_init_io( png_p, stdout );
|
||||
png_set_filter( png_p, 0, PNG_FILTER_NONE );
|
||||
png_set_compression_level( png_p, Z_BEST_COMPRESSION );
|
||||
png_set_IHDR( png_p, info_p, file_width, file_height, 8,
|
||||
PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT );
|
||||
|
||||
png_write_info( png_p, info_p );
|
||||
png_write_image( png_p, rows );
|
||||
png_write_end( png_p, NULL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
* ex: shiftwidth=4 tabstop=8
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user