## ## $Id: ski.scl,v 1.1 1995/09/07 19:22:05 bloss Exp $ ## ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ## #### # # # #### #### # ## # # # # # # # # ## #### #### # #### # # ## # # # # ### # # # ## # # # # # ### # # # # # ## #### # # # ### #### #### ###### ## ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## SCL source file for a model of a ski ## ## Author: Brian F. Loss ## Date: June 13, 1995 ## Last Modified: July 13, 1995 ## { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This section contains the SCL code for the ski itself. # { # # Here is the side profile curve for the top of the ski. # TopCtlPts = array( pt( 0,-38.250, 0.375 ), pt( 0,-37.203, -0.151 ), pt( 0, -4.929, 1.802 ), pt( 0, 31.825, -0.106 ), pt( 0, 36.000, 1.207 ), pt( 0, 38.120, 3.380 ) ); TopProfile = uniOpCrv( 3, TopCtlPts ); # # Make a surface out of it. Refine the curve first, so there are # enough points for the tapering function to use. # TopSrf = extrude( kRefineCrv( TopProfile, 10.0 ), pt( -1.75, 0 ), pt( 1.75, 0 ) ); # # Here is the side profile curve for the bottom of the ski. # BotCtlPts = array( pt( 0, 38.250, 3.250 ), pt( 0, 36.000, 0.957 ), pt( 0, 31.723, -0.424 ), pt( 0, -5.001, 0.914 ), pt( 0,-37.321, -0.274 ), pt( 0,-38.250, 0.125 ) ); BotProfile = uniOpCrv( 3, BotCtlPts ); # # Make a surface out of it. Refine the curve first, so there are # enough points for the tapering function to use. # BotSrf = extrude( kRefineCrv( BotProfile, 10.0 ), pt( -1.75, 0 ), pt( 1.75, 0 ) ); # # This is the scaling curve that will give the correct top/bottom # profile of the ski. # scale_pts = array( pt( -40.000000, 0.749476 ), pt( -38.249607, 0.749476 ), pt( -37.252816, 0.870592 ), pt( -34.901029, 0.758476 ), pt( -25.462328, 0.785740 ), pt( -13.110825, 0.703480 ), pt( -9.339421, 0.695641 ), pt( 8.472509, 0.765041 ), pt( 17.795048, 0.808812 ), pt( 31.850518, 0.982041 ), pt( 35.786566, 0.834775 ), pt( 37.455883, 0.441198 ), pt( 38.250317, 0.072781 ), pt( 40.000000, 0.072781 ) ); scale_crv = uniOpCrv( 3, scale_pts ); # # Taper the ski. This required my hacked version of taperWithSplineFn. # The hacked version takes the component from the scaling axis (that's # the axis along which the tapering occurs), and calls x_crv_eval with # that component on the tapering curve. The result is the remaining # components from the scaling curve (which we assume is only y). The # first of the remaining values is used as the scaling factor. The old # version took the component value and passed it (as t) to crv_eval. # This did not at all produce the desired effects. # tapered_top = taperWithSplineFn( objTransform( TopSrf, rz( -90 ) ), "X", false, scale_crv ); tapered_bot = taperWithSplineFn( objTransform( BotSrf, rz( -90 ) ), "X", false, scale_crv ); # # Pull out boundary curves for the top surface. # top_l = getBoundary( tapered_top, "left" ); top_t = getBoundary( tapered_top, "top" ); top_r = getBoundary( tapered_top, "right" ); top_b = getBoundary( tapered_top, "bottom" ); # # Pull out boundary curves for the bottom surface. # bot_l = getBoundary( tapered_bot, "left" ); bot_t = getBoundary( tapered_bot, "top" ); bot_r = getBoundary( tapered_bot, "right" ); bot_b = getBoundary( tapered_bot, "bottom" ); # # The left edge of the ski. # left_l = profile( crvEval( bot_b, 1 ), crvEval( top_b, 0 ) ); left_r = profile( crvEval( top_b, 1 ), crvEval( bot_b, 0 ) ); left_srf = boolSum( top_b, bot_b, left_l, left_r ); # # The right edge of the ski. The curves are all reversed # in order to get the normals correct. # right_l = profile( crvEval( bot_t, 1 ), crvEval( top_t, 0 ) ); right_r = profile( crvEval( top_t, 1 ), crvEval( bot_t, 0 ) ); right_srf = boolSum( reverseCrv( top_t ), reverseCrv( bot_t ), reverseCrv( right_l ), reverseCrv( right_r ) ); # # The front edge of the ski. # frnt_l = profile( crvEval( bot_b, 0 ), crvEval( top_b, 1 ) ); frnt_r = profile( crvEval( top_t, 1 ), crvEval( bot_t, 0 ) ); frnt_t = profile( crvEval( top_b, 1 ), crvEval( top_t, 1 ) ); frnt_b = profile( crvEval( bot_t, 0 ), crvEval( bot_b, 0 ) ); frnt_srf = boolSum( frnt_t, frnt_b, frnt_l, frnt_r ); # # The back edge of the ski. # back_l = profile( crvEval( top_b, 0 ), crvEval( bot_b, 1 ) ); back_r = profile( crvEval( bot_t, 1 ), crvEval( top_t, 0 ) ); back_t = profile( crvEval( top_t, 0 ), crvEval( top_b, 0 ) ); back_b = profile( crvEval( bot_b, 1 ), crvEval( bot_t, 1 ) ); back_srf = boolSum( back_t, back_b, back_l, back_r ); ## ## Yeah, here it is! This is the entire ski. ## ski = group( tapered_top, tapered_bot, left_srf, right_srf, frnt_srf, back_srf ); ## ## Set colors and surface qualities for the ski base. ## setAttr( ski, "back_color", color( 56, 142, 142 ) ); setColor( ski, color( 56, 142, 142 ) ); setSq( ski, "SlightlyDull" ); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This section contains the SCL code for the ski binding. # { # # The front base plate. # frnt_base_arc_pts = array( pt( 3.5, 0.32476 ), pt( 3.9, 0.330 ), pt( 4.125, 0.0 ) ); frnt_base_arc = uniOpCrv( 3, frnt_base_arc_pts ); frnt_base_profile = profile( pt( 4.125, 0.0 ), pt( -2.625, 0.0 ), pt( -2.8125, 0.32476 ), pt( 3.5, 0.32476 ), frnt_base_arc ); fbp = raiseCrvOrder( frnt_base_profile, 4 ); frnt_base_obj = extrude( fbp, pt( 0,0,-1.1875 ), pt( 0,0,1.1875 ), true ); # # The front housing. # frnt_housing_profile = profile( pt( -2.8125, 0.32476 ), pt( -2.33040, 0.89929 ), pt( 0.05117, 2.27429 ), pt( 0.26233, 1.98702 ), pt( 0.15000, 1.91000 ), pt( 0.15000, 0.32476 ), pt( -2.8125, 0.32476 ) ); fhp = raiseCrvOrder( frnt_housing_profile, 4 ); frnt_housing_obj = extrude( fhp, pt( 0,0,-1.1875 ), pt( 0,0,1.1875 ), true ); # # The toe hold. # toe_hold_pts = array( pt( 1, 0.0, 1.25 ), pt( 0.8, 0.0, 1.25 ), pt( 0.4, 0.0, 1 ), pt( 0.3, 0.0 ), pt( 0.4, 0.0, -1 ), pt( 0.8, 0.0, -1.25 ), pt( 1, 0.0, -1.25 ) ); toe_hold_trim_crv = profile( uniOpCrv( 3, toe_hold_pts ), pt( 1, 0.0, 1.25 )); toe_hold_trim_srf = extrude( toe_hold_trim_crv, pt( 0,1.92476 ), pt( 0,0.0 ), true ); toe_hold_profile = profile( pt( 0.8, 0.32476, -1.6 ), pt( 0.15000, 0.32476, -1.1875 ), pt( 0.15000, 0.32476, 1.1875 ), pt( 0.8, 0.32476, 1.6 ), pt( 0.8, 0.32476, -1.6 ) ); tmp_toe_hold_obj = extrude( toe_hold_profile, pt( 0.0, 0.0 ), pt( 0.0, 2.2 ), true ); tmp_toe_hold_obj2 = combineShells( objTransform( toe_hold_trim_srf, ty( 0.2 ), tx( 0.2 ), sxyz( 0.85,1.0,0.85 ) ), tmp_toe_hold_obj, "-" ); tmp_toe_hold_obj3 = combineShells( tmp_toe_hold_obj2, objTransform( toe_hold_trim_srf, ty( -0.2 ) ), "*" ); tht = profile( pt( 0.8, 1.6, -1.6 ), pt( 0.15000, 1.6, -1.1875 ), pt( 0.15000, 1.6, 1.1875 ), pt( 0.8, 1.6, 1.6 ), pt( 0.8, 1.6, -1.6 ) ); tthts = objTransform( extrude( toe_hold_profile, pt( 0.0, 1.6 ), pt( 0.0, 2.4 ), true ), sxyz( 1.5, 1, 1.5 ), tx( -0.25 ) ); toe_hold_obj = combineShells( tthts, tmp_toe_hold_obj3, "*" ); # # The heel plate. # heel_plate_pts = array( pt( -1.75, 1.1875 ), pt( -1.60, 1.1875 ), pt( -1.5, 0.950 ), pt( -1.35, 0.875 ), pt( -1.25, 0.875 ) ); heel_plate_crv = uniOpCrv( 3, heel_plate_pts ); half_heel_plate_profile = profile( pt( -2.95, 0 ), pt( -2.95, 0.4375 ), pt( -3.25, 0.4375 ), pt( -3.25, 1.1875 ), heel_plate_crv, pt( 4, 0.875 ), pt( 4, 0 ) ); heel_plate_profile = profile( reverseObj( half_heel_plate_profile ), objTransform( half_heel_plate_profile, rx( 180 ) ) ); heel_plate_obj = extrude( heel_plate_profile, pt( 0,0,0.32476 ), pt( 0,0,0 ), true ); # # The brake pad. # brake_pad_pts = array( pt( -3.55, 1.1875 ), pt( -4.2, 1.0 ), pt( -4.74078, 0.5 ) ); brake_pad_crv = uniOpCrv( 3, brake_pad_pts ); half_brake_pad_profile = profile( pt( -3., 0 ), pt( -3., 0.3875 ), pt( -3.30, 0.3875 ), pt( -3.30, 1.1875 ), brake_pad_crv, pt( -4.74078, 0 )); brake_pad_profile = profile( reverseObj( half_brake_pad_profile ), objTransform( half_brake_pad_profile, rx( 180 ) ) ); brake_pad_obj = objTransform( extrude( brake_pad_profile, pt( 0,0,0 ), pt( 0,0,0.32476 ), true ), tz( -0.32476 ), rx( 180 ) ); # # The brake tubes. # line1 = lineThru2Pts( pt( -4, 0.2 ), pt( -3.1, 0.2 ) ); line2 = lineThru2Pts( pt( -3.1, 0.2 ), pt( -3.1, 1.5 ) ); line3 = lineThru2Pts( pt( -3.1, 1.5 ), pt( 0, 1.5 ) ); arc1 = arcRadTan2Lines( 0.08, line1, line2 ); arc2 = arcRadTan2Lines( 0.1, line2, line3 ); tube_profile = profile( pt( -4, 0.2 ), arc1, arc2, pt( 0, 1.5 ) ); brake_tube = circTubeConstantWidth( tube_profile, 0.08, true ); brake_tubes = group( objTransform( brake_tube, tz( 0.16238 ) ), objTransform( brake_tube, rx( 180 ), tz( 0.16238 ) ) ); # # The back housing. # back_housing_profile = profile( pt( 0.8, 0, 0.1 ), pt( 0.8, 0, 0.7 ), pt( 1.5, 0, 1.375 ), pt( 3.925, 0, 1.375 ), pt( 3.925, 0, 0.1 ), pt( 0.8, 0, 0.1 ) ); back_housing_obj = extrude( back_housing_profile, pt( 0, 0.5 ), pt( 0, -0.5 ), true ); # # The binding release latch # half_release_profile = profile( pt( 0, 0, 1.42 ), pt( 0, -0.55, 1.42 ), pt( 0, -0.55, 1 ), pt( 0, -0.62, 1 ), pt( 0, -0.62, 1.65 ), pt( 0, 0, 1.65 ) ); release_profile = profile( reverseObj( half_release_profile ), objTransform( half_release_profile, rz( 180 ) ) ); release_obj = extrude( release_profile, pt( 4.5, 0 ), pt( 2, 0), true ); # # The heel hold. # heel_hold_profile = profile( pt( 1, 0, 0.4 ), pt( 2.25, 0, 0.4 ), pt( 2.25, 0, 1.6 ), pt( 1.8, 0, 1.6 ), pt( 0.3, 0, 2 ), pt( 0.3, 0, 1 ), pt( 1, 0, 0.4 ) ); tmp_heel_hold_obj = extrude( heel_hold_profile, pt( 0, -0.55 ), pt( 0, 0.55 ), true ); # Trim some stuff out from the heel_hold cyl = objTransform( circTubeConstantWidth( profile( pt( -1.59, 0, -1 ), pt( -1.59, 0, 3 ) ), 2, true ), ry( -2 ) ); heel_hold_obj = combineShells( tmp_heel_hold_obj, cyl, "-" ); # # The heel catch. (that little thing that sticks out from the heel hold) # heel_catch_pts = array( pt( 0.4, 0, 1 ), pt( 0.3, 0, 0.9 ), pt( 0.1, 0, 1 ) ); heel_catch_crv = uniOpCrv( 3, heel_catch_pts ); heel_catch_profile = profile( heel_catch_crv, objTransform( reverseObj( heel_catch_crv ), tz( 0.04 ) ), pt( 0.4, 0, 1 ) ); heel_catch_obj = extrude( heel_catch_profile, pt( 0,-0.1 ), pt( 0,0.1 ), true ); # # Put it all together, and put it on the ski correctly. # frnt_base_obj_t = objTransform( frnt_base_obj, sy( 0.7 ), ry( 180 ), rz( -1.2 ), rx( 90 ), tz( 1.2 ), tx( 4 ) ); frnt_housing_obj_t = objTransform( frnt_housing_obj, sy( 0.7 ), ry( 180 ), rz( -1.2 ), rx( 90 ), tz( 1.2 ), tx( 4 ) ); toe_hold_obj_t = objTransform( toe_hold_obj, sy( 0.7 ), ry( 180 ), rz( -1.2 ), rx( 90 ), tz( 1.2 ), tx( 4 ) ); binding_frnt = group( frnt_base_obj_t, frnt_housing_obj_t, toe_hold_obj_t ); heel_plate_obj_t = objTransform( heel_plate_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); brake_pad_obj_t = objTransform( brake_pad_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); brake_tubes_t = objTransform( brake_tubes, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); back_housing_obj_t = objTransform( back_housing_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); release_obj_t = objTransform( release_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); heel_hold_obj_t = objTransform( heel_hold_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); heel_catch_obj_t = objTransform( heel_catch_obj, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); heel_piece = group( heel_hold_obj_t, heel_catch_obj_t ); binding_back = group( heel_plate_obj_t, brake_pad_obj_t, brake_tubes_t, back_housing_obj_t, release_obj_t, heel_piece ); ## ## Set colors and surface qualities for the binding ## setAttr( binding_frnt, "back_color", color( 255,255,255 ) ); setAttr( binding_back, "back_color", color( 255,255,255 ) ); setColor( binding_frnt, "White" ); setColor( binding_back, "White" ); setSq( binding_frnt, "Dull" ); setSq( binding_back, "Dull" ); ## ## Put the whole binding together ## binding = group( binding_frnt, binding_back ); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is the ski and its binding. # TheSki = group( ski, binding ); } { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Some anchors for animation. # tubes_an_orig = zAnchorFromPt( pt( -3.1, 0, 0.16238 ) ); pad_an_orig = zAnchorFromPt( pt( -4, 0, 0.16238 ) ); heel_an_orig = zAnchorFromPt( pt( 1.28, 0, 1.2 ) ); rel_an_orig = zAnchorFromPt( pt( 2.2, 0, 1.3 ) ); tubes_an = objTransform( tubes_an_orig, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); pad_an = objTransform( pad_an_orig, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); heel_an = objTransform( heel_an_orig, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); rel_an = objTransform( rel_an_orig, rz( 180 ), ry( -1.55 ), tz( 1.2 ), tx( -12 ) ); # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create the animated ski. # pad_ani_tx_crv_pts = array( pt( 0, 0.3 ), pt( 20, 0.3 ), pt( 170, 0.237 ), pt( 180, 0 ) ); pad_ani_tx_crv = uniOpCrv( 3, pad_ani_tx_crv_pts ); pad_ani_tz_crv_pts = array( pt( 0, 0.6 ), pt( 20, 0.6 ), pt( 170, 0.474 ), pt( 180, 0 ) ); pad_ani_tz_crv = uniOpCrv( 3, pad_ani_tz_crv_pts ); ani_pad = instance( brake_pad_obj_t, tx( pad_ani_tx_crv, pad_an ), tz( pad_ani_tz_crv, pad_an ) ); tube_ani_crv_pts = array( pt( 0, 50 ), pt( 20, 50 ), pt( 170, 39.474 ), pt( 180, 0 ) ); tube_ani_crv = uniOpCrv( 3, tube_ani_crv_pts ); ani_tubes = instance( brake_tubes_t, ry( tube_ani_crv, tubes_an ) ); heel_ani_crv_pts = array( pt( 0,0 ), pt( 20, 0 ), pt( 170, -8 ), pt( 180, -38 ) ); heel_ani_crv = uniOpCrv( 3, heel_ani_crv_pts ); ani_heel_piece = instance( heel_piece, ry( heel_ani_crv, heel_an ) ); release_ani_crv_pts = array( pt( 0,0 ), pt( 20, 0 ), pt( 170, -8 ), pt( 180, -38 ) ); release_ani_crv = uniOpCrv( 3, release_ani_crv_pts ); ani_release = instance( release_obj_t, ry( release_ani_crv, heel_an ) ); ani_binding_back = group( heel_plate_obj_t, ani_pad, ani_tubes, back_housing_obj_t, ani_release, ani_heel_piece ); ani_binding = group( binding_frnt, ani_binding_back ); ## ## Set colors and surface qualities for the animated part of the binding. ## setAttr( ani_binding_back, "back_color", color( 255,255,255 ) ); setColor( ani_binding_back, "White" ); setSq( ani_binding_back, "Dull" ); ## ## Here is the entire animated version of the ski/binding. ## AniSki = group( ski, ani_binding ); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Set up lights and dump them to a file. # { light1 = lightSource( pt( 0,-10,10 ), 1, 1 ); light2 = lightSource( pt( -30,-20,8 ), 0.8, 1 ); dumpA1File( { light1, light2 }, "../mats/lights.a1" ); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Dump the models to a file. # { dumpA1File( { TheSki }, "../a1files/ski.a1" ); dumpA1File( { AniSki }, "../a1files/ani_ski.a1" ); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a room with skis in it. # { srf = flatSrf( 2, 2, 2, 2 ); floor = objTransform( srf, sg( 60 ), tz( -0.2 ) ); setColor( floor, "Sienna" ); setSq( floor, "Floor" ); setTexture( floor, "wood_grain2.rle" ); wall1 = objTransform( srf, sy( 30 ), sx( 60 ), rx( 90 ), ty( 60 ), tz( 29.8 ) ); setColor( wall1, "Wheat" ); setSq( wall1, "Dull" ); wall2 = objTransform( srf, sx( 30 ), sy( 60 ), ry( 90 ), tx( 60 ), tz( 29.8 ) ); setColor( wall2, "Wheat" ); setSq( wall2, "Dull" ); leftSki = objTransform( TheSki, ty( 2.5 ), rz( 20 ) ); rightSki = objTransform( TheSki, ty( -2.5 ), tx( 5 ), ry( 1 ), tz( 0.6 ), rz( 20 ) ); # Set up lights for the room. light1 = lightSource( pt( 0,-10,8 ), 1, 1 ); light2 = lightSource( pt( -20,-5,3 ), 1, 1 ); # Dump lights and room model to a1 files. dumpA1File( { light1, light2 }, "../mats/room_lights.a1" ); dumpA1File( { floor, wall1, wall2, leftSki, rightSki }, "../a1files/room.a1" ); }