include "cleaver.scl"; include "teapot3.scl"; commentOutCode << Model1: restoreModel( "teapot-solid-half.a1" )$; HalfTeapot: Model1[0]$; HalfLid: Model1[1]$; commentOutCode unshow( HalfTeapot, HalfLid ); Model2: restoreModel( "teapot-solid-half2.a1" )$; HalfTeapot: Model2[0]$; HalfLid: Model2[1]$; commentOutCode unshow( HalfTeapot2, HalfLid2 ); >> << # Put everything on a butcher block table top. BlockMinX: -20; BlockMaxX: 4; BlockMinY: -4; BlockMaxY: 20; BlockChamfer: .2; BlockTop: objTransform( flatSrfBounds( Linear, Linear, 4, 4, pt( BlockMinX, BlockMinY ), pt( BlockMaxX, BlockMaxY ) ), rX( -90 ) ); setSQ( BlockTop, "Wood3" ); setTexture( BlockTop, "block.rle" ); # Chamfer the edge of the block. BlockSideCrv: curve( Linear, "ec_open", "kv_chord", array( Origin, pt( BlockChamfer, 0 , BlockChamfer ), pt( blockMaxX, 0, BlockChamfer ) ) ); BlockSide: objTransform( extrude( BlockSideCrv, pt( 0, BlockMinY ), pt( 0, BlockMaxY ) ), rY( 90 ), rX( -90 ), tX( blockMaxX ) ); setSQ( BlockSide, "Wood3" ); setTexture( BlockSide, "end.rle" ); TeapotScale: 1.1; HalfLoc: objTransform( group( HalfTeapot2, HalfLid2 ), sG( TeapotScale ), rY( 15 ), tX( -.25 ), tZ( -.75 ) )$; >> << bboxObj( Cleaver ); CleaverZ: -1; CleaverX: -5; CleaverAngle: 15; CleaverRot: 10; CleaverLoc: objTransform( Cleaver, sG( ModelScale ), rY( 180 ), tX( 5.8 ), tY( 1 ), rZ( CleaverAngle ), rY( CleaverRot ), tX( CleaverX ), tZ( CleaverZ ) )$; >> << # Find out where the back half of the teapot lies. TeaPotOutsideSrf: objTransform( srfFromShell( HalfTeapot, 4 ), sg( TeapotScale ) )$; TeapotU: .66; TeapotV: 1.75; TeapotPt: e3( srfEval( TeaPotOutsideSrf, TeapotU, TeapotV ) ); # We really need the srfNormals function for this! # Instead, extract iso-curves and cross-product their derivatives. TeapotUCrv: crvInSrf( TeaPotOutsideSrf, "col", TeapotU ); TeapotVCrv: crvInSrf( TeaPotOutsideSrf, "row", TeapotV ); # Can't differentiate projective curves. E3TeapotUCtlPoly: forCollect( I; 0; I < size( TeapotUCrv.ctlpoly ); I+1 ) ### > e3( TeapotUCrv.ctlpoly[ I ] ); E3TeapotVCtlPoly: forCollect( I; 0; I < size( TeapotVCrv.ctlpoly ); I+1 ) ### > e3( TeapotVCrv.ctlpoly[ I ] ); E3TeapotUCrv: curve( Cubic, "ec_open", TeapotUCrv.kv, E3TeapotUCtlPoly ); E3TeapotVCrv: curve( Quadratic, "ec_open", TeapotVCrv.kv, E3TeapotVCtlPoly ); TeapotUDerivCrv: diffCrv( E3TeapotUCrv ); TeapotVDerivCrv: diffCrv( E3TeapotVCrv ); TeapotUVec: crvEval( TeapotUDerivCrv, TeapotV ); TeapotVVec: crvEval( TeapotVDerivCrv, TeapotU ); TeapotVec: crossProd( TeapotUVec, TeapotVVec ); # We really need the rotateAxis matdescrs for this! TeapotYAngle: atan2D( -TeapotVec.X, -TeapotVec.Z ); TeapotXAngle: atan2D( TeapotVec.Y, -TeapotVec.Z ); RotHalf: objTransform( group( HalfTeapot, HalfLid ), sg( TeapotScale ), tXYZ( -TeapotPt.X, -TeapotPt.Y, -TeapotPt.Z ), rY( -TeapotYAngle ), rX( (-TeapotXAngle) - 90 ) )$; RotHalfLoc: objTransform( RotHalf, rY( -5 ), tX( -4.5 ), tZ( -7 ) )$; >> commentOutCode show( BlockTop, CleaverLoc, HalfLoc, RotHalfLoc ); << Scene: objTransform( group( BlockTop, BlockSide, CleaverLoc, HalfLoc, RotHalfLoc ), # group( BlockTop, BlockSide, Cut, XAxis, YAxis ), tXYZ( 3.5, 0, 4.5 ), sg( .17 ), rY( -55 ), rX( 37 ), rZ( -3 ) )$; Light1: lightSource( pt( -20, 20, 20 ), .5, 1 ); Light2: lightSource( pt( 20, 20, 20 ), .5, 1 ); >> commentOutCode show( Light1, Light2, Scene ); commentOutCode dumpA1File( array( Light1, Light2, Scene ), "Scene.a1" ); # Another scene, with just the teapot. << TeapotLoc: objTransform( group( Teapot, Lid ), sg( TeapotScale ), rY( 20 ), tX( .5 ), tZ( -3.5 ) )$; Scene2: objTransform( group( BlockTop, BlockSide, TeapotLoc, YAxis ), tXYZ( .5, 0, 4.5 ), sg( .25 ), rY( -55 ), rX( 37 ), rZ( -9 ) )$; >> commentOutCode show( Light1, Light2, Scene2 ); commentOutCode dumpA1File( array( Light1, Light2, Scene2 ), "Scene2.a1" );