home *** CD-ROM | disk | FTP | other *** search
- #
- # Optimal polygonization of freeform surfaces.
- #
- # Gershon Elber, March 1994
- #
- #############################################################################
-
- cross = ctlpt( E3, 0.0001, 0.0, 1.0 ) +
- ctlpt( E3, 1.0, 0.0, 1.0 ) +
- ctlpt( E3, 1.0, 0.0, 0.95 ) +
- cbspline( 3,
- list( ctlpt( E3, 0.1, 0.0, 0.95 ),
- ctlpt( E3, 0.1, 0.0, 0.9 ),
- ctlpt( E3, 0.1, 0.0, 0.7 ),
- ctlpt( E3, 0.2, 0.0, 0.6 ),
- ctlpt( E3, 0.2, 0.0, 0.2 ),
- ctlpt( E3, 0.4, 0.0, 0.05 ),
- ctlpt( E3, 0.4, 0.0, 0.0 ) ),
- list( KV_OPEN ) ) +
- ctlpt( E3, 0.0001, 0.0, 0.0 );
- table = surfprev( cross );
- color(table, green);
-
- poly_approx_opt = 23;
- poly_approx_tol = 0.03;
- flat4ply = 1;
- p = gpolygon(table, on);
- interact(list(table, p));
-
- poly_approx_opt = 1;
- poly_approx_tol = 10;
- flat4ply = 0;
- p = gpolygon(table, on);
- interact(list(table, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 1;
- p = gpolygon(table, on);
- interact(list(table, p));
-
-
- t = 4 * (sqrt(2) - 1) / 3;
- c1 = cbezier( list( ctlpt( E3, 1.0, 0.0, 0.0 ),
- ctlpt( E3, 1.0, t, 0.0 ),
- ctlpt( E3, t, 1.0, 0.0 ),
- ctlpt( E3, 0.0, 1.0, 0.0 ) ) );
- c2 = -c1 * rotz( 180 );
- c3 = -c1 * rotz( 270 );
- c4 = c1 * rotz( 90 );
- srf = boolsum( c1, c2, c3, c4 );
- color(srf, green);
-
- poly_approx_opt = 11;
- poly_approx_tol = 0.01;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 23;
- poly_approx_tol = 0.01;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- srf = boolone( circle( vector( 0, 0, 0 ), 1 ) );
- color(srf, green);
-
- poly_approx_opt = 11;
- poly_approx_tol = 0.03;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 23;
- poly_approx_tol = 0.01;
- flat4ply = 0;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- c1 = cbspline( 3,
- list( ctlpt( E3, -1.0, 1.0, 0.0 ),
- ctlpt( E3, -0.2, 0.2, 0.0 ),
- ctlpt( E3, 0.2, 0.2, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 0.0 ) ),
- list( KV_OPEN ) );
- c2 = c1 * trans( vector( 0.0, 0.0, 2.0 ) );
-
- srf = sfromcrvs( list( c1, c2 ), 2 );
- color(srf, green);
-
- poly_approx_opt = 2;
- poly_approx_tol = 0.01;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 0;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- c1 = cbspline( 3,
- list( ctlpt( E3, -1.0, 1.0, 0.0 ),
- ctlpt( E3, -0.2, 0.2, 0.0 ),
- ctlpt( E3, 0.2, 0.2, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 0.0 ) ),
- list( KV_OPEN ) );
- c2 = c1 * trans( vector( 0.0, -0.5, 0.9 ) );
- c3 = c1 * trans( vector( 0.0, -0.5, 1.1 ) );
- c4 = c1 * trans( vector( 0.0, 0.0, 2.0 ) );
-
- srf = sfromcrvs( list( c1, c2, c3, c4 ), 3 );
- color(srf, green);
-
- poly_approx_opt = 2;
- poly_approx_tol = 0.01;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 0;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- poly_approx_opt = 0;
- poly_approx_tol = 10;
- flat4ply = 1;
- p = gpolygon(srf, on);
- interact(list(srf, p));
-
- wiggle = sbspline( 3, 3,
- list( list( ctlpt( E3, 0.01, 0.4, -1.0 ),
- ctlpt( E3, 0.4, -0.5, -0.9 ),
- ctlpt( E3, 0.7, 0.0, -0.4 ) ),
- list( ctlpt( E3, -0.2, 1.2, -0.3 ),
- ctlpt( E3, 0.2, 0.0, -0.3 ),
- ctlpt( E3, 0.5, 0.6, 0.2 ) ),
- list( ctlpt( E3, -0.3, 0.2, -0.2 ),
- ctlpt( E3, 0.1, -0.7, -0.1 ),
- ctlpt( E3, 0.4, -0.2, 0.4 ) ),
- list( ctlpt( E3, -0.5, 0.8, 0.4 ),
- ctlpt( E3, -0.1, -0.3, 0.4 ),
- ctlpt( E3, 0.2, 0.3, 1.0 ) ),
- list( ctlpt( E3, -0.6, -0.1, 0.5 ),
- ctlpt( E3, -0.2, -1.0, 0.6 ),
- ctlpt( E3, 0.1, -0.5, 1.2 ) ) ),
- list( list( KV_OPEN ),
- list( KV_OPEN ) ) );
- color(wiggle, green);
-
- poly_approx_opt = 2;
- poly_approx_tol = 0.03;
- flat4ply = 1;
- p = gpolygon(wiggle, on);
- interact(list(wiggle, p));
-
- poly_approx_opt = 0;
- flat4ply = 0;
- p = gpolygon(wiggle, on);
- interact(list(wiggle, p));
-
- flat4ply = 1;
- p = gpolygon(wiggle, on);
- interact(list(wiggle, p));
-