Thread View: comp.windows.x.pex
2 messages
2 total messages
Started by Matthias Pfuetzner
Fri, 04 Sep 1992 13:14
IBM's graPHIGS package, problem with GPNBS, any hint?
Author: Matthias Pfuetzner
Date: Fri, 04 Sep 1992 13:14
Date: Fri, 04 Sep 1992 13:14
41 lines
2367 bytes
2367 bytes
Hi Everybody!
I have a problem with IBM RS/6000 graPHIGS library and the GPNBS call.
Simply said: The above call inserts the corresponding element into the
structure store, but I don't see nothing on the screen!
I checked whether the currently open workstation supports non-uniform B-spline
surfaces (it does), what the maximum order is (6, I only use 2x3 and sometimes
3x3), so that I'm sure, this primitive is available.
Before inserting the GPNBS I inserted "pfill_area_set3" using the ISO C
Binding provided under /usr/lpp/graPHIGS/samples/cbinding, so that I can use
mixed calls for those routines that are currently not supported in ISO C
Binding form. This fill_area_set3 is properly drawn, so that I'm sure the
workstation is opened correctly. The data I supply for the B-spline surface is
OK, as I am also using libphigs.a (producing PEX calls) on the IBM and on Sun
workstations with X11R5 by MIT. With these libraries I see my surface!
I never use trimcurves, so I don't use GPTNBS.
Here is the call:
#if defined( AIXV3 ) && defined( USE_GRAPHIGS )
GPNBS( (Pint)2, (Pint)3, uknots.num_floats - 2, vknots.num_floats - 3,
uknots.floats, vknots.floats, 0, 0, 0, 1, 4, grid.points.point4d,
uknots.floats[0], uknots.floats[uknots.num_floats - 1],
vknots.floats[0], vknots.floats[vknots.num_floats - 1] );
#else
pnuni_bsp_surf( (Pint)2, (Pint)3, &uknots, &vknots, PRATIONAL, &grid,
(Pint) 0, (Ptrimcurve_list *) 0 );
#endif
Any hint is highly appreciated!
Sincerly,
Matthias
--
Matthias Pfuetzner | @work: +49 6151 155-150 | @home: +49 6151 75717
6100 Darmstadt, FRG | ZGDV, Wilhelminenstrasse 7 | Lichtenbergstrasse 73
pfuetzner@igd.fhg.de, pfuetzner@zgdvda.UUCP | Keith Packard said:
R5 is different from R4. That's why we changed the release number :-)
IBM's graPHIGS package, problem with GPNBS, any hint? (again!)
Author: Matthias Pfuetzner
Date: Tue, 15 Sep 1992 13:27
Date: Tue, 15 Sep 1992 13:27
921 lines
30567 bytes
30567 bytes
Hi again!
In article <1484@igd.fhg.de> I wrote:
>I have a problem with IBM RS/6000 graPHIGS library and the GPNBS call.
>
>Simply said: The above call inserts the corresponding element into the
>structure store, but I don't see nothing on the screen!
[some stuff deleted]
> The data I supply for the B-spline surface is
>OK, as I am also using libphigs.a (producing PEX calls) on the IBM and on Sun
>workstations with X11R5 by MIT. With these libraries I see my surface!
[some stuff deleted]
Here now a complete, but stripped down example! If anybody can tell me what I
did wrong, I'd really appreciate it.
Sincerly,
Matthias
----- cut ----- cut ----- cut ----- cut ----- cut ----- cut -----
/* To build, use:
cc -g -I/usr/include -I/usr/lpp/graPHIGS/samples/cbinding -DAIXV3 -D_BSD
-D__STR31__ -c my_test.c
cc -o my_test my_test.o -g -lgP -lXext -lX11 -lm
*/
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <phigs.h>
#include <afmnc.h>
typedef struct
{
Pint num_floats; /* number of Pfloats in list */
Pfloat *floats; /* list of floats */
} Pfloat_list;
typedef struct
{
Pint u_dim; /* dimension (number of divisions) along U */
Pint v_dim; /* dimension (number of divisions) along V */
} Ppcs_dims;
typedef struct
{
Pfloat x; /* x coordinate */
Pfloat y; /* y coordinate */
Pfloat z; /* z coordinate */
Pfloat w; /* w coordinate */
} Ppoint4;
typedef struct
{ /* grid of 3D or 4D points, [u_dim][v_dim] */
Ppcs_dims num_points; /* number of points in each dimension */
union
{
Ppoint3 *point3d; /* array of 3D points */
Ppoint4 *point4d; /* array of 4D points */
} points;
} Ppoint_grid34;
int ret_val;
Ppoint3 vrp;
Pvec3 vpn;
Pvec3 vup;
Pview_rep3 vrep;
Pint err;
Pview_map3 view_map;
double x3d[3];
double A1;
double A2;
double B1;
double L1;
double L2;
double RI;
double RA;
double ALFA;
int tube_bow()
{
Ppoint_list_list3 side_list;
Ppoint_list3 side;
Ppoint3 p[4];
Ppoint3 pf;
Pvec3 shift;
Pvec3 scale;
Pmatrix3 matrix;
Pfloat_list uknots;
Pfloat tmp_floats_x[4];
Pfloat_list vknots;
Pfloat tmp_floats_y[8];
Ppoint_grid34 grid;
Ppoint4 tmp_points[10];
double tmp_ang;
double tmp_ang_15x;
double tmp_ang_25x;
double tmp_ang_35x;
double tmp_ang_45x;
double tmp_ang_15y;
double tmp_ang_25y;
double tmp_ang_35y;
double tmp_ang_45y;
double diff_x;
double diff_y;
double weight;
side.num_points = 4;
side.points = p;
side_list.num_point_lists = 1;
side_list.point_lists = &side;
pf.x = x3d[0];
pf.y = x3d[1];
pf.z = x3d[2];
shift.delta_x = 0.;
shift.delta_y = 0.;
shift.delta_z = 0.;
scale.delta_x = 1.;
scale.delta_y = 1.;
scale.delta_z = 1.;
pbuild_tran_matrix3( &pf, &shift, (Pfloat)0., (Pfloat)0., (Pfloat)0.,
&scale, &err, matrix );
pset_local_tran3( matrix, PTYPE_REPLACE );
uknots.num_floats = 4;
uknots.floats = tmp_floats_x;
uknots.floats[0] = 0.;
uknots.floats[1] = 0.;
uknots.floats[2] = 1.;
uknots.floats[3] = 1.;
if( ALFA <= 90.0 )
vknots.num_floats = 6;
else
vknots.num_floats = 8;
vknots.floats = tmp_floats_y;
vknots.floats[0] = 0.;
vknots.floats[1] = 0.;
vknots.floats[2] = 0.;
vknots.floats[3] = 1.;
vknots.floats[4] = 1.;
if( ALFA <= 90.0 )
vknots.floats[5] = 1.;
else
{
vknots.floats[5] = 2.;
vknots.floats[6] = 2.;
vknots.floats[7] = 2.;
}
grid.num_points.u_dim = 2;
if( ALFA <= 90.0 )
grid.num_points.v_dim = 3;
else
grid.num_points.v_dim = 5;
grid.points.point4d = tmp_points;
tmp_ang = ALFA * 3.14159265358979323846 / 180;
if( ALFA <= 90.0 )
{
tmp_ang_25x = tan( tmp_ang / 2 );
tmp_ang_25y = tan( tmp_ang / 2 );
tmp_ang_45x = cos( ( 90 - ALFA ) * 3.14159265358979323846 / 180. );
tmp_ang_45y = sin( ( 90 - ALFA ) * 3.14159265358979323846 / 180. );
weight = cos( tmp_ang / 2 );
}
else
{
tmp_ang_15x = tan( tmp_ang / 4 );
tmp_ang_15y = tan( tmp_ang / 4 );
tmp_ang_25x = cos((90 - ( ALFA / 2. ) ) * 3.14159265358979323846 / 180.);
tmp_ang_25y = sin((90 - ( ALFA / 2. ) ) * 3.14159265358979323846 / 180.);
tmp_ang_35x = tan( 3 * tmp_ang / 4 );
tmp_ang_35y = tan( 3 * tmp_ang / 4 );
tmp_ang_45x = sin( ( 180 - ALFA ) * 3.14159265358979323846 / 180. );
tmp_ang_45y = cos( ( 180 - ALFA ) * 3.14159265358979323846 / 180. );
weight = cos( tmp_ang / 4 );
}
/**************/
/* Front part */
/**************/
/* front */
p[0].x = x3d[0];
p[0].y = x3d[1] - (A1/2);
p[0].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2;
p[1].y = x3d[1] - (A1/2);
p[1].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2;
p[2].y = x3d[1] + (A1/2);
p[2].z = x3d[2] + (B1/2);
p[3].x = x3d[0];
p[3].y = x3d[1] + (A1/2);
p[3].z = x3d[2] + (B1/2);
pfill_area_set3( &side_list );
/* back */
p[3].x = x3d[0];
p[3].y = x3d[1] - (A1/2);
p[3].z = x3d[2] - (B1/2);
p[2].x = x3d[0] + L2;
p[2].y = x3d[1] - (A1/2);
p[2].z = x3d[2] - (B1/2);
p[1].x = x3d[0] + L2;
p[1].y = x3d[1] + (A1/2);
p[1].z = x3d[2] - (B1/2);
p[0].x = x3d[0];
p[0].y = x3d[1] + (A1/2);
p[0].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
/* bottom */
p[3].x = x3d[0];
p[3].y = x3d[1] - (A1/2);
p[3].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2;
p[2].y = x3d[1] - (A1/2);
p[2].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2;
p[1].y = x3d[1] - (A1/2);
p[1].z = x3d[2] - (B1/2);
p[0].x = x3d[0];
p[0].y = x3d[1] - (A1/2);
p[0].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
/* top */
p[0].x = x3d[0];
p[0].y = x3d[1] + (A1/2);
p[0].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2;
p[1].y = x3d[1] + (A1/2);
p[1].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2;
p[2].y = x3d[1] + (A1/2);
p[2].z = x3d[2] - (B1/2);
p[3].x = x3d[0];
p[3].y = x3d[1] + (A1/2);
p[3].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
/***************/
/* Middle part */
/***************/
/* back */
/* Assign the points */
/* [0][0] */
grid.points.point4d[0].x = x3d[0] + L2;
grid.points.point4d[0].y = x3d[1] - (A1/2);
grid.points.point4d[0].z = x3d[2] + (B1/2);
grid.points.point4d[0].w = 1.0;
/* [1][0] */
grid.points.point4d[1].x = x3d[0] + L2;
grid.points.point4d[1].y = x3d[1] + (A1/2);
grid.points.point4d[1].z = x3d[2] + (B1/2);
grid.points.point4d[1].w = 1.0;
if( ALFA <= 90.0 )
{
/* [0][1] */
grid.points.point4d[2].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[2].y = x3d[1] - (A1/2);
grid.points.point4d[2].z = x3d[2] + (B1/2);
grid.points.point4d[2].w = weight;
/* [1][1] */
grid.points.point4d[3].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[3].y = x3d[1] + (A1/2);
grid.points.point4d[3].z = x3d[2] + (B1/2);
grid.points.point4d[3].w = weight;
/* [0][2] */
grid.points.point4d[4].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[4].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_45y ) * RI );
grid.points.point4d[4].z = x3d[2] + (B1/2);
grid.points.point4d[4].w = 1.0;
/* [1][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[5].y = x3d[1] - (A1/2) + A2 -
( ( 1 - tmp_ang_45y ) * (RI + A2) );
grid.points.point4d[5].z = x3d[2] + (B1/2);
grid.points.point4d[5].w = 1.0;
}
else
{
/* [0][1] */
grid.points.point4d[2].x = x3d[0] + L2 + ( tmp_ang_15x * RI );
grid.points.point4d[2].y = x3d[1] - (A1/2);
grid.points.point4d[2].z = x3d[2] + (B1/2);
grid.points.point4d[2].w = weight;
/* [1][1] */
grid.points.point4d[3].x = x3d[0] + L2 +
( tmp_ang_15x * (3*RA + RI + A2)/4 );
grid.points.point4d[3].y = x3d[1] + (A1/2);
grid.points.point4d[3].z = x3d[2] + (B1/2);
grid.points.point4d[3].w = weight;
/* [0][2] */
grid.points.point4d[4].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[4].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_25y ) * RI );
grid.points.point4d[4].z = x3d[2] + (B1/2);
grid.points.point4d[4].w = 1.0;
/* [1][2] */
grid.points.point4d[5].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[5].y = x3d[1] + (A1/2) -
( ( 1 - tmp_ang_25y ) * (RA + RI + A2)/2 );
grid.points.point4d[5].z = x3d[2] + (B1/2);
grid.points.point4d[5].w = 1.0;
diff_x = grid.points.point4d[2].x - grid.points.point4d[4].x;
diff_y = grid.points.point4d[2].y - grid.points.point4d[4].y;
grid.points.point4d[6].x = grid.points.point4d[4].x - diff_x;
grid.points.point4d[6].y = grid.points.point4d[4].y - diff_y;
grid.points.point4d[6].z = x3d[2] + (B1/2);
grid.points.point4d[6].w = weight;
diff_x = grid.points.point4d[3].x - grid.points.point4d[5].x;
diff_y = grid.points.point4d[3].y - grid.points.point4d[5].y;
grid.points.point4d[7].x = grid.points.point4d[5].x - diff_x;
grid.points.point4d[7].y = grid.points.point4d[5].y - diff_y;
grid.points.point4d[7].z = x3d[2] + (B1/2);
grid.points.point4d[7].w = weight;
/* [0][4] */
grid.points.point4d[8].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[8].y = x3d[1] - (A1/2) - RI - tmp_ang_45y * RI;
grid.points.point4d[8].z = x3d[2] + (B1/2);
grid.points.point4d[8].w = 1.0;
/* [1][4] */
grid.points.point4d[9].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[9].y = x3d[1] - (A1/2) - RI -
tmp_ang_45y * (RI + A2);
grid.points.point4d[9].z = x3d[2] + (B1/2);
grid.points.point4d[9].w = 1.0;
}
GPNBS( (Pint)2, (Pint) 3, uknots.num_floats - 2, vknots.num_floats - 3,
uknots.floats, vknots.floats, 0, 0, 0, 1, 4, grid.points.point4d,
uknots.floats[0], uknots.floats[uknots.num_floats - 1],
vknots.floats[0], vknots.floats[vknots.num_floats - 1] );
/* front */
/* Assign the points */
/* [0][0] */
grid.points.point4d[1].x = x3d[0] + L2;
grid.points.point4d[1].y = x3d[1] - (A1/2);
grid.points.point4d[1].z = x3d[2] - (B1/2);
grid.points.point4d[1].w = 1.0;
/* [1][0] */
grid.points.point4d[0].x = x3d[0] + L2;
grid.points.point4d[0].y = x3d[1] + (A1/2);
grid.points.point4d[0].z = x3d[2] - (B1/2);
grid.points.point4d[0].w = 1.0;
if( ALFA <= 90.0 )
{
/* [0][1] */
grid.points.point4d[3].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[3].y = x3d[1] - (A1/2);
grid.points.point4d[3].z = x3d[2] - (B1/2);
grid.points.point4d[3].w = weight;
/* [1][1] */
grid.points.point4d[2].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2);
grid.points.point4d[2].y = x3d[1] + (A1/2);
grid.points.point4d[2].z = x3d[2] - (B1/2);
grid.points.point4d[2].w = weight;
/* [0][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[5].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_45y ) * RI );
grid.points.point4d[5].z = x3d[2] - (B1/2);
grid.points.point4d[5].w = 1.0;
/* [1][2] */
grid.points.point4d[4].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[4].y = x3d[1] - (A1/2) + A2 -
( ( 1 - tmp_ang_45y ) * (RI + A2) );
grid.points.point4d[4].z = x3d[2] - (B1/2);
grid.points.point4d[4].w = 1.0;
}
else
{
/* [0][1] */
grid.points.point4d[3].x = x3d[0] + L2 + ( tmp_ang_15x * RI );
grid.points.point4d[3].y = x3d[1] - (A1/2);
grid.points.point4d[3].z = x3d[2] - (B1/2);
grid.points.point4d[3].w = weight;
/* [1][1] */
grid.points.point4d[2].x = x3d[0] + L2 +
( tmp_ang_15x * (3*RA + RI + A2)/4 );
grid.points.point4d[2].y = x3d[1] + (A1/2);
grid.points.point4d[2].z = x3d[2] - (B1/2);
grid.points.point4d[2].w = weight;
/* [0][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[5].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_25y ) * RI );
grid.points.point4d[5].z = x3d[2] - (B1/2);
grid.points.point4d[5].w = 1.0;
/* [1][2] */
grid.points.point4d[4].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2);
grid.points.point4d[4].y = x3d[1] + (A1/2) -
( ( 1 - tmp_ang_25y ) * (RA + RI + A2)/2 );
grid.points.point4d[4].z = x3d[2] - (B1/2);
grid.points.point4d[4].w = 1.0;
diff_x = grid.points.point4d[3].x - grid.points.point4d[5].x;
diff_y = grid.points.point4d[3].y - grid.points.point4d[5].y;
grid.points.point4d[7].x = grid.points.point4d[5].x - diff_x;
grid.points.point4d[7].y = grid.points.point4d[5].y - diff_y;
grid.points.point4d[7].z = x3d[2] - (B1/2);
grid.points.point4d[7].w = weight;
diff_x = grid.points.point4d[2].x - grid.points.point4d[4].x;
diff_y = grid.points.point4d[2].y - grid.points.point4d[4].y;
grid.points.point4d[6].x = grid.points.point4d[4].x - diff_x;
grid.points.point4d[6].y = grid.points.point4d[4].y - diff_y;
grid.points.point4d[6].z = x3d[2] - (B1/2);
grid.points.point4d[6].w = weight;
/* [0][4] */
grid.points.point4d[9].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[9].y = x3d[1] - (A1/2) - RI - tmp_ang_45y * RI;
grid.points.point4d[9].z = x3d[2] - (B1/2);
grid.points.point4d[9].w = 1.0;
/* [1][4] */
grid.points.point4d[8].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[8].y = x3d[1] - (A1/2) - RI -
tmp_ang_45y * (RI + A2);
grid.points.point4d[8].z = x3d[2] - (B1/2);
grid.points.point4d[8].w = 1.0;
}
GPNBS( (Pint)2, (Pint) 3, uknots.num_floats - 2, vknots.num_floats - 3,
uknots.floats, vknots.floats, 0, 0, 0, 1, 4, grid.points.point4d,
uknots.floats[0], uknots.floats[uknots.num_floats - 1],
vknots.floats[0], vknots.floats[vknots.num_floats - 1] );
/* top */
/* Assign the points */
/* [0][0] */
grid.points.point4d[1].x = x3d[0] + L2;
grid.points.point4d[1].y = x3d[1] - (A1/2);
grid.points.point4d[1].z = x3d[2] + (B1/2);
grid.points.point4d[1].w = 1.0;
/* [1][0] */
grid.points.point4d[0].x = x3d[0] + L2;
grid.points.point4d[0].y = x3d[1] - (A1/2);
grid.points.point4d[0].z = x3d[2] - (B1/2);
grid.points.point4d[0].w = 1.0;
if( ALFA <= 90.0 )
{
/* [0][1] */
grid.points.point4d[3].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[3].y = x3d[1] - (A1/2);
grid.points.point4d[3].z = x3d[2] + (B1/2);
grid.points.point4d[3].w = weight;
/* [1][1] */
grid.points.point4d[2].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[2].y = x3d[1] - (A1/2);
grid.points.point4d[2].z = x3d[2] - (B1/2);
grid.points.point4d[2].w = weight;
/* [0][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[5].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_45y ) * RI );
grid.points.point4d[5].z = x3d[2] + (B1/2);
grid.points.point4d[5].w = 1.0;
/* [1][2] */
grid.points.point4d[4].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[4].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_45y ) * RI );
grid.points.point4d[4].z = x3d[2] - (B1/2);
grid.points.point4d[4].w = 1.0;
}
else
{
/* [0][1] */
grid.points.point4d[3].x = x3d[0] + L2 + ( tmp_ang_15x * RI );
grid.points.point4d[3].y = x3d[1] - (A1/2);
grid.points.point4d[3].z = x3d[2] + (B1/2);
grid.points.point4d[3].w = weight;
/* [1][1] */
grid.points.point4d[2].x = x3d[0] + L2 + ( tmp_ang_15x * RI );
grid.points.point4d[2].y = x3d[1] - (A1/2);
grid.points.point4d[2].z = x3d[2] - (B1/2);
grid.points.point4d[2].w = weight;
/* [0][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[5].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_25y ) * RI );
grid.points.point4d[5].z = x3d[2] + (B1/2);
grid.points.point4d[5].w = 1.0;
/* [1][2] */
grid.points.point4d[4].x = x3d[0] + L2 + ( tmp_ang_25x * RI );
grid.points.point4d[4].y = x3d[1] - (A1/2) -
( ( 1 - tmp_ang_25y ) * RI );
grid.points.point4d[4].z = x3d[2] - (B1/2);
grid.points.point4d[4].w = 1.0;
diff_x = grid.points.point4d[3].x - grid.points.point4d[5].x;
diff_y = grid.points.point4d[3].y - grid.points.point4d[5].y;
grid.points.point4d[7].x = grid.points.point4d[5].x - diff_x;
grid.points.point4d[7].y = grid.points.point4d[5].y - diff_y;
grid.points.point4d[7].z = x3d[2] + (B1/2);
grid.points.point4d[7].w = weight;
diff_x = grid.points.point4d[2].x - grid.points.point4d[4].x;
diff_y = grid.points.point4d[2].y - grid.points.point4d[4].y;
grid.points.point4d[6].x = grid.points.point4d[4].x - diff_x;
grid.points.point4d[6].y = grid.points.point4d[4].y - diff_y;
grid.points.point4d[6].z = x3d[2] - (B1/2);
grid.points.point4d[6].w = weight;
/* [0][4] */
grid.points.point4d[9].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[9].y = x3d[1] - (A1/2) - RI - tmp_ang_45y * RI;
grid.points.point4d[9].z = x3d[2] + (B1/2);
grid.points.point4d[9].w = 1.0;
/* [1][4] */
grid.points.point4d[8].x = x3d[0] + L2 + ( tmp_ang_45x * RI );
grid.points.point4d[8].y = x3d[1] - (A1/2) - RI - tmp_ang_45y * RI;
grid.points.point4d[8].z = x3d[2] - (B1/2);
grid.points.point4d[8].w = 1.0;
}
GPNBS( (Pint)2, (Pint) 3, uknots.num_floats - 2, vknots.num_floats - 3,
uknots.floats, vknots.floats, 0, 0, 0, 1, 4, grid.points.point4d,
uknots.floats[0], uknots.floats[uknots.num_floats - 1],
vknots.floats[0], vknots.floats[vknots.num_floats - 1] );
/* bottom */
/* Assign the points */
/* [0][0] */
grid.points.point4d[0].x = x3d[0] + L2;
grid.points.point4d[0].y = x3d[1] + (A1/2);
grid.points.point4d[0].z = x3d[2] + (B1/2);
grid.points.point4d[0].w = 1.0;
/* [1][0] */
grid.points.point4d[1].x = x3d[0] + L2;
grid.points.point4d[1].y = x3d[1] + (A1/2);
grid.points.point4d[1].z = x3d[2] - (B1/2);
grid.points.point4d[1].w = 1.0;
if( ALFA <= 90.0 )
{
/* [0][1] */
grid.points.point4d[2].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[2].y = x3d[1] + (A1/2);
grid.points.point4d[2].z = x3d[2] + (B1/2);
grid.points.point4d[2].w = weight;
/* [1][1] */
grid.points.point4d[3].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[3].y = x3d[1] + (A1/2);
grid.points.point4d[3].z = x3d[2] - (B1/2);
grid.points.point4d[3].w = weight;
/* [0][2] */
grid.points.point4d[4].x = x3d[0] + L2 +
( tmp_ang_45x * (RI + A2) );
grid.points.point4d[4].y = x3d[1] - (A1/2) + A2 -
( ( 1 - tmp_ang_45y ) * (RI + A2) );
grid.points.point4d[4].z = x3d[2] + (B1/2);
grid.points.point4d[4].w = 1.0;
/* [1][2] */
grid.points.point4d[5].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[5].y = x3d[1] - (A1/2) + A2 -
( ( 1 - tmp_ang_45y ) * (RI + A2) );
grid.points.point4d[5].z = x3d[2] - (B1/2);
grid.points.point4d[5].w = 1.0;
}
else
{
/* [0][1] */
grid.points.point4d[2].x = x3d[0] + L2 +
( tmp_ang_15x * (3*RA + RI + A2)/4 );
grid.points.point4d[2].y = x3d[1] + (A1/2);
grid.points.point4d[2].z = x3d[2] + (B1/2);
grid.points.point4d[2].w = weight;
/* [1][1] */
grid.points.point4d[3].x = x3d[0] + L2 +
( tmp_ang_15x * (3*RA + RI + A2)/4 );
grid.points.point4d[3].y = x3d[1] + (A1/2);
grid.points.point4d[3].z = x3d[2] - (B1/2);
grid.points.point4d[3].w = weight;
/* [0][2] */
grid.points.point4d[4].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[4].y = x3d[1] + (A1/2) -
( ( 1 - tmp_ang_25y ) * (RA +RI + A2)/2 );
grid.points.point4d[4].z = x3d[2] + (B1/2);
grid.points.point4d[4].w = 1.0;
/* [1][2] */
grid.points.point4d[5].x = x3d[0] + L2 +
( tmp_ang_25x * (RA + RI + A2)/2 );
grid.points.point4d[5].y = x3d[1] + (A1/2) -
( ( 1 - tmp_ang_25y ) * (RA + RI + A2)/2 );
grid.points.point4d[5].z = x3d[2] - (B1/2);
grid.points.point4d[5].w = 1.0;
diff_x = grid.points.point4d[2].x - grid.points.point4d[4].x;
diff_y = grid.points.point4d[2].y - grid.points.point4d[4].y;
grid.points.point4d[6].x = grid.points.point4d[4].x - diff_x;
grid.points.point4d[6].y = grid.points.point4d[4].y - diff_y;
grid.points.point4d[6].z = x3d[2] + (B1/2);
grid.points.point4d[6].w = weight;
diff_x = grid.points.point4d[3].x - grid.points.point4d[5].x;
diff_y = grid.points.point4d[3].y - grid.points.point4d[5].y;
grid.points.point4d[7].x = grid.points.point4d[5].x - diff_x;
grid.points.point4d[7].y = grid.points.point4d[5].y - diff_y;
grid.points.point4d[7].z = x3d[2] - (B1/2);
grid.points.point4d[7].w = weight;
/* [0][4] */
grid.points.point4d[8].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[8].y = x3d[1] - (A1/2) - RI -
tmp_ang_45y * (RI + A2);
grid.points.point4d[8].z = x3d[2] + (B1/2);
grid.points.point4d[8].w = 1.0;
/* [1][4] */
grid.points.point4d[9].x = x3d[0] + L2 + ( tmp_ang_45x * (RI + A2) );
grid.points.point4d[9].y = x3d[1] - (A1/2) - RI -
tmp_ang_45y * (RI + A2);
grid.points.point4d[9].z = x3d[2] - (B1/2);
grid.points.point4d[9].w = 1.0;
}
GPNBS( (Pint)2, (Pint) 3, uknots.num_floats - 2, vknots.num_floats - 3,
uknots.floats, vknots.floats, 0, 0, 0, 1, 4, grid.points.point4d,
uknots.floats[0], uknots.floats[uknots.num_floats - 1],
vknots.floats[0], vknots.floats[vknots.num_floats - 1] );
/*************/
/* Back part */
/*************/
shift.delta_x = 0.;
shift.delta_y = 0.;
shift.delta_z = 0.;
pf.x = x3d[0] + L2;
pf.y = x3d[1] - A1/2 - RI;
pf.z = x3d[2];
scale.delta_x = 1.;
scale.delta_y = 1.;
scale.delta_z = 1.;
pbuild_tran_matrix3( &pf, &shift,
0., 0., -ALFA * 3.14159265358979323846 / 180,
&scale, &err, matrix );
pset_local_tran3( matrix, PTYPE_PRECONCAT );
/* front */
p[0].x = x3d[0] + L2;
p[0].y = x3d[1] - (A1/2);
p[0].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2 + L1;
p[1].y = x3d[1] - (A1/2);
p[1].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2 + L1;
p[2].y = x3d[1] - (A1/2) + A2;
p[2].z = x3d[2] + (B1/2);
p[3].x = x3d[0] + L2;
p[3].y = x3d[1] - (A1/2) + A2;
p[3].z = x3d[2] + (B1/2);
pfill_area_set3( &side_list );
/* back */
p[3].x = x3d[0] + L2;
p[3].y = x3d[1] - (A1/2);
p[3].z = x3d[2] - (B1/2);
p[2].x = x3d[0] + L2 + L1;
p[2].y = x3d[1] - (A1/2);
p[2].z = x3d[2] - (B1/2);
p[1].x = x3d[0] + L2 + L1;
p[1].y = x3d[1] - (A1/2) + A2;
p[1].z = x3d[2] - (B1/2);
p[0].x = x3d[0] + L2;
p[0].y = x3d[1] - (A1/2) + A2;
p[0].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
/* bottom */
p[3].x = x3d[0] + L2;
p[3].y = x3d[1] - (A1/2);
p[3].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2 + L1;
p[2].y = x3d[1] - (A1/2);
p[2].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2 + L1;
p[1].y = x3d[1] - (A1/2);
p[1].z = x3d[2] - (B1/2);
p[0].x = x3d[0] + L2;
p[0].y = x3d[1] - (A1/2);
p[0].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
/* top */
p[0].x = x3d[0] + L2;
p[0].y = x3d[1] - (A1/2) + A2;
p[0].z = x3d[2] + (B1/2);
p[1].x = x3d[0] + L2 + L1;
p[1].y = x3d[1] - (A1/2) + A2;
p[1].z = x3d[2] + (B1/2);
p[2].x = x3d[0] + L2 + L1;
p[2].y = x3d[1] - (A1/2) + A2;
p[2].z = x3d[2] - (B1/2);
p[3].x = x3d[0] + L2;
p[3].y = x3d[1] - (A1/2) + A2;
p[3].z = x3d[2] - (B1/2);
pfill_area_set3( &side_list );
} /* tube_bow */
/************************************************************************/
/* main */
/************************************************************************/
main()
{
popen_phigs( PDEF_ERR_FILE, PDEF_MEM_SIZE );
popen_ws( 1, "*", 6 );
vrp.x = 0.;
vrp.y = 0.;
vrp.z = 0.;
vpn.delta_x = 0.;
vpn.delta_y = 0.;
vpn.delta_z = 1.;
vup.delta_x = 0.;
vup.delta_y = 1.;
vup.delta_z = 0.;
peval_view_ori_matrix3( &vrp, &vpn, &vup, &err, vrep.ori_matrix );
view_map.win.x_min = -65.0;
view_map.win.x_max = 185.0;
view_map.win.y_min = -125.0;
view_map.win.y_max = 125.0;
view_map.proj_vp.x_min = 0.;
view_map.proj_vp.x_max = 1.;
view_map.proj_vp.y_min = 0.;
view_map.proj_vp.y_max = 1.;
view_map.proj_vp.z_min = 0.;
view_map.proj_vp.z_max = 1.;
view_map.proj_type = PTYPE_PERSPECT;
view_map.proj_ref_point.x = 0.;
view_map.proj_ref_point.y = 0.;
view_map.proj_ref_point.z = 50000.;
view_map.view_plane = 0.;
view_map.back_plane = -2000.;
view_map.front_plane = 2000.;
peval_view_map_matrix3( &view_map, &err, vrep.map_matrix );
vrep.clip_limit = view_map.proj_vp;
vrep.xy_clip = PIND_NO_CLIP;
vrep.back_clip = PIND_NO_CLIP;
vrep.front_clip = PIND_NO_CLIP;
pset_view_rep3( 1, 1, &vrep );
pset_disp_upd_st( 1, PDEFER_WAIT, PMODE_UWOR );
popen_struct( 1 );
pset_view_ind( 1 );
pset_int_colr_ind( 2 );
pset_edge_colr_ind( 3 );
pset_int_style( PSTYLE_SOLID );
pset_edgetype( PLINE_SOLID );
pset_edge_flag( PEDGE_ON );
x3d[0] = 0.;
x3d[1] = 0.;
x3d[2] = 0.;
A1 = 40.;
A2 = 40.;
B1 = 80.;
L1 = 5.;
L2 = 5.;
RI = 10.;
RA = 50.;
ALFA = 90.;
tube_bow();
pclose_struct();
ppost_struct( 1, 1, 1.0 );
pupd_ws( 1, PFLAG_PERFORM );
ret_val = getchar();
pclose_ws( 1 );
pclose_phigs();
} /* main */
----- cut ----- cut ----- cut ----- cut ----- cut ----- cut -----
--
Matthias Pfuetzner | @work: +49 6151 155-150 | @home: +49 6151 75717
6100 Darmstadt, FRG | ZGDV, Wilhelminenstrasse 7 | Lichtenbergstrasse 73
pfuetzner@igd.fhg.de, pfuetzner@zgdvda.UUCP | Hans-Ulrich Klose sagte:
Wir pfeifen nicht nach ihrer Tanze... (09.09.92 in der Haushaltsdebatte)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads